Class: Cumuli::CLI::Commander

Inherits:
Object
  • Object
show all
Defined in:
lib/cumuli/cli/commander.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Commander

Returns a new instance of Commander.



6
7
8
# File 'lib/cumuli/cli/commander.rb', line 6

def initialize(command)
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



4
5
6
# File 'lib/cumuli/cli/commander.rb', line 4

def command
  @command
end

Instance Method Details

#buildObject



10
11
12
# File 'lib/cumuli/cli/commander.rb', line 10

def build
  "#{rvm_preface} #{command}"
end

#rvm_prefaceObject



14
15
16
# File 'lib/cumuli/cli/commander.rb', line 14

def rvm_preface
  "rvm ruby-#{rvm_version} exec" if rvmrc?
end

#rvm_versionObject



26
27
28
# File 'lib/cumuli/cli/commander.rb', line 26

def rvm_version
  File.read(rvmrc_descriptor).match(/(\d\.\d\.\d@\w+)/)[0]
end

#rvmrc?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/cumuli/cli/commander.rb', line 22

def rvmrc?
  File.exist?(rvmrc_descriptor)
end

#rvmrc_descriptorObject



18
19
20
# File 'lib/cumuli/cli/commander.rb', line 18

def rvmrc_descriptor
  './.rvmrc'
end