scud 0.5.0 → 0.6.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.
data/bin/scud CHANGED
@@ -6,7 +6,7 @@ require 'scud'
6
6
  include GLI::App
7
7
 
8
8
  program_desc <<DESC
9
- create and terminate VMs in the cloud and bootstrap your favourite CM tool (puppet, chef etc)
9
+ create and bootstrap cloud instances with ease, your way.
10
10
  DESC
11
11
 
12
12
  config_file 'scud/config.yaml'
@@ -2,9 +2,8 @@ require 'scud/version'
2
2
  require 'scud/provider'
3
3
  require 'scud/provisioner/capistrano'
4
4
 
5
- # Add requires for other files you add to your project here, so
6
- # you just need to require this one file in your bin file
7
-
5
+ # external deps
6
+ #
8
7
  require 'pp'
9
8
  require 'fog'
10
9
  require 'table_print'
@@ -4,22 +4,30 @@ require 'capistrano/cli'
4
4
  module Scud
5
5
  module Provisioner
6
6
  module Capistrano
7
- extend self
8
7
 
9
- def bootstrap(opts={})
8
+ def self.bootstrap(opts={})
10
9
  config = ::Capistrano::Configuration.new
11
10
  config.logger.level = ::Capistrano::Logger::TRACE
12
- config.load "#{ENV['HOME']}/scud/bootstrap.rb"
11
+ bootstrapname = find_bootstrap(opts[:bootstrapname])
12
+ unless bootstrapname
13
+ puts "No provisioning tasks found - #{opts[:bootstrapname]}"
14
+ exit 1
15
+ end
16
+ config.load bootstrapname
13
17
 
14
18
  config.default_run_options[:pty] = true
15
19
 
16
- #TODO: find better way of parsing options to cap tasks
17
- #
18
20
  ENV['HOSTS'] = opts[:dns_name]
19
21
 
20
22
  puts "\nbootstrapping #{ENV['HOSTS']}....."
21
23
  config.bootstrap
22
24
  end
25
+
26
+ private
27
+
28
+ def self.find_bootstrap(name)
29
+ Gem.find_files('**/*.rb').select { |path| path =~ /#{name}\/bootstrap.rb/ }.first
30
+ end
23
31
  end
24
32
  end
25
33
  end
@@ -1,6 +1,6 @@
1
1
  desc 'bootstrap an instance'
2
2
  long_desc '''
3
- This will run all of the capistrano tasks declared in $HOME/scud/bootstrap.rb
3
+ This will run all of the capistrano tasks declared in $HOME/scud/*/bootstrap.rb
4
4
  '''
5
5
  command :bootstrap do |c|
6
6
 
@@ -8,6 +8,11 @@ command :bootstrap do |c|
8
8
  c.long_desc 'What is the name of the instance you wish to bootstrap - eg: ec2-54-253-9-16.ap-southeast-2.compute.amazonaws.com'
9
9
  c.flag :dns_name
10
10
 
11
+ c.desc 'name of the bootstrap task to run'
12
+ c.long_desc 'What bootstrap task to run - eg: puppetclient, standalone, lamp etc'
13
+ c.default_value 'basic'
14
+ c.flag :bootstrapname
15
+
11
16
  c.desc 'EC2 region'
12
17
  c.long_desc 'Which EC2 region ?'
13
18
  c.default_value 'ap-southeast-2'
@@ -26,6 +26,7 @@ command :create do |c|
26
26
 
27
27
  c.desc 'instance name'
28
28
  c.long_desc 'Friendly name to display in AWS console'
29
+ c.default_value (0...8).map{(65+rand(26)).chr}.join
29
30
  c.flag :name
30
31
 
31
32
  c.desc 'bootstrap host'
@@ -33,11 +34,16 @@ command :create do |c|
33
34
  c.default_value true
34
35
  c.switch :bootstrap
35
36
 
37
+ c.desc 'name of the bootstrap task to run'
38
+ c.long_desc 'What bootstrap task to run - eg: puppetclient, standalone, lamp etc'
39
+ c.default_value 'basic'
40
+ c.flag :bootstrapname
41
+
36
42
  c.action do |global_options, options, args|
37
43
  opts=global_options.merge(options)
38
44
  server = Scud::Provider::EC2.create(opts)
39
45
  if opts[:bootstrap]
40
- server.wait_for { print '.'; openport?(server.public_ip_address, 22) }
46
+ server.wait_for(60) { print '.'; openport?(server.public_ip_address, 22) }
41
47
  Scud::Provisioner::Capistrano.bootstrap(opts.merge(:dns_name => server.dns_name))
42
48
  puts "#{server.dns_name} has been bootstrapped."
43
49
  else
@@ -1,3 +1,3 @@
1
1
  module Scud
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -6,7 +6,7 @@ spec = Gem::Specification.new do |s|
6
6
  s.version = Scud::VERSION
7
7
  s.author = 'Mick Pollard'
8
8
  s.email = 'aussielunix@gmail.com'
9
- s.homepage = 'http://aussie.lunix.com.au'
9
+ s.homepage = 'http://aussielunix.github.io/scud/'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.summary = 'scud is for creating, terminating and bootstrapping VMs (cloud instances).'
12
12
  # Add your other files here if you make them
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-16 00:00:00.000000000 Z
12
+ date: 2013-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -148,7 +148,7 @@ files:
148
148
  - ext/tasks/puppet.rb
149
149
  - ext/bootstrap.rb
150
150
  - scud.rdoc
151
- homepage: http://aussie.lunix.com.au
151
+ homepage: http://aussielunix.github.io/scud/
152
152
  licenses: []
153
153
  post_install_message:
154
154
  rdoc_options:
@@ -167,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
167
  version: '0'
168
168
  segments:
169
169
  - 0
170
- hash: -3751677803402973259
170
+ hash: -3999055534572787464
171
171
  required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  none: false
173
173
  requirements:
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  version: '0'
177
177
  segments:
178
178
  - 0
179
- hash: -3751677803402973259
179
+ hash: -3999055534572787464
180
180
  requirements: []
181
181
  rubyforge_project:
182
182
  rubygems_version: 1.8.23