occi-cli 4.2.5 → 4.3.0.beta.2

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: 680ab69d1c40a75b5a9df25119035c83c2cab917
4
- data.tar.gz: 88cba70109d019f3c07bec4e781b05a429e4d928
3
+ metadata.gz: 6619c059a9c212ac56867b6a511709f491203d83
4
+ data.tar.gz: 3314928f191fb6d332fd19db78b1ab62b70d2bb2
5
5
  SHA512:
6
- metadata.gz: e0dec2c46c8d8c5d0afc355578aeaadaac3075399beca6cb5f9725d37696b48aa32324e8df7df51de46423b0efe1a3a37d319b9cb0a5fb92e44cddbe46036cb1
7
- data.tar.gz: f5af0130cb7a243e4934fbe4c36220877607ac0ecc34597e45aa4fd5e76461d332278c667afed16e2b43b24c73aed621a26b65dde6ed5de0ac4719e97f466990
6
+ metadata.gz: 2cf34b18bae42981a5951f7753393b50ea031434d1e0b35caa2fa2b88b7351899f7e236a39623c166150bb7693b6b916679aaf538b563420bcc34b8d8b4a637e
7
+ data.tar.gz: b939222b11c1d02ca20052d9be6a1d75e4eabb3f4c7cc3e9e117719d49c191e65ba1f93e822a08e10ea4d1ea9a22e9054c4ce92f542549a14900d813459743d6
data/.travis.yml CHANGED
@@ -3,7 +3,7 @@ language: ruby
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- - 2.1.1
6
+ - 2.1
7
7
  - ruby-head
8
8
  - jruby-19mode
9
9
  - jruby-head
@@ -26,9 +26,9 @@ matrix:
26
26
  jdk: openjdk7
27
27
  - rvm: 2.0.0
28
28
  jdk: oraclejdk7
29
- - rvm: 2.1.1
29
+ - rvm: 2.1
30
30
  jdk: openjdk7
31
- - rvm: 2.1.1
31
+ - rvm: 2.1
32
32
  jdk: oraclejdk7
33
33
  - rvm: ruby-head
34
34
  jdk: openjdk7
@@ -42,3 +42,4 @@ branches:
42
42
  - 4.0.x
43
43
  - 4.1.x
44
44
  - 4.2.x
45
+ - 4.3.x
data/README.md CHANGED
@@ -1,18 +1,17 @@
1
1
  rOCCI-cli - A Ruby OCCI Framework
2
2
  =================================
3
3
 
4
- [![Build Status](https://secure.travis-ci.org/gwdg/rOCCI-cli.png)](http://travis-ci.org/gwdg/rOCCI-cli)
5
- [![Dependency Status](https://gemnasium.com/gwdg/rOCCI-cli.png)](https://gemnasium.com/gwdg/rOCCI-cli)
4
+ [![Build Status](https://secure.travis-ci.org/EGI-FCTF/rOCCI-cli.png)](http://travis-ci.org/EGI-FCTF/rOCCI-cli)
5
+ [![Dependency Status](https://gemnasium.com/EGI-FCTF/rOCCI-cli.png)](https://gemnasium.com/EGI-FCTF/rOCCI-cli)
6
6
  [![Gem Version](https://fury-badge.herokuapp.com/rb/occi-cli.png)](https://badge.fury.io/rb/occi-cli)
7
- [![Code Climate](https://codeclimate.com/github/gwdg/rOCCI-cli.png)](https://codeclimate.com/github/gwdg/rOCCI-cli)
7
+ [![Code Climate](https://codeclimate.com/github/EGI-FCTF/rOCCI-cli.png)](https://codeclimate.com/github/EGI-FCTF/rOCCI-cli)
8
8
 
9
9
  Requirements
10
10
  ------------
11
11
 
12
12
  ### Ruby
13
- * Ruby 1.9.3 is required
13
+ * Ruby 1.9.3 or newer is required
14
14
  * RubyGems have to be installed
15
- * Rake has to be installed (e.g., `gem install rake`)
16
15
 
17
16
  ### Examples
18
17
  #### For distros based on Debian:
@@ -46,12 +45,10 @@ Installation
46
45
 
47
46
  To install the most recent stable version
48
47
 
49
- gem install rake
50
48
  gem install occi-cli
51
49
 
52
50
  To install the most recent beta version
53
51
 
54
- gem install rake
55
52
  gem install occi-cli --pre
56
53
 
57
54
  ### From source (dev)
@@ -62,7 +59,7 @@ To install the most recent beta version
62
59
 
63
60
  To build and install the bleeding edge version from master
64
61
 
65
- git clone git://github.com/gwdg/rOCCI-cli.git
62
+ git clone git://github.com/EGI-FCTF/rOCCI-cli.git
66
63
  cd rOCCI-cli
67
64
  gem install bundler
68
65
  bundle install
@@ -75,7 +72,7 @@ To build and install the bleeding edge version from master
75
72
 
76
73
  To build a Java jar file from master use
77
74
 
78
- git clone git://github.com/gwdg/rOCCI-cli.git
75
+ git clone git://github.com/EGI-FCTF/rOCCI-cli.git
79
76
  cd rOCCI-cli
80
77
  gem install bundler
81
78
  bundle install
@@ -151,6 +148,11 @@ To delete a compute resource use
151
148
  Changelog
152
149
  ---------
153
150
 
151
+ ### Version 4.3
152
+ * Updated dependencies
153
+ * Powered by rOCCI-core 4.3.x
154
+ * New `discover` functionality
155
+
154
156
  ### Version 4.2
155
157
  * Droppped the interactive mode (it might return in the future)
156
158
  * Updated internals
@@ -225,7 +227,7 @@ Development
225
227
 
226
228
  Checkout latest version from GIT:
227
229
 
228
- git clone git://github.com/gwdg/rOCCI-cli.git
230
+ git clone git://github.com/EGI-FCTF/rOCCI-cli.git
229
231
 
230
232
  Change to rOCCI-cli folder
231
233
 
@@ -237,11 +239,11 @@ Install dependencies for deployment
237
239
 
238
240
  ### Code Documentation
239
241
 
240
- [Code Documentation for rOCCI-cli by YARD](http://rubydoc.info/github/gwdg/rOCCI-cli/)
242
+ [Code Documentation for rOCCI-cli by YARD](http://rubydoc.info/github/EGI-FCTF/rOCCI-cli/)
241
243
 
242
244
  ### Continuous integration
243
245
 
244
- [Continuous integration for rOCCI-cli by Travis-CI](http://travis-ci.org/gwdg/rOCCI-cli/)
246
+ [Continuous integration for rOCCI-cli by Travis-CI](http://travis-ci.org/EGI-FCTF/rOCCI-cli/)
245
247
 
246
248
  ### Contribute
247
249
 
data/bin/occi CHANGED
@@ -55,7 +55,7 @@ begin
55
55
  connect :http, options
56
56
  rescue OpenSSL::SSL::SSLError => ssl_ex
57
57
  # generic SSL error raised whilst establishing a connection
58
- # possibly an untrusted server cert or invalid user credentials
58
+ # possibly an untrusted server cert or invalid user credentials
59
59
  Occi::Cli::Log.fatal "An SSL error occurred! Please, make sure your credentials " \
60
60
  "are valid and recognized by the endpoint! Message: #{ssl_ex.message}"
61
61
 
@@ -146,6 +146,8 @@ begin
146
146
  helper_delete options, output
147
147
  when :trigger
148
148
  helper_trigger options, output
149
+ when :discover
150
+ helper_discover options, output
149
151
  when :refresh
150
152
  refresh
151
153
  when :skip, :test, :dry_run
@@ -0,0 +1,29 @@
1
+ module Occi::Cli::Helpers::DiscoverHelper
2
+
3
+ def helper_discover(options, output = nil)
4
+ found = Occi::Core::Kinds.new
5
+
6
+ case options.entity_type
7
+ when :resource
8
+ # get everything related to Occi::Core::Resource
9
+ resource_type_identifiers.each { |resource_ti| found << model.get_by_id(resource_ti) }
10
+ when :link
11
+ # get everything related to Occi::Core::Link
12
+ link_type_identifiers.each { |link_ti| found << model.get_by_id(link_ti) }
13
+ else
14
+ Occi::Cli::Log.warn "Attempting to discover an " \
15
+ "unknown entity type #{options.entity_type.to_s.inspect}"
16
+ raise "Unknown entity type #{options.entity_type.to_s.inspect}, " \
17
+ "terminating discovery!"
18
+ end
19
+
20
+ helper_discover_output(found, options, output)
21
+ end
22
+
23
+ def helper_discover_output(found, options, output)
24
+ return found unless output
25
+
26
+ puts output.format(found)
27
+ end
28
+
29
+ end
@@ -10,4 +10,5 @@ extend Occi::Cli::Helpers::DescribeHelper
10
10
  extend Occi::Cli::Helpers::CreateHelper
11
11
  extend Occi::Cli::Helpers::DeleteHelper
12
12
  extend Occi::Cli::Helpers::TriggerHelper
13
- extend Occi::Cli::Helpers::LinkHelper
13
+ extend Occi::Cli::Helpers::LinkHelper
14
+ extend Occi::Cli::Helpers::DiscoverHelper
@@ -11,9 +11,10 @@ module Occi::Cli
11
11
 
12
12
  AUTH_METHODS = [:x509, :basic, :digest, :none].freeze
13
13
  MEDIA_TYPES = ["application/occi+json", "text/plain,text/occi", "text/plain", "text/occi"].freeze
14
- ACTIONS = [:list, :describe, :create, :delete, :trigger, :link, :unlink].freeze
14
+ ACTIONS = [:list, :describe, :create, :delete, :trigger, :link, :unlink, :discover].freeze
15
15
  LOG_OUTPUTS = [:stdout, :stderr].freeze
16
16
  LOG_LEVELS = [:debug, :error, :fatal, :info, :unknown, :warn].freeze
17
+ ENTITY_TYPES = [:resource, :link].freeze
17
18
 
18
19
  REQ_CREATE_ATTRS = ["occi.core.title"].freeze
19
20
 
@@ -199,6 +200,13 @@ module Occi::Cli
199
200
  options.trigger_action = Occi::Cli::OcciOpts::Helper.parse_action(trigger_action)
200
201
  end
201
202
 
203
+ opts.on("-i",
204
+ "--entity-type TYPE",
205
+ ENTITY_TYPES,
206
+ "Entity types to perform discovery on, only: [#{ENTITY_TYPES.join('|')}]") do |entity_type|
207
+ options.entity_type = entity_type
208
+ end
209
+
202
210
  opts.on("-l",
203
211
  "--log-to OUTPUT",
204
212
  LOG_OUTPUTS,
@@ -387,7 +395,11 @@ module Occi::Cli
387
395
  mandatory << :links
388
396
  end
389
397
 
390
- mandatory.concat [:resource, :action]
398
+ if options.action == :discover
399
+ mandatory.concat [:entity_type]
400
+ else
401
+ mandatory.concat [:resource, :action]
402
+ end
391
403
 
392
404
  mandatory
393
405
  end
@@ -23,6 +23,8 @@ module Occi::Cli
23
23
  method = "links_to_#{@output_format}".to_sym
24
24
  elsif data.kind_of? Occi::Core::Mixins
25
25
  method = "mixins_to_#{@output_format}".to_sym
26
+ elsif data.kind_of? Occi::Core::Kinds
27
+ method = "kinds_to_#{@output_format}".to_sym
26
28
  elsif data.kind_of? Array
27
29
  raise Occi::Cli::Errors::FormatterInputTypeError,
28
30
  "Arrays with #{data.first.class.name.inspect} are not supported!" unless data.first.nil? || data.first.kind_of?(String)
@@ -140,6 +142,43 @@ module Occi::Cli
140
142
  url_locations.join("\n")
141
143
  end
142
144
 
145
+ def kinds_to_plain(occi_kinds)
146
+ # using ERB templates for known kinds
147
+ file = "#{File.expand_path('..', __FILE__)}/templates/kinds.erb"
148
+ template = ERB.new(File.new(file).read, nil, '-')
149
+
150
+ formatted_output = ""
151
+ formatted_output << template.result(binding) unless occi_kinds.blank?
152
+
153
+ formatted_output
154
+ end
155
+
156
+ def kinds_to_json(occi_kinds)
157
+ # generate JSON document from Occi::Core::Kinds
158
+ occi_kinds = occi_kinds.to_a
159
+
160
+ if @output_format.to_s.end_with? '_pretty'
161
+ output_first = "[\n"
162
+ output_ary = occi_kinds.collect do |r|
163
+ JSON.pretty_generate(r.as_json.to_hash)
164
+ end
165
+ separator = ",\n"
166
+ output_last = "\n]"
167
+ else
168
+ output_first = "["
169
+ output_ary = occi_kinds.collect do |r|
170
+ JSON.generate(r.as_json.to_hash)
171
+ end
172
+ separator = ","
173
+ output_last = "]"
174
+ end
175
+
176
+ "#{output_first}#{output_ary.join(separator)}#{output_last}"
177
+ end
178
+ alias_method :kinds_to_json_pretty, :kinds_to_json
179
+ alias_method :kinds_to_json_extended_pretty, :kinds_to_json
180
+ alias_method :kinds_to_json_extended, :kinds_to_json
181
+
143
182
  end
144
183
 
145
184
  end
@@ -0,0 +1,27 @@
1
+ <%- # We always get Occi::Core::Kinds -%>
2
+ <%- unless occi_kinds.blank? -%><%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) %><%- end %>
3
+ <%- occi_kinds.each do |kind| -%>
4
+ [[ <%= kind.type_identifier %> ]]
5
+ >> title: <%= kind.title %>
6
+ >> parent: <%= kind.parent %>
7
+ >> location: <%= kind.location %>
8
+ >> related to: <%= kind.related.join(', ') %>
9
+
10
+ Attributes:
11
+ <%- kind.attributes.names.each_pair do |attribute, properties| %>
12
+ [[ <%= attribute %> ]]
13
+ | type: <%= properties.type %>
14
+ | required: <%= properties.required %>
15
+ | mutable: <%= properties.mutable %>
16
+ | default: <%= properties.default %>
17
+ | description: <%= properties.description %>
18
+ | pattern: <%= properties.pattern %>
19
+ <%- end -%>
20
+
21
+ Actions:
22
+ <%- kind.actions.each do |action| %>
23
+ [[ <%= action.type_identifier %> ]]
24
+ <%- end -%>
25
+ <%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) -%>
26
+
27
+ <%- end -%>
@@ -1,5 +1,5 @@
1
1
  module Occi
2
2
  module Cli
3
- VERSION = "4.2.5" unless defined?(::Occi::Cli::VERSION)
3
+ VERSION = "4.3.0.beta.2" unless defined?(::Occi::Cli::VERSION)
4
4
  end
5
5
  end
data/occi-cli.gemspec CHANGED
@@ -8,20 +8,20 @@ Gem::Specification.new do |gem|
8
8
  gem.name = "occi-cli"
9
9
  gem.version = Occi::Cli::VERSION
10
10
  gem.authors = ["Florian Feldhaus","Piotr Kasprzak", "Boris Parak"]
11
- gem.email = ["florian.feldhaus@gwdg.de", "piotr.kasprzak@gwdg.de", "xparak@mail.muni.cz"]
11
+ gem.email = ['florian.feldhaus@gmail.com', 'piotr.kasprzak@gwdg.de', 'parak@cesnet.cz']
12
12
  gem.description = %q{This gem is a client implementation of the Open Cloud Computing Interface in Ruby}
13
13
  gem.summary = %q{Executable OCCI client}
14
- gem.homepage = 'https://github.com/gwdg/rOCCI-cli'
14
+ gem.homepage = 'https://github.com/EGI-FCTF/rOCCI-cli'
15
15
  gem.license = 'Apache License, Version 2.0'
16
16
 
17
17
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  gem.files = `git ls-files`.split("\n")
19
19
  gem.test_files = `git ls-files -- {test,spec}/*`.split("\n")
20
- gem.require_paths = ["lib"]
20
+ gem.require_paths = ['lib']
21
21
 
22
- gem.add_dependency 'occi-api', '~> 4.2.5'
23
- gem.add_dependency 'json'
24
- gem.add_dependency 'highline'
22
+ gem.add_dependency 'occi-api', '~> 4.3.0.beta.2'
23
+ gem.add_dependency 'json', '~> 1.8', '>= 1.8.1'
24
+ gem.add_dependency 'highline', '~> 1.6', '>= 1.6.21'
25
25
 
26
- gem.required_ruby_version = ">= 1.9.3"
26
+ gem.required_ruby_version = ">= 1.9.3"
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.5
4
+ version: 4.3.0.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Feldhaus
@@ -10,65 +10,77 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-10 00:00:00.000000000 Z
13
+ date: 2014-10-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: occi-api
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 4.2.5
21
+ version: 4.3.0.beta.2
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: 4.2.5
28
+ version: 4.3.0.beta.2
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: json
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '0'
35
+ version: '1.8'
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: 1.8.1
36
39
  type: :runtime
37
40
  prerelease: false
38
41
  version_requirements: !ruby/object:Gem::Requirement
39
42
  requirements:
40
- - - '>='
43
+ - - "~>"
44
+ - !ruby/object:Gem::Version
45
+ version: '1.8'
46
+ - - ">="
41
47
  - !ruby/object:Gem::Version
42
- version: '0'
48
+ version: 1.8.1
43
49
  - !ruby/object:Gem::Dependency
44
50
  name: highline
45
51
  requirement: !ruby/object:Gem::Requirement
46
52
  requirements:
47
- - - '>='
53
+ - - "~>"
48
54
  - !ruby/object:Gem::Version
49
- version: '0'
55
+ version: '1.6'
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 1.6.21
50
59
  type: :runtime
51
60
  prerelease: false
52
61
  version_requirements: !ruby/object:Gem::Requirement
53
62
  requirements:
54
- - - '>='
63
+ - - "~>"
64
+ - !ruby/object:Gem::Version
65
+ version: '1.6'
66
+ - - ">="
55
67
  - !ruby/object:Gem::Version
56
- version: '0'
68
+ version: 1.6.21
57
69
  description: This gem is a client implementation of the Open Cloud Computing Interface
58
70
  in Ruby
59
71
  email:
60
- - florian.feldhaus@gwdg.de
72
+ - florian.feldhaus@gmail.com
61
73
  - piotr.kasprzak@gwdg.de
62
- - xparak@mail.muni.cz
74
+ - parak@cesnet.cz
63
75
  executables:
64
76
  - occi
65
77
  extensions: []
66
78
  extra_rdoc_files: []
67
79
  files:
68
- - .gitignore
69
- - .rspec
70
- - .travis.yml
71
- - .yardopts
80
+ - ".gitignore"
81
+ - ".rspec"
82
+ - ".travis.yml"
83
+ - ".yardopts"
72
84
  - AUTHORS
73
85
  - Gemfile
74
86
  - LICENSE
@@ -87,6 +99,7 @@ files:
87
99
  - lib/occi/cli/helpers/create_helper.rb
88
100
  - lib/occi/cli/helpers/delete_helper.rb
89
101
  - lib/occi/cli/helpers/describe_helper.rb
102
+ - lib/occi/cli/helpers/discover_helper.rb
90
103
  - lib/occi/cli/helpers/link_helper.rb
91
104
  - lib/occi/cli/helpers/list_helper.rb
92
105
  - lib/occi/cli/helpers/trigger_helper.rb
@@ -95,6 +108,7 @@ files:
95
108
  - lib/occi/cli/occi_opts/cli_examples.erb
96
109
  - lib/occi/cli/occi_opts/occi_opts_helper.rb
97
110
  - lib/occi/cli/resource_output_factory.rb
111
+ - lib/occi/cli/templates/kinds.erb
98
112
  - lib/occi/cli/templates/links.erb
99
113
  - lib/occi/cli/templates/mixins.erb
100
114
  - lib/occi/cli/templates/resources.erb
@@ -104,7 +118,7 @@ files:
104
118
  - spec/occi/cli/occi_opts_spec.rb
105
119
  - spec/occi/cli/resource_output_factory_spec.rb
106
120
  - spec/spec_helper.rb
107
- homepage: https://github.com/gwdg/rOCCI-cli
121
+ homepage: https://github.com/EGI-FCTF/rOCCI-cli
108
122
  licenses:
109
123
  - Apache License, Version 2.0
110
124
  metadata: {}
@@ -114,14 +128,14 @@ require_paths:
114
128
  - lib
115
129
  required_ruby_version: !ruby/object:Gem::Requirement
116
130
  requirements:
117
- - - '>='
131
+ - - ">="
118
132
  - !ruby/object:Gem::Version
119
133
  version: 1.9.3
120
134
  required_rubygems_version: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - '>='
136
+ - - ">"
123
137
  - !ruby/object:Gem::Version
124
- version: '0'
138
+ version: 1.3.1
125
139
  requirements: []
126
140
  rubyforge_project:
127
141
  rubygems_version: 2.2.2