foremancli 0.4.1 → 0.4.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/foremancli CHANGED
@@ -97,13 +97,13 @@ OptionParser.new do |opts|
97
97
  end
98
98
  collections_filterable.each do |collection|
99
99
  options[collection] = false
100
- opts.on("--#{collection} [filter]", "Retreive a list of #{collection}") do |f|
100
+ opts.on("--#{collection} [filter]", "Retrieve a list of #{collection}") do |f|
101
101
  options[collection] = f || true
102
102
  end
103
103
  end
104
104
  collections.each do |collection|
105
105
  options[collection] = false
106
- opts.on("--#{collection}", "Retreive a list of #{collection}") do
106
+ opts.on("--#{collection}", "Retrieve a list of #{collection}") do
107
107
  options[collection] = true
108
108
  end
109
109
  end
@@ -122,7 +122,7 @@ OptionParser.new do |opts|
122
122
  puts " FOREMAN_USER Foreman user"
123
123
  puts " FOREMAN_PASSWORD Foreman password"
124
124
  puts ""
125
- puts " CLI options take precendence over ENVIRONMENT VARIABLES"
125
+ puts " CLI options take precedence over ENVIRONMENT VARIABLES"
126
126
  puts ""
127
127
  puts " FILTERS:"
128
128
  puts ""
@@ -182,13 +182,23 @@ def print_response response
182
182
  when "yaml"
183
183
  YAML.dump(response)
184
184
  else
185
- (response.first.is_a?(Hash) ? response.map{|o| o.inspect} : response).join("\n")
185
+ r = response.first
186
+ if r.is_a?(Hash)
187
+ # we simply return host list
188
+ if r.first[0] == "host"
189
+ response.map{|h| h["host"]["name"]}
190
+ else
191
+ response.map{|o| o.inspect}
192
+ end
193
+ else
194
+ response.join("\n")
195
+ end
186
196
  end)
187
197
  end
188
198
 
189
199
  options.each do |collection, filter|
190
200
  next unless filter
191
- if filter == true
201
+ if filter
192
202
  print_response(get_collection(collection))
193
203
  else
194
204
  print_response(search_collection(collection, filter))
Binary file
Binary file
Binary file
data/foremancli.gemspec CHANGED
@@ -6,7 +6,7 @@ require "foremancli/version"
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "foremancli"
8
8
  s.version = Foremancli::VERSION.dup
9
- s.date = "2012-01-11"
9
+ s.date = "2012-05-01"
10
10
  s.summary = "This is the CLI for Foreman, which is a provisioning tool and node classifier for sysadmins."
11
11
  s.email = "brian.gupta@brandorr.com"
12
12
  s.homepage = "https://github.com/ohadlevy/foreman/blob/master/extras/cli/foremancli"
@@ -1,3 +1,3 @@
1
1
  module Foremancli
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2.1'
3
3
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foremancli
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 101
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
+ - 2
9
10
  - 1
10
- version: 0.4.1
11
+ version: 0.4.2.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Brian Gupta
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2012-01-11 00:00:00 -05:00
19
+ date: 2012-05-01 00:00:00 -04:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -61,6 +62,8 @@ extra_rdoc_files: []
61
62
  files:
62
63
  - bin/foremancli
63
64
  - foremancli-0.4.1.gem
65
+ - foremancli-0.4.2.gem
66
+ - foremancli-0.5.0.gem
64
67
  - foremancli.gemspec
65
68
  - lib/foremancli/version.rb
66
69
  has_rdoc: true