rudy 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/CHANGES.txt +28 -5
  2. data/README.rdoc +1 -1
  3. data/Rudyfile +51 -19
  4. data/bin/ird +153 -0
  5. data/bin/rudy +18 -23
  6. data/bin/rudy-ec2 +5 -10
  7. data/bin/rudy-s3 +1 -3
  8. data/bin/rudy-sdb +0 -2
  9. data/examples/README.md +10 -0
  10. data/examples/debian-sinatra-passenger/commands.rb +19 -0
  11. data/examples/debian-sinatra-passenger/machines.rb +32 -0
  12. data/examples/debian-sinatra-passenger/routines.rb +30 -0
  13. data/examples/debian-sinatra-thin/commands.rb +17 -0
  14. data/examples/debian-sinatra-thin/machines.rb +35 -0
  15. data/examples/debian-sinatra-thin/routines.rb +72 -0
  16. data/lib/rudy.rb +8 -17
  17. data/lib/rudy/aws.rb +1 -2
  18. data/lib/rudy/aws/ec2/address.rb +0 -1
  19. data/lib/rudy/aws/ec2/snapshot.rb +11 -0
  20. data/lib/rudy/aws/s3.rb +6 -3
  21. data/lib/rudy/cli.rb +12 -2
  22. data/lib/rudy/cli/aws/ec2/candy.rb +19 -48
  23. data/lib/rudy/cli/aws/ec2/images.rb +109 -122
  24. data/lib/rudy/cli/aws/s3/buckets.rb +1 -2
  25. data/lib/rudy/cli/config.rb +13 -0
  26. data/lib/rudy/cli/disks.rb +24 -1
  27. data/lib/rudy/cli/routines.rb +10 -11
  28. data/lib/rudy/config.rb +6 -9
  29. data/lib/rudy/config/objects.rb +4 -0
  30. data/lib/rudy/global.rb +4 -5
  31. data/lib/rudy/huxtable.rb +23 -8
  32. data/lib/rudy/machines.rb +11 -4
  33. data/lib/rudy/metadata.rb +8 -94
  34. data/lib/rudy/metadata/backup.rb +113 -0
  35. data/lib/rudy/metadata/backups.rb +65 -0
  36. data/lib/rudy/{disks.rb → metadata/disk.rb} +36 -69
  37. data/lib/rudy/metadata/disks.rb +67 -0
  38. data/lib/rudy/metadata/objectbase.rb +104 -0
  39. data/lib/rudy/mixins.rb +2 -0
  40. data/lib/rudy/routines.rb +173 -88
  41. data/lib/rudy/routines/helpers/dependshelper.rb +34 -0
  42. data/lib/rudy/routines/helpers/diskhelper.rb +174 -5
  43. data/lib/rudy/routines/helpers/scmhelper.rb +2 -2
  44. data/lib/rudy/routines/helpers/scripthelper.rb +11 -4
  45. data/lib/rudy/routines/passthrough.rb +3 -1
  46. data/lib/rudy/routines/reboot.rb +75 -0
  47. data/lib/rudy/routines/startup.rb +3 -3
  48. data/lib/rudy/scm/git.rb +17 -17
  49. data/lib/rudy/scm/svn.rb +46 -5
  50. data/lib/rudy/utils.rb +3 -2
  51. data/rudy.gemspec +24 -46
  52. data/test/30_sdb_metadata/10_disks_test.rb +5 -5
  53. metadata +36 -68
  54. data/lib/annoy.rb +0 -298
  55. data/lib/console.rb +0 -404
  56. data/lib/escape.rb +0 -305
  57. data/lib/rudy/backup.rb +0 -135
  58. data/lib/storable.rb +0 -292
  59. data/lib/sysinfo.rb +0 -285
  60. data/lib/tryouts.rb +0 -33
  61. data/vendor/highline-1.5.1/CHANGELOG +0 -222
  62. data/vendor/highline-1.5.1/INSTALL +0 -35
  63. data/vendor/highline-1.5.1/LICENSE +0 -7
  64. data/vendor/highline-1.5.1/README +0 -63
  65. data/vendor/highline-1.5.1/Rakefile +0 -82
  66. data/vendor/highline-1.5.1/TODO +0 -6
  67. data/vendor/highline-1.5.1/examples/ansi_colors.rb +0 -38
  68. data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +0 -18
  69. data/vendor/highline-1.5.1/examples/basic_usage.rb +0 -75
  70. data/vendor/highline-1.5.1/examples/color_scheme.rb +0 -32
  71. data/vendor/highline-1.5.1/examples/limit.rb +0 -12
  72. data/vendor/highline-1.5.1/examples/menus.rb +0 -65
  73. data/vendor/highline-1.5.1/examples/overwrite.rb +0 -19
  74. data/vendor/highline-1.5.1/examples/page_and_wrap.rb +0 -322
  75. data/vendor/highline-1.5.1/examples/password.rb +0 -7
  76. data/vendor/highline-1.5.1/examples/trapping_eof.rb +0 -22
  77. data/vendor/highline-1.5.1/examples/using_readline.rb +0 -17
  78. data/vendor/highline-1.5.1/lib/highline.rb +0 -758
  79. data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +0 -120
  80. data/vendor/highline-1.5.1/lib/highline/compatibility.rb +0 -17
  81. data/vendor/highline-1.5.1/lib/highline/import.rb +0 -43
  82. data/vendor/highline-1.5.1/lib/highline/menu.rb +0 -395
  83. data/vendor/highline-1.5.1/lib/highline/question.rb +0 -463
  84. data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +0 -193
  85. data/vendor/highline-1.5.1/setup.rb +0 -1360
  86. data/vendor/highline-1.5.1/test/tc_color_scheme.rb +0 -56
  87. data/vendor/highline-1.5.1/test/tc_highline.rb +0 -823
  88. data/vendor/highline-1.5.1/test/tc_import.rb +0 -54
  89. data/vendor/highline-1.5.1/test/tc_menu.rb +0 -429
  90. data/vendor/highline-1.5.1/test/ts_all.rb +0 -15
@@ -1,35 +0,0 @@
1
- = Installing HighLine
2
-
3
- RubyGems is the preferred easy install method for HighLine. However, you can
4
- install HighLine manually as described below.
5
-
6
- == Installing the Gem
7
-
8
- HighLine is intended to be installed via the
9
- RubyGems[http://rubyforge.org/projects/rubygems/] system. To get the latest
10
- version, simply enter the following into your command prompt:
11
-
12
- $ sudo gem install highline
13
-
14
- You must have RubyGems[http://rubyforge.org/projects/rubygems/] installed for
15
- the above to work.
16
-
17
- == Installing Manually
18
-
19
- Download the latest version of HighLine from the
20
- {RubyForge project page}[http://rubyforge.org/frs/?group_id=683]. Navigate to
21
- the root project directory and enter:
22
-
23
- $ sudo ruby setup.rb
24
-
25
- == Using termios
26
-
27
- While not a requirement, HighLine will take advantage of the termios library if
28
- installed (on Unix). This slightly improves HighLine's character reading
29
- capabilities and thus is recommended for all Unix users.
30
-
31
- If using the HighLine gem, you should be able to add termios as easily as:
32
-
33
- $ sudo gem install termios
34
-
35
- For manual installs, consult the termios documentation.
@@ -1,7 +0,0 @@
1
- = License Terms
2
-
3
- Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html] (see COPYING for details) or the
4
- {Ruby software license}[http://www.ruby-lang.org/en/LICENSE.txt] by
5
- James Edward Gray II and Greg Brown.
6
-
7
- Please email James[mailto:james@grayproductions.net] with any questions.
@@ -1,63 +0,0 @@
1
- = Read Me
2
-
3
- by James Edward Gray II
4
-
5
- == Description
6
-
7
- Welcome to HighLine.
8
-
9
- HighLine was designed to ease the tedious tasks of doing console input and
10
- output with low-level methods like gets() and puts(). HighLine provides a
11
- robust system for requesting data from a user, without needing to code all the
12
- error checking and validation rules and without needing to convert the typed
13
- Strings into what your program really needs. Just tell HighLine what you're
14
- after, and let it do all the work.
15
-
16
- == Documentation
17
-
18
- See HighLine and HighLine::Question for documentation.
19
-
20
- == Examples
21
-
22
- Basic usage:
23
-
24
- ask("Company? ") { |q| q.default = "none" }
25
-
26
- Validation:
27
-
28
- ask("Age? ", Integer) { |q| q.in = 0..105 }
29
- ask("Name? (last, first) ") { |q| q.validate = /\A\w+, ?\w+\Z/ }
30
-
31
- Type conversion for answers:
32
-
33
- ask("Birthday? ", Date)
34
- ask("Interests? (comma sep list) ", lambda { |str| str.split(/,\s*/) })
35
-
36
- Reading passwords:
37
-
38
- ask("Enter your password: ") { |q| q.echo = false }
39
- ask("Enter your password: ") { |q| q.echo = "x" }
40
-
41
- ERb based output (with HighLine's ANSI color tools):
42
-
43
- say("This should be <%= color('bold', BOLD) %>!")
44
-
45
- Menus:
46
-
47
- choose do |menu|
48
- menu.prompt = "Please choose your favorite programming language? "
49
-
50
- menu.choice(:ruby) { say("Good choice!") }
51
- menu.choices(:python, :perl) { say("Not from around here, are you?") }
52
- end
53
-
54
- For more examples see the examples/ directory of this project.
55
-
56
- == Installing
57
-
58
- See the INSTALL file for instructions.
59
-
60
- == Questions and/or Comments
61
-
62
- Feel free to email {James Edward Gray II}[mailto:james@grayproductions.net] or
63
- {Gregory Brown}[mailto:gregory.t.brown@gmail.com] with any questions.
@@ -1,82 +0,0 @@
1
- require "rake/rdoctask"
2
- require "rake/testtask"
3
- require "rake/gempackagetask"
4
-
5
- require "rubygems"
6
-
7
- dir = File.dirname(__FILE__)
8
- lib = File.join(dir, "lib", "highline.rb")
9
- version = File.read(lib)[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
10
-
11
- task :default => [:test]
12
-
13
- Rake::TestTask.new do |test|
14
- test.libs << "test"
15
- test.test_files = [ "test/ts_all.rb" ]
16
- test.verbose = true
17
- end
18
-
19
- Rake::RDocTask.new do |rdoc|
20
- rdoc.rdoc_files.include( "README", "INSTALL",
21
- "TODO", "CHANGELOG",
22
- "AUTHORS", "COPYING",
23
- "LICENSE", "lib/" )
24
- rdoc.main = "README"
25
- rdoc.rdoc_dir = "doc/html"
26
- rdoc.title = "HighLine Documentation"
27
- end
28
-
29
- about "Upload current documentation to Rubyforge"
30
- task :upload_docs => [:rdoc] do
31
- sh "scp -r doc/html/* " +
32
- "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/highline/doc/"
33
- sh "scp -r site/* " +
34
- "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/highline/"
35
- end
36
-
37
- spec = Gem::Specification.new do |spec|
38
- spec.name = "highline"
39
- spec.version = version
40
- spec.platform = Gem::Platform::RUBY
41
- spec.summary = "HighLine is a high-level command-line IO library."
42
- spec.files = Dir.glob("{examples,lib,test}/**/*.rb").
43
- delete_if { |item| item.include?("CVS") } +
44
- ["Rakefile", "setup.rb"]
45
-
46
- spec.test_files = "test/ts_all.rb"
47
- spec.has_rdoc = true
48
- spec.extra_rdoc_files = %w{README INSTALL TODO CHANGELOG LICENSE}
49
- spec.rdoc_options << '--title' << 'HighLine Documentation' <<
50
- '--main' << 'README'
51
-
52
- spec.require_path = 'lib'
53
-
54
- spec.author = "James Edward Gray II"
55
- spec.email = "james@grayproductions.net"
56
- spec.rubyforge_project = "highline"
57
- spec.homepage = "http://highline.rubyforge.org"
58
- spec.description = <<END_DESC
59
- A high-level IO library that provides validation, type conversion, and more for
60
- command-line interfaces. HighLine also includes a complete menu system that can
61
- crank out anything from simple list selection to complete shells with just
62
- minutes of work.
63
- END_DESC
64
- end
65
-
66
- Rake::GemPackageTask.new(spec) do |pkg|
67
- pkg.need_zip = true
68
- pkg.need_tar = true
69
- end
70
-
71
- about "Show library's code statistics"
72
- task :stats do
73
- require 'code_statistics'
74
- CodeStatistics.new( ["HighLine", "lib"],
75
- ["Functionals", "examples"],
76
- ["Units", "test"] ).to_s
77
- end
78
-
79
- about "Add new files to Subversion"
80
- task :add_to_svn do
81
- sh %Q{svn status | ruby -nae 'system "svn add \#{$F[1]}" if $F[0] == "?"' }
82
- end
@@ -1,6 +0,0 @@
1
- = To Do List
2
-
3
- The following is a list of planned expansions for HighLine, in no particular
4
- order.
5
-
6
- * Rent this space.
@@ -1,38 +0,0 @@
1
- #!/usr/local/bin/ruby -w
2
-
3
- # ansi_colors.rb
4
- #
5
- # Created by James Edward Gray II on 2005-05-03.
6
- # Copyright 2005 Gray Productions. All rights reserved.
7
-
8
- require "rubygems"
9
- require "highline/import"
10
-
11
- # Supported color sequences.
12
- colors = %w{black red green yellow blue magenta cyan white}
13
-
14
- # Using color() with symbols.
15
- colors.each_with_index do |c, i|
16
- say("This should be <%= color('#{c}', :#{c}) %>!")
17
- if i == 0
18
- say( "This should be " +
19
- "<%= color('white on #{c}', :white, :on_#{c}) %>!")
20
- else
21
- say( "This should be " +
22
- "<%= color( '#{colors[i - 1]} on #{c}',
23
- :#{colors[i - 1]}, :on_#{c} ) %>!")
24
- end
25
- end
26
-
27
- # Using color with constants.
28
- say("This should be <%= color('bold', BOLD) %>!")
29
- say("This should be <%= color('underlined', UNDERLINE) %>!")
30
-
31
- # Using constants only.
32
- say("This might even <%= BLINK %>blink<%= CLEAR %>!")
33
-
34
- # It even works with list wrapping.
35
- erb_digits = %w{Zero One Two Three Four} +
36
- ["<%= color('Five', :blue) %%>"] +
37
- %w{Six Seven Eight Nine}
38
- say("<%= list(#{erb_digits.inspect}, :columns_down, 3) %>")
@@ -1,18 +0,0 @@
1
- #!/usr/local/bin/ruby -w
2
-
3
- # asking_for_arrays.rb
4
- #
5
- # Created by James Edward Gray II on 2005-07-05.
6
- # Copyright 2005 Gray Productions. All rights reserved.
7
-
8
- require "rubygems"
9
- require "highline/import"
10
- require "pp"
11
-
12
- grades = ask( "Enter test scores (or a blank line to quit):",
13
- lambda { |ans| ans =~ /^-?\d+$/ ? Integer(ans) : ans} ) do |q|
14
- q.gather = ""
15
- end
16
-
17
- say("Grades:")
18
- pp grades
@@ -1,75 +0,0 @@
1
- #!/usr/local/bin/ruby -w
2
-
3
- # basic_usage.rb
4
- #
5
- # Created by James Edward Gray II on 2005-04-28.
6
- # Copyright 2005 Gray Productions. All rights reserved.
7
-
8
- require "rubygems"
9
- require "highline/import"
10
- require "yaml"
11
-
12
- contacts = [ ]
13
-
14
- class NameClass
15
- def self.parse( string )
16
- if string =~ /^\s*(\w+),\s*(\w+)\s*$/
17
- self.new($2, $1)
18
- else
19
- raise ArgumentError, "Invalid name format."
20
- end
21
- end
22
-
23
- def initialize(first, last)
24
- @first, @last = first, last
25
- end
26
-
27
- attr_reader :first, :last
28
- end
29
-
30
- begin
31
- entry = Hash.new
32
-
33
- # basic output
34
- say("Enter a contact:")
35
-
36
- # basic input
37
- entry[:name] = ask("Name? (last, first) ", NameClass) do |q|
38
- q.validate = /\A\w+, ?\w+\Z/
39
- end
40
- entry[:company] = ask("Company? ") { |q| q.default = "none" }
41
- entry[:address] = ask("Address? ")
42
- entry[:city] = ask("City? ")
43
- entry[:state] = ask("State? ") do |q|
44
- q.case = :up
45
- q.validate = /\A[A-Z]{2}\Z/
46
- end
47
- entry[:zip] = ask("Zip? ") do |q|
48
- q.validate = /\A\d{5}(?:-?\d{4})?\Z/
49
- end
50
- entry[:phone] = ask( "Phone? ",
51
- lambda { |p| p.delete("^0-9").
52
- sub(/\A(\d{3})/, '(\1) ').
53
- sub(/(\d{4})\Z/, '-\1') } ) do |q|
54
- q.validate = lambda { |p| p.delete("^0-9").length == 10 }
55
- q.responses[:not_valid] = "Enter a phone numer with area code."
56
- end
57
- entry[:age] = ask("Age? ", Integer) { |q| q.in = 0..105 }
58
- entry[:birthday] = ask("Birthday? ", Date)
59
- entry[:interests] = ask( "Interests? (comma separated list) ",
60
- lambda { |str| str.split(/,\s*/) } )
61
- entry[:description] = ask("Enter a description for this contact.") do |q|
62
- q.whitespace = :strip_and_collapse
63
- end
64
-
65
- contacts << entry
66
- # shortcut for yes and no questions
67
- end while agree("Enter another contact? ", true)
68
-
69
- if agree("Save these contacts? ", true)
70
- file_name = ask("Enter a file name: ") do |q|
71
- q.validate = /\A\w+\Z/
72
- q.confirm = true
73
- end
74
- File.open("#{file_name}.yaml", "w") { |file| YAML.dump(contacts, file) }
75
- end
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env ruby -w
2
-
3
- # color_scheme.rb
4
- #
5
- # Created by Jeremy Hinegardner on 2007-01-24
6
- # Copyright 2007 Jeremy Hinegardner. All rights reserved
7
-
8
- require 'rubygems'
9
- require 'highline/import'
10
-
11
- # Create a color scheme, naming color patterns with symbol names.
12
- ft = HighLine::ColorScheme.new do |cs|
13
- cs[:headline] = [ :bold, :yellow, :on_black ]
14
- cs[:horizontal_line] = [ :bold, :white, :on_blue]
15
- cs[:even_row] = [ :green ]
16
- cs[:odd_row] = [ :magenta ]
17
- end
18
-
19
- # Assign that color scheme to HighLine...
20
- HighLine.color_scheme = ft
21
-
22
- # ...and use it.
23
- say("<%= color('Headline', :headline) %>")
24
- say("<%= color('-'*20, :horizontal_line) %>")
25
-
26
- # Setup a toggle for rows.
27
- i = true
28
- ("A".."D").each do |row|
29
- row_color = i ? :even_row : :odd_row
30
- say("<%= color('#{row}', '#{row_color}') %>")
31
- i = !i
32
- end
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby -w
2
-
3
- # limit.rb
4
- #
5
- # Created by James Edward Gray II on 2008-11-12.
6
- # Copyright 2008 Gray Productions. All rights reserved.
7
-
8
- require "rubygems"
9
- require "highline/import"
10
-
11
- text = ask("Enter text (max 10 chars): ") { |q| q.limit = 10 }
12
- puts "You entered: #{text}!"
@@ -1,65 +0,0 @@
1
- #!/usr/local/bin/ruby -w
2
-
3
- require "rubygems"
4
- require "highline/import"
5
-
6
- # The old way, using ask() and say()...
7
- choices = %w{ruby python perl}
8
- say("This is the old way using ask() and say()...")
9
- say("Please choose your favorite programming language:")
10
- say(choices.map { |c| " #{c}\n" }.join)
11
-
12
- case ask("? ", choices)
13
- when "ruby"
14
- say("Good choice!")
15
- else
16
- say("Not from around here, are you?")
17
- end
18
-
19
- # The new and improved choose()...
20
- say("\nThis is the new mode (default)...")
21
- choose do |menu|
22
- menu.prompt = "Please choose your favorite programming language? "
23
-
24
- menu.choice :ruby do say("Good choice!") end
25
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
26
- end
27
-
28
- say("\nThis is letter indexing...")
29
- choose do |menu|
30
- menu.index = :letter
31
- menu.index_suffix = ") "
32
-
33
- menu.prompt = "Please choose your favorite programming language? "
34
-
35
- menu.choice :ruby do say("Good choice!") end
36
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
37
- end
38
-
39
- say("\nThis is with a different layout...")
40
- choose do |menu|
41
- menu.layout = :one_line
42
-
43
- menu.header = "Languages"
44
- menu.prompt = "Favorite? "
45
-
46
- menu.choice :ruby do say("Good choice!") end
47
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
48
- end
49
-
50
- say("\nYou can even build shells...")
51
- loop do
52
- choose do |menu|
53
- menu.layout = :menu_only
54
-
55
- menu.shell = true
56
-
57
- menu.choice(:load, "Load a file.") do |command, details|
58
- say("Loading file with options: #{details}...")
59
- end
60
- menu.choice(:save, "Save a file.") do |command, details|
61
- say("Saving file with options: #{details}...")
62
- end
63
- menu.choice(:quit, "Exit program.") { exit }
64
- end
65
- end