occi-cli 4.2.0.beta.6 → 4.2.0.beta.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZmVhNmZkM2RmN2ZhZjRkOTI1MWYyM2I3YzQyZTk3MjNkYzIzNGJkMA==
5
+ data.tar.gz: !binary |-
6
+ NTIyZTVmNDhiZjQ3ZTg2MjVmNThmMTU1OTA3YzZiMzE4NWFlYWMxNQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MmNjNjVhNjc2MmQ1MTA5MzRjMTQ1NjRjMGE2OTE3YjIwYzkwZjUxNmU2ODg4
10
+ MGY5ZjdkMGVkOThiY2VlMDNlMmNmMTQzNDY0Y2QwMzJmMDI4N2Y0MmJiMjhj
11
+ NDFkNTAyZDk2ZjIxMzhmN2JmN2MwNTAxN2M3ODkyZWRmYjMzZjM=
12
+ data.tar.gz: !binary |-
13
+ M2M1MmFjNTZmNzZhMTAwYzhiYTk4ODJjNjE5NzkxNzE2ZmYyNGMwYTQ0Y2Yy
14
+ NzM3NGMwMWIzZmY3MzI3ZjUzZDZkNzRiOTgxZDkyNmViZDQ1MDdhYzVlODll
15
+ NDI2Mzc5ZjU1ZTVmMzE5NjdlMmYwMmM1ZjRkZjdkNWY4Zjc1YzE=
@@ -9,6 +9,11 @@ module Occi::Cli
9
9
  MIXIN_REGEXP = ACTION_REGEXP = /^(\S+?)#(\S+)$/
10
10
  CONTEXT_REGEXP = ATTR_REGEXP = /^(\S+?)=(.+)$/
11
11
 
12
+ ATTR_NUM_EXP = /num\((?<number>\d+)\)/
13
+ ATTR_BOOL_EXP = /bool\((?<bool>true|false)\)/
14
+ ATTR_FLOAT_EXP = /float\((?<float>\d+\.\d+)\)/
15
+ ATTR_INVALID_EXP = /num\(.*\)|bool\(.*\)|float\(.*\)/
16
+
12
17
  def self.parse_context_variable(cvar)
13
18
  ary = CONTEXT_REGEXP.match(cvar).to_a.drop 1
14
19
  raise ArgumentError, "Context variables must always contain ATTR=VALUE pairs!" unless ary.length == 2
@@ -38,6 +43,7 @@ module Occi::Cli
38
43
  raise ArgumentError, "Attribute must always contain ATTR=VALUE pairs!" unless ary.length == 2
39
44
 
40
45
  ary[0] = "occi.core.#{ary[0]}" unless ary[0].include?('.')
46
+ ary[1] = parse_attribute_value(ary[1])
41
47
 
42
48
  ary
43
49
  end
@@ -56,6 +62,23 @@ module Occi::Cli
56
62
  Occi::Core::Action.new("#{parts[0]}#", parts[1])
57
63
  end
58
64
 
65
+ def self.parse_attribute_value(value)
66
+ result = value
67
+
68
+ ATTR_NUM_EXP =~ value
69
+ result = Regexp.last_match(:number).to_i if Regexp.last_match(:number)
70
+
71
+ ATTR_BOOL_EXP =~ value
72
+ result = (Regexp.last_match(:bool) == 'true' ? true : false) if Regexp.last_match(:bool)
73
+
74
+ ATTR_FLOAT_EXP =~ value
75
+ result = Regexp.last_match(:float).to_f if Regexp.last_match(:float)
76
+
77
+ raise ArgumentError, "Failed to cast attribute value #{result.inspect}!" if ATTR_INVALID_EXP =~ result.to_s
78
+
79
+ result
80
+ end
81
+
59
82
  end
60
83
  end
61
84
  end
@@ -362,10 +362,8 @@ module Occi::Cli
362
362
  end
363
363
 
364
364
  if options.action == :create
365
- if options.links
365
+ if options.mixins.blank? && options.resource == 'compute'
366
366
  mandatory << :links
367
- else
368
- mandatory << :mixins
369
367
  end
370
368
 
371
369
  mandatory << :attributes
@@ -1,5 +1,5 @@
1
1
  module Occi
2
2
  module Cli
3
- VERSION = "4.2.0.beta.6" unless defined?(::Occi::Cli::VERSION)
3
+ VERSION = "4.2.0.beta.7" unless defined?(::Occi::Cli::VERSION)
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0.beta.6
5
- prerelease: 6
4
+ version: 4.2.0.beta.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Florian Feldhaus
@@ -11,12 +10,11 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2014-01-06 00:00:00.000000000 Z
13
+ date: 2014-01-08 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: occi-api
18
17
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
19
  - - '='
22
20
  - !ruby/object:Gem::Version
@@ -24,7 +22,6 @@ dependencies:
24
22
  type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
25
  requirements:
29
26
  - - '='
30
27
  - !ruby/object:Gem::Version
@@ -32,7 +29,6 @@ dependencies:
32
29
  - !ruby/object:Gem::Dependency
33
30
  name: json
34
31
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
32
  requirements:
37
33
  - - ! '>='
38
34
  - !ruby/object:Gem::Version
@@ -40,7 +36,6 @@ dependencies:
40
36
  type: :runtime
41
37
  prerelease: false
42
38
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
39
  requirements:
45
40
  - - ! '>='
46
41
  - !ruby/object:Gem::Version
@@ -48,7 +43,6 @@ dependencies:
48
43
  - !ruby/object:Gem::Dependency
49
44
  name: highline
50
45
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
46
  requirements:
53
47
  - - ! '>='
54
48
  - !ruby/object:Gem::Version
@@ -56,7 +50,6 @@ dependencies:
56
50
  type: :runtime
57
51
  prerelease: false
58
52
  version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
53
  requirements:
61
54
  - - ! '>='
62
55
  - !ruby/object:Gem::Version
@@ -112,26 +105,25 @@ files:
112
105
  homepage: https://github.com/gwdg/rOCCI-cli
113
106
  licenses:
114
107
  - Apache License, Version 2.0
108
+ metadata: {}
115
109
  post_install_message:
116
110
  rdoc_options: []
117
111
  require_paths:
118
112
  - lib
119
113
  required_ruby_version: !ruby/object:Gem::Requirement
120
- none: false
121
114
  requirements:
122
115
  - - ! '>='
123
116
  - !ruby/object:Gem::Version
124
117
  version: 1.9.3
125
118
  required_rubygems_version: !ruby/object:Gem::Requirement
126
- none: false
127
119
  requirements:
128
120
  - - ! '>'
129
121
  - !ruby/object:Gem::Version
130
122
  version: 1.3.1
131
123
  requirements: []
132
124
  rubyforge_project:
133
- rubygems_version: 1.8.25
125
+ rubygems_version: 2.1.11
134
126
  signing_key:
135
- specification_version: 3
127
+ specification_version: 4
136
128
  summary: Executable OCCI client
137
129
  test_files: []