occi-cli 4.2.0 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/lib/occi/cli/helpers/describe_helper.rb +6 -2
- data/lib/occi/cli/resource_output_factory.rb +19 -4
- data/lib/occi/cli/templates/links.erb +18 -0
- data/lib/occi/cli/templates/mixins.erb +2 -2
- data/lib/occi/cli/templates/resources.erb +2 -2
- data/lib/occi/cli/version.rb +1 -1
- data/occi-cli.gemspec +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmQ1MzBkMjVlYzUwYjU1NmQxNjQzODM5MTUwMjZmOTU2MWQyOGJkNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZThhODJiYjFlNmNjNDIxNGVhYzlkMThhZTVmYThlNjc5MTI3MmRiMg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
N2IzNTZkMDljOTVmMjMzNWIxMmUzZWQ3MTYyYzc2MzM0ZmRhNWY2Y2M5N2Zl
|
10
|
+
MzNhNDM0NzcxYmRhODU1Mzg4ZTI2YzE4OWJlNzFhNzhiNWNhN2ZkYTYwYTUz
|
11
|
+
NzU5YzZiMGQ2NzU4MjNiM2FlODU3MTMzMjg0NzZjYzA3MjVlYmM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTZjYzE0YWIxNjBlMGRkYTYxMGEwNWE0ZWUyYmMyZjZiY2I5NWJjNGM0MzE4
|
14
|
+
MWM3OTkxZDcxMTM5NTBiNzA4NzEzZGU4YjZmOWVmOGVhNTZmMzJiNWQyMmM1
|
15
|
+
Y2VlODQzMDUwNjZmOGNmZjc2MjZmYTVlMGE0ODYwNmZmYzhjZTQ=
|
@@ -4,8 +4,12 @@ module Occi::Cli::Helpers::DescribeHelper
|
|
4
4
|
if resource_types.include?(options.resource) || resource_type_identifiers.include?(options.resource) || options.resource.start_with?(options.endpoint) || options.resource.start_with?('/')
|
5
5
|
Occi::Cli::Log.debug "#{options.resource.inspect} is a resource type, type identifier or an actual resource."
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
resources_or_links = describe(options.resource)
|
8
|
+
if resources_or_links.kind_of?(Occi::Core::Resources) || resources_or_links.kind_of?(Occi::Core::Links)
|
9
|
+
found = resources_or_links
|
10
|
+
else
|
11
|
+
found = Occi::Core::Resources.new
|
12
|
+
end
|
9
13
|
elsif mixin_types.include?(options.resource) || mixin_type_identifiers.include?(options.resource)
|
10
14
|
Occi::Cli::Log.debug "#{options.resource.inspect} is a mixin type or type identifier."
|
11
15
|
|
@@ -19,6 +19,8 @@ module Occi::Cli
|
|
19
19
|
# construct a method name from data type and output format
|
20
20
|
if data.kind_of? Occi::Core::Resources
|
21
21
|
method = "resources_to_#{@output_format}".to_sym
|
22
|
+
elsif data.kind_of? Occi::Core::Links
|
23
|
+
method = "links_to_#{@output_format}".to_sym
|
22
24
|
elsif data.kind_of? Occi::Core::Mixins
|
23
25
|
method = "mixins_to_#{@output_format}".to_sym
|
24
26
|
elsif data.kind_of? Array
|
@@ -56,6 +58,8 @@ module Occi::Cli
|
|
56
58
|
"#{output_first}#{output_ary.join(separator)}#{output_last}"
|
57
59
|
end
|
58
60
|
alias_method :resources_to_json_pretty, :resources_to_json
|
61
|
+
alias_method :links_to_json, :resources_to_json
|
62
|
+
alias_method :links_to_json_pretty, :resources_to_json
|
59
63
|
alias_method :mixins_to_json, :resources_to_json
|
60
64
|
alias_method :mixins_to_json_pretty, :resources_to_json
|
61
65
|
|
@@ -70,7 +74,7 @@ module Occi::Cli
|
|
70
74
|
alias_method :locations_to_json_pretty, :locations_to_json
|
71
75
|
|
72
76
|
def resources_to_plain(occi_resources)
|
73
|
-
# using ERB templates for known resource
|
77
|
+
# using ERB templates for known resource types
|
74
78
|
file = "#{File.expand_path('..', __FILE__)}/templates/resources.erb"
|
75
79
|
template = ERB.new(File.new(file).read, nil, '-')
|
76
80
|
|
@@ -80,13 +84,24 @@ module Occi::Cli
|
|
80
84
|
formatted_output
|
81
85
|
end
|
82
86
|
|
83
|
-
def
|
84
|
-
# using ERB templates for known
|
87
|
+
def links_to_plain(occi_links)
|
88
|
+
# using ERB templates for known link types
|
89
|
+
file = "#{File.expand_path('..', __FILE__)}/templates/links.erb"
|
90
|
+
template = ERB.new(File.new(file).read, nil, '-')
|
91
|
+
|
92
|
+
formatted_output = ""
|
93
|
+
formatted_output << template.result(binding) unless occi_links.blank?
|
94
|
+
|
95
|
+
formatted_output
|
96
|
+
end
|
97
|
+
|
98
|
+
def mixins_to_plain(occi_mixins)
|
99
|
+
# using ERB templates for known mixin types
|
85
100
|
file = "#{File.expand_path('..', __FILE__)}/templates/mixins.erb"
|
86
101
|
template = ERB.new(File.new(file).read, nil, '-')
|
87
102
|
|
88
103
|
formatted_output = ""
|
89
|
-
formatted_output << template.result(binding) unless
|
104
|
+
formatted_output << template.result(binding) unless occi_mixins.blank?
|
90
105
|
|
91
106
|
formatted_output
|
92
107
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%- # We always get Occi::Core::Links -%>
|
2
|
+
<%- unless occi_links.blank? -%><%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) %><%- end %>
|
3
|
+
<%- occi_links.each do |link| -%>
|
4
|
+
[[ <%= link.kind.type_identifier %> ]]
|
5
|
+
<%- link.attributes.names.each_pair do |attribute, value| -%>
|
6
|
+
<%= attribute %> = <%= value %>
|
7
|
+
<%- end -%>
|
8
|
+
|
9
|
+
Mixins:
|
10
|
+
<%- link.mixins.each do |mixin| %>
|
11
|
+
[[ <%= mixin.type_identifier %> ]]
|
12
|
+
title: <%= mixin.title %>
|
13
|
+
term: <%= mixin.term %>
|
14
|
+
location: <%= mixin.location %>
|
15
|
+
<%- end -%>
|
16
|
+
<%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) -%>
|
17
|
+
|
18
|
+
<%- end -%>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%- # We always get Occi::Core::Mixins -%>
|
2
|
-
<%- unless
|
3
|
-
<%-
|
2
|
+
<%- unless occi_mixins.blank? -%><%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) %><%- end %>
|
3
|
+
<%- occi_mixins.each do |mixin| -%>
|
4
4
|
[[ <%= mixin.type_identifier %> ]]
|
5
5
|
title: <%= mixin.title %>
|
6
6
|
term: <%= mixin.term %>
|
@@ -23,8 +23,8 @@ Mixins:
|
|
23
23
|
<%- end -%>
|
24
24
|
|
25
25
|
Actions:
|
26
|
-
<%- resource.
|
27
|
-
[[ <%= action.
|
26
|
+
<%- resource.actions.each do |action| %>
|
27
|
+
[[ <%= action.type_identifier %> ]]
|
28
28
|
<%- end -%>
|
29
29
|
<%= '#' * (HighLine::SystemExtensions.terminal_size.first - 1) -%>
|
30
30
|
|
data/lib/occi/cli/version.rb
CHANGED
data/occi-cli.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.test_files = `git ls-files -- {test,spec}/*`.split("\n")
|
20
20
|
gem.require_paths = ["lib"]
|
21
21
|
|
22
|
-
gem.add_dependency 'occi-api', '~> 4.2.
|
22
|
+
gem.add_dependency 'occi-api', '~> 4.2.1'
|
23
23
|
gem.add_dependency 'json'
|
24
24
|
gem.add_dependency 'highline'
|
25
25
|
|
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.
|
4
|
+
version: 4.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Feldhaus
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: occi-api
|
@@ -18,40 +18,40 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.2.
|
21
|
+
version: 4.2.1
|
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.
|
28
|
+
version: 4.2.1
|
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
35
|
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - '>='
|
40
|
+
- - ! '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: highline
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - '>='
|
47
|
+
- - ! '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - '>='
|
54
|
+
- - ! '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
description: This gem is a client implementation of the Open Cloud Computing Interface
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/occi/cli/occi_opts/cli_examples.erb
|
96
96
|
- lib/occi/cli/occi_opts/occi_opts_helper.rb
|
97
97
|
- lib/occi/cli/resource_output_factory.rb
|
98
|
+
- lib/occi/cli/templates/links.erb
|
98
99
|
- lib/occi/cli/templates/mixins.erb
|
99
100
|
- lib/occi/cli/templates/resources.erb
|
100
101
|
- lib/occi/cli/version.rb
|
@@ -113,12 +114,12 @@ require_paths:
|
|
113
114
|
- lib
|
114
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
116
|
requirements:
|
116
|
-
- - '>='
|
117
|
+
- - ! '>='
|
117
118
|
- !ruby/object:Gem::Version
|
118
119
|
version: 1.9.3
|
119
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
121
|
requirements:
|
121
|
-
- - '>='
|
122
|
+
- - ! '>='
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
125
|
requirements: []
|