chef-fork 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fde528113e145397075b09d8fb0acf5c4761fcb9
4
- data.tar.gz: 4276edcd1989f0f75cf1be4beee09dc101b47ed7
3
+ metadata.gz: ff9a6a1e5886c238b2375110fc72f34624bded15
4
+ data.tar.gz: 34d6aaf1a3c65f92da6ec7190688d1abe7209c7f
5
5
  SHA512:
6
- metadata.gz: b6bda285ea2d5ec7b4df7af95ce3f422994f0450b110d5d8ff6ed7ac9f32381260f19a626fdd2e60b8470393430a50e76d5e6103a6d81f0af25ec32144e9c57f
7
- data.tar.gz: 990b36264081d96946ecba6bfd981a68d63080deae6d149320b9d115e639367d47637f46d4b617b2c5cb0d945ad1e1cff10df91cdc851fbdbb90a1fb1a23b403
6
+ metadata.gz: e42f96c88b4d3d13fda2e55d96f79791b18116cdfd2cd70bc35095e0f126a794c9abf53d4ffdc242899465d9adbb09fd75fbe9ee2b45931e954310b627a3ca08
7
+ data.tar.gz: 12dc3fee80a97cbf77e6c09c5d084976cc0119e4fe7fc7e1ad511f5c24ff563193a3b55b189099ef6ea5b9c32b544b2e540c6713671b223de54d9ef25d02f600
data/bin/fork CHANGED
@@ -1,9 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  $LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
3
-
4
- # bundler/setup doesn't work expectedly when installed via gem
5
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
6
- require "bundler/setup"
7
-
8
3
  require "chef/fork"
9
4
  Chef::Fork.new.main(ARGV.dup)
@@ -13,10 +13,11 @@ class Chef
13
13
  module Commands
14
14
  class Bootstrap < Ssh
15
15
  def run(args=[])
16
- rest = optparse.order(args)
17
- hostname = rest.shift
18
- command = bootstrap_command()
19
- ssh(hostname, [command])
16
+ rest = optparse.parse(args)
17
+ if hostname = rest.shift
18
+ command = bootstrap_command()
19
+ ssh(hostname, [command])
20
+ end
20
21
  end
21
22
 
22
23
  private
@@ -8,13 +8,14 @@ class Chef
8
8
  module Commands
9
9
  class Cookbook < Noop
10
10
  def run(args=[])
11
- case args.first
11
+ rest = optparse.order(args)
12
+ case rest.first
12
13
  when "show"
13
- cookbook_show(args.slice(1..-1))
14
+ cookbook_show(rest.slice(1..-1) || [])
14
15
  when "upload"
15
- cookbook_upload(args.slice(1..-1))
16
+ cookbook_upload(rest.slice(1..-1) || [])
16
17
  else
17
- raise(NameError.new(args.inspect))
18
+ raise(NameError.new(rest.inspect))
18
19
  end
19
20
  end
20
21
 
@@ -8,11 +8,12 @@ class Chef
8
8
  module Commands
9
9
  class Data < Noop
10
10
  def run(args=[])
11
- case args.first
11
+ rest = optparse.order(args)
12
+ case rest.first
12
13
  when "bag"
13
- data_bag(args.slice(1..-1))
14
+ data_bag(rest.slice(1..-1) || [])
14
15
  else
15
- raise(NameError.new(args.inspect))
16
+ raise(NameError.new(rest.inspect))
16
17
  end
17
18
  end
18
19
 
@@ -20,9 +21,9 @@ class Chef
20
21
  def data_bag(args=[])
21
22
  case args.first
22
23
  when "from"
23
- data_bag_from(args.slice(1..-1))
24
+ data_bag_from(args.slice(1..-1) || [])
24
25
  when "show"
25
- data_bag_show(args.slice(1..-1))
26
+ data_bag_show(args.slice(1..-1) || [])
26
27
  else
27
28
  raise(NameError.new(args.inspect))
28
29
  end
@@ -31,7 +32,7 @@ class Chef
31
32
  def data_bag_from(args=[])
32
33
  case args.first
33
34
  when "file"
34
- data_bag_from_file(args.slice(1..-1))
35
+ data_bag_from_file(args.slice(1..-1) || [])
35
36
  else
36
37
  raise(NameError.new(args.inspect))
37
38
  end
@@ -8,36 +8,8 @@ class Chef
8
8
  module Commands
9
9
  class Databag < Data
10
10
  def run(args=[])
11
- data_bag(args)
12
- end
13
-
14
- private
15
- def data_bag(args=[])
16
- case args.first
17
- when "from"
18
- data_bag_from(args.slice(1..-1))
19
- when "show"
20
- data_bag_show(args.slice(1..-1))
21
- else
22
- raise(NameError.new(args.inspect))
23
- end
24
- end
25
-
26
- def data_bag_from(args=[])
27
- case args.first
28
- when "file"
29
- data_bag_from_file(args.slice(1..-1))
30
- else
31
- raise(NameError.new(args.inspect))
32
- end
33
- end
34
-
35
- def data_bag_from_file(args=[])
36
- raise(NotImplementedError.new(args.inspect))
37
- end
38
-
39
- def data_bag_show(args=[])
40
- raise(NotImplementedError.new(args.inspect))
11
+ rest = optparse.order(args)
12
+ data_bag(rest)
41
13
  end
42
14
  end
43
15
  end
@@ -8,13 +8,14 @@ class Chef
8
8
  module Commands
9
9
  class Environment < Noop
10
10
  def run(args=[])
11
- case args.first
11
+ rest = optparse.order(args)
12
+ case rest.first
12
13
  when "from"
13
- environment_from(args.slice(1..-1))
14
+ environment_from(rest.slice(1..-1) || [])
14
15
  when "show"
15
- environment_show(args.slice(1..-1))
16
+ environment_show(rest.slice(1..-1) || [])
16
17
  else
17
- raise(NameError.new(args.inspect))
18
+ raise(NameError.new(rest.inspect))
18
19
  end
19
20
  end
20
21
 
@@ -22,7 +23,7 @@ class Chef
22
23
  def environment_from(args=[])
23
24
  case args.first
24
25
  when "file"
25
- environment_from_file(args.slice(1..-1))
26
+ environment_from_file(args.slice(1..-1) || [])
26
27
  else
27
28
  raise(NameError.new(args.inspect))
28
29
  end
@@ -8,13 +8,14 @@ class Chef
8
8
  module Commands
9
9
  class Role < Noop
10
10
  def run(args=[])
11
- case args.first
11
+ rest = optparse.order(args)
12
+ case rest.first
12
13
  when "from"
13
- role_from(args.slice(1..-1))
14
+ role_from(rest.slice(1..-1) || [])
14
15
  when "show"
15
- role_show(args.slice(1..-1))
16
+ role_show(rest.slice(1..-1) || [])
16
17
  else
17
- raise(NameError.new(args.inspect))
18
+ raise(NameError.new(rest.inspect))
18
19
  end
19
20
  end
20
21
 
@@ -10,8 +10,9 @@ class Chef
10
10
  class Ssh < Noop
11
11
  def run(args=[])
12
12
  rest = optparse.order(args)
13
- hostname = rest.shift
14
- ssh(hostname, rest)
13
+ if hostname = rest.shift
14
+ ssh(hostname, rest)
15
+ end
15
16
  end
16
17
 
17
18
  private
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  class Fork
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamashita Yuu