Class: DTask

Inherits:
Object
  • Object
show all
Defined in:
lib/dtask.rb

Defined Under Namespace

Classes: Config, Error, RemoteBox

Constant Summary collapse

VERSION =
"002"
TASK =

task table

Hash.new

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ DTask

Load the dtask file.



83
84
85
86
# File 'lib/dtask.rb', line 83

def initialize(name)
  load File.expand_path("~/.dtask/#{name}.dtask")
  @remote = RemoteBox.new
end

Instance Method Details

#run(task) ⇒ Object

Run the task.



89
90
91
92
93
94
95
96
97
# File 'lib/dtask.rb', line 89

def run(task)
  if TASK.key?(task)
    puts "#{Config.server} >>> #{task}"
    @remote.cd_appdir
    @remote.instance_eval &TASK[task]
  else
    puts "No such task: #{task}"
  end
end