cloudfactory 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.1 (2011-08-26)
2
+
3
+ * Fixed the bug of creating multiple output formats for a line. Issue #352
4
+
1
5
  ## 0.2.0 (2011-08-26)
2
6
 
3
7
  * Line creation when doing production and if the line is not created is now removed. Fixed #283
data/lib/cf/cli/line.rb CHANGED
@@ -267,14 +267,15 @@ module Cf # :nodoc: all
267
267
  end
268
268
 
269
269
  end
270
+ end
270
271
 
271
- output_formats = line_dump['output_formats'].presence
272
- if output_formats
273
- output_format = CF::OutputFormat.new(output_formats.merge(:line => line))
274
- say "Adding Output Format #{output_formats}", :green
275
- display_error(line_title, "#{output_format.errors}") if output_format.errors.present?
276
- end
272
+ output_formats = line_dump['output_formats'].presence
273
+ if output_formats
274
+ output_format = CF::OutputFormat.new(output_formats.merge(:line => line))
275
+ say "Adding Output Format #{output_formats}", :green
276
+ display_error(line_title, "#{output_format.errors}") if output_format.errors.present?
277
277
  end
278
+
278
279
  say " ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁", :white
279
280
  say "Line was successfully created.", :green
280
281
  say "View your line at http://#{CF.account_name}.#{CF.api_url.split("/")[-2]}/lines/#{CF.account_name}/#{line.title}", :yellow
@@ -63,7 +63,7 @@ module CF
63
63
  instruction = CustomTaskForm.new(form)
64
64
  end
65
65
 
66
- def to_s
66
+ def to_s # :nodoc:
67
67
  "{:title => #{self.title}, :instruction => #{self.instruction}, :raw_html => #{self.raw_html}, :raw_css => #{self.raw_css}, :raw_javascript => #{self.raw_javascript}, :errors => #{self.errors}}"
68
68
  end
69
69
  end
data/lib/cf/form_field.rb CHANGED
@@ -64,7 +64,7 @@ module CF
64
64
  end
65
65
  end
66
66
 
67
- def to_s
67
+ def to_s # :nodoc:
68
68
  "{:id => => #{self.id}, :label => #{self.label}, :field_type => #{self.field_type}, :required => #{self.required}, :errors => #{self.errors}}"
69
69
  end
70
70
  end
@@ -157,7 +157,7 @@ module CF
157
157
  self.skill_badges << resp.parsed_response['skill_badges']
158
158
  end
159
159
 
160
- def to_s
160
+ def to_s # :nodoc:
161
161
  "{:id => => #{self.id}, :number => #{self.number}, :reward => #{self.reward}, :stat_badge => #{self.stat_badge}, :skill_badges => #{self.skill_badges}, :errors => #{self.errors}}"
162
162
  end
163
163
  end
@@ -15,7 +15,10 @@ module CF
15
15
  attr_accessor :id
16
16
 
17
17
  # Title of Line with which input_format is associated
18
- attr_accessor :line_title, :errors
18
+ attr_accessor :line_title
19
+
20
+ # Contains error message if any
21
+ attr_accessor :errors
19
22
 
20
23
  # ==Initializes a new input_format
21
24
  # ===Usage Example:
@@ -82,7 +85,7 @@ module CF
82
85
  get("/lines/#{CF.account_name}/#{line.title.downcase}/input_formats.json")
83
86
  end
84
87
 
85
- def to_s
88
+ def to_s # :nodoc:
86
89
  "{:id => #{self.id}, :name => #{self.name}, :required => #{self.required}, :valid_type => #{self.valid_type}, :errors => #{self.errors}}"
87
90
  end
88
91
  end
data/lib/cf/line.rb CHANGED
@@ -26,7 +26,10 @@ module CF
26
26
  attr_accessor :input_formats
27
27
 
28
28
  # Contains Error Messages
29
- attr_accessor :errors, :output_formats
29
+ attr_accessor :errors
30
+
31
+ # output_formats of the final output for a line
32
+ attr_accessor :output_formats
30
33
 
31
34
  # ==Initializes a new line
32
35
  # ==Usage of line.new("line_name")
@@ -186,6 +189,10 @@ module CF
186
189
  @input_formats << input_formats_value
187
190
  end
188
191
 
192
+ # ==Specifies output format for a line
193
+ # ===Usage Example:
194
+ # output_format = CF::OutputFormat.new({:station_1 => [{:name => "First Name"}],:station_2 => [{:name => "Mobile", :except => true}]})
195
+ # line.output_formats output_format
189
196
  def output_formats output_format = nil
190
197
  if output_format
191
198
  settings = output_format.settings
@@ -205,7 +212,7 @@ module CF
205
212
  end
206
213
  end
207
214
 
208
- def output_formats=(output_format)
215
+ def output_formats=(output_format) # :nodoc:
209
216
  @output_formats = output_format
210
217
  end
211
218
  # ==Returns the content of a line by making an Api call
@@ -247,6 +254,8 @@ module CF
247
254
  # ==Returns all the lines of an account
248
255
  # ===Syntax for all method is
249
256
  # CF::Line.all
257
+ # OR
258
+ # CF:Line.all(:page => 1)
250
259
  def self.all(options={})
251
260
  page = options[:page].presence
252
261
  if page
@@ -326,6 +335,9 @@ module CF
326
335
  return resp
327
336
  end
328
337
 
338
+ # ==Return all the associated elements of a line
339
+ # ===Usage Example:
340
+ # line = CF::Line.inspect("line_title")
329
341
  def self.inspect(line_title)
330
342
  resp = get("/lines/#{CF.account_name}/#{line_title.downcase}/inspect.json")
331
343
  @errors = resp.error.message if resp.code != 200
@@ -3,9 +3,19 @@ module CF
3
3
  require 'httparty'
4
4
  include Client
5
5
 
6
- # type of the station, e.g. station = Station.new({:type => "Work"})
7
- attr_accessor :settings, :errors, :line, :output_formats_settings
6
+ # output_format settings
7
+ attr_accessor :settings
8
8
 
9
+ # Contains error message if any
10
+ attr_accessor :errors
11
+
12
+ # Line object for which output_format is specified
13
+ attr_accessor :line
14
+
15
+ # ==Specifies output format for a line
16
+ # ===Usage Example:
17
+ # output_format = CF::OutputFormat.new({:station_1 => [{:name => "First Name"}],:station_2 => [{:name => "Mobile", :except => true}]})
18
+ # line.output_formats output_format
9
19
  def initialize(options={})
10
20
  if !options.blank?
11
21
  @settings = options
@@ -89,7 +89,7 @@ module CF
89
89
  RobotWorker.new(options)
90
90
  end
91
91
 
92
- def to_s
92
+ def to_s # :nodoc:
93
93
  "{:number => #{self.number}, :reward => #{self.reward}, :type => #{self.type}, :settings => #{self.settings}, :errors => #{self.errors}}"
94
94
  end
95
95
  end
data/lib/cf/run.rb CHANGED
@@ -85,7 +85,10 @@ module CF
85
85
  def self.create(line, title, file)
86
86
  Run.new(line, title, file)
87
87
  end
88
-
88
+
89
+ # ==Adds units to an existing production Run
90
+ # ===Usage Example:
91
+ # units = CF::Run.add_units({:run_title => "title", :file => "path_of_file"})
89
92
  def self.add_units(options={})
90
93
  units = options[:units].presence
91
94
  run_title = options[:run_title].presence
@@ -190,24 +193,33 @@ module CF
190
193
  return resp
191
194
  end
192
195
 
196
+ # ==Returns progress of the production run
197
+ # ===Usage Example:
198
+ # progress = CF::Run.progress("run_title")
193
199
  def self.progress(run_title)
194
200
  get("/runs/#{CF.account_name}/#{run_title}/progress.json")
195
201
  end
196
202
 
197
- def progress
203
+ def progress # :nodoc:
198
204
  self.class.get("/runs/#{CF.account_name}/#{self.title}/progress.json")
199
205
  end
200
206
 
207
+ # ==Returns progress details of the production run
208
+ # ===Usage Example:
209
+ # progress = CF::Run.progress_details("run_title")
201
210
  def self.progress_details(run_title)
202
211
  resp = get("/runs/#{CF.account_name}/#{run_title}/details.json")
203
212
  return resp['progress_details']
204
213
  end
205
214
 
206
- def progress_details
215
+ def progress_details # :nodoc:
207
216
  resp = self.class.get("/runs/#{CF.account_name}/#{self.title}/details.json")
208
217
  return resp['progress_details']
209
218
  end
210
219
 
220
+ # ==Returns all runs of a line
221
+ # ===Usage Example:
222
+ # progress = CF::Run.all({:line_title => "line_title", :page => 1)
211
223
  def self.all(options={})
212
224
  page = options[:page].presence
213
225
  line_title = options[:line_title].presence
@@ -245,6 +257,9 @@ module CF
245
257
  end
246
258
  end
247
259
 
260
+ # ==Resumes the paused production run
261
+ # ===Usage Example:
262
+ # resume_run = CF::Run.resume("run_title")
248
263
  def self.resume(run_title)
249
264
  resp = post("/runs/#{CF.account_name}/#{run_title}/resume.json")
250
265
  @errors = resp.error.message if resp.code != 200
data/lib/cf/station.rb CHANGED
@@ -25,7 +25,10 @@ module CF
25
25
  attr_accessor :auto_judge
26
26
 
27
27
  # Contains Error Message if any
28
- attr_accessor :errors, :batch_size
28
+ attr_accessor :errors
29
+
30
+ # batch_size attribute, required for specifing size of batch
31
+ attr_accessor :batch_size
29
32
 
30
33
  # ==Initializes a new station
31
34
  # ===Usage Example:
@@ -300,7 +303,7 @@ module CF
300
303
  return resp
301
304
  end
302
305
 
303
- def to_s
306
+ def to_s # :nodoc:
304
307
  if self.type == "TournamentStation"
305
308
  "{:type => #{self.type}, :index => #{self.index}, :line_title => #{self.line_title}, :station_input_formats => #{self.station_input_formats}, :jury_worker => #{self.jury_worker}, auto_judge => #{self.auto_judge}, :errors => #{self.errors}}"
306
309
  else
data/lib/cf/task_form.rb CHANGED
@@ -106,7 +106,7 @@ module CF
106
106
  @form_fields << form_fields
107
107
  end
108
108
 
109
- def to_s
109
+ def to_s # :nodoc:
110
110
  "{:title => #{self.title}, :instruction => #{self.instruction}, :form_fields => #{self.form_fields}, :errors => #{self.errors}}"
111
111
  end
112
112
  end
data/lib/cf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CF # :nodoc: all
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudfactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-26 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
- requirement: &2154621780 !ruby/object:Gem::Requirement
16
+ requirement: &2161058340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154621780
24
+ version_requirements: *2161058340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &2154621280 !ruby/object:Gem::Requirement
27
+ requirement: &2161057840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2154621280
35
+ version_requirements: *2161057840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hashie
38
- requirement: &2154620780 !ruby/object:Gem::Requirement
38
+ requirement: &2161057340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2154620780
46
+ version_requirements: *2161057340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &2154620400 !ruby/object:Gem::Requirement
49
+ requirement: &2161056960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2154620400
57
+ version_requirements: *2161056960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: json
60
- requirement: &2154619940 !ruby/object:Gem::Requirement
60
+ requirement: &2161056500 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2154619940
68
+ version_requirements: *2161056500
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
- requirement: &2154619440 !ruby/object:Gem::Requirement
71
+ requirement: &2161056000 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0.14'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2154619440
79
+ version_requirements: *2161056000
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: highline
82
- requirement: &2157297800 !ruby/object:Gem::Requirement
82
+ requirement: &2161055580 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2157297800
90
+ version_requirements: *2161055580
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: httparty
93
- requirement: &2157297260 !ruby/object:Gem::Requirement
93
+ requirement: &2161055040 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0.7'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *2157297260
101
+ version_requirements: *2161055040
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: terminal-table
104
- requirement: &2157296760 !ruby/object:Gem::Requirement
104
+ requirement: &2161054540 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '1.4'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *2157296760
112
+ version_requirements: *2161054540
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: millisami-csv-hash
115
- requirement: &2157296380 !ruby/object:Gem::Requirement
115
+ requirement: &2161054160 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *2157296380
123
+ version_requirements: *2161054160
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: awesome_print
126
- requirement: &2157295920 !ruby/object:Gem::Requirement
126
+ requirement: &2161053700 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *2157295920
134
+ version_requirements: *2161053700
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: ruby-debug19
137
- requirement: &2157295500 !ruby/object:Gem::Requirement
137
+ requirement: &2161053280 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *2157295500
145
+ version_requirements: *2161053280
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: aruba
148
- requirement: &2157295080 !ruby/object:Gem::Requirement
148
+ requirement: &2161052860 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *2157295080
156
+ version_requirements: *2161052860
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: rails
159
- requirement: &2157294580 !ruby/object:Gem::Requirement
159
+ requirement: &2161052360 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ~>
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: 3.0.3
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *2157294580
167
+ version_requirements: *2161052360
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: bundler
170
- requirement: &2157294080 !ruby/object:Gem::Requirement
170
+ requirement: &2155103440 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ~>
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: 1.0.0
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *2157294080
178
+ version_requirements: *2155103440
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: generator_spec
181
- requirement: &2157293620 !ruby/object:Gem::Requirement
181
+ requirement: &2155102980 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ~>
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: 0.8.3
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *2157293620
189
+ version_requirements: *2155102980
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: rspec-rails
192
- requirement: &2157293240 !ruby/object:Gem::Requirement
192
+ requirement: &2155102600 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ! '>='
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: '0'
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *2157293240
200
+ version_requirements: *2155102600
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: cucumber
203
- requirement: &2157292780 !ruby/object:Gem::Requirement
203
+ requirement: &2155102140 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - ! '>='
@@ -208,10 +208,10 @@ dependencies:
208
208
  version: '0'
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *2157292780
211
+ version_requirements: *2155102140
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: rdoc
214
- requirement: &2157292280 !ruby/object:Gem::Requirement
214
+ requirement: &2155101640 !ruby/object:Gem::Requirement
215
215
  none: false
216
216
  requirements:
217
217
  - - ~>
@@ -219,10 +219,10 @@ dependencies:
219
219
  version: 3.5.3
220
220
  type: :development
221
221
  prerelease: false
222
- version_requirements: *2157292280
222
+ version_requirements: *2155101640
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: vcr
225
- requirement: &2157291860 !ruby/object:Gem::Requirement
225
+ requirement: &2155101220 !ruby/object:Gem::Requirement
226
226
  none: false
227
227
  requirements:
228
228
  - - ! '>='
@@ -230,10 +230,10 @@ dependencies:
230
230
  version: '0'
231
231
  type: :development
232
232
  prerelease: false
233
- version_requirements: *2157291860
233
+ version_requirements: *2155101220
234
234
  - !ruby/object:Gem::Dependency
235
235
  name: rake
236
- requirement: &2157291400 !ruby/object:Gem::Requirement
236
+ requirement: &2155100760 !ruby/object:Gem::Requirement
237
237
  none: false
238
238
  requirements:
239
239
  - - ! '>='
@@ -241,10 +241,10 @@ dependencies:
241
241
  version: '0'
242
242
  type: :development
243
243
  prerelease: false
244
- version_requirements: *2157291400
244
+ version_requirements: *2155100760
245
245
  - !ruby/object:Gem::Dependency
246
246
  name: webmock
247
- requirement: &2157290980 !ruby/object:Gem::Requirement
247
+ requirement: &2155100340 !ruby/object:Gem::Requirement
248
248
  none: false
249
249
  requirements:
250
250
  - - ! '>='
@@ -252,10 +252,10 @@ dependencies:
252
252
  version: '0'
253
253
  type: :development
254
254
  prerelease: false
255
- version_requirements: *2157290980
255
+ version_requirements: *2155100340
256
256
  - !ruby/object:Gem::Dependency
257
257
  name: timecop
258
- requirement: &2157290560 !ruby/object:Gem::Requirement
258
+ requirement: &2155099920 !ruby/object:Gem::Requirement
259
259
  none: false
260
260
  requirements:
261
261
  - - ! '>='
@@ -263,7 +263,7 @@ dependencies:
263
263
  version: '0'
264
264
  type: :development
265
265
  prerelease: false
266
- version_requirements: *2157290560
266
+ version_requirements: *2155099920
267
267
  description: A Ruby wrapper and CLI for to interact with Cloudfactory.com REST API
268
268
  email:
269
269
  - info@cloudfactory.com