cloudfactory 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,15 +10,11 @@ module CF
10
10
  sleep 1
11
11
  line = CF::Line.create(title,"Digitization") do |l|
12
12
  CF::InputFormat.new({:line => l, :name => "url", :valid_type => "url", :required => "true"})
13
- CF::Station.create({:line => l, :type => "work"}) do |s|
13
+ CF::Station.create({:line => l, :type => "robot"}) do |s|
14
14
  CF::RobotWorker.create({:station => s, :settings => {:document => ["{{url}}"], :sanitize => true}, :type => "sentiment_robot"})
15
15
  end
16
16
  end
17
17
  run = CF::Run.create(line, "run-#{title}", [{"url"=> "http://www.thehappyguy.com/happiness-self-help-book.html"}])
18
- sleep 10
19
- output = run.final_output
20
- output.first['sentiment_of_url'].should eql("positive")
21
- output.first['sentiment_relevance_of_url'].should eql(25.7649)
22
18
  line.stations.first.worker.class.should eql(CF::RobotWorker)
23
19
  line.stations.first.worker.reward.should eql(0.5)
24
20
  line.stations.first.worker.number.should eql(1)
@@ -34,17 +30,13 @@ module CF
34
30
  input_format = CF::InputFormat.new({:name => "url", :required => true, :valid_type => "url"})
35
31
  line.input_formats input_format
36
32
 
37
- station = CF::Station.new({:type => "work"})
33
+ station = CF::Station.new({:type => "robot"})
38
34
  line.stations station
39
35
 
40
36
  worker = CF::RobotWorker.new({:settings => {:document => ["{{url}}"], :sanitize => true}, :type => "sentiment_robot"})
41
37
  line.stations.first.worker = worker
42
38
 
43
39
  run = CF::Run.create(line, "run-#{title}", [{"url"=> "http://www.thehappyguy.com/happiness-self-help-book.html"}])
44
- sleep 10
45
- output = run.final_output
46
- output.first['sentiment_of_url'].should eql("positive")
47
- output.first['sentiment_relevance_of_url'].should eql(25.7649)
48
40
  line.stations.first.worker.class.should eql(CF::RobotWorker)
49
41
  line.stations.first.worker.reward.should eql(0.5)
50
42
  line.stations.first.worker.number.should eql(1)
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,7 @@ require 'rails'
7
7
  RSpec.configure do |config|
8
8
  config.before(:suite) do
9
9
  ::Debugger.start
10
- ::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings)
10
+ ::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings)
11
11
 
12
12
  API_CONFIG = YAML.load_file(File.expand_path("../../fixtures/api_credentials.yml", __FILE__))
13
13
  CF.configure do |config|
@@ -10,15 +10,11 @@ module CF
10
10
  sleep 1
11
11
  line = CF::Line.create(title,"Digitization") do |l|
12
12
  CF::InputFormat.new({:line => l, :name => "url", :valid_type => "url", :required => "true"})
13
- CF::Station.create({:line => l, :type => "work"}) do |s|
13
+ CF::Station.create({:line => l, :type => "robot"}) do |s|
14
14
  CF::RobotWorker.create({:station => s, :settings => {:url => ["{{url}}"], :max_retrieve => 5, :show_source_text => true}, :type => "term_extraction_robot"})
15
15
  end
16
16
  end
17
17
  run = CF::Run.create(line, "run-#{title}", [{"url"=> "http://www.sprout-technology.com"}])
18
- sleep 10
19
- output = run.final_output
20
- output.first['keyword_relevance_of_url'].should eql([96.7417, 57.3763, 56.8721, 54.6844, 17.7066])
21
- output.first['keywords_of_url'].should eql(["tech startup thing", "nights", "Nepal", "Canada", "U.S."])
22
18
  line.stations.first.worker.class.should eql(CF::RobotWorker)
23
19
  line.stations.first.worker.reward.should eql(0.5)
24
20
  line.stations.first.worker.number.should eql(1)
@@ -34,17 +30,13 @@ module CF
34
30
  input_format = CF::InputFormat.new({:name => "url", :required => true, :valid_type => "url"})
35
31
  line.input_formats input_format
36
32
 
37
- station = CF::Station.new({:type => "work"})
33
+ station = CF::Station.new({:type => "robot"})
38
34
  line.stations station
39
35
 
40
36
  worker = CF::RobotWorker.create({:settings => {:url => ["{{url}}"], :max_retrieve => 5, :show_source_text => true}, :type => "term_extraction_robot"})
41
37
  line.stations.first.worker = worker
42
38
 
43
39
  run = CF::Run.create(line, "run-#{title}", [{"url"=> "http://www.sprout-technology.com"}])
44
- sleep 10
45
- output = run.final_output
46
- output.first['keyword_relevance_of_url'].should eql([96.7417, 57.3763, 56.8721, 54.6844, 17.7066])
47
- output.first['keywords_of_url'].should eql(["tech startup thing", "nights", "Nepal", "Canada", "U.S."])
48
40
  line.stations.first.worker.class.should eql(CF::RobotWorker)
49
41
  line.stations.first.worker.reward.should eql(0.5)
50
42
  line.stations.first.worker.number.should eql(1)
@@ -20,16 +20,12 @@ module CF
20
20
  CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
21
21
  CF::CustomTaskForm.create({:station => s, :title => "Descibe about Company", :instruction => "Describe", :raw_html => html})
22
22
  end
23
- CF::Station.create({:line => self, :type => "work"}) do |s1|
23
+ CF::Station.create({:line => self, :type => "robot"}) do |s1|
24
24
  CF::RobotWorker.create({:station => s1, :type => "text_appending_robot", :settings => {:append => ["{{description}}"], :separator => "||"}})
25
25
  end
26
26
  end
27
27
  run = CF::Run.create(line, "text_appending_robot_run", [{"Company"=>"Sprout","Website"=>"www.sprout.com"}])
28
28
  # debugger
29
- output = run.final_output
30
- station_1_output = run.output(:station => 1)
31
- station_1_output.first['description'].should eql(["this is description", "about company", "the company works on", "Ruby on Rails"])
32
- output.first['append_description'].should eql("this is description||about company||the company works on||Ruby on Rails")
33
29
  line.stations.last.worker.class.should eql(CF::RobotWorker)
34
30
  line.stations.first.worker.reward.should eql(20)
35
31
  line.stations.first.worker.number.should eql(1)
@@ -62,7 +58,7 @@ module CF
62
58
  form = CF::CustomTaskForm.create({:title => "Descibe about Company", :instruction => "Describe", :raw_html => html})
63
59
  line.stations.first.form = form
64
60
 
65
- station = CF::Station.new({:type => "work"})
61
+ station = CF::Station.new({:type => "robot"})
66
62
  line.stations station
67
63
 
68
64
  worker_1 = CF::RobotWorker.create({:type => "text_appending_robot", :settings => {:append => ["{{description}}"], :separator => "||"}})
@@ -70,10 +66,7 @@ module CF
70
66
 
71
67
  run = CF::Run.create(line, "text_appending_robot_run_1", [{"Company"=>"Sprout","Website"=>"www.sprout.com"}])
72
68
  # debugger
73
- output = run.final_output
74
- station_1_output = run.output(:station => 1)
75
- station_1_output.first['description'].should eql(["this is description", "about company", "the company works on", "Ruby on Rails"])
76
- output.first['append_description'].should eql("this is description||about company||the company works on||Ruby on Rails")
69
+
77
70
  line.stations.last.worker.class.should eql(CF::RobotWorker)
78
71
  line.stations.first.worker.reward.should eql(20)
79
72
  line.stations.first.worker.number.should eql(1)
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.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-20 00:00:00.000000000Z
12
+ date: 2011-12-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
- requirement: &2154442200 !ruby/object:Gem::Requirement
16
+ requirement: &2157585220 !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: *2154442200
24
+ version_requirements: *2157585220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &2154439280 !ruby/object:Gem::Requirement
27
+ requirement: &2157582740 !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: *2154439280
35
+ version_requirements: *2157582740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hashie
38
- requirement: &2154432420 !ruby/object:Gem::Requirement
38
+ requirement: &2157581420 !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: *2154432420
46
+ version_requirements: *2157581420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &2154430300 !ruby/object:Gem::Requirement
49
+ requirement: &2157570220 !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: *2154430300
57
+ version_requirements: *2157570220
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: json
60
- requirement: &2154425660 !ruby/object:Gem::Requirement
60
+ requirement: &2157569340 !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: *2154425660
68
+ version_requirements: *2157569340
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
- requirement: &2154424520 !ruby/object:Gem::Requirement
71
+ requirement: &2157568080 !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: *2154424520
79
+ version_requirements: *2157568080
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: highline
82
- requirement: &2154423500 !ruby/object:Gem::Requirement
82
+ requirement: &2157567440 !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: *2154423500
90
+ version_requirements: *2157567440
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: httparty
93
- requirement: &2154421200 !ruby/object:Gem::Requirement
93
+ requirement: &2157566640 !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: *2154421200
101
+ version_requirements: *2157566640
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: terminal-table
104
- requirement: &2154419020 !ruby/object:Gem::Requirement
104
+ requirement: &2157566020 !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: *2154419020
112
+ version_requirements: *2157566020
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: millisami-csv-hash
115
- requirement: &2154417960 !ruby/object:Gem::Requirement
115
+ requirement: &2157565640 !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: *2154417960
123
+ version_requirements: *2157565640
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: awesome_print
126
- requirement: &2154415540 !ruby/object:Gem::Requirement
126
+ requirement: &2157565160 !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: *2154415540
134
+ version_requirements: *2157565160
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: ruby-debug19
137
- requirement: &2154413760 !ruby/object:Gem::Requirement
137
+ requirement: &2157564720 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,21 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *2154413760
145
+ version_requirements: *2157564720
146
+ - !ruby/object:Gem::Dependency
147
+ name: ruby-debug19
148
+ requirement: &2157564280 !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: *2157564280
146
157
  - !ruby/object:Gem::Dependency
147
158
  name: aruba
148
- requirement: &2154411120 !ruby/object:Gem::Requirement
159
+ requirement: &2157563800 !ruby/object:Gem::Requirement
149
160
  none: false
150
161
  requirements:
151
162
  - - ! '>='
@@ -153,10 +164,10 @@ dependencies:
153
164
  version: '0'
154
165
  type: :development
155
166
  prerelease: false
156
- version_requirements: *2154411120
167
+ version_requirements: *2157563800
157
168
  - !ruby/object:Gem::Dependency
158
169
  name: rails
159
- requirement: &2154410380 !ruby/object:Gem::Requirement
170
+ requirement: &2157563160 !ruby/object:Gem::Requirement
160
171
  none: false
161
172
  requirements:
162
173
  - - ~>
@@ -164,10 +175,10 @@ dependencies:
164
175
  version: 3.0.3
165
176
  type: :development
166
177
  prerelease: false
167
- version_requirements: *2154410380
178
+ version_requirements: *2157563160
168
179
  - !ruby/object:Gem::Dependency
169
180
  name: bundler
170
- requirement: &2154400200 !ruby/object:Gem::Requirement
181
+ requirement: &2157562480 !ruby/object:Gem::Requirement
171
182
  none: false
172
183
  requirements:
173
184
  - - ~>
@@ -175,10 +186,10 @@ dependencies:
175
186
  version: 1.0.0
176
187
  type: :development
177
188
  prerelease: false
178
- version_requirements: *2154400200
189
+ version_requirements: *2157562480
179
190
  - !ruby/object:Gem::Dependency
180
191
  name: generator_spec
181
- requirement: &2154398740 !ruby/object:Gem::Requirement
192
+ requirement: &2157561800 !ruby/object:Gem::Requirement
182
193
  none: false
183
194
  requirements:
184
195
  - - ~>
@@ -186,10 +197,10 @@ dependencies:
186
197
  version: 0.8.3
187
198
  type: :development
188
199
  prerelease: false
189
- version_requirements: *2154398740
200
+ version_requirements: *2157561800
190
201
  - !ruby/object:Gem::Dependency
191
202
  name: rspec-rails
192
- requirement: &2154397760 !ruby/object:Gem::Requirement
203
+ requirement: &2157560980 !ruby/object:Gem::Requirement
193
204
  none: false
194
205
  requirements:
195
206
  - - ! '>='
@@ -197,10 +208,10 @@ dependencies:
197
208
  version: '0'
198
209
  type: :development
199
210
  prerelease: false
200
- version_requirements: *2154397760
211
+ version_requirements: *2157560980
201
212
  - !ruby/object:Gem::Dependency
202
213
  name: cucumber
203
- requirement: &2154396360 !ruby/object:Gem::Requirement
214
+ requirement: &2157559980 !ruby/object:Gem::Requirement
204
215
  none: false
205
216
  requirements:
206
217
  - - ! '>='
@@ -208,10 +219,10 @@ dependencies:
208
219
  version: '0'
209
220
  type: :development
210
221
  prerelease: false
211
- version_requirements: *2154396360
222
+ version_requirements: *2157559980
212
223
  - !ruby/object:Gem::Dependency
213
224
  name: rdoc
214
- requirement: &2154395020 !ruby/object:Gem::Requirement
225
+ requirement: &2157558000 !ruby/object:Gem::Requirement
215
226
  none: false
216
227
  requirements:
217
228
  - - ~>
@@ -219,10 +230,10 @@ dependencies:
219
230
  version: 3.5.3
220
231
  type: :development
221
232
  prerelease: false
222
- version_requirements: *2154395020
233
+ version_requirements: *2157558000
223
234
  - !ruby/object:Gem::Dependency
224
235
  name: vcr
225
- requirement: &2154394240 !ruby/object:Gem::Requirement
236
+ requirement: &2157554800 !ruby/object:Gem::Requirement
226
237
  none: false
227
238
  requirements:
228
239
  - - ! '>='
@@ -230,10 +241,10 @@ dependencies:
230
241
  version: '0'
231
242
  type: :development
232
243
  prerelease: false
233
- version_requirements: *2154394240
244
+ version_requirements: *2157554800
234
245
  - !ruby/object:Gem::Dependency
235
246
  name: rake
236
- requirement: &2154383680 !ruby/object:Gem::Requirement
247
+ requirement: &2157552220 !ruby/object:Gem::Requirement
237
248
  none: false
238
249
  requirements:
239
250
  - - ! '>='
@@ -241,10 +252,10 @@ dependencies:
241
252
  version: '0'
242
253
  type: :development
243
254
  prerelease: false
244
- version_requirements: *2154383680
255
+ version_requirements: *2157552220
245
256
  - !ruby/object:Gem::Dependency
246
257
  name: webmock
247
- requirement: &2154377880 !ruby/object:Gem::Requirement
258
+ requirement: &2157551500 !ruby/object:Gem::Requirement
248
259
  none: false
249
260
  requirements:
250
261
  - - ! '>='
@@ -252,10 +263,10 @@ dependencies:
252
263
  version: '0'
253
264
  type: :development
254
265
  prerelease: false
255
- version_requirements: *2154377880
266
+ version_requirements: *2157551500
256
267
  - !ruby/object:Gem::Dependency
257
268
  name: timecop
258
- requirement: &2154369400 !ruby/object:Gem::Requirement
269
+ requirement: &2157550320 !ruby/object:Gem::Requirement
259
270
  none: false
260
271
  requirements:
261
272
  - - ! '>='
@@ -263,7 +274,7 @@ dependencies:
263
274
  version: '0'
264
275
  type: :development
265
276
  prerelease: false
266
- version_requirements: *2154369400
277
+ version_requirements: *2157550320
267
278
  description: A Ruby wrapper and CLI for to interact with Cloudfactory.com REST API
268
279
  email:
269
280
  - info@cloudfactory.com
@@ -444,3 +455,4 @@ test_files:
444
455
  - spec/task_form_spec.rb
445
456
  - spec/term_extraction_robot_spec.rb
446
457
  - spec/text_appending_robot_spec.rb
458
+ has_rdoc: