Class: Space::Shell::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/space/shell/command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, command) ⇒ Command

Returns a new instance of Command.



14
15
16
17
# File 'lib/space/shell/command.rb', line 14

def initialize(context, command)
  @context = context
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



12
13
14
# File 'lib/space/shell/command.rb', line 12

def command
  @command
end

#contextObject (readonly)

Returns the value of attribute context.



12
13
14
# File 'lib/space/shell/command.rb', line 12

def context
  @context
end

#resultObject (readonly)

Returns the value of attribute result.



12
13
14
# File 'lib/space/shell/command.rb', line 12

def result
  @result
end

Class Method Details

.execute(command) ⇒ Object



7
8
9
# File 'lib/space/shell/command.rb', line 7

def execute(command)
  `#{command}`
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
# File 'lib/space/shell/command.rb', line 19

def run
  Watcher.suspend do
    App.logger.debug "RUNNING #{command} [#{context.path}]"
    notifying do
      @result = chain.call
    end
  end
end