Chef_Solo_Nodes 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -60,8 +60,12 @@ Executable Usage: SSH
60
60
  Implementation
61
61
  --------------
62
62
 
63
- It grabs all your files using Dir.glob("./nodes/\*.json").
64
- Chef\_Solo\_IPS() also does some magic. It's easier to
63
+ It's easier to
65
64
  understand if you see the code.
66
65
  [It's just one page long.](https://github.com/da99/Chef_Solo_Nodes/blob/master/lib/Chef_Solo_Nodes.rb)
67
66
 
67
+ [bin/SSH](https://github.com/da99/Chef_Solo_Nodes/blob/master/bin/SSH)
68
+
69
+ [bin/IP](https://github.com/da99/Chef_Solo_Nodes/blob/master/bin/IP)
70
+
71
+
@@ -1,22 +1,29 @@
1
1
  require 'Chef_Solo_Nodes/version'
2
2
  require "json"
3
3
 
4
- def Chef_Solo_Nodes raw_role = '*'
4
+ #
5
+ # Arguments:
6
+ #
7
+ # role_or_paths = File paths Array OR Role name String.
8
+ #
9
+ #
10
+ def Chef_Solo_Nodes role_or_paths = '*'
5
11
 
6
- if raw_role.is_a?(Array)
12
+ if role_or_paths.is_a?(Array)
7
13
  role = '*'
8
- targets = raw_role
14
+ files = role_or_paths
9
15
  else
10
- role = raw_role.to_s
11
- targets = Dir.glob("nodes/*.json")
16
+ role = role_or_paths.to_s
17
+ files = Dir.glob("nodes/*.json")
12
18
  end
13
19
 
14
- targets.map { |str|
20
+ files.map { |str|
15
21
  h = JSON(File.read(str))
16
22
  next if role != '*' && !(h['roles'] || []).include?(role)
17
23
  h['ipaddress'] ||= File.basename(str).sub(".json", "")
18
24
  h
19
25
  }.compact
26
+
20
27
  end
21
28
 
22
29
  def Chef_Solo_IPs *args
@@ -1,3 +1,3 @@
1
1
  class Chef_Solo_Nodes
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Chef_Solo_Nodes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: