small_wonder 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -59,6 +59,10 @@ You can also specify a version number to pass to the application object:
59
59
 
60
60
  $ small_wonder -p example -V 123
61
61
 
62
+ Lastly you can create user defined tasks that get run ("deploy" is the default):
63
+
64
+ $ small_wonder -p example -a sometask
65
+
62
66
  #### Chef Data
63
67
 
64
68
  During the deployment Small Wonder will save data back to the Chef node. Moreover, status is updated to the task currently being run, so you can see live deployment progress in your searches.
data/lib/small_wonder.rb CHANGED
@@ -70,15 +70,11 @@ module SmallWonder
70
70
  SmallWonder::Config.application_deployments_dir, '**', '*.rb')))
71
71
 
72
72
  case SmallWonder::Config.action
73
- when "none"
74
- SmallWonder::Log.info("No action specified, assuming deploy ...")
75
- SmallWonder::Deploy.run
76
- when "deploy"
77
- SmallWonder::Deploy.run
78
73
  when "vicki"
79
74
  system("open http://www.youtube.com/watch?v=ukSvjqwJixw")
80
75
  else
81
- SmallWonder::Log.error("Supported action \"#{SmallWonder::Config.action}\"!")
76
+ SmallWonder::Log.info("Using specified action: #{SmallWonder::Config.action}")
77
+ SmallWonder::Deploy.run
82
78
  end
83
79
 
84
80
  end
@@ -17,8 +17,8 @@ module SmallWonder
17
17
  option :action,
18
18
  :short => "-a ACTION",
19
19
  :long => "--action ACTION",
20
- :description => "The action you want small wonder to take [deploy]",
21
- :default => "none"
20
+ :description => "The action you want small wonder to take [deploy|anythingyouwant]",
21
+ :default => "deploy"
22
22
 
23
23
  option :app,
24
24
  :short => "-p APP",
@@ -3,7 +3,7 @@ module SmallWonder
3
3
  def self.run()
4
4
  if SmallWonder::Config.app
5
5
  nodes = SmallWonder::Deploy.node_query()
6
- SmallWonder::Deploy.deploy(SmallWonder::Config.app, nodes)
6
+ SmallWonder::Deploy.run_action_task(SmallWonder::Config.action, SmallWonder::Config.app, nodes)
7
7
  else
8
8
  SmallWonder::Log.error("No application was specified for your deploy, use the '-p' switch.")
9
9
  end
@@ -27,7 +27,7 @@ module SmallWonder
27
27
  nodes
28
28
  end
29
29
 
30
- def self.deploy(application_name, nodes)
30
+ def self.run_action_task(action, application_name, nodes)
31
31
  if nodes.length > 0
32
32
  SmallWonder::Log.info("Found the following nodes via your search.")
33
33
 
@@ -55,7 +55,7 @@ module SmallWonder
55
55
  application = SmallWonder::Application.new(node, application_name)
56
56
  end
57
57
 
58
- deploy_application(application, sudo_password)
58
+ deploy_application(action, application, sudo_password)
59
59
  end
60
60
  end
61
61
  else
@@ -63,8 +63,8 @@ module SmallWonder
63
63
  end
64
64
  end
65
65
 
66
- def self.deploy_application(application, sudo_password)
67
- run_salticid_task(application, sudo_password)
66
+ def self.deploy_application(action, application, sudo_password)
67
+ run_salticid_task(action, application, sudo_password)
68
68
 
69
69
  if SmallWonder::Config.write_node_file
70
70
  SmallWonder::Utils.write_node_data_file(application.node_name)
@@ -73,7 +73,7 @@ module SmallWonder
73
73
 
74
74
  ## deploy step
75
75
  # Creates a new salticid host for node, and calls <app>.deploy on it.
76
- def self.run_salticid_task(application, sudo_password)
76
+ def self.run_salticid_task(action, application, sudo_password)
77
77
  SmallWonder::Log.info("Running #{application.application_name} deployment for #{application.node_name} ...")
78
78
 
79
79
  host = SmallWonder.salticid.host application.node_name
@@ -94,7 +94,7 @@ module SmallWonder
94
94
 
95
95
  # sub hyphens for underscores to work around having hyphens in method names
96
96
  host.role application.application_name.gsub("-", "_")
97
- host.send(application.application_name.gsub("-", "_")).deploy
97
+ host.send(application.application_name.gsub("-", "_")).__send__(action)
98
98
 
99
99
  # set the application status to final since the deploy is done
100
100
  application.status = "final"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: small_wonder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joe Williams
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-01 00:00:00 Z
18
+ date: 2012-08-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: mixlib-config