cft_smartcloud 0.2.2 → 0.3.0
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.
- data/.gitignore +1 -0
- data/CHANGELOG +11 -0
- data/README.md +106 -0
- data/VERSION +1 -1
- data/bin/cft_smartcloud +33 -7
- data/bin/smartcloud +33 -7
- data/cft_smartcloud.gemspec +84 -20
- data/lib/config/config.yml +2 -0
- data/lib/curl_client.rb +42 -0
- data/lib/rest-client-1.6.6-master/.gitignore +6 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/README.rdoc +10 -1
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/Rakefile +0 -0
- data/lib/rest-client-1.6.6-master/VERSION +1 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/bin/restclient +5 -4
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/history.md +22 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/rest-client.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/rest_client.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/abstract_response.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/exceptions.rb +0 -0
- data/lib/rest-client-1.6.6-master/lib/restclient/net_http_ext.rb +55 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/payload.rb +17 -2
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/raw_response.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/request.rb +21 -19
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/resource.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient/response.rb +0 -0
- data/lib/{rest-client-1.6.3 → rest-client-1.6.6-master}/lib/restclient.rb +0 -0
- data/lib/rest-client-1.6.6-master/rest-client.gemspec +76 -0
- data/lib/rest-client-1.6.6-master/spec/abstract_response_spec.rb +85 -0
- data/lib/rest-client-1.6.6-master/spec/base.rb +16 -0
- data/lib/rest-client-1.6.6-master/spec/exceptions_spec.rb +98 -0
- data/lib/rest-client-1.6.6-master/spec/integration/certs/equifax.crt +19 -0
- data/lib/rest-client-1.6.6-master/spec/integration/certs/verisign.crt +14 -0
- data/lib/rest-client-1.6.6-master/spec/integration/request_spec.rb +25 -0
- data/lib/rest-client-1.6.6-master/spec/integration_spec.rb +38 -0
- data/lib/rest-client-1.6.6-master/spec/master_shake.jpg +0 -0
- data/lib/rest-client-1.6.6-master/spec/payload_spec.rb +234 -0
- data/lib/rest-client-1.6.6-master/spec/raw_response_spec.rb +17 -0
- data/lib/rest-client-1.6.6-master/spec/request2_spec.rb +40 -0
- data/lib/rest-client-1.6.6-master/spec/request_spec.rb +536 -0
- data/lib/rest-client-1.6.6-master/spec/resource_spec.rb +134 -0
- data/lib/rest-client-1.6.6-master/spec/response_spec.rb +169 -0
- data/lib/rest-client-1.6.6-master/spec/restclient_spec.rb +73 -0
- data/lib/slop-2.3.1/.gemtest +0 -0
- data/lib/slop-2.3.1/.gitignore +6 -0
- data/lib/slop-2.3.1/.yardopts +6 -0
- data/lib/slop-2.3.1/CHANGES.md +137 -0
- data/lib/slop-2.3.1/LICENSE +20 -0
- data/lib/slop-2.3.1/README.md +293 -0
- data/lib/slop-2.3.1/Rakefile +6 -0
- data/lib/slop-2.3.1/lib/slop.rb +1022 -0
- data/lib/slop-2.3.1/slop.gemspec +11 -0
- data/lib/slop-2.3.1/test/commands_test.rb +151 -0
- data/lib/slop-2.3.1/test/helper.rb +13 -0
- data/lib/slop-2.3.1/test/option_test.rb +198 -0
- data/lib/slop-2.3.1/test/slop_test.rb +574 -0
- data/lib/smartcloud.rb +186 -116
- data/lib/terminal-table-1.4.4/History.rdoc +53 -0
- data/lib/terminal-table-1.4.4/Manifest +24 -0
- data/lib/terminal-table-1.4.4/README.rdoc +240 -0
- data/lib/terminal-table-1.4.4/Rakefile +15 -0
- data/lib/terminal-table-1.4.4/Todo.rdoc +14 -0
- data/lib/terminal-table-1.4.4/examples/examples.rb +80 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/cell.rb +88 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/core_ext.rb +8 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/import.rb +4 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/row.rb +48 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/separator.rb +14 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/style.rb +61 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/table.rb +217 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/table_helper.rb +9 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table/version.rb +6 -0
- data/lib/terminal-table-1.4.4/lib/terminal-table.rb +27 -0
- data/lib/terminal-table-1.4.4/spec/cell_spec.rb +54 -0
- data/lib/terminal-table-1.4.4/spec/core_ext_spec.rb +18 -0
- data/lib/terminal-table-1.4.4/spec/import_spec.rb +11 -0
- data/lib/terminal-table-1.4.4/spec/spec.opts +1 -0
- data/lib/terminal-table-1.4.4/spec/spec_helper.rb +8 -0
- data/lib/terminal-table-1.4.4/spec/table_spec.rb +525 -0
- data/lib/terminal-table-1.4.4/tasks/docs.rake +13 -0
- data/lib/terminal-table-1.4.4/tasks/gemspec.rake +3 -0
- data/lib/terminal-table-1.4.4/tasks/spec.rake +25 -0
- data/lib/terminal-table-1.4.4/terminal-table.gemspec +30 -0
- data/responses/addresses +26 -0
- data/responses/addresses.blank +2 -0
- data/responses/instances +74 -0
- data/responses/keys +33 -0
- data/responses/locations +142 -0
- data/responses/offerings_image +3780 -0
- data/responses/storage +379 -0
- metadata +86 -22
- data/README.rdoc +0 -75
- data/lib/rest-client-1.6.3/VERSION +0 -1
- data/lib/rest-client-1.6.3/lib/restclient/net_http_ext.rb +0 -21
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
Slop
|
|
2
|
+
====
|
|
3
|
+
|
|
4
|
+
Slop is a simple option parser with an easy to remember syntax and friendly API.
|
|
5
|
+
|
|
6
|
+
Installation
|
|
7
|
+
------------
|
|
8
|
+
|
|
9
|
+
### Rubygems
|
|
10
|
+
|
|
11
|
+
gem install slop
|
|
12
|
+
|
|
13
|
+
### GitHub
|
|
14
|
+
|
|
15
|
+
git clone git://github.com/injekt/slop.git
|
|
16
|
+
gem build slop.gemspec
|
|
17
|
+
gem install slop-<version>.gem
|
|
18
|
+
|
|
19
|
+
Usage
|
|
20
|
+
-----
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
# parse assumes ARGV, otherwise you can pass it your own Array
|
|
24
|
+
opts = Slop.parse do
|
|
25
|
+
on :v, :verbose, 'Enable verbose mode' # A boolean option
|
|
26
|
+
on :n, :name=, 'Your name' # This option requires an argument
|
|
27
|
+
on :s, :sex, 'Your sex', true # So does this one
|
|
28
|
+
on :a, :age, 'Your age', optional: true # This one accepts an optional argument
|
|
29
|
+
on '-D', '--debug', 'Enable debug' # The prefixed -'s are optional
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# if ARGV is `-v --name 'lee jarvis' -s male`
|
|
33
|
+
opts.verbose? #=> true
|
|
34
|
+
opts.name? #=> true
|
|
35
|
+
opts[:name] #=> 'lee jarvis'
|
|
36
|
+
opts.age? #=> false
|
|
37
|
+
opts[:age] #=> nil
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For more information about creating options, see the
|
|
41
|
+
[Creating Options](https://github.com/injekt/slop/wiki/Creating-Options)
|
|
42
|
+
wiki page.
|
|
43
|
+
|
|
44
|
+
You can also return your options as a Hash
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
opts.to_hash #=> { :name => 'Lee Jarvis', :verbose => true, :age => nil, :sex => 'male' }
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If you want some pretty output for the user to see your options, you can just
|
|
51
|
+
send the Slop object to `puts` or use the `help` method.
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
puts opts
|
|
55
|
+
puts opts.help
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Will output something like
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
-v, --verbose Enable verbose mode
|
|
62
|
+
-n, --name Your name
|
|
63
|
+
-a, --age Your age
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
You can also add a banner using the `banner` method
|
|
67
|
+
|
|
68
|
+
```ruby
|
|
69
|
+
opts = Slop.parse do
|
|
70
|
+
banner "Usage: foo.rb [options]"
|
|
71
|
+
end
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Helpful Help
|
|
75
|
+
------------
|
|
76
|
+
|
|
77
|
+
Long form:
|
|
78
|
+
|
|
79
|
+
```ruby
|
|
80
|
+
Slop.parse do
|
|
81
|
+
...
|
|
82
|
+
on :h, :help, 'Print this help message', :tail => true do
|
|
83
|
+
puts help
|
|
84
|
+
exit
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Shortcut:
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
Slop.new :help => true
|
|
93
|
+
# or
|
|
94
|
+
Slop.new :help
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Parsing
|
|
98
|
+
-------
|
|
99
|
+
|
|
100
|
+
Slop's pretty good at parsing, let's take a look at what it'll extract for you
|
|
101
|
+
|
|
102
|
+
```ruby
|
|
103
|
+
Slop.parse(:multiple_switches => false) do
|
|
104
|
+
on 's', 'server='
|
|
105
|
+
on 'p', 'port=', :as => :integer
|
|
106
|
+
on 'username=', :matches => /^[a-zA-Z]+$/
|
|
107
|
+
on 'password='
|
|
108
|
+
end
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Now throw some options at it:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
-s ftp://foobar.com -p1234 --username=FooBar --password 'hello there'
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Here's what we'll get back
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
{
|
|
121
|
+
:server => "ftp://foobar.com",
|
|
122
|
+
:port => 1234,
|
|
123
|
+
:username => "FooBar",
|
|
124
|
+
:password => "hello there"
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Events
|
|
129
|
+
------
|
|
130
|
+
|
|
131
|
+
If you'd like to trigger an event when an option is used, you can pass a
|
|
132
|
+
block to your option. Here's how:
|
|
133
|
+
|
|
134
|
+
```ruby
|
|
135
|
+
Slop.parse do
|
|
136
|
+
on :V, :version, 'Print the version' do
|
|
137
|
+
puts 'Version 1.0.0'
|
|
138
|
+
exit
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Now when using the `--version` option on the command line, the trigger will
|
|
144
|
+
be called and its contents executed.
|
|
145
|
+
|
|
146
|
+
Yielding Non Options
|
|
147
|
+
--------------------
|
|
148
|
+
|
|
149
|
+
If you pass a block to `Slop#parse`, Slop will yield non-options as
|
|
150
|
+
they're found, just like
|
|
151
|
+
[OptionParser](http://rubydoc.info/stdlib/optparse/1.9.2/OptionParser:order)
|
|
152
|
+
does it.
|
|
153
|
+
|
|
154
|
+
```ruby
|
|
155
|
+
opts = Slop.new do
|
|
156
|
+
on :n, :name, :optional => false
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
opts.parse do |arg|
|
|
160
|
+
puts arg
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# if ARGV is `foo --name Lee bar`
|
|
164
|
+
foo
|
|
165
|
+
bar
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Negative Options
|
|
169
|
+
----------------
|
|
170
|
+
|
|
171
|
+
Slop also allows you to prefix `--no-` to an option which will force the option
|
|
172
|
+
to return a false value.
|
|
173
|
+
|
|
174
|
+
```ruby
|
|
175
|
+
opts = Slop.parse do
|
|
176
|
+
on :v, :verbose, :default => true
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# with no command line options
|
|
180
|
+
opts[:verbose] #=> true
|
|
181
|
+
|
|
182
|
+
# with `--no-verbose`
|
|
183
|
+
opts[:verbose] #=> false
|
|
184
|
+
opts.verbose? #=> false
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Short Switches
|
|
188
|
+
--------------
|
|
189
|
+
|
|
190
|
+
Want to enable multiple switches at once like rsync does? By default Slop will
|
|
191
|
+
parse `-abc` as the options `a` `b` and `c` and set their values to true. If
|
|
192
|
+
you would like to disable this, you can pass `multiple_switches => false` to
|
|
193
|
+
a new Slop object. In which case Slop will then parse `-fbar` as the option
|
|
194
|
+
`f` with the argument value `bar`.
|
|
195
|
+
|
|
196
|
+
```ruby
|
|
197
|
+
Slop.parse do
|
|
198
|
+
on :a, 'First switch'
|
|
199
|
+
on :b, 'Second switch'
|
|
200
|
+
on :c, 'Third switch'
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Using `-ac`
|
|
204
|
+
opts[:a] #=> true
|
|
205
|
+
opts[:b] #=> false
|
|
206
|
+
opts[:c] #=> true
|
|
207
|
+
|
|
208
|
+
Slop.parse(:multiple_switches => false) do
|
|
209
|
+
on :a, 'Some switch', true
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Using `ahello`
|
|
213
|
+
opts[:a] #=> 'hello'
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Lists
|
|
217
|
+
-----
|
|
218
|
+
|
|
219
|
+
You can of course also parse lists into options. Here's how:
|
|
220
|
+
|
|
221
|
+
```ruby
|
|
222
|
+
opts = Slop.parse do
|
|
223
|
+
opt :people, true, :as => Array
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# ARGV is `--people lee,john,bill`
|
|
227
|
+
opts[:people] #=> ['lee', 'john', 'bill']
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Slop supports a few styles of list parsing. Check out
|
|
231
|
+
[this wiki page](https://github.com/injekt/slop/wiki/Lists) for more info.
|
|
232
|
+
|
|
233
|
+
Strict Mode
|
|
234
|
+
-----------
|
|
235
|
+
|
|
236
|
+
Passing `strict => true` to `Slop.parse` causes it to raise a `Slop::InvalidOptionError`
|
|
237
|
+
when an invalid option is found (`false` by default):
|
|
238
|
+
|
|
239
|
+
```ruby
|
|
240
|
+
Slop.new(:strict => true).parse(%w/--foo/)
|
|
241
|
+
# => Slop::InvalidOptionError: Unknown option -- 'foo'
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Features
|
|
245
|
+
--------
|
|
246
|
+
|
|
247
|
+
Check out the following wiki pages for more features:
|
|
248
|
+
|
|
249
|
+
* [Ranges](https://github.com/injekt/slop/wiki/Ranges)
|
|
250
|
+
* [Auto Create](https://github.com/injekt/slop/wiki/Auto-Create)
|
|
251
|
+
* [Commands](https://github.com/injekt/slop/wiki/Commands)
|
|
252
|
+
|
|
253
|
+
Woah woah, why you hating on OptionParser?
|
|
254
|
+
------------------------------------------
|
|
255
|
+
|
|
256
|
+
I'm not, honestly! I love OptionParser. I really do, it's a fantastic library.
|
|
257
|
+
So why did I build Slop? Well, I find myself using OptionParser to simply
|
|
258
|
+
gather a bunch of key/value options, usually you would do something like this:
|
|
259
|
+
|
|
260
|
+
```ruby
|
|
261
|
+
require 'optparse'
|
|
262
|
+
|
|
263
|
+
things = {}
|
|
264
|
+
|
|
265
|
+
opt = OptionParser.new do |opt|
|
|
266
|
+
opt.on('-n', '--name NAME', 'Your name') do |name|
|
|
267
|
+
things[:name] = name
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
opt.on('-a', '--age AGE', 'Your age') do |age|
|
|
271
|
+
things[:age] = age.to_i
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# you get the point
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
opt.parse
|
|
278
|
+
things #=> { :name => 'lee', :age => 105 }
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Which is all great and stuff, but it can lead to some repetition. The same
|
|
282
|
+
thing in Slop:
|
|
283
|
+
|
|
284
|
+
```ruby
|
|
285
|
+
require 'slop'
|
|
286
|
+
|
|
287
|
+
opts = Slop.parse do
|
|
288
|
+
on :n, :name=, 'Your name'
|
|
289
|
+
on :a, :age=, 'Your age', :as => :int
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
opts.to_hash #=> { :name => 'lee', :age => 105 }
|
|
293
|
+
```
|