rudy 0.6.8 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. data/CHANGES.txt +15 -2
  2. data/README.rdoc +30 -23
  3. data/Rakefile +5 -5
  4. data/Rudyfile +87 -66
  5. data/bin/rudy +120 -167
  6. data/bin/rudy-ec2 +17 -13
  7. data/bin/rudy-s3 +6 -4
  8. data/bin/rudy-sdb +5 -4
  9. data/lib/annoy.rb +1 -1
  10. data/lib/console.rb +1 -3
  11. data/lib/rudy.rb +11 -25
  12. data/lib/rudy/aws/ec2/instance.rb +1 -1
  13. data/lib/rudy/aws/ec2/volume.rb +2 -2
  14. data/lib/rudy/aws/sdb/error.rb +2 -1
  15. data/lib/rudy/cli.rb +10 -1
  16. data/lib/rudy/cli/aws/ec2/addresses.rb +1 -1
  17. data/lib/rudy/cli/aws/ec2/images.rb +3 -1
  18. data/lib/rudy/cli/aws/ec2/instances.rb +2 -2
  19. data/lib/rudy/cli/candy.rb +11 -0
  20. data/lib/rudy/cli/config.rb +25 -44
  21. data/lib/rudy/cli/machines.rb +30 -10
  22. data/lib/rudy/cli/routines.rb +67 -19
  23. data/lib/rudy/config.rb +30 -13
  24. data/lib/rudy/config/objects.rb +135 -10
  25. data/lib/rudy/disks.rb +8 -52
  26. data/lib/rudy/global.rb +9 -5
  27. data/lib/rudy/guidelines.rb +18 -0
  28. data/lib/rudy/huxtable.rb +29 -19
  29. data/lib/rudy/machines.rb +10 -7
  30. data/lib/rudy/mixins/hash.rb +25 -0
  31. data/lib/rudy/routines.rb +160 -10
  32. data/lib/rudy/routines/helper.rb +50 -0
  33. data/lib/rudy/routines/helpers/diskhelper.rb +44 -18
  34. data/lib/rudy/routines/helpers/scmhelper.rb +39 -0
  35. data/lib/rudy/routines/helpers/scripthelper.rb +86 -35
  36. data/lib/rudy/routines/helpers/userhelper.rb +37 -0
  37. data/lib/rudy/routines/passthrough.rb +36 -0
  38. data/lib/rudy/routines/release.rb +38 -22
  39. data/lib/rudy/routines/shutdown.rb +20 -49
  40. data/lib/rudy/routines/startup.rb +20 -47
  41. data/lib/rudy/scm.rb +75 -0
  42. data/lib/rudy/scm/git.rb +215 -0
  43. data/lib/rudy/scm/svn.rb +7 -6
  44. data/lib/rudy/utils.rb +12 -30
  45. data/lib/storable.rb +4 -1
  46. data/lib/sysinfo.rb +10 -0
  47. data/rudy.gemspec +21 -9
  48. data/test/01_mixins/10_hash_test.rb +25 -0
  49. data/test/{05_config → 10_config}/00_setup_test.rb +1 -1
  50. data/test/{05_config → 10_config}/30_machines_test.rb +1 -1
  51. data/test/15_scm/00_setup_test.rb +20 -0
  52. data/test/15_scm/20_git_test.rb +61 -0
  53. data/test/helper.rb +1 -1
  54. data/vendor/highline-1.5.1/Rakefile +3 -3
  55. metadata +41 -12
  56. data/bin/ird +0 -175
data/bin/ird DELETED
@@ -1,175 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- # = Interactive Rudy (experimental)
4
- #
5
- # === Not your granparent's deployment tool
6
- #
7
- # See ird -h for usage
8
- #
9
-
10
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
11
- $:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'highline-1.5.1', 'lib')
12
- %w{drydock caesars rye}.each { |dir| $:.unshift File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
13
- require 'rubygems'
14
-
15
- # SEE: http://github.com/rubyspec/matzruby/blob/a34130eb7c4ecc164115a59aa1b76c643bd98202/lib/irb/xmp.rb
16
- # SEE: http://github.com/blackwinter/wirble/tree/master
17
- require "irb"
18
- require 'irb/completion'
19
-
20
- require 'rudy'
21
- require 'drydock'
22
- require 'rudy/cli'
23
-
24
-
25
- module RudyCLI_Interactive # :nodoc:all
26
- extend self
27
- extend Drydock
28
- include Readline
29
-
30
- global :A, :accesskey, String, "AWS Access Key"
31
- global :S, :secretkey, String, "AWS Secret Access Key"
32
- #global :R, :region, String, "Connect to a specific EC2 region (ie: #{Rudy::DEFAULT_REGION})"
33
- #global :n, :nocolor, "Disable output colors"
34
- global :f, :config, String, "Specify another configuration file to read (ie: #{Rudy::CONFIG_FILE})"
35
- global :z, :zone, String, "Connect to a specific EC2 zone (ie: #{Rudy::DEFAULT_ZONE})"
36
- global :e, :environment, String, "Connect to the specified environment (ie: #{Rudy::DEFAULT_ENVIRONMENT})"
37
- global :r, :role, String, "Connect to a machine with the specified role (ie: #{Rudy::DEFAULT_ROLE})"
38
- global :p, :position, String, "Position in the machine in its group (ie: #{Rudy::DEFAULT_POSITION})"
39
- global :u, :user, String, "Provide a username (ie: #{Rudy::DEFAULT_USER})"
40
- #global :q, :quiet, "Run with less output"
41
- #global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
42
- # @verbose ||= 0
43
- # @verbose += 1
44
- #end
45
- global :V, :version, "Display version number" do
46
- puts "Rudy version: #{Rudy::VERSION}"
47
- exit 0
48
- end
49
-
50
-
51
- default :interactive
52
- debug :off
53
- desc "An interactive REPL for Rudy."
54
- usage "#{$0} [global options]"
55
- command :interactive do |obj|
56
-
57
- @@rmach = Rudy::Machines.new(:global => obj.global)
58
- @@rkey = Rudy::KeyPairs.new(:global => obj.global)
59
- @@rgrp = Rudy::Groups.new(:global => obj.global)
60
- @@rvol = Rudy::Volumes.new(:global => obj.global)
61
- @@radd = Rudy::Addresses.new(:global => obj.global)
62
-
63
- puts Rudy::CLI.generate_header(@@rmach.global, @@rmach.config)
64
- puts Rudy::Utils.without_indent(%Q`
65
- ------------------------------------------------------------
66
- Welcome Interactive Rudy! (EXPERIMENTAL)
67
- ------------------------------------------------------------
68
-
69
- `)
70
- h
71
-
72
- # What's the deal with this error message when defining a help method?
73
- # => rb: warn: can't alias help from irb_help
74
- if __FILE__ == $0
75
- IRB.start(__FILE__)
76
- else
77
- # check -e option
78
- if /^-e$/ =~ $0
79
- IRB.start(__FILE__)
80
- else
81
- IRB.start(__FILE__)
82
- end
83
- end
84
-
85
- end
86
-
87
-
88
-
89
-
90
- def h;
91
- puts (%Q`
92
- HELP
93
-
94
- h Help (this screen)
95
- m Rudy::Machines instance
96
- g Rudy::Groups instance
97
- k Rudy::KeyPairs instance
98
- v Rudy::Volumes instance
99
- a Rudy::Addresses instance
100
- ssh [GROUP] Connect to a machine
101
- example Start an EC2 instance from scratch.
102
- `)
103
- end
104
- def example
105
- puts (%Q`
106
- EXAMPLE
107
- Start an EC2 instance from scratch.
108
-
109
- # Create a security group
110
- >> g.create
111
- => #<Rudy::AWS::EC2::Group @name="stage-app" ...>
112
-
113
- # Create a keypair (used to login as root)
114
- >> k.create
115
- => #<Rudy::AWS::EC2::KeyPair @name="key-stage-app" ...>
116
-
117
- # Start an EC2 machine instance:
118
- >> m.create
119
- Instance: i-228def51
120
- Waiting for the instance to startup
121
- ........It's up!
122
-
123
- # Login to the new instance
124
- >> ssh
125
-
126
- All commands in Rudy refer to the global defaults unless
127
- otherwise specified. "stage" is the default environment and
128
- "app" is the default role. You can change these with command
129
- line arguments or by modifying the defaults in your Rudy
130
- config file: #{@@rmach.config_dirname}
131
-
132
- You can also specify your own names by providing
133
- one as the first argument: g.create 'group5000'.
134
-
135
- # List instances in stage-app
136
- >> m.list :running
137
- => [#<Rudy::AWS::EC2::Instance:0x18c5888 ...>]
138
-
139
- # Print the instance in a human readable way
140
- >> puts m.list.first.to_s
141
-
142
- # Print instance system console output
143
- >> puts m.console
144
-
145
- # Destroy ALL INSTANCES in stage-app
146
- >> m.destroy
147
- `)
148
- end
149
-
150
- def m; @@rmach; end
151
- def k; @@rkey; end
152
- def g; @@rgrp; end
153
- def v; @@rvol; end
154
- def a; @@radd; end
155
-
156
- # Change Group
157
- #def cg(name); end
158
-
159
- def ssh(*args)
160
- @@rmach.switch_user :root
161
- @@rmach.connect(*args)
162
- @@rmach.switch_user # back to previous user
163
- nil
164
- end
165
-
166
-
167
- end
168
-
169
- include CLI # So we don't have to say CLI.example in the REPL.
170
-
171
-
172
- __END__
173
- #@rbox = Rye::Box.new('ec2-174-129-173-3.compute-1.amazonaws.com', 'root')
174
- #@rbox2 = Rye::Box.new('ec2-174-129-173-3.compute-1.amazonaws.com', 'root')
175
- #@rbox.add_keys('/Users/delano/Projects/git/rudy/.rudy/key-test-app.private')