small_wonder 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/small_wonder CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'small_wonder'))
4
4
 
5
- SmallWonder.main
5
+ SmallWonder.long_main
data/bin/sw ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'small_wonder'))
4
+
5
+ SmallWonder.short_main
@@ -51,10 +51,22 @@ module SmallWonder
51
51
  :default => :info,
52
52
  :proc => Proc.new { |l| l.to_sym }
53
53
 
54
+ help = <<-EOH
55
+
56
+ Examples:
57
+ $ small_wonder -a deploy -p yourapp -q "attribute:something*" -V 123
58
+ $ small_wonder -p yourapp
59
+
60
+ Small Wonder's short hand CLI, fewer switches but you can still use them if you want
61
+ $ sw APPNAME ACTION [FQDN]
62
+ $ sw yourapp deploy
63
+ $ sw yourapp deploy testing01* -V 123 # same as 'small_wonder -a deploy -p yourapp -q "fqdn:testing01*" -V 123'
64
+ EOH
65
+
54
66
  option :help,
55
67
  :short => "-h",
56
68
  :long => "--help",
57
- :description => "All the help you need ...",
69
+ :description => help,
58
70
  :on => :tail,
59
71
  :boolean => true,
60
72
  :show_options => true,
data/lib/small_wonder.rb CHANGED
@@ -39,7 +39,21 @@ module SmallWonder
39
39
  @salticid
40
40
  end
41
41
 
42
- def main()
42
+ def long_main()
43
+
44
+ cli = SmallWonder::CLI.new
45
+ cli.parse_options
46
+
47
+ # consume small wonder config
48
+ SmallWonder::Utils.consume_config_file(cli, cli.config[:config_file])
49
+
50
+ # consume knife config
51
+ SmallWonder::Utils.consume_config_file(cli, cli.config[:knife_config_file])
52
+
53
+ main()
54
+ end
55
+
56
+ def short_main()
43
57
 
44
58
  cli = SmallWonder::CLI.new
45
59
  cli.parse_options
@@ -47,6 +61,22 @@ module SmallWonder
47
61
  # consume small wonder config
48
62
  SmallWonder::Utils.consume_config_file(cli, cli.config[:config_file])
49
63
 
64
+ # consume knife config
65
+ SmallWonder::Utils.consume_config_file(cli, cli.config[:knife_config_file])
66
+
67
+ # sw facade deploy [fqdn]
68
+ SmallWonder::Config.app = ARGV[0]
69
+ SmallWonder::Config.action = ARGV[1]
70
+
71
+ if ARGV[2]
72
+ SmallWonder::Config.query = "fqdn:#{ARGV[2]}"
73
+ end
74
+
75
+ main()
76
+ end
77
+
78
+ def main()
79
+
50
80
  unless SmallWonder::Utils.sane_working_dir?(SmallWonder::Config.remote_working_dir)
51
81
  SmallWonder::Log.error("Your remote working dir looks strange (#{SmallWonder::Config.remote_working_dir})")
52
82
  exit(1)
@@ -57,8 +87,6 @@ module SmallWonder
57
87
  exit(1)
58
88
  end
59
89
 
60
- SmallWonder::Utils.consume_config_file(cli, cli.config[:knife_config_file])
61
-
62
90
  # inintialize chef/knife config
63
91
  Chef::Config[:node_name] = SmallWonder::Config.node_name
64
92
  Chef::Config[:client_key] = SmallWonder::Config.client_key
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: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
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-17 00:00:00 Z
18
+ date: 2012-08-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: mixlib-config
@@ -175,12 +175,14 @@ description:
175
175
  email: j@boundary.com
176
176
  executables:
177
177
  - small_wonder
178
+ - sw
178
179
  extensions: []
179
180
 
180
181
  extra_rdoc_files:
181
182
  - README.md
182
183
  files:
183
184
  - bin/small_wonder
185
+ - bin/sw
184
186
  - lib/small_wonder/application.rb
185
187
  - lib/small_wonder/cli.rb
186
188
  - lib/small_wonder/config.rb