Class: Homesteading::Run

Inherits:
Command show all
Defined in:
lib/homesteading/commands/run.rb

Constant Summary

Constants inherited from Command

Command::COMMANDS

Instance Method Summary collapse

Methods inherited from Command

create, register

Instance Method Details

#defaultObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/homesteading/commands/run.rb', line 7

def default
  puts
  options = parse_options
  app     = options[:app]
  command = ARGV.join(" ")

  app_dirs = if app
    ["#{Dir.pwd}/homesteading-#{app}/"]
  else
    Dir.glob("#{Dir.pwd}/homesteading-*/")
  end

  app_dirs.each do |app_dir|
    app = app_dir.split("/").last.sub(/homesteading-/, "").downcase

    puts "* Running command on #{app}:"
    puts "    #{command}"
    puts

    FileUtils.cd app_dir do
      system command
    end
    puts
  end
end