class App
Public Class Methods
app_name()
click to toggle source
# File tvshow.rb, line 13 def self.app_name return self.executable.basename('.rb').to_s end
executable()
click to toggle source
# File tvshow.rb, line 9 def self.executable return Pathname.new(__FILE__).realpath end
exit_on_error(error, code)
click to toggle source
# File lib/app.rb, line 11 def self.exit_on_error(error, code) $stderr.puts error.message exit(code) end
load(path='lib')
click to toggle source
# File tvshow.rb, line 17 def self.load(path='lib') self.root.join(path).entries.each do |l| fpath = self.root.join(path).join(l) tests = [fpath.file?, fpath.readable?, fpath.to_s[0] != '.', fpath.extname == '.rb'] require(fpath) if tests.all? {|test| test === true} end return self end
root()
click to toggle source
# File tvshow.rb, line 5 def self.root Pathname.new(__FILE__).realpath.dirname end
run()
click to toggle source
# File lib/app.rb, line 2 def self.run LibC.setproctitle(self.app_name) begin CLI::Commands.from_app(self).parse rescue ArgumentError => e self.exit_on_error(e, 22) end end