Module: Awt::DSL

Defined in:
lib/awt/dsl.rb

Instance Method Summary collapse

Instance Method Details

#server(host, user: nil, port: 22, key: "~/.ssh/id_rsa") ⇒ Object



11
12
13
# File 'lib/awt/dsl.rb', line 11

def server(host, user: nil, port: 22, key: "~/.ssh/id_rsa")
  $AWT_TARGETS << Awt::Server.new(host: host, user: user, port: port, key: key)
end

#task(name, &block) ⇒ Object



6
7
8
9
# File 'lib/awt/dsl.rb', line 6

def task(name, &block)
  task = Task.new &block
  $AWT_TASKS.store(name.to_sym, task)
end

#task_find(path = File.expand_path(".")) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/awt/dsl.rb', line 15

def task_find(path = File.expand_path("."))
  task_file = "Awtfile"
  file = File.join(path, task_file)

  if File.exists?(file)
    file
  else
    if path == "/"
      file = File.join(ENV["HOME"], task_file)
      File.exists?(file) ? file : nil
    else
      task_find(File.expand_path("..", path))
    end
  end
end