collins_shell 0.2.20 → 0.2.21

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: 41a56f3b9b0909179d86cbab556c5e2f117ef0f7
4
- data.tar.gz: 67342b86952dbfd4751800fe6549a031bc4236fa
3
+ metadata.gz: 97c0825c7e2fcb8c6f3b59f0a410b30a36e9825f
4
+ data.tar.gz: 5cefc07d909c2f927da30eef95facf704b3fab36
5
5
  SHA512:
6
- metadata.gz: 938ced203b6811f3c946647cfcbb1b41e0b8878334e2e9574860d41abf8f9aa475346d9e23344745d5e9225ad1aba1a0625539ffa3df14c74b75fcbb7cd77742
7
- data.tar.gz: 184e73ef37b984a5e406ec5ae15dd1fbbb1424341c7f8e827821788b8b789bda452ea41d8fc3f044461c1137ad95b0bc38fa20473dfb080ed580873bbe6af61a
6
+ metadata.gz: 9ec18cfc5f8b7f3339e4647aec644fe60969491bce03e94ea9a603938a5fcf6fd5587f0a64f4db8da68cd1049336a6f624057821fd90658f08439e188ce63fb2
7
+ data.tar.gz: f6fc8edd8b8643b2766a59341f4ba73e0d65981399f6560a5e13e0b7dfd0367a4c03fbc07e38672070f29f89e984e0049184fd2e43579a3de83f06fa788dfd47
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ require 'jeweler'
14
14
 
15
15
  jeweler = Jeweler::Tasks.new do |gem|
16
16
  gem.name = 'collins_shell'
17
- gem.homepage = 'https://github.com/tumblr/collins/tree/master/support/collins-shell'
17
+ gem.homepage = 'https://github.com/tumblr/collins/tree/master/support/ruby/collins-shell'
18
18
  gem.license = 'APL 2.0'
19
19
  gem.summary = %Q{Shell for Collins API}
20
20
  gem.description = "Provides basic CLI for interacting with Collins API"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.20
1
+ 0.2.21
@@ -8,10 +8,10 @@ Gem::Specification.new do |s|
8
8
  s.version = File.read 'VERSION'
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Blake Matheny"]
12
- s.date = "2013-04-15"
11
+ s.authors = ["Blake Matheny", "Gabe Conradi"]
12
+ s.date = "2014-08-09"
13
13
  s.description = "Provides basic CLI for interacting with Collins API"
14
- s.email = "bmatheny@tumblr.com"
14
+ s.email = ["bmatheny@tumblr.com","gabe@tumblr.com"]
15
15
  s.executables = ["collins-shell"]
16
16
  s.extra_rdoc_files = [
17
17
  "README.md"
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  "collins_shell.gemspec",
28
28
  "lib/collins_shell.rb",
29
29
  "lib/collins_shell/asset.rb",
30
+ "lib/collins_shell/asset_type.rb",
30
31
  "lib/collins_shell/cli.rb",
31
32
  "lib/collins_shell/console.rb",
32
33
  "lib/collins_shell/console/asset.rb",
@@ -55,7 +56,7 @@ Gem::Specification.new do |s|
55
56
  "lib/collins_shell/util/log_printer.rb",
56
57
  "lib/collins_shell/util/printer_util.rb"
57
58
  ]
58
- s.homepage = "https://github.com/tumblr/collins/tree/master/support/collins-shell"
59
+ s.homepage = "https://github.com/tumblr/collins/tree/master/support/ruby/collins-shell"
59
60
  s.licenses = ["APL 2.0"]
60
61
  s.require_paths = ["lib"]
61
62
  s.rubygems_version = "1.8.23"
@@ -65,7 +66,7 @@ Gem::Specification.new do |s|
65
66
  s.specification_version = 3
66
67
 
67
68
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
68
- s.add_runtime_dependency(%q<collins_client>, ["~> 0.2.9"])
69
+ s.add_runtime_dependency(%q<collins_client>, ["~> 0.2.11"])
69
70
  s.add_runtime_dependency(%q<highline>, ["~> 1.6.15"])
70
71
  s.add_runtime_dependency(%q<mustache>, ["~> 0.99.4"])
71
72
  s.add_runtime_dependency(%q<pry>, ["~> 0.9.9.6"])
@@ -73,7 +74,7 @@ Gem::Specification.new do |s|
73
74
  s.add_runtime_dependency(%q<terminal-table>, ["~> 1.4.5"])
74
75
  s.add_runtime_dependency(%q<thor>, ["~> 0.16.0"])
75
76
  else
76
- s.add_dependency(%q<collins_client>, ["~> 0.2.9"])
77
+ s.add_dependency(%q<collins_client>, ["~> 0.2.11"])
77
78
  s.add_dependency(%q<highline>, ["~> 1.6.15"])
78
79
  s.add_dependency(%q<mustache>, ["~> 0.99.4"])
79
80
  s.add_dependency(%q<pry>, ["~> 0.9.9.6"])
@@ -82,7 +83,7 @@ Gem::Specification.new do |s|
82
83
  s.add_dependency(%q<thor>, ["~> 0.16.0"])
83
84
  end
84
85
  else
85
- s.add_dependency(%q<collins_client>, ["~> 0.2.9"])
86
+ s.add_dependency(%q<collins_client>, ["~> 0.2.11"])
86
87
  s.add_dependency(%q<highline>, ["~> 1.6.15"])
87
88
  s.add_dependency(%q<mustache>, ["~> 0.99.4"])
88
89
  s.add_dependency(%q<pry>, ["~> 0.9.9.6"])
@@ -0,0 +1,87 @@
1
+ require 'collins_shell/thor'
2
+ require 'collins_shell/util'
3
+ require 'thor'
4
+ require 'thor/group'
5
+
6
+ module CollinsShell
7
+
8
+ class AssetType < Thor
9
+ include ThorHelper
10
+ include CollinsShell::Util
11
+ namespace :asset_type
12
+
13
+ def self.banner task, namespace = true, subcommand = false
14
+ "#{basename} #{task.formatted_usage(self, true, subcommand).gsub(':',' ')}"
15
+ end
16
+
17
+ desc 'create', 'Create a new asset type'
18
+ use_collins_options
19
+ method_option :name, :type => :string, :required => true, :desc => 'Name of asset type. Must be all caps and unique. Can contain numbers, letters and underscores.'
20
+ method_option :label, :type => :string, :required => true, :desc => 'A friendly (short) description of the asset type to use in visual labels. Usually just a camel case version of the name, possibly with spaces.'
21
+ def create
22
+ name = options.name.upcase
23
+ label = options.label
24
+ call_collins get_collins_client, "asset_type_create!" do |client|
25
+ if client.asset_type_create!(name, label) then
26
+ say_success "Successfully created asset type '#{name}'"
27
+ else
28
+ say_error "Failed creating asset type '#{name}'"
29
+ end
30
+ end
31
+ end
32
+
33
+ desc 'delete ATYPE', 'Delete an asset type'
34
+ use_collins_options
35
+ def delete atype
36
+ call_collins get_collins_client, "asset_type_delete!" do |client|
37
+ if client.asset_type_delete!(atype) then
38
+ say_success "Successfully deleted asset type '#{atype}'"
39
+ else
40
+ say_error "Failed deleting asset type '#{atype}'"
41
+ end
42
+ end
43
+ end
44
+
45
+ desc 'get ATYPE', 'Get an asset type by name'
46
+ use_collins_options
47
+ def get atype
48
+ call_collins get_collins_client, "asset_type_get" do |client|
49
+ header = [["Name", "Label"]]
50
+ atype = client.asset_type_get(atype)
51
+ table = header + [[atype.name, atype.label]]
52
+ print_table table
53
+ end
54
+ end
55
+
56
+ desc 'list', 'list asset types that are configured'
57
+ use_collins_options
58
+ def list
59
+ call_collins get_collins_client, "asset_type_get_all" do |client|
60
+ header = [["Name", "Label"]]
61
+ atypes = header + client.asset_type_get_all.map do |atype|
62
+ [atype.name, atype.label]
63
+ end
64
+ print_table atypes
65
+ end
66
+ end
67
+
68
+ desc 'update ATYPE', 'Update the name and/or label of an asset type'
69
+ use_collins_options
70
+ method_option :name, :type => :string, :required => false, :desc => 'New name of asset type. Must be all caps and unique. Can contains numbers, letters, and underscores.'
71
+ method_option :label, :type => :string, :required => false, :desc => 'A friendly (short) description of the asset type to use in visual labels. Usually just a camel case version of the name, possibly with spaces.'
72
+ def update atype
73
+ name = options.name.upcase if options.name?
74
+ label = options.label if options.label?
75
+ call_collins get_collins_client, "asset_type_update!" do |client|
76
+ opts = { :name => name, :label => label }
77
+ if client.asset_type_update!(atype, opts) then
78
+ say_success "Successfully updated asset type '#{atype}'"
79
+ else
80
+ say_error "Failed creating asset type '#{atype}'"
81
+ end
82
+ end
83
+ end
84
+
85
+ end
86
+
87
+ end
@@ -1,4 +1,5 @@
1
1
  require 'collins_shell/asset'
2
+ require 'collins_shell/asset_type'
2
3
  require 'collins_shell/console'
3
4
  require 'collins_shell/ip_address'
4
5
  require 'collins_shell/ipmi'
@@ -23,6 +24,7 @@ module CollinsShell
23
24
  include CollinsShell::Util
24
25
 
25
26
  register(CollinsShell::Asset, 'asset', 'asset <command>', 'Asset related commands')
27
+ register(CollinsShell::AssetType, 'asset_type', 'asset_type <command>', 'Asset Type related commands')
26
28
  register(CollinsShell::Tag, 'tag', 'tag <command>', 'Tag related commands')
27
29
  register(CollinsShell::IpAddress, 'ip_address', 'ip_address <command>', 'IP address related commands')
28
30
  register(CollinsShell::Ipmi, 'ipmi', 'ipmi <command>', 'IPMI related commands')
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collins_shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.20
4
+ version: 0.2.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Matheny
8
+ - Gabe Conradi
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2013-04-15 00:00:00 Z
13
+ date: 2014-08-09 00:00:00 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: collins_client
@@ -18,7 +19,7 @@ dependencies:
18
19
  requirements:
19
20
  - - ~>
20
21
  - !ruby/object:Gem::Version
21
- version: 0.2.9
22
+ version: 0.2.11
22
23
  type: :runtime
23
24
  version_requirements: *id001
24
25
  - !ruby/object:Gem::Dependency
@@ -82,7 +83,9 @@ dependencies:
82
83
  type: :runtime
83
84
  version_requirements: *id007
84
85
  description: Provides basic CLI for interacting with Collins API
85
- email: bmatheny@tumblr.com
86
+ email:
87
+ - bmatheny@tumblr.com
88
+ - gabe@tumblr.com
86
89
  executables:
87
90
  - collins-shell
88
91
  extensions: []
@@ -100,6 +103,7 @@ files:
100
103
  - collins_shell.gemspec
101
104
  - lib/collins_shell.rb
102
105
  - lib/collins_shell/asset.rb
106
+ - lib/collins_shell/asset_type.rb
103
107
  - lib/collins_shell/cli.rb
104
108
  - lib/collins_shell/console.rb
105
109
  - lib/collins_shell/console/asset.rb
@@ -127,7 +131,7 @@ files:
127
131
  - lib/collins_shell/util/asset_stache.rb
128
132
  - lib/collins_shell/util/log_printer.rb
129
133
  - lib/collins_shell/util/printer_util.rb
130
- homepage: https://github.com/tumblr/collins/tree/master/support/collins-shell
134
+ homepage: https://github.com/tumblr/collins/tree/master/support/ruby/collins-shell
131
135
  licenses:
132
136
  - APL 2.0
133
137
  metadata: {}
@@ -149,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
153
  requirements: []
150
154
 
151
155
  rubyforge_project:
152
- rubygems_version: 2.3.0
156
+ rubygems_version: 2.4.1
153
157
  signing_key:
154
158
  specification_version: 3
155
159
  summary: Shell for Collins API