Command-line launcher for Rote.
Methods
Attributes
| [RW] | debug | |
| [RW] | rake | |
| [RW] | rakefile | |
| [RW] | rakeopts | |
| [RW] | rote_lib | |
| [RW] | tasks | |
| [RW] | trace | |
| [RW] | usage | |
| [RW] | version |
Public Class methods
Create a new Application instance, processing command-line arguments, optionally passing self to the supplied block for further configuration.
[ show source ]
# File lib/rote/app.rb, line 25
25: def initialize(rote_lib) # :yield: self if block_given?
26: # init vars
27: @rote_lib = rote_lib
28: @debug = false
29: @tasks = false
30: @trace = false
31: @usage = false
32: @version = false
33:
34: @rakefile = "#{rote_lib}/rote/builtin.rf"
35: raise "Missing builtin.rf (expected at '#{@rakefile}')!" unless File.exists?(@rakefile)
36:
37: @rakeopts = ENV['RAKE_OPTS'] || ''
38: @rake = ENV['RAKE_CMD'] || (PLATFORM =~ /mswin/ ? 'rake.cmd' : 'rake')
39:
40: process_args
41:
42: yield self if block_given?
43: end
Public Instance methods
Run the application with the current options.
[ show source ]
# File lib/rote/app.rb, line 46
46: def run
47: if @version
48: print "rote, version #{ROTEVERSION}\n"
49:
50: elsif @tasks
51: print `#{rake} --rakefile=#{rakefile} --libdir=#{rote_lib} --tasks`.gsub(/^rake /,'rote ')
52:
53: elsif @usage
54: show_usage()
55:
56: else
57: if @trace
58: rakeopts << ' --trace'
59: elsif @debug
60: rakeopts << '--verbose'
61: end
62:
63: exec("#{rake} --rakefile=#{rakefile} --libdir=#{rote_lib} #{rakeopts} #{$*.join(' ')}")
64: end
65: end