cft_smartcloud 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,525 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
module Terminal
|
5
|
+
describe Table do
|
6
|
+
before :each do
|
7
|
+
@table = Table.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should select columns" do
|
11
|
+
@table << ['foo', 'bar']
|
12
|
+
@table << ['big foo', 'big foo bar']
|
13
|
+
@table.column(1).should == ['bar', 'big foo bar']
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should select the column with headings at an index" do
|
17
|
+
@table << [1,2,3]
|
18
|
+
@table << [4,5,6]
|
19
|
+
@table.column_with_headings(2).should == [3,6]
|
20
|
+
end
|
21
|
+
|
22
|
+
#it "should select the columns with colspans > 1 in the index" do
|
23
|
+
# @table << [1,{:value => 2, :colspan => 2}]
|
24
|
+
# @table << [{:value => 3, :colspan => 2}, 4]
|
25
|
+
#end
|
26
|
+
|
27
|
+
it "should account for the colspan when selecting columns" do
|
28
|
+
@table << [1,2,3]
|
29
|
+
@table << [{:value => "4,5", :colspan => 2}, 6]
|
30
|
+
@table.column_with_headings(0).should == [1,"4,5"]
|
31
|
+
@table.column_with_headings(1).should == [2,"4,5"]
|
32
|
+
@table.column_with_headings(2).should == [3,6]
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should render tables with colspan properly" do
|
36
|
+
@table << [1,2,3]
|
37
|
+
@table << [4,5,6]
|
38
|
+
@table << [{:value => "7", :colspan => 2}, 88]
|
39
|
+
@table.render.should == <<-EOF.deindent
|
40
|
+
+---+---+----+
|
41
|
+
| 1 | 2 | 3 |
|
42
|
+
| 4 | 5 | 6 |
|
43
|
+
| 7 | 88 |
|
44
|
+
+---+---+----+
|
45
|
+
EOF
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should count columns" do
|
49
|
+
@table << [1, 2, 3]
|
50
|
+
@table.number_of_columns.should == 3
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should iterate columns" do
|
54
|
+
@table << [1, 2, 3]
|
55
|
+
@table << [4, 5, 6]
|
56
|
+
@table.columns.should == [[1, 4], [2, 5], [3, 6]]
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should select columns" do
|
60
|
+
@table.headings = ['one', 'two']
|
61
|
+
@table << ['foo', 'bar']
|
62
|
+
@table << ['big foo', 'big foo bar']
|
63
|
+
@table.column(1).should == ['bar', 'big foo bar']
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should select columns when using hashes" do
|
67
|
+
@table.headings = ['one', 'two']
|
68
|
+
@table.rows = [[{ :value => 'a', :align => :left }, 1], ['b', 2], ['c', 3]]
|
69
|
+
@table.column(0).should == ['a', 'b', 'c']
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should find column length" do
|
73
|
+
@table << ['foo', 'bar', 'a']
|
74
|
+
@table << ['big foo', 'big foo bar']
|
75
|
+
@table.column_width(1).should == 11
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should find column length with headings" do
|
79
|
+
@table.headings = ['one', 'super long heading']
|
80
|
+
@table << ['foo', 'bar', 'a']
|
81
|
+
@table << ['big foo', 'big foo bar']
|
82
|
+
@table.column_width(1).should == 18
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should render separators" do
|
86
|
+
@table.headings = ['Char', 'Num']
|
87
|
+
@table << ['a', 1]
|
88
|
+
separator = Terminal::Table::Separator.new(@table)
|
89
|
+
separator.render.should == '+------+-----+'
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should add separator" do
|
93
|
+
@table << ['a', 1]
|
94
|
+
@table.add_separator
|
95
|
+
@table << ['b', 2]
|
96
|
+
@table.rows.size.should == 2
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should render an empty table properly" do
|
100
|
+
@table.render.should == <<-EOF.deindent
|
101
|
+
++
|
102
|
+
++
|
103
|
+
EOF
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should render properly" do
|
107
|
+
@table.headings = ['Char', 'Num']
|
108
|
+
@table << ['a', 1]
|
109
|
+
@table << ['b', 2]
|
110
|
+
@table << ['c', 3]
|
111
|
+
@table.render.should == <<-EOF.deindent
|
112
|
+
+------+-----+
|
113
|
+
| Char | Num |
|
114
|
+
+------+-----+
|
115
|
+
| a | 1 |
|
116
|
+
| b | 2 |
|
117
|
+
| c | 3 |
|
118
|
+
+------+-----+
|
119
|
+
EOF
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should render styles properly" do
|
123
|
+
@table.headings = ['Char', 'Num']
|
124
|
+
@table.style = {:border_x => "=", :border_y => ":", :border_i => "x", :padding_left => 0, :padding_right => 2}
|
125
|
+
@table << ['a', 1]
|
126
|
+
@table << ['b', 2]
|
127
|
+
@table << ['c', 3]
|
128
|
+
@table.style.padding_right.should == 2
|
129
|
+
@table.render.should == <<-EOF.deindent
|
130
|
+
x======x=====x
|
131
|
+
:Char :Num :
|
132
|
+
x======x=====x
|
133
|
+
:a :1 :
|
134
|
+
:b :2 :
|
135
|
+
:c :3 :
|
136
|
+
x======x=====x
|
137
|
+
EOF
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should render width properly" do
|
141
|
+
@table.headings = ['Char', 'Num']
|
142
|
+
@table << ['a', 1]
|
143
|
+
@table << ['b', 2]
|
144
|
+
@table << ['c', 3]
|
145
|
+
@table.style.width = 21
|
146
|
+
@table.render.should == <<-EOF.deindent
|
147
|
+
+---------+---------+
|
148
|
+
| Char | Num |
|
149
|
+
+---------+---------+
|
150
|
+
| a | 1 |
|
151
|
+
| b | 2 |
|
152
|
+
| c | 3 |
|
153
|
+
+---------+---------+
|
154
|
+
EOF
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should render title properly" do
|
158
|
+
@table.title = "Title"
|
159
|
+
@table.headings = ['Char', 'Num']
|
160
|
+
@table << ['a', 1]
|
161
|
+
@table << ['b', 2]
|
162
|
+
@table << ['c', 3]
|
163
|
+
@table.render.should == <<-EOF.deindent
|
164
|
+
+-------+-----+
|
165
|
+
| Title |
|
166
|
+
+-------+-----+
|
167
|
+
| Char | Num |
|
168
|
+
+-------+-----+
|
169
|
+
| a | 1 |
|
170
|
+
| b | 2 |
|
171
|
+
| c | 3 |
|
172
|
+
+-------+-----+
|
173
|
+
EOF
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should render properly without headings" do
|
177
|
+
@table << ['a', 1]
|
178
|
+
@table << ['b', 2]
|
179
|
+
@table << ['c', 3]
|
180
|
+
@table.render.should == <<-EOF.deindent
|
181
|
+
+---+---+
|
182
|
+
| a | 1 |
|
183
|
+
| b | 2 |
|
184
|
+
| c | 3 |
|
185
|
+
+---+---+
|
186
|
+
EOF
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should render separators" do
|
190
|
+
@table.headings = ['Char', 'Num']
|
191
|
+
@table << ['a', 1]
|
192
|
+
@table << ['b', 2]
|
193
|
+
@table.add_separator
|
194
|
+
@table << ['c', 3]
|
195
|
+
@table.render.should == <<-EOF.deindent
|
196
|
+
+------+-----+
|
197
|
+
| Char | Num |
|
198
|
+
+------+-----+
|
199
|
+
| a | 1 |
|
200
|
+
| b | 2 |
|
201
|
+
+------+-----+
|
202
|
+
| c | 3 |
|
203
|
+
+------+-----+
|
204
|
+
EOF
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should align columns with separators" do
|
208
|
+
@table.headings = ['Char', 'Num']
|
209
|
+
@table << ['a', 1]
|
210
|
+
@table << ['b', 2]
|
211
|
+
@table.add_separator
|
212
|
+
@table << ['c', 3]
|
213
|
+
@table.align_column 1, :right
|
214
|
+
@table.render.should == <<-EOF.deindent
|
215
|
+
+------+-----+
|
216
|
+
| Char | Num |
|
217
|
+
+------+-----+
|
218
|
+
| a | 1 |
|
219
|
+
| b | 2 |
|
220
|
+
+------+-----+
|
221
|
+
| c | 3 |
|
222
|
+
+------+-----+
|
223
|
+
EOF
|
224
|
+
end
|
225
|
+
|
226
|
+
|
227
|
+
it "should render properly using block syntax" do
|
228
|
+
table = Terminal::Table.new do |t|
|
229
|
+
t << ['a', 1]
|
230
|
+
t << ['b', 2]
|
231
|
+
t << ['c', 3]
|
232
|
+
end
|
233
|
+
table.render.should == <<-EOF.deindent
|
234
|
+
+---+---+
|
235
|
+
| a | 1 |
|
236
|
+
| b | 2 |
|
237
|
+
| c | 3 |
|
238
|
+
+---+---+
|
239
|
+
EOF
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should render properly using instance_eval block syntax" do
|
243
|
+
table = Terminal::Table.new do
|
244
|
+
add_row ['a', 1]
|
245
|
+
add_row ['b', 2]
|
246
|
+
add_row ['c', 3]
|
247
|
+
end
|
248
|
+
table.render.should == <<-EOF.deindent
|
249
|
+
+---+---+
|
250
|
+
| a | 1 |
|
251
|
+
| b | 2 |
|
252
|
+
| c | 3 |
|
253
|
+
+---+---+
|
254
|
+
EOF
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should allows a hash of options for creation" do
|
258
|
+
headings = ['Char', 'Num']
|
259
|
+
rows = [['a', 1], ['b', 2], ['c', 3]]
|
260
|
+
Terminal::Table.new(:rows => rows, :headings => headings).render.should == <<-EOF.deindent
|
261
|
+
+------+-----+
|
262
|
+
| Char | Num |
|
263
|
+
+------+-----+
|
264
|
+
| a | 1 |
|
265
|
+
| b | 2 |
|
266
|
+
| c | 3 |
|
267
|
+
+------+-----+
|
268
|
+
EOF
|
269
|
+
end
|
270
|
+
|
271
|
+
it "should flex for large cells" do
|
272
|
+
@table.headings = ['Just some characters', 'Num']
|
273
|
+
@table.rows = [['a', 1], ['b', 2], ['c', 3]]
|
274
|
+
@table.render.should == <<-EOF.deindent
|
275
|
+
+----------------------+-----+
|
276
|
+
| Just some characters | Num |
|
277
|
+
+----------------------+-----+
|
278
|
+
| a | 1 |
|
279
|
+
| b | 2 |
|
280
|
+
| c | 3 |
|
281
|
+
+----------------------+-----+
|
282
|
+
EOF
|
283
|
+
end
|
284
|
+
|
285
|
+
it "should allow alignment of headings and cells" do
|
286
|
+
@table.headings = ['Characters', {:value => 'Nums', :alignment => :right} ]
|
287
|
+
@table << [{:value => 'a', :alignment => :center}, 1]
|
288
|
+
@table << ['b', 222222222222222]
|
289
|
+
@table << ['c', 3]
|
290
|
+
@table.render.should == <<-EOF.deindent
|
291
|
+
+------------+-----------------+
|
292
|
+
| Characters | Nums |
|
293
|
+
+------------+-----------------+
|
294
|
+
| a | 1 |
|
295
|
+
| b | 222222222222222 |
|
296
|
+
| c | 3 |
|
297
|
+
+------------+-----------------+
|
298
|
+
EOF
|
299
|
+
|
300
|
+
end
|
301
|
+
|
302
|
+
it "should align columns, but allow specifics to remain" do
|
303
|
+
@table.headings = ['Just some characters', 'Num']
|
304
|
+
@table.rows = [[{:value => 'a', :alignment => :left}, 1], ['b', 2], ['c', 3]]
|
305
|
+
@table.align_column 0, :center
|
306
|
+
@table.align_column 1, :right
|
307
|
+
@table.render.should == <<-EOF.deindent
|
308
|
+
+----------------------+-----+
|
309
|
+
| Just some characters | Num |
|
310
|
+
+----------------------+-----+
|
311
|
+
| a | 1 |
|
312
|
+
| b | 2 |
|
313
|
+
| c | 3 |
|
314
|
+
+----------------------+-----+
|
315
|
+
EOF
|
316
|
+
end
|
317
|
+
|
318
|
+
describe "#==" do
|
319
|
+
it "should be equal to itself" do
|
320
|
+
t = Table.new
|
321
|
+
t.should == t
|
322
|
+
end
|
323
|
+
|
324
|
+
# it "should be equal with two empty tables" do
|
325
|
+
# table_one = Table.new
|
326
|
+
# table_two = Table.new
|
327
|
+
#
|
328
|
+
# table_one.should == table_two
|
329
|
+
# table_two.should == table_one
|
330
|
+
# end
|
331
|
+
|
332
|
+
it "should not be equal with different headings" do
|
333
|
+
table_one = Table.new
|
334
|
+
table_two = Table.new
|
335
|
+
|
336
|
+
table_one.headings << "a"
|
337
|
+
|
338
|
+
table_one.should_not == table_two
|
339
|
+
table_two.should_not == table_one
|
340
|
+
end
|
341
|
+
|
342
|
+
it "should not be equal with different rows" do
|
343
|
+
table_one = Table.new
|
344
|
+
table_two = Table.new
|
345
|
+
|
346
|
+
table_one.should_not == table_two
|
347
|
+
table_two.should_not == table_one
|
348
|
+
end
|
349
|
+
|
350
|
+
it "should not be equal if the other object does not respond_to? :headings" do
|
351
|
+
table_one = Table.new
|
352
|
+
table_two = Object.new
|
353
|
+
table_two.stub!(:rows).and_return([])
|
354
|
+
table_one.should_not == table_two
|
355
|
+
end
|
356
|
+
|
357
|
+
it "should not be equal if the other object does not respond_to? :rows" do
|
358
|
+
table_one = Table.new
|
359
|
+
table_two = Object.new
|
360
|
+
table_two.stub!(:rows).and_return([])
|
361
|
+
table_one.should_not == table_two
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
it "should handle colspan inside heading" do
|
366
|
+
@table.headings = ['one', { :value => 'two', :alignment => :center, :colspan => 2}]
|
367
|
+
@table.rows = [['a', 1, 2], ['b', 3, 4], ['c', 3, 4]]
|
368
|
+
@table.render.should == <<-EOF.deindent
|
369
|
+
+-----+---+---+
|
370
|
+
| one | two |
|
371
|
+
+-----+---+---+
|
372
|
+
| a | 1 | 2 |
|
373
|
+
| b | 3 | 4 |
|
374
|
+
| c | 3 | 4 |
|
375
|
+
+-----+---+---+
|
376
|
+
EOF
|
377
|
+
end
|
378
|
+
|
379
|
+
it "should handle colspan inside cells" do
|
380
|
+
@table.headings = ['one', 'two', 'three']
|
381
|
+
@table.rows = [['a', 1, 2], ['b', 3, 4], [{:value => "joined", :colspan => 2,:alignment => :center}, 'c']]
|
382
|
+
@table.render.should == <<-EOF.deindent
|
383
|
+
+-----+-----+-------+
|
384
|
+
| one | two | three |
|
385
|
+
+-----+-----+-------+
|
386
|
+
| a | 1 | 2 |
|
387
|
+
| b | 3 | 4 |
|
388
|
+
| joined | c |
|
389
|
+
+-----+-----+-------+
|
390
|
+
EOF
|
391
|
+
end
|
392
|
+
|
393
|
+
it "should handle colspan inside cells regardless of colspan position" do
|
394
|
+
@table.headings = ['one', 'two', 'three']
|
395
|
+
@table.rows = [['a', 1, 2], ['b', 3, 4], ['c', {:value => "joined", :colspan => 2,:alignment => :center}]]
|
396
|
+
@table.render.should == <<-EOF.deindent
|
397
|
+
+-----+-----+-------+
|
398
|
+
| one | two | three |
|
399
|
+
+-----+-----+-------+
|
400
|
+
| a | 1 | 2 |
|
401
|
+
| b | 3 | 4 |
|
402
|
+
| c | joined |
|
403
|
+
+-----+-----+-------+
|
404
|
+
EOF
|
405
|
+
end
|
406
|
+
|
407
|
+
it "should handle overflowing colspans" do
|
408
|
+
@table.headings = ['one', 'two', 'three']
|
409
|
+
@table.rows = [['a', 1, 2], ['b', 3, 4], ['c', {:value => "joined that is very very long", :colspan => 2,:alignment => :center}]]
|
410
|
+
@table.render.should == <<-EOF.deindent
|
411
|
+
+-----+---------------+---------------+
|
412
|
+
| one | two | three |
|
413
|
+
+-----+---------------+---------------+
|
414
|
+
| a | 1 | 2 |
|
415
|
+
| b | 3 | 4 |
|
416
|
+
| c | joined that is very very long |
|
417
|
+
+-----+---------------+---------------+
|
418
|
+
EOF
|
419
|
+
end
|
420
|
+
|
421
|
+
it "should only increase column size for multi-column if it is unavoidable" do
|
422
|
+
@table << [12345,2,3]
|
423
|
+
@table << [{:value => 123456789, :colspan => 2}, 4]
|
424
|
+
@table.render.should == <<-EOF.deindent
|
425
|
+
+-------+---+---+
|
426
|
+
| 12345 | 2 | 3 |
|
427
|
+
| 123456789 | 4 |
|
428
|
+
+-------+---+---+
|
429
|
+
EOF
|
430
|
+
end
|
431
|
+
|
432
|
+
|
433
|
+
it "should handle colspan 1" do
|
434
|
+
@table.headings = ['name', { :value => 'values', :colspan => 1}]
|
435
|
+
@table.rows = [['a', 1], ['b', 4], ['c', 7]]
|
436
|
+
@table.render.should == <<-EOF.deindent
|
437
|
+
+------+--------+
|
438
|
+
| name | values |
|
439
|
+
+------+--------+
|
440
|
+
| a | 1 |
|
441
|
+
| b | 4 |
|
442
|
+
| c | 7 |
|
443
|
+
+------+--------+
|
444
|
+
EOF
|
445
|
+
end
|
446
|
+
|
447
|
+
it "should handle big colspan" do
|
448
|
+
@table.headings = ['name', { :value => 'values', :alignment => :right, :colspan => 3}]
|
449
|
+
@table.headings = ['name', { :value => 'values', :colspan => 3}]
|
450
|
+
@table.rows = [['a', 1, 2, 3], ['b', 4, 5, 6], ['c', 7, 8, 9]]
|
451
|
+
|
452
|
+
@table.render.should == <<-EOF.deindent
|
453
|
+
+------+---+---+---+
|
454
|
+
| name | values |
|
455
|
+
+------+---+---+---+
|
456
|
+
| a | 1 | 2 | 3 |
|
457
|
+
| b | 4 | 5 | 6 |
|
458
|
+
| c | 7 | 8 | 9 |
|
459
|
+
+------+---+---+---+
|
460
|
+
EOF
|
461
|
+
end
|
462
|
+
|
463
|
+
it "should handle multiple colspan" do
|
464
|
+
@table.headings = [
|
465
|
+
'name',
|
466
|
+
{ :value => 'Values', :alignment => :right, :colspan => 2},
|
467
|
+
{ :value => 'Other values', :alignment => :right, :colspan => 2},
|
468
|
+
{ :value => 'Column 3', :alignment => :right, :colspan => 2}
|
469
|
+
]
|
470
|
+
|
471
|
+
3.times do |row_index|
|
472
|
+
row = ["row ##{row_index+1}"]
|
473
|
+
6.times do |i|
|
474
|
+
row << row_index*6 + i
|
475
|
+
end
|
476
|
+
@table.add_row(row)
|
477
|
+
end
|
478
|
+
|
479
|
+
@table.render.should == <<-EOF.deindent
|
480
|
+
+--------+----+----+-------+-------+-----+-----+
|
481
|
+
| name | Values | Other values | Column 3 |
|
482
|
+
+--------+----+----+-------+-------+-----+-----+
|
483
|
+
| row #1 | 0 | 1 | 2 | 3 | 4 | 5 |
|
484
|
+
| row #2 | 6 | 7 | 8 | 9 | 10 | 11 |
|
485
|
+
| row #3 | 12 | 13 | 14 | 15 | 16 | 17 |
|
486
|
+
+--------+----+----+-------+-------+-----+-----+
|
487
|
+
EOF
|
488
|
+
end
|
489
|
+
|
490
|
+
it "should render a table with only X cell borders" do
|
491
|
+
@table.style = {:border_x => "-", :border_y => "", :border_i => ""}
|
492
|
+
|
493
|
+
@table.headings = ['name', { :value => 'values', :alignment => :right, :colspan => 3}]
|
494
|
+
@table.headings = ['name', { :value => 'values', :colspan => 3}]
|
495
|
+
@table.rows = [['a', 1, 2, 3], ['b', 4, 5, 6], ['c', 7, 8, 9]]
|
496
|
+
|
497
|
+
@table.render.should == <<-EOF.strip
|
498
|
+
---------------
|
499
|
+
name values
|
500
|
+
---------------
|
501
|
+
a 1 2 3
|
502
|
+
b 4 5 6
|
503
|
+
c 7 8 9
|
504
|
+
---------------
|
505
|
+
EOF
|
506
|
+
end
|
507
|
+
|
508
|
+
it "should render a table without cell borders" do
|
509
|
+
@table.style = {:border_x => "", :border_y => "", :border_i => ""}
|
510
|
+
|
511
|
+
@table.headings = ['name', { :value => 'values', :alignment => :right, :colspan => 3}]
|
512
|
+
@table.headings = ['name', { :value => 'values', :colspan => 3}]
|
513
|
+
@table.rows = [['a', 1, 2, 3], ['b', 4, 5, 6], ['c', 7, 8, 9]]
|
514
|
+
|
515
|
+
@table.render.should == <<-EOF
|
516
|
+
|
517
|
+
name values
|
518
|
+
|
519
|
+
a 1 2 3
|
520
|
+
b 4 5 6
|
521
|
+
c 7 8 9
|
522
|
+
EOF
|
523
|
+
end
|
524
|
+
end
|
525
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
namespace :docs do
|
3
|
+
|
4
|
+
desc 'Remove rdoc products'
|
5
|
+
task :remove => [:clobber_docs]
|
6
|
+
|
7
|
+
desc 'Build docs, and open in browser for viewing (specify BROWSER)'
|
8
|
+
task :open => [:docs] do
|
9
|
+
browser = ENV["BROWSER"] || "safari"
|
10
|
+
sh "open -a #{browser} doc/index.html"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
desc "Run all specifications"
|
5
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
6
|
+
t.libs << "lib"
|
7
|
+
t.spec_opts = ["--color", "--require", "spec/spec_helper.rb"]
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :spec do
|
11
|
+
|
12
|
+
desc "Run all specifications verbosely"
|
13
|
+
Spec::Rake::SpecTask.new(:verbose) do |t|
|
14
|
+
t.libs << "lib"
|
15
|
+
t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Run specific specification verbosely (specify SPEC)"
|
19
|
+
Spec::Rake::SpecTask.new(:select) do |t|
|
20
|
+
t.libs << "lib"
|
21
|
+
t.spec_files = [ENV["SPEC"]]
|
22
|
+
t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{terminal-table}
|
5
|
+
s.version = "1.4.4"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["TJ Holowaychuk", "Scott J. Goldman"]
|
9
|
+
s.date = %q{2011-11-07}
|
10
|
+
s.description = %q{Simple, feature rich ascii table generation library}
|
11
|
+
s.email = %q{tj@vision-media.ca}
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/terminal-table.rb", "lib/terminal-table/cell.rb", "lib/terminal-table/core_ext.rb", "lib/terminal-table/import.rb", "lib/terminal-table/table.rb", "lib/terminal-table/table_helper.rb", "lib/terminal-table/version.rb", "lib/terminal-table/cell.rb", "lib/terminal-table/row.rb", "lib/terminal-table/separator.rb", "lib/terminal-table/style.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
|
13
|
+
s.files = ["History.rdoc", "Manifest", "README.rdoc", "Rakefile", "Todo.rdoc", "examples/examples.rb", "lib/terminal-table.rb", "lib/terminal-table/cell.rb", "lib/terminal-table/core_ext.rb", "lib/terminal-table/import.rb", "lib/terminal-table/table.rb", "lib/terminal-table/table_helper.rb", "lib/terminal-table/version.rb", "lib/terminal-table/cell.rb", "lib/terminal-table/row.rb", "lib/terminal-table/separator.rb", "lib/terminal-table/style.rb", "spec/cell_spec.rb", "spec/core_ext_spec.rb", "spec/import_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/table_spec.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake", "terminal-table.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/visionmedia/terminal-table}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Terminal-table", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{terminal-table}
|
18
|
+
s.rubygems_version = %q{1.3.5}
|
19
|
+
s.summary = %q{Simple, feature rich ascii table generation library}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
data/responses/addresses
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
2
|
+
<ns2:DescribeAddressesResponse xmlns:ns2="http://www.ibm.com/xmlns/b2b/cloud/api/2010-03-31">
|
3
|
+
|
4
|
+
<Address>
|
5
|
+
<Type>RESERVED</Type>
|
6
|
+
<IP>129.35.209.233</IP>
|
7
|
+
<Hostname>129.35.209.233</Hostname>
|
8
|
+
<Location>61</Location>
|
9
|
+
<ID>87832</ID>
|
10
|
+
<OfferingID>20001223</OfferingID>
|
11
|
+
<Mode>PRIMARY</Mode>
|
12
|
+
<State>2</State>
|
13
|
+
<owner>ibmcloud@cohesiveft.com</owner>
|
14
|
+
</Address>
|
15
|
+
<Address>
|
16
|
+
<Type>RESERVED</Type>
|
17
|
+
<IP>129.35.211.162</IP>
|
18
|
+
<Hostname>129.35.211.162</Hostname>
|
19
|
+
<Location>61</Location>
|
20
|
+
<ID>92738</ID>
|
21
|
+
<OfferingID>20001223</OfferingID>
|
22
|
+
<Mode>PRIMARY</Mode>
|
23
|
+
<State>2</State>
|
24
|
+
<owner>ibmcloud@cohesiveft.com</owner>
|
25
|
+
</Address>
|
26
|
+
</ns2:DescribeAddressesResponse>
|