Class: Tennpipes::Cli::Base
- Defined in:
- lib/tennpipes-base/cli/base.rb
Instance Method Summary collapse
- #console(*args) ⇒ Object
- #generate(*args) ⇒ Object
- #rake(*args) ⇒ Object
- #runner(*args) ⇒ Object
- #version ⇒ Object
Methods inherited from Launcher
Instance Method Details
#console(*args) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/tennpipes-base/cli/base.rb', line 28 def console(*args) prepare :console require File.("../../version", __FILE__) ARGV.clear require 'irb' begin require "irb/completion" rescue LoadError end require File.('config/boot.rb') puts "=> Loading #{Tennpipes.env} console (Tennpipes v.#{Tennpipes.version})" require File.('../console', __FILE__) IRB.start end |
#generate(*args) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/tennpipes-base/cli/base.rb', line 45 def generate(*args) begin # We try to load the vendored tennpipes-init if exist tennpipes_gen_path = File.('../../../../../tennpipes-init/lib', __FILE__) $:.unshift(tennpipes_gen_path) if File.directory?(tennpipes_gen_path) && !$:.include?(tennpipes_gen_path) require 'tennpipes-base/command' require 'tennpipes-init/command' ARGV.shift ARGV << 'help' if ARGV.empty? Tennpipes.bin_gen(*ARGV) rescue puts "<= You need tennpipes-init! Run: gem install tennpipes-init" end end |
#rake(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tennpipes-base/cli/base.rb', line 10 def rake(*args) prepare :rake args << "-T" if [:list] args << [:list] unless [:list].nil? || [:list].to_s == "list" args << "--trace" if [:trace] args << "--verbose" if [:verbose] ARGV.clear ARGV.concat(args) puts "=> Executing Rake #{ARGV.join(' ')} ..." load File.('../rake.rb', __FILE__) Rake.application.init Rake.application.instance_variable_set(:@rakefile, __FILE__) load File.('Rakefile') Rake.application.top_level end |
#runner(*args) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/tennpipes-base/cli/base.rb', line 69 def runner(*args) prepare :runner code_or_file = args.shift abort "Please specify code or file" if code_or_file.nil? require File.('config/boot.rb') if File.exist?(code_or_file) eval(File.read(code_or_file), nil, code_or_file) else eval(code_or_file) end end |