Class: MRuby::Command

Inherits:
Object show all
Extended by:
Forwardable
Includes:
Rake::DSL
Defined in:
ext/enterprise_script_service/mruby/lib/mruby/build/command.rb

Direct Known Subclasses

Archiver, Compiler, CrossTestRunner, Git, Gperf, Linker, Mrbc, Yacc

Defined Under Namespace

Classes: Archiver, Compiler, CrossTestRunner, Git, Gperf, Linker, Mrbc, Yacc

Constant Summary collapse

NotFoundCommands =
{}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build) ⇒ Command

Returns a new instance of Command.



10
11
12
# File 'ext/enterprise_script_service/mruby/lib/mruby/build/command.rb', line 10

def initialize(build)
  @build = build
end

Instance Attribute Details

#buildObject

Returns the value of attribute build.



8
9
10
# File 'ext/enterprise_script_service/mruby/lib/mruby/build/command.rb', line 8

def build
  @build
end

#commandObject

Returns the value of attribute command.



8
9
10
# File 'ext/enterprise_script_service/mruby/lib/mruby/build/command.rb', line 8

def command
  @command
end

Instance Method Details

#cloneObject

clone is deep clone without @build



15
16
17
18
19
20
21
22
23
24
25
# File 'ext/enterprise_script_service/mruby/lib/mruby/build/command.rb', line 15

def clone
  target = super
  excepts = %w(@build)
  instance_variables.each do |attr|
    unless excepts.include?(attr.to_s)
      val = Marshal::load(Marshal.dump(instance_variable_get(attr))) # deep clone
      target.instance_variable_set(attr, val)
    end
  end
  target
end

#shellquote(s) ⇒ Object



27
28
29
30
31
32
33
# File 'ext/enterprise_script_service/mruby/lib/mruby/build/command.rb', line 27

def shellquote(s)
  if ENV['OS'] == 'Windows_NT'
    "\"#{s}\""
  else
    "#{s}"
  end
end