forked from auser/poolparty
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcloud
executable file
·51 lines (39 loc) · 1.55 KB
/
cloud
1
2
3
4
5
6
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../lib")
require "poolparty"
require "colors"
require "mixins/printing"
require 'git-style-binary/command'
GitStyleBinary.primary do
self.class.send :include, Printing
@theme = :short
version "PoolParty release: #{PoolParty.version}"
banner <<-EOS
Usage: #{$0} #{all_options_string} COMMAND [ARGS]
The cloud subcommands commands are:
\#{GitStyleBinary.pretty_known_subcommands(:short).join(" ")}
See 'cloud help COMMAND' for more information on a specific command.
EOS
opt :debug, "Debug the output", :type => :boolean, :default => false
opt :clouds_dot_rb, "Set the clouds.rb file", :type => String, :default => "clouds.rb"
opt :testing, "Set testing mode on", :type => :boolean, :default => false
opt :name, "Name of the working cloud", :type => String, :default => nil
before_run do |command|
# Setup testing/debugging
$TESTING = true if command[:testing]
$DEBUGGING = true if command[:debug]
@loaded_pool = PoolParty::Pool.find_and_load_default_clouds_dot_rb(command[:clouds_dot_rb])
@loaded_clouds = command[:name] ? [clouds[command[:name]]] : @loaded_pool.clouds.map {|name,cld|cld}
@loaded_clouds.map do |cld|
cld.verbose = command[:verbose]
cld.debug = command[:debug]
end
end
run do |command|
subcommands = GitStyleBinary.list_subcommands
puts "Usage: cloud COMMAND [ARGS]
The cloud subcommands commands are:
#{subcommands}
See 'cloud help COMMAND' for more information on a specific command"
end
end