rudy 0.6.8 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +15 -2
- data/README.rdoc +30 -23
- data/Rakefile +5 -5
- data/Rudyfile +87 -66
- data/bin/rudy +120 -167
- data/bin/rudy-ec2 +17 -13
- data/bin/rudy-s3 +6 -4
- data/bin/rudy-sdb +5 -4
- data/lib/annoy.rb +1 -1
- data/lib/console.rb +1 -3
- data/lib/rudy.rb +11 -25
- data/lib/rudy/aws/ec2/instance.rb +1 -1
- data/lib/rudy/aws/ec2/volume.rb +2 -2
- data/lib/rudy/aws/sdb/error.rb +2 -1
- data/lib/rudy/cli.rb +10 -1
- data/lib/rudy/cli/aws/ec2/addresses.rb +1 -1
- data/lib/rudy/cli/aws/ec2/images.rb +3 -1
- data/lib/rudy/cli/aws/ec2/instances.rb +2 -2
- data/lib/rudy/cli/candy.rb +11 -0
- data/lib/rudy/cli/config.rb +25 -44
- data/lib/rudy/cli/machines.rb +30 -10
- data/lib/rudy/cli/routines.rb +67 -19
- data/lib/rudy/config.rb +30 -13
- data/lib/rudy/config/objects.rb +135 -10
- data/lib/rudy/disks.rb +8 -52
- data/lib/rudy/global.rb +9 -5
- data/lib/rudy/guidelines.rb +18 -0
- data/lib/rudy/huxtable.rb +29 -19
- data/lib/rudy/machines.rb +10 -7
- data/lib/rudy/mixins/hash.rb +25 -0
- data/lib/rudy/routines.rb +160 -10
- data/lib/rudy/routines/helper.rb +50 -0
- data/lib/rudy/routines/helpers/diskhelper.rb +44 -18
- data/lib/rudy/routines/helpers/scmhelper.rb +39 -0
- data/lib/rudy/routines/helpers/scripthelper.rb +86 -35
- data/lib/rudy/routines/helpers/userhelper.rb +37 -0
- data/lib/rudy/routines/passthrough.rb +36 -0
- data/lib/rudy/routines/release.rb +38 -22
- data/lib/rudy/routines/shutdown.rb +20 -49
- data/lib/rudy/routines/startup.rb +20 -47
- data/lib/rudy/scm.rb +75 -0
- data/lib/rudy/scm/git.rb +215 -0
- data/lib/rudy/scm/svn.rb +7 -6
- data/lib/rudy/utils.rb +12 -30
- data/lib/storable.rb +4 -1
- data/lib/sysinfo.rb +10 -0
- data/rudy.gemspec +21 -9
- data/test/01_mixins/10_hash_test.rb +25 -0
- data/test/{05_config → 10_config}/00_setup_test.rb +1 -1
- data/test/{05_config → 10_config}/30_machines_test.rb +1 -1
- data/test/15_scm/00_setup_test.rb +20 -0
- data/test/15_scm/20_git_test.rb +61 -0
- data/test/helper.rb +1 -1
- data/vendor/highline-1.5.1/Rakefile +3 -3
- metadata +41 -12
- data/bin/ird +0 -175
data/bin/rudy-ec2
CHANGED
@@ -27,7 +27,7 @@ module RudyCLI_EC2
|
|
27
27
|
# ----------------------------------- AMAZON EC2 COMMANDS --------
|
28
28
|
# ------------------------------------------------------------------
|
29
29
|
|
30
|
-
|
30
|
+
about "Amazon EC2 Elastic IP addresses"
|
31
31
|
usage "rudy-ec2 addresses"
|
32
32
|
usage "rudy-ec2 addresses -C"
|
33
33
|
usage "rudy-ec2 addresses -A -i instance-id address"
|
@@ -45,7 +45,7 @@ module RudyCLI_EC2
|
|
45
45
|
command_alias :addresses, :address
|
46
46
|
command_alias :addresses, :a
|
47
47
|
|
48
|
-
|
48
|
+
about "Amazon EC2 instance console output"
|
49
49
|
usage "rudy-ec2 console [-g group] [instance ID]"
|
50
50
|
option :g, :group, String, "A security group name"
|
51
51
|
argv :awsid
|
@@ -53,7 +53,7 @@ module RudyCLI_EC2
|
|
53
53
|
command_alias :consoles, :console
|
54
54
|
command_alias :consoles, :c
|
55
55
|
|
56
|
-
|
56
|
+
about "Copy files to or from machines."
|
57
57
|
usage "rudy-ec2 copy [-p] [-r] [-u user] [-k path/2/privatekey] source target"
|
58
58
|
usage "rudy-ec2 upload -k path/2/privatekey -u username local-source target"
|
59
59
|
usage "rudy-ec2 download remote-source target"
|
@@ -73,7 +73,7 @@ module RudyCLI_EC2
|
|
73
73
|
command_alias :copy, :upload
|
74
74
|
command_alias :copy, :download
|
75
75
|
|
76
|
-
|
76
|
+
about "Amazon EC2 EC2 Security Groups"
|
77
77
|
usage "rudy-ec2 groups"
|
78
78
|
usage "rudy-ec2 groups -C [-p ports] [-a addresses] [-r protocols] name"
|
79
79
|
usage "rudy-ec2 groups -A [-p ports] [-a addresses] [-r protocols] name"
|
@@ -97,7 +97,7 @@ module RudyCLI_EC2
|
|
97
97
|
command_alias :groups, :group
|
98
98
|
command_alias :groups, :g
|
99
99
|
|
100
|
-
|
100
|
+
about "Amazon EC2 Machine Images (AMIs)"
|
101
101
|
usage "rudy-ec2 images"
|
102
102
|
usage "rudy-ec2 images image-id"
|
103
103
|
usage "rudy-ec2 images -o 123456789012"
|
@@ -117,7 +117,7 @@ module RudyCLI_EC2
|
|
117
117
|
command_alias :images, :image
|
118
118
|
command_alias :images, :im
|
119
119
|
|
120
|
-
|
120
|
+
about "Amazon EC2 Instances"
|
121
121
|
usage "rudy-ec2 instances"
|
122
122
|
usage "rudy-ec2 instances [-g group-name] [instance-ID]"
|
123
123
|
usage "rudy-ec2 instances -C -m ami-235fba4a -s m1.small -k keypair-name"
|
@@ -142,7 +142,7 @@ module RudyCLI_EC2
|
|
142
142
|
command_alias :instances, :in
|
143
143
|
command_alias :instances, :i
|
144
144
|
|
145
|
-
|
145
|
+
about "Amazon EC2 KeyPairs"
|
146
146
|
usage "rudy-ec2 keypairs"
|
147
147
|
usage "rudy-ec2 keypairs -C name"
|
148
148
|
usage "rudy-ec2 keypairs -D name"
|
@@ -153,7 +153,7 @@ module RudyCLI_EC2
|
|
153
153
|
command_alias :keypairs, :keypair
|
154
154
|
command_alias :keypairs, :k
|
155
155
|
|
156
|
-
|
156
|
+
about "Amazon EC2 Snapshots"
|
157
157
|
usage "rudy-ec2 snapshots"
|
158
158
|
usage "rudy-ec2 snapshots -C -v volume-id"
|
159
159
|
usage "rudy-ec2 snapshots -D snapshot-id"
|
@@ -165,7 +165,7 @@ module RudyCLI_EC2
|
|
165
165
|
command_alias :snapshots, :snapshot
|
166
166
|
command_alias :snapshots, :t
|
167
167
|
|
168
|
-
|
168
|
+
about "Open an SSH connection"
|
169
169
|
usage "rudy-ec2 ssh"
|
170
170
|
usage "rudy-ec2 -u root -k path/2/key ssh"
|
171
171
|
usage "rudy-ec2 -u root -k path/2/key ssh uname -a"
|
@@ -178,10 +178,10 @@ module RudyCLI_EC2
|
|
178
178
|
command :ssh => Rudy::CLI::AWS::EC2::Candy
|
179
179
|
command_alias :ssh, :connect
|
180
180
|
|
181
|
-
|
181
|
+
about "Amazon EC2 status"
|
182
182
|
command :status => Rudy::CLI::AWS::EC2::Candy
|
183
183
|
|
184
|
-
|
184
|
+
about "Amazon EC2 Volumes"
|
185
185
|
usage "rudy-ec2 volumes"
|
186
186
|
usage "rudy-ec2 volumes -C -s size [-d device-path]"
|
187
187
|
usage "rudy-ec2 volumes -A volume-id instance-id"
|
@@ -200,7 +200,7 @@ module RudyCLI_EC2
|
|
200
200
|
command_alias :volumes, :volume
|
201
201
|
command_alias :volumes, :v
|
202
202
|
|
203
|
-
|
203
|
+
about "Availability Zones"
|
204
204
|
usage "rudy-ec2 zones"
|
205
205
|
argv :name
|
206
206
|
command :zones => Rudy::CLI::AWS::EC2::Zones
|
@@ -224,11 +224,14 @@ end
|
|
224
224
|
# will run after Rye shuts down the ssh-agent.
|
225
225
|
begin
|
226
226
|
Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
|
227
|
-
rescue Drydock::ArgError, Drydock::OptError=> ex
|
227
|
+
rescue Drydock::ArgError, Drydock::OptError => ex
|
228
228
|
STDERR.puts ex.message
|
229
229
|
STDERR.puts ex.usage
|
230
|
+
rescue Drydock::InvalidArgument => ex
|
231
|
+
STDERR.puts ex.message
|
230
232
|
rescue Rudy::Error => ex
|
231
233
|
STDERR.puts ex.message
|
234
|
+
STDERR.puts ex.backtrace if Drydock.debug?
|
232
235
|
rescue => ex
|
233
236
|
STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
|
234
237
|
STDERR.puts ex.backtrace if Drydock.debug?
|
@@ -239,3 +242,4 @@ rescue SystemExit
|
|
239
242
|
# Don't balk
|
240
243
|
end
|
241
244
|
|
245
|
+
|
data/bin/rudy-s3
CHANGED
@@ -25,7 +25,7 @@ module RudyCLI_S3
|
|
25
25
|
# ------------------------------------ AMAZON S3 COMMANDS --------
|
26
26
|
# ------------------------------------------------------------------
|
27
27
|
|
28
|
-
|
28
|
+
about "Amazon S3 Buckets"
|
29
29
|
usage "rudy-s3 buckets"
|
30
30
|
option :l, :list, "List bucket objects"
|
31
31
|
action :C, :create, "Create a bucket"
|
@@ -34,7 +34,7 @@ module RudyCLI_S3
|
|
34
34
|
command :buckets => Rudy::CLI::AWS::S3::Buckets
|
35
35
|
command_alias :buckets, :b
|
36
36
|
|
37
|
-
#
|
37
|
+
#about "Amazon S3 Storage Interface"
|
38
38
|
#usage "rudy-s3 store file-path"
|
39
39
|
#option :b, :bucket, String, "Bucket name"
|
40
40
|
#argv :path
|
@@ -61,11 +61,14 @@ end
|
|
61
61
|
# will run after Rye shuts down the ssh-agent.
|
62
62
|
begin
|
63
63
|
Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
|
64
|
-
rescue Drydock::ArgError, Drydock::OptError=> ex
|
64
|
+
rescue Drydock::ArgError, Drydock::OptError => ex
|
65
65
|
STDERR.puts ex.message
|
66
66
|
STDERR.puts ex.usage
|
67
|
+
rescue Drydock::InvalidArgument => ex
|
68
|
+
STDERR.puts ex.message
|
67
69
|
rescue Rudy::Error => ex
|
68
70
|
STDERR.puts ex.message
|
71
|
+
STDERR.puts ex.backtrace if Drydock.debug?
|
69
72
|
rescue => ex
|
70
73
|
STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
|
71
74
|
STDERR.puts ex.backtrace if Drydock.debug?
|
@@ -76,4 +79,3 @@ rescue SystemExit
|
|
76
79
|
# Don't balk
|
77
80
|
end
|
78
81
|
|
79
|
-
|
data/bin/rudy-sdb
CHANGED
@@ -26,7 +26,7 @@ module RudyCLI_SDB
|
|
26
26
|
# ------------------------------------------------------------------
|
27
27
|
|
28
28
|
|
29
|
-
|
29
|
+
about "Displays the SimpleDB domains associated to your account"
|
30
30
|
action :C, :create, "Create a domain"
|
31
31
|
action :D, :destroy, "Destroy a domain"
|
32
32
|
argv :name
|
@@ -51,11 +51,14 @@ end
|
|
51
51
|
# will run after Rye shuts down the ssh-agent.
|
52
52
|
begin
|
53
53
|
Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
|
54
|
-
rescue Drydock::ArgError, Drydock::OptError=> ex
|
54
|
+
rescue Drydock::ArgError, Drydock::OptError => ex
|
55
55
|
STDERR.puts ex.message
|
56
56
|
STDERR.puts ex.usage
|
57
|
+
rescue Drydock::InvalidArgument => ex
|
58
|
+
STDERR.puts ex.message
|
57
59
|
rescue Rudy::Error => ex
|
58
60
|
STDERR.puts ex.message
|
61
|
+
STDERR.puts ex.backtrace if Drydock.debug?
|
59
62
|
rescue => ex
|
60
63
|
STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
|
61
64
|
STDERR.puts ex.backtrace if Drydock.debug?
|
@@ -66,5 +69,3 @@ rescue SystemExit
|
|
66
69
|
# Don't balk
|
67
70
|
end
|
68
71
|
|
69
|
-
|
70
|
-
|
data/lib/annoy.rb
CHANGED
data/lib/console.rb
CHANGED
data/lib/rudy.rb
CHANGED
@@ -9,6 +9,7 @@ require 'digest/md5'
|
|
9
9
|
require 'stringio'
|
10
10
|
require 'ostruct'
|
11
11
|
require 'yaml'
|
12
|
+
require 'json'
|
12
13
|
require 'logger'
|
13
14
|
require 'socket'
|
14
15
|
require 'timeout'
|
@@ -26,6 +27,7 @@ require 'net/scp'
|
|
26
27
|
require 'net/ssh/multi'
|
27
28
|
require 'net/ssh/gateway'
|
28
29
|
|
30
|
+
require 'rudy/mixins/hash'
|
29
31
|
|
30
32
|
|
31
33
|
# = Rudy
|
@@ -34,38 +36,16 @@ require 'net/ssh/gateway'
|
|
34
36
|
#
|
35
37
|
# Rudy is a development and deployment tool for the Amazon Elastic Compute Cloud
|
36
38
|
# (EC2). See README.rdoc for more information.
|
37
|
-
#
|
38
|
-
# == Status: Alpha
|
39
39
|
#
|
40
|
-
# The current release (0.6) is not ready for general production use. Use it for
|
41
|
-
# exploring EC2 and operating your development / ad-hoc instances. We've put in
|
42
|
-
# a lot of effort to make sure Rudy plays safe, but it's possible we missed
|
43
|
-
# something. That's why we consider it alpha code.
|
44
|
-
#
|
45
|
-
# To get started right away, try:
|
46
|
-
#
|
47
|
-
# $ rudy -h
|
48
|
-
# $ rudy show-commands
|
49
|
-
#
|
50
|
-
# Also:
|
51
|
-
#
|
52
|
-
# $ rudy-ec2 -h
|
53
|
-
# $ rudy-ec2 show-commands
|
54
|
-
#
|
55
|
-
# And if you're feeling particularly saucey, try Rudy's REPL interface:
|
56
|
-
#
|
57
|
-
# $ ird
|
58
40
|
#
|
59
|
-
#
|
60
|
-
#
|
61
41
|
module Rudy
|
62
42
|
extend self
|
63
43
|
|
64
44
|
module VERSION #:nodoc:
|
65
45
|
unless defined?(MAJOR)
|
66
46
|
MAJOR = 0.freeze
|
67
|
-
MINOR =
|
68
|
-
TINY =
|
47
|
+
MINOR = 7.freeze
|
48
|
+
TINY = 0.freeze
|
69
49
|
end
|
70
50
|
def self.to_s; [MAJOR, MINOR, TINY].join('.'); end
|
71
51
|
def self.to_f; self.to_s.to_f; end
|
@@ -141,6 +121,11 @@ module Rudy
|
|
141
121
|
lines.join($/)
|
142
122
|
end
|
143
123
|
end
|
124
|
+
|
125
|
+
#--
|
126
|
+
# TODO: Update exception Syntax based on:
|
127
|
+
# http://blog.rubybestpractices.com/posts/gregory/anonymous_class_hacks.html
|
128
|
+
#++
|
144
129
|
class NoConfig < Rudy::Error
|
145
130
|
def message; "No configuration found!"; end
|
146
131
|
end
|
@@ -180,8 +165,9 @@ require 'rudy/huxtable' # requires
|
|
180
165
|
require 'rudy/aws' # is
|
181
166
|
require 'rudy/metadata' # important
|
182
167
|
|
183
|
-
require 'rudy/machines'
|
184
168
|
require 'rudy/disks'
|
169
|
+
require 'rudy/machines'
|
185
170
|
require 'rudy/routines'
|
171
|
+
require 'rudy/scm'
|
186
172
|
|
187
173
|
|
data/lib/rudy/aws/ec2/volume.rb
CHANGED
@@ -101,7 +101,7 @@ module Rudy::AWS
|
|
101
101
|
opts = {
|
102
102
|
:volume_id => vol_id,
|
103
103
|
:instance_id => inst_id,
|
104
|
-
:device => device
|
104
|
+
:device => device.to_s # Solaris devices are numbers
|
105
105
|
}
|
106
106
|
ret = execute_request(false) { @ec2.attach_volume(opts) }
|
107
107
|
(ret['status'] == 'attaching')
|
@@ -154,7 +154,7 @@ module Rudy::AWS
|
|
154
154
|
|
155
155
|
def get(vol_id)
|
156
156
|
vol_id = Volumes.get_vol_id(vol_id)
|
157
|
-
list(:any, vol_id).first
|
157
|
+
list(:any, vol_id).first rescue nil
|
158
158
|
end
|
159
159
|
|
160
160
|
# deleting?, available?, etc...
|
data/lib/rudy/aws/sdb/error.rb
CHANGED
@@ -29,7 +29,7 @@ module Rudy
|
|
29
29
|
|
30
30
|
class FeatureDeprecatedError < RequestError ; end
|
31
31
|
|
32
|
-
class ConnectionError < Error
|
32
|
+
class ConnectionError < Rudy::Error
|
33
33
|
attr_reader :response
|
34
34
|
|
35
35
|
def initialize(response)
|
@@ -39,6 +39,7 @@ module Rudy
|
|
39
39
|
)
|
40
40
|
@response = response
|
41
41
|
end
|
42
|
+
|
42
43
|
end
|
43
44
|
|
44
45
|
end
|
data/lib/rudy/cli.rb
CHANGED
@@ -25,7 +25,10 @@ module Rudy
|
|
25
25
|
|
26
26
|
protected
|
27
27
|
def init
|
28
|
-
|
28
|
+
|
29
|
+
|
30
|
+
Rudy::Huxtable.update_config
|
31
|
+
|
29
32
|
# The CLI wants output!
|
30
33
|
Rudy::Huxtable.update_logger STDOUT
|
31
34
|
|
@@ -80,6 +83,12 @@ module Rudy
|
|
80
83
|
end
|
81
84
|
end
|
82
85
|
|
86
|
+
def machine_separator(name, awsid)
|
87
|
+
dashes = 80 - name.size #
|
88
|
+
dashes = 0 if dashes < 1
|
89
|
+
('%s %-63s awsid: %s ' % [$/, name, awsid]).att(:reverse)
|
90
|
+
end
|
91
|
+
|
83
92
|
end
|
84
93
|
|
85
94
|
def self.generate_header(global, config)
|
@@ -23,7 +23,7 @@ module AWS; module EC2;
|
|
23
23
|
raise "Could not fetch #{address.ipaddress}" unless address
|
24
24
|
|
25
25
|
puts "Destroying address: #{@argv.ipaddress}"
|
26
|
-
puts "NOTE: this IP address will become available to other EC2 customers.".
|
26
|
+
puts "NOTE: this IP address will become available to other EC2 customers.".bright
|
27
27
|
execute_check(:medium)
|
28
28
|
execute_action { @radd.destroy(@argv.ipaddress) }
|
29
29
|
self.addresses
|
@@ -93,7 +93,7 @@ module AWS; module EC2;
|
|
93
93
|
opts[:group] = :any if @option.all
|
94
94
|
opts[:id] = @option.instid if @option.instid
|
95
95
|
|
96
|
-
puts "You may want to run rudy-ec2 #{@alias} --prepare before this.".
|
96
|
+
puts "You may want to run rudy-ec2 #{@alias} --prepare before this.".bright
|
97
97
|
puts "This feature is experimental. Make sure you enter the bucket"
|
98
98
|
puts "and image names correctly because if they're wrong the image"
|
99
99
|
puts "won't get created and you'll be annoyed that you waited."
|
@@ -126,6 +126,8 @@ module AWS; module EC2;
|
|
126
126
|
# Open the connection and run the command
|
127
127
|
rbox = Rye::Box.new(inst.dns_public, ssh_opts)
|
128
128
|
|
129
|
+
# TODO: Replace with rbox.upload
|
130
|
+
|
129
131
|
# ~/.rudy, /etc/motd, history -c, /etc/hosts, /var/log/rudy*
|
130
132
|
cert = File.read(@@global.cert)
|
131
133
|
pk = File.read(@@global.privatekey)
|
@@ -48,8 +48,8 @@ module AWS; module EC2;
|
|
48
48
|
puts "Creating #{opts[:size]} instance in #{@@global.zone}"
|
49
49
|
|
50
50
|
unless opts[:keypair]
|
51
|
-
puts "You did not specify a keypair. Unless you've prepared a user account".
|
52
|
-
puts "on this image (#{opts[:ami]}) you will not be able to log in to it.".
|
51
|
+
puts "You did not specify a keypair. Unless you've prepared a user account".bright
|
52
|
+
puts "on this image (#{opts[:ami]}) you will not be able to log in to it.".bright
|
53
53
|
exit unless Annoy.proceed?(:low)
|
54
54
|
end
|
55
55
|
|
data/lib/rudy/cli/candy.rb
CHANGED
@@ -3,6 +3,17 @@ module Rudy
|
|
3
3
|
module CLI
|
4
4
|
class Candy < Rudy::CLI::CommandBase
|
5
5
|
|
6
|
+
def open
|
7
|
+
rmach = Rudy::Machines.new
|
8
|
+
machines = rmach.list
|
9
|
+
puts 1
|
10
|
+
if machines
|
11
|
+
`open http://#{machines.first.dns_public}`
|
12
|
+
else
|
13
|
+
puts "No machines"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
6
17
|
end
|
7
18
|
end
|
8
19
|
end
|
data/lib/rudy/cli/config.rb
CHANGED
@@ -31,54 +31,35 @@ module Rudy
|
|
31
31
|
# $ rudy config --all
|
32
32
|
#
|
33
33
|
def config
|
34
|
-
|
34
|
+
# if Rudy.in_situ? # TODO: do something intelligent when running on EC2
|
35
35
|
|
36
|
+
if @@config.nil? || @@config.empty?
|
37
|
+
return if @@global.quiet
|
38
|
+
raise Rudy::NoConfig
|
39
|
+
end
|
40
|
+
|
41
|
+
outform = @@global.format == :json ? :to_json : :to_yaml
|
36
42
|
|
37
|
-
@option.
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
types = @option.marshal_dump.keys & @@config.keys # Intersections only
|
44
|
+
types = @@config.keys if @option.all
|
45
|
+
types = [:machines] if types.empty?
|
46
|
+
|
47
|
+
if @option.project
|
48
|
+
rf = File.join(RUDY_HOME, 'Rudyfile')
|
49
|
+
raise "Cannot find: #{rf}" unless File.exists?(rf)
|
50
|
+
puts File.read(rf)
|
51
|
+
|
52
|
+
elsif @option.script
|
53
|
+
conf = fetch_script_config
|
54
|
+
puts conf.to_hash.send(outform) if conf
|
55
|
+
|
46
56
|
else
|
47
|
-
if
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
53
|
-
if @@config.routines?
|
54
|
-
puts "# ROUTINES: "
|
55
|
-
y @@config.routines.to_hash
|
56
|
-
end
|
57
|
-
elsif @option.defaults?
|
58
|
-
y @@config.defaults.to_hash
|
59
|
-
elsif @option.script
|
60
|
-
y fetch_script_config.to_hash
|
61
|
-
elsif @option.project
|
62
|
-
rf = File.join(RUDY_HOME, 'Rudyfile')
|
63
|
-
raise "Cannot find: #{rf}" unless File.exists?(rf)
|
64
|
-
puts File.read(rf)
|
65
|
-
else
|
66
|
-
zon, env, rol = @@global.zone, @@global.environment, @@global.role
|
67
|
-
usr, att = @@global.user, @argv.name
|
68
|
-
val = @@config.machines.find_deferred(zon, env, rol, usr, att) || ''
|
69
|
-
puts (val.is_a?(String)) ? val : val.to_hash.to_yaml
|
57
|
+
puts "# ACCOUNTS: [not displayed]" if types.delete(:accounts)
|
58
|
+
types.each do |conftype|
|
59
|
+
puts "# #{conftype.to_s.upcase}"
|
60
|
+
next unless @@config[conftype] # Nothing to output
|
61
|
+
puts @@config[conftype].to_hash.send(outform)
|
70
62
|
end
|
71
|
-
|
72
|
-
#name = @argv.first
|
73
|
-
#if name && @@config.userdata.has_key?(which)
|
74
|
-
# value = @@config.userdata[which][name.to_s]
|
75
|
-
# puts value if value
|
76
|
-
#elsif @option.all
|
77
|
-
# puts @@config.to_yaml
|
78
|
-
#else
|
79
|
-
# value = @@config.userdata[which]
|
80
|
-
# puts value.to_yaml if value
|
81
|
-
#end
|
82
63
|
end
|
83
64
|
|
84
65
|
end
|