Class: MRuby::CLI::Rake

Inherits:
Object
  • Object
show all
Defined in:
lib/mruby/cli/rake.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Rake

Returns a new instance of Rake.



4
5
6
# File 'lib/mruby/cli/rake.rb', line 4

def initialize(options)
  @options = options
end

Class Method Details

.[](options) ⇒ Object

Alias to exec a rake process



28
29
30
# File 'lib/mruby/cli/rake.rb', line 28

def [](options)
  self.new(options).exec
end

Instance Method Details

#argumentsObject



16
17
18
# File 'lib/mruby/cli/rake.rb', line 16

def arguments
  Array(@options[:args])
end

#commandObject



12
13
14
# File 'lib/mruby/cli/rake.rb', line 12

def command
  Source.path.join('minirake').to_s
end

#environmentObject



8
9
10
# File 'lib/mruby/cli/rake.rb', line 8

def environment
  @options.fetch(:env,{})
end

#execObject



20
21
22
23
24
# File 'lib/mruby/cli/rake.rb', line 20

def exec
  args = [self.environment,self.command,*self.arguments]
  puts args.inspect
  Kernel.exec(*args)
end