cloudfactory 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/Gemfile +10 -0
- data/README.md +44 -0
- data/Rakefile +40 -0
- data/bin/cf +8 -0
- data/cf.gemspec +76 -0
- data/example/google_translate_app/Gemfile +12 -0
- data/example/google_translate_app/config.ru +7 -0
- data/example/google_translate_app/google_translate_input.csv +4 -0
- data/example/google_translate_app/google_translator_app.rb +53 -0
- data/example/google_translate_app/views/index.haml +2 -0
- data/example/google_translate_app/views/layout.haml +7 -0
- data/example/google_translate_app/views/run.haml +4 -0
- data/example/google_translate_app/views/style.sass +2 -0
- data/example/human_worker_app/Gemfile +12 -0
- data/example/human_worker_app/config.ru +7 -0
- data/example/human_worker_app/human_worker_app.rb +55 -0
- data/example/human_worker_app/human_worker_input.csv +5 -0
- data/example/human_worker_app/public/app.js +12 -0
- data/example/human_worker_app/temp.csv +3 -0
- data/example/human_worker_app/views/index.haml +15 -0
- data/example/human_worker_app/views/layout.haml +10 -0
- data/example/human_worker_app/views/result.haml +18 -0
- data/example/human_worker_app/views/run.haml +12 -0
- data/example/human_worker_app/views/style.sass +25 -0
- data/example/sample_yaml_files/concept_tagging_robot.yaml +18 -0
- data/example/sample_yaml_files/content_scraping_robot.yaml +19 -0
- data/example/sample_yaml_files/entity_extraction_robot.yaml +18 -0
- data/example/sample_yaml_files/google_translate_robot.yaml +20 -0
- data/example/sample_yaml_files/image_processing_robot.yaml +20 -0
- data/example/sample_yaml_files/keyword_matching_and_text_extraction_robot.yaml +26 -0
- data/example/sample_yaml_files/mailer_robot.yaml +21 -0
- data/example/sample_yaml_files/media_converter_robot.yaml +21 -0
- data/example/sample_yaml_files/media_splitting_robot.yaml +20 -0
- data/example/sample_yaml_files/multiple_skill_badge.yaml +75 -0
- data/example/sample_yaml_files/sentiment_robot.yaml +19 -0
- data/example/sample_yaml_files/skill_badge.yaml +56 -0
- data/example/sample_yaml_files/stat_badge.yaml +40 -0
- data/example/sample_yaml_files/term_extraction_robot.yaml +20 -0
- data/example/sample_yaml_files/tournament_station_and_form_fields.yaml +40 -0
- data/features/form_generation.feature +46 -0
- data/features/form_preview.feature +98 -0
- data/features/line_creation.feature +99 -0
- data/features/line_deletion.feature +50 -0
- data/features/line_generation.feature +57 -0
- data/features/run.feature +141 -0
- data/features/support/cli_steps.rb +16 -0
- data/features/support/env.rb +23 -0
- data/features/target_url.feature +82 -0
- data/fixtures/api_credentials_example.yml +4 -0
- data/fixtures/input_data/media_converter_robot.csv +2 -0
- data/fixtures/input_data/test.csv +2 -0
- data/lib/cf.rb +94 -0
- data/lib/cf/account.rb +32 -0
- data/lib/cf/cli.rb +52 -0
- data/lib/cf/cli/config.rb +87 -0
- data/lib/cf/cli/form.rb +82 -0
- data/lib/cf/cli/line.rb +237 -0
- data/lib/cf/cli/production.rb +62 -0
- data/lib/cf/cli/templates/css_file.css.erb +22 -0
- data/lib/cf/cli/templates/form_preview.html.erb +17 -0
- data/lib/cf/cli/templates/html_file.html.erb +21 -0
- data/lib/cf/cli/templates/js_file.js.erb +18 -0
- data/lib/cf/cli/templates/line.tt +55 -0
- data/lib/cf/cli/templates/sample-line/form.css +27 -0
- data/lib/cf/cli/templates/sample-line/form.html +26 -0
- data/lib/cf/cli/templates/sample-line/form.js +7 -0
- data/lib/cf/cli/templates/sample-line/line.yml.erb +67 -0
- data/lib/cf/cli/templates/sample-line/sample-line.csv +3 -0
- data/lib/cf/client.rb +56 -0
- data/lib/cf/custom_task_form.rb +136 -0
- data/lib/cf/department.rb +24 -0
- data/lib/cf/final_output.rb +20 -0
- data/lib/cf/form_field.rb +62 -0
- data/lib/cf/human_worker.rb +67 -0
- data/lib/cf/input_format.rb +134 -0
- data/lib/cf/line.rb +231 -0
- data/lib/cf/robot_worker.rb +31 -0
- data/lib/cf/run.rb +158 -0
- data/lib/cf/station.rb +340 -0
- data/lib/cf/task_form.rb +147 -0
- data/lib/cf/version.rb +3 -0
- data/lib/generators/cf/form/form_generator.rb +55 -0
- data/lib/generators/cf/form/templates/cf_form.html.erb +11 -0
- data/lib/generators/cf/install/install_generator.rb +22 -0
- data/lib/generators/cf/install/templates/README +13 -0
- data/lib/generators/cf/install/templates/cloud_factory.rb +7 -0
- data/spec/account_spec.rb +11 -0
- data/spec/badge_spec.rb +88 -0
- data/spec/concept_tagging_robot_spec.rb +54 -0
- data/spec/config_spec.rb +20 -0
- data/spec/content_scraping_robot_spec.rb +58 -0
- data/spec/custom_task_form_spec.rb +190 -0
- data/spec/department_spec.rb +14 -0
- data/spec/entity_extraction_robot_spec.rb +56 -0
- data/spec/form_field_spec.rb +126 -0
- data/spec/generators/form_generator_spec.rb +60 -0
- data/spec/generators/install_generator_spec.rb +35 -0
- data/spec/google_translate_robot_spec.rb +64 -0
- data/spec/human_worker_spec.rb +118 -0
- data/spec/image_processing_robot_spec.rb +56 -0
- data/spec/input_format_spec.rb +113 -0
- data/spec/keyword_matching_and_text_extraction_robot_spec.rb +73 -0
- data/spec/line_spec.rb +338 -0
- data/spec/mailer_robot_spec.rb +62 -0
- data/spec/media_converter_robot_spec.rb +72 -0
- data/spec/media_splitting_robot_spec.rb +62 -0
- data/spec/run_spec.rb +298 -0
- data/spec/sentiment_robot_spec.rb +56 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/station_spec.rb +256 -0
- data/spec/task_form_spec.rb +96 -0
- data/spec/term_extraction_robot_spec.rb +58 -0
- data/spec/text_appending_robot_spec.rb +86 -0
- metadata +472 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
api_key: f488a62d0307e79ec4f1e6131fa220be47e83d44
|
2
|
+
title: manish
|
3
|
+
description: Describe the line what its purpose is and what it does. You got the idea, right?
|
4
|
+
department: Survey
|
5
|
+
|
6
|
+
input_formats:
|
7
|
+
- name: url
|
8
|
+
required: true
|
9
|
+
valid_type: url
|
10
|
+
|
11
|
+
stations:
|
12
|
+
- station:
|
13
|
+
station_index: 1
|
14
|
+
station_type: work
|
15
|
+
worker:
|
16
|
+
worker_type: term_extraction_robot
|
17
|
+
settings:
|
18
|
+
url: ["{url}"]
|
19
|
+
max_retrieve: 5
|
20
|
+
show_source_text: true
|
@@ -0,0 +1,40 @@
|
|
1
|
+
api_key: f488a62d0307e79ec4f1e6131fa220be47e83d44
|
2
|
+
title: manish
|
3
|
+
description: Describe the line what its purpose is and what it does. You got the idea, right?
|
4
|
+
department: Survey
|
5
|
+
|
6
|
+
input_formats:
|
7
|
+
- name: text
|
8
|
+
required: true
|
9
|
+
valid_type: general
|
10
|
+
|
11
|
+
stations:
|
12
|
+
- station:
|
13
|
+
station_index: 1
|
14
|
+
station_type: tournament
|
15
|
+
jury_worker:
|
16
|
+
max_judges: 10
|
17
|
+
auto_judge:
|
18
|
+
enabled: true
|
19
|
+
worker:
|
20
|
+
worker_type: human
|
21
|
+
num_workers: 1
|
22
|
+
reward: 10
|
23
|
+
task_form:
|
24
|
+
form_title: Enter text from a business card image
|
25
|
+
instruction: Description should be written here
|
26
|
+
form_fields:
|
27
|
+
- label: First Name
|
28
|
+
required: true
|
29
|
+
field_type: SA
|
30
|
+
- label: Middle Name
|
31
|
+
field_type: SA
|
32
|
+
- label: Last Name
|
33
|
+
required: true
|
34
|
+
field_type: SA
|
35
|
+
- label: Gender
|
36
|
+
required: true
|
37
|
+
field_type: RB
|
38
|
+
option_values:
|
39
|
+
- male
|
40
|
+
- female
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Feature: Generate Custom Task Forms
|
2
|
+
In order to generate custom task forms
|
3
|
+
As a CLI user
|
4
|
+
I want to generate custom task forms
|
5
|
+
|
6
|
+
Scenario: Scaffolding a custom task form but outside of the line directory
|
7
|
+
Given a directory named "brandiator"
|
8
|
+
When I run `cf form generate --station 1 --labels company,website --fields ceo:string email:email`
|
9
|
+
Then the output should contain:
|
10
|
+
"""
|
11
|
+
The current directory is not a valid line directory.
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scenario: Warn if the given station already has the form created
|
15
|
+
Given an empty file named "brandiator/line.yml"
|
16
|
+
And a directory named "brandiator/station_2"
|
17
|
+
And I cd to "brandiator"
|
18
|
+
When I run `cf form generate --station 2 --labels company,website --fields ceo:string email:email`
|
19
|
+
Then the output should contain:
|
20
|
+
"""
|
21
|
+
Skipping the form generation because the station_2 already exists with its custom form.
|
22
|
+
Use the -f flag to force it to overwrite or check and delete the station_2 folder manually.
|
23
|
+
"""
|
24
|
+
|
25
|
+
Scenario: Overwrite forcefully if the given station already has the form created
|
26
|
+
Given an empty file named "brandiator/line.yml"
|
27
|
+
And a directory named "brandiator/station_2"
|
28
|
+
And I cd to "brandiator"
|
29
|
+
When I run `cf form generate --force --station 2 --labels company,website --fields ceo:string email:email`
|
30
|
+
Then the output should contain:
|
31
|
+
"""
|
32
|
+
A new custom task form created in station_2.
|
33
|
+
"""
|
34
|
+
|
35
|
+
Scenario: Scaffolding a custom task form with all the parameters and valid conditions
|
36
|
+
Given an empty file named "brandiator/line.yml"
|
37
|
+
And I cd to "brandiator"
|
38
|
+
When I run `cf form generate --station 2 --labels company,website --fields ceo:string email:email`
|
39
|
+
Then the following files should exist:
|
40
|
+
| station_2/form.html |
|
41
|
+
| station_2/form.css |
|
42
|
+
| station_2/form.js |
|
43
|
+
And the output should contain:
|
44
|
+
"""
|
45
|
+
A new custom task form created in station_2.
|
46
|
+
"""
|
@@ -0,0 +1,98 @@
|
|
1
|
+
Feature: Preview a generated custom form
|
2
|
+
In order to preview the generated custom task form
|
3
|
+
As a CLI user
|
4
|
+
I want to preview the custom task form
|
5
|
+
|
6
|
+
Scenario: Previewing the generated form in the browser with the non-existing station
|
7
|
+
Given an empty file named "brandiator/line.yml"
|
8
|
+
And I cd to "brandiator"
|
9
|
+
When I run `cf form preview --station 2`
|
10
|
+
Then the output should contain:
|
11
|
+
"""
|
12
|
+
No form exists for station 2
|
13
|
+
Generate the form for station 2 and then preview it.
|
14
|
+
"""
|
15
|
+
|
16
|
+
Scenario: Trying to preview the form for the empty station directory
|
17
|
+
Given an empty file named "brandiator/line.yml"
|
18
|
+
And a directory named "station_2"
|
19
|
+
And I cd to "brandiator"
|
20
|
+
When I run `cf form preview --station 2`
|
21
|
+
Then the output should contain:
|
22
|
+
"""
|
23
|
+
No form exists for station 2
|
24
|
+
Generate the form for station 2 and then preview it.
|
25
|
+
"""
|
26
|
+
@announce
|
27
|
+
Scenario: Previewing the generated form in the browser
|
28
|
+
Given an empty file named "brandiator/line.yml"
|
29
|
+
# And a directory named "station_2"
|
30
|
+
And I cd to "brandiator"
|
31
|
+
|
32
|
+
And a file named "station_2/form.html" with:
|
33
|
+
"""
|
34
|
+
<div id="my_form_instructions" class="brandiator cf_form_instruction">
|
35
|
+
<ul>
|
36
|
+
<li>Sample bullet list of instruction</li>
|
37
|
+
<li>Sample bullet list of instruction</li>
|
38
|
+
<li>Sample bullet list of instruction</li>
|
39
|
+
</ul>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div id="my_form" class="brandiator cf_form_content">
|
43
|
+
<label>{{company}}</label>
|
44
|
+
<label>{{website}}</label>
|
45
|
+
|
46
|
+
<div id = "field-panel">
|
47
|
+
<p><label>ceo</label><input id="ceo" type="text" name="output[ceo]" data-valid-type="string" /></p>
|
48
|
+
<p><label>email</label><input id="email" type="text" name="output[email]" data-valid-type="email" /></p>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
"""
|
52
|
+
And a file named "station_2/form.css" with:
|
53
|
+
"""
|
54
|
+
body { background-color: #777; color: #fefefe; }
|
55
|
+
"""
|
56
|
+
And a file named "station_2/form.js" with:
|
57
|
+
"""
|
58
|
+
alert("Hey! If you see me, it means I work.")
|
59
|
+
"""
|
60
|
+
|
61
|
+
When I run `cf form preview --station 2`
|
62
|
+
Then a file named "station_2/form_preview.html" should exist
|
63
|
+
# And the file ".cf/brandiator/my_form_preview.html" should contain:
|
64
|
+
# """
|
65
|
+
# <!DOCTYPE html>
|
66
|
+
# <html lang="en">
|
67
|
+
# <head>
|
68
|
+
# <title>Form Preview</title>
|
69
|
+
# <link href="my_form.css" media="screen, projection" rel="stylesheet" type="text/css" />
|
70
|
+
# <script src="my_formjs" type="text/javascript"></script>
|
71
|
+
# </head>
|
72
|
+
# <!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
|
73
|
+
# <!--[if IE 7 ]> <body class="ie7"> <![endif]-->
|
74
|
+
# <!--[if IE 8 ]> <body class="ie8"> <![endif]-->
|
75
|
+
# <!--[if IE 9 ]> <body class="ie9"> <![endif]-->
|
76
|
+
# <!--[if (gt IE 9)|!(IE)]><!--> <body> <!--<![endif]-->
|
77
|
+
# <div id="container">
|
78
|
+
# <div id="my_form_instructions" class="brandiator cf_form_instruction">
|
79
|
+
# <ul>
|
80
|
+
# <li>Sample bullet list of instruction</li>
|
81
|
+
# <li>Sample bullet list of instruction</li>
|
82
|
+
# <li>Sample bullet list of instruction</li>
|
83
|
+
# </ul>
|
84
|
+
# </div>
|
85
|
+
#
|
86
|
+
# <div id="my_form" class="brandiator cf_form_content">
|
87
|
+
# <label>{{company}}</label>
|
88
|
+
# <label>{{website}}</label>
|
89
|
+
#
|
90
|
+
# <div id = "field-panel">
|
91
|
+
# <p><label>ceo</label><input id="ceo" type="text" name="output[ceo]" data-valid-type="string" /></p>
|
92
|
+
# <p><label>email</label><input id="email" type="text" name="output[email]" data-valid-type="email" /></p>
|
93
|
+
# </div>
|
94
|
+
# </div>
|
95
|
+
# </div>
|
96
|
+
# </body>
|
97
|
+
# </html>
|
98
|
+
# """
|
@@ -0,0 +1,99 @@
|
|
1
|
+
Feature: Create a new line on CF
|
2
|
+
In order to create a line with the generated line file
|
3
|
+
As a CLI user
|
4
|
+
I want to create a line via cli for the line
|
5
|
+
|
6
|
+
@announce, @too_slow_process
|
7
|
+
Scenario: Creating a Line
|
8
|
+
Given a file named ".cf_credentials" with:
|
9
|
+
"""
|
10
|
+
---
|
11
|
+
:target_url: http://lvh.me:3000/api/
|
12
|
+
:api_version: v1
|
13
|
+
|
14
|
+
"""
|
15
|
+
And a file named "brandiator/line.yml" with:
|
16
|
+
"""
|
17
|
+
api_key: 89ceebf739adbf59d34911f4f28b2fa0e1564fb6
|
18
|
+
title: brandiator
|
19
|
+
description: Describe the line what its purpose is and what it does. You got the idea, right?
|
20
|
+
department: Survey
|
21
|
+
|
22
|
+
input_formats:
|
23
|
+
- name: company
|
24
|
+
required: true
|
25
|
+
valid_type: general
|
26
|
+
- name: website
|
27
|
+
required: false
|
28
|
+
valid_type: url
|
29
|
+
|
30
|
+
stations:
|
31
|
+
- station:
|
32
|
+
station_index: 1
|
33
|
+
station_type: work
|
34
|
+
worker:
|
35
|
+
worker_type: human
|
36
|
+
num_workers: 2
|
37
|
+
reward: 5
|
38
|
+
task_form:
|
39
|
+
form_title: Enter text from a business card image for TASKFORM
|
40
|
+
instruction: Read the business card image and the fill the fields for TASKFORM
|
41
|
+
form_fields:
|
42
|
+
- label: CEO Name
|
43
|
+
field_type: short_answer
|
44
|
+
required: true
|
45
|
+
- label: CEO Email
|
46
|
+
field_type: email
|
47
|
+
required: true
|
48
|
+
- station:
|
49
|
+
station_index: 2
|
50
|
+
station_type: work
|
51
|
+
worker:
|
52
|
+
worker_type: human
|
53
|
+
num_workers: 1
|
54
|
+
reward: 3
|
55
|
+
custom_task_form:
|
56
|
+
form_title: Enter text from a business card image for CUSTOMTASKFORM
|
57
|
+
instruction: Read the business card image and the fill the fields for CUSTOMTASKFORM
|
58
|
+
html: form.html
|
59
|
+
css: form.css
|
60
|
+
js: form.js
|
61
|
+
"""
|
62
|
+
And a file named "brandiator/station_2/form.html" with:
|
63
|
+
"""
|
64
|
+
<div id="my_form_instructions" class="brandiator cf_form_instruction">
|
65
|
+
<ul>
|
66
|
+
<li>Sample bullet list of instruction</li>
|
67
|
+
</ul>
|
68
|
+
</div>
|
69
|
+
<div id="my_form" class="brandiator cf_form_content">
|
70
|
+
<label>{{company}}</label>
|
71
|
+
<label>{{website}}</label>
|
72
|
+
<div id = "field-panel">
|
73
|
+
<p><label>ceo</label><input id="ceo" type="text" name="output[ceo]" data-valid-type="string" /></p>
|
74
|
+
<p><label>email</label><input id="email" type="text" name="output[email]" data-valid-type="email" /></p>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
"""
|
78
|
+
And a file named "brandiator/station_2/form.css" with:
|
79
|
+
"""
|
80
|
+
body { background: #e0e0d8; color: #000; }
|
81
|
+
"""
|
82
|
+
And a file named "brandiator/station_2/form.js" with:
|
83
|
+
"""
|
84
|
+
<script type="text/javascript">
|
85
|
+
$(document).ready(function(){
|
86
|
+
//do your stuff here
|
87
|
+
});
|
88
|
+
</script>
|
89
|
+
"""
|
90
|
+
|
91
|
+
And I cd to "brandiator"
|
92
|
+
When I run `cf line create`
|
93
|
+
Then the output should match:
|
94
|
+
"""
|
95
|
+
Congrats! brandiator was successfully created.
|
96
|
+
View your line at http://taken.lvh.me:3000/lines/taken/brandiator
|
97
|
+
Now you can do production runs with: cf production start <your_run_title>
|
98
|
+
Note: Make sure your-run-title.csv file is in the input directory.
|
99
|
+
"""
|
@@ -0,0 +1,50 @@
|
|
1
|
+
Feature: Deleting a line on CF
|
2
|
+
In order to delete a line
|
3
|
+
As a CLI user
|
4
|
+
I want to delete a line via cli for the line
|
5
|
+
|
6
|
+
@announce, @too_slow_process
|
7
|
+
Scenario: Creating then deleting a Line
|
8
|
+
Given a file named ".cf_credentials" with:
|
9
|
+
"""
|
10
|
+
---
|
11
|
+
:target_url: http://lvh.me:3000/api/
|
12
|
+
:api_version: v1
|
13
|
+
"""
|
14
|
+
And a file named "brandiator/line.yml" with:
|
15
|
+
"""
|
16
|
+
api_key: 89ceebf739adbf59d34911f4f28b2fa0e1564fb6
|
17
|
+
title: brandiator-deletion
|
18
|
+
description: Describe the line what its purpose is and what it does. You got the idea, right?
|
19
|
+
department: Survey
|
20
|
+
input_formats:
|
21
|
+
- name: company
|
22
|
+
required: true
|
23
|
+
valid_type: general
|
24
|
+
stations:
|
25
|
+
- station:
|
26
|
+
station_index: 1
|
27
|
+
station_type: work
|
28
|
+
worker:
|
29
|
+
worker_type: human
|
30
|
+
num_workers: 2
|
31
|
+
reward: 5
|
32
|
+
task_form:
|
33
|
+
form_title: Enter text from a business card image for TASKFORM
|
34
|
+
instruction: Read the business card image and the fill the fields for TASKFORM
|
35
|
+
form_fields:
|
36
|
+
- label: CEO Name
|
37
|
+
field_type: short_answer
|
38
|
+
required: true
|
39
|
+
"""
|
40
|
+
And I cd to "brandiator"
|
41
|
+
When I run `cf line create`
|
42
|
+
Then the output should match:
|
43
|
+
"""
|
44
|
+
Congrats! brandiator-deletion was successfully created.
|
45
|
+
"""
|
46
|
+
When I run `cf line delete`
|
47
|
+
Then the output should match:
|
48
|
+
"""
|
49
|
+
The line brandiator-deletion is deleted successfully!
|
50
|
+
"""
|
@@ -0,0 +1,57 @@
|
|
1
|
+
Feature: Line manage
|
2
|
+
In order to generate a line yaml scaffold
|
3
|
+
As a CLI user
|
4
|
+
I want to scaffold a line
|
5
|
+
|
6
|
+
@slow_process, @announce
|
7
|
+
Scenario: Scaffolding a line
|
8
|
+
Given a directory named "cf_apps"
|
9
|
+
And I cd to "cf_apps"
|
10
|
+
When I run `cf line generate brandiator`
|
11
|
+
Then a file named "brandiator/line.yml" should exist
|
12
|
+
And the following files should exist:
|
13
|
+
| brandiator/station_2/form.html |
|
14
|
+
| brandiator/station_2/form.css |
|
15
|
+
| brandiator/station_2/form.js |
|
16
|
+
| brandiator/input/brandiator.csv |
|
17
|
+
|
18
|
+
And a directory named "brandiator/output" should exist
|
19
|
+
And the output should contain:
|
20
|
+
"""
|
21
|
+
A new line named brandiator generated.
|
22
|
+
Modify the brandiator/line.yml file and you can create this line with: cf line create
|
23
|
+
"""
|
24
|
+
|
25
|
+
@slow_process, @no-clobber
|
26
|
+
Scenario: Overwriting with a --force (-f) flag for an existing line
|
27
|
+
And I cd to "cf_apps"
|
28
|
+
When I run `cf line generate brandiator`
|
29
|
+
Then the output should match:
|
30
|
+
"""
|
31
|
+
Skipping brandiator/line.yml because it already exists.
|
32
|
+
Use the -f flag to force it to overwrite or check and delete it manually.
|
33
|
+
"""
|
34
|
+
|
35
|
+
Scenario: No api_key present in the yaml file
|
36
|
+
Given a file named ".cf_credentials" with:
|
37
|
+
"""
|
38
|
+
---
|
39
|
+
:target_url: http://lvh.me:3000/api/
|
40
|
+
:api_version: v1
|
41
|
+
|
42
|
+
"""
|
43
|
+
|
44
|
+
Given a directory named "cf_apps"
|
45
|
+
And I cd to "cf_apps"
|
46
|
+
And a file named "brandiator/line.yml" with:
|
47
|
+
"""
|
48
|
+
api_key:
|
49
|
+
title: brandiator
|
50
|
+
department: Survey
|
51
|
+
"""
|
52
|
+
And I cd to "brandiator"
|
53
|
+
When I run `cf line create`
|
54
|
+
Then the output should match:
|
55
|
+
"""
|
56
|
+
The api_key is missing in the line.yml file
|
57
|
+
"""
|
@@ -0,0 +1,141 @@
|
|
1
|
+
Feature: Create a production run on CF
|
2
|
+
In order to create a run with the generated line
|
3
|
+
As a CLI user
|
4
|
+
I want to make a production run
|
5
|
+
|
6
|
+
@announce
|
7
|
+
Scenario: Creating a production run without run title
|
8
|
+
Given an empty file named "brandiator/line.yml"
|
9
|
+
And I cd to "brandiator"
|
10
|
+
When I run `cf production start`
|
11
|
+
Then the output should contain:
|
12
|
+
"""
|
13
|
+
The run title is required to start the production.
|
14
|
+
"""
|
15
|
+
|
16
|
+
@announce
|
17
|
+
Scenario: Warn about the missing input/input_data.csv input file if not present
|
18
|
+
Given a file named "brandiator/line.yml" with:
|
19
|
+
"""
|
20
|
+
api_key: 89ceebf739adbf59d34911f4f28b2fa0e1564fb6
|
21
|
+
title: brandiator
|
22
|
+
"""
|
23
|
+
And I cd to "brandiator"
|
24
|
+
And a directory named "input"
|
25
|
+
When I run `cf production start my_first-run -i input_data.csv`
|
26
|
+
Then the output should contain:
|
27
|
+
"""
|
28
|
+
The input data csv file named input/input_data.csv is missing.
|
29
|
+
"""
|
30
|
+
|
31
|
+
@announce
|
32
|
+
Scenario: Warn about the missing input/run-title.csv input file if not present when -i optional value is not passed
|
33
|
+
Given a file named "brandiator/line.yml" with:
|
34
|
+
"""
|
35
|
+
api_key: 89ceebf739adbf59d34911f4f28b2fa0e1564fb6
|
36
|
+
title: brandiator
|
37
|
+
"""
|
38
|
+
And I cd to "brandiator"
|
39
|
+
And a directory named "input"
|
40
|
+
When I run `cf production start my_first-run`
|
41
|
+
Then the output should contain:
|
42
|
+
"""
|
43
|
+
The input data csv file named input/my-first-run.csv is missing.
|
44
|
+
"""
|
45
|
+
|
46
|
+
@announce, @too_slow_process
|
47
|
+
Scenario: Starting a production
|
48
|
+
Given a file named ".cf_credentials" with:
|
49
|
+
"""
|
50
|
+
---
|
51
|
+
:target_url: http://lvh.me:3000/api/
|
52
|
+
:api_version: v1
|
53
|
+
|
54
|
+
"""
|
55
|
+
And a file named "brandiator/station_2/form.html" with:
|
56
|
+
"""
|
57
|
+
<div id="my_form_instructions" class="brandiator cf_form_instruction">
|
58
|
+
<ul>
|
59
|
+
<li>Sample bullet list of instruction</li>
|
60
|
+
</ul>
|
61
|
+
</div>
|
62
|
+
<div id="my_form" class="brandiator cf_form_content">
|
63
|
+
<label>{{company}}</label>
|
64
|
+
<label>{{website}}</label>
|
65
|
+
<div id = "field-panel">
|
66
|
+
<p><label>ceo</label><input id="ceo" type="text" name="output[ceo]" data-valid-type="string" /></p>
|
67
|
+
<p><label>email</label><input id="email" type="text" name="output[email]" data-valid-type="email" /></p>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
"""
|
71
|
+
And a file named "brandiator/station_2/form.css" with:
|
72
|
+
"""
|
73
|
+
body { background: #e0e0d8; color: #000; }
|
74
|
+
"""
|
75
|
+
And a file named "brandiator/station_2/form.js" with:
|
76
|
+
"""
|
77
|
+
<script type="text/javascript">
|
78
|
+
$(document).ready(function(){
|
79
|
+
//do your stuff here
|
80
|
+
});
|
81
|
+
</script>
|
82
|
+
"""
|
83
|
+
|
84
|
+
And a file named "brandiator/line.yml" with:
|
85
|
+
"""
|
86
|
+
api_key: 89ceebf739adbf59d34911f4f28b2fa0e1564fb6
|
87
|
+
title: brandiator
|
88
|
+
description: Describe the line what its purpose is and what it does. You got the idea, right?
|
89
|
+
department: Survey
|
90
|
+
|
91
|
+
input_formats:
|
92
|
+
- name: company
|
93
|
+
required: true
|
94
|
+
valid_type: general
|
95
|
+
- name: website
|
96
|
+
required: false
|
97
|
+
valid_type: url
|
98
|
+
|
99
|
+
stations:
|
100
|
+
- station:
|
101
|
+
station_index: 1
|
102
|
+
station_type: work
|
103
|
+
worker:
|
104
|
+
worker_type: human
|
105
|
+
num_workers: 2
|
106
|
+
reward: 5
|
107
|
+
task_form:
|
108
|
+
form_title: Enter text from a business card image for TASKFORM
|
109
|
+
instruction: Read the business card image and the fill the fields for TASKFORM
|
110
|
+
form_fields:
|
111
|
+
- label: CEO Name
|
112
|
+
field_type: short_answer
|
113
|
+
required: true
|
114
|
+
- label: CEO Email
|
115
|
+
field_type: email
|
116
|
+
required: true
|
117
|
+
- station:
|
118
|
+
station_index: 2
|
119
|
+
station_type: work
|
120
|
+
worker:
|
121
|
+
worker_type: human
|
122
|
+
num_workers: 1
|
123
|
+
reward: 3
|
124
|
+
custom_task_form:
|
125
|
+
form_title: Enter text from a business card image for CUSTOMTASKFORM
|
126
|
+
instruction: Read the business card image and the fill the fields for CUSTOMTASKFORM
|
127
|
+
html: form.html
|
128
|
+
css: form.css
|
129
|
+
js: form.js
|
130
|
+
"""
|
131
|
+
And a file named "brandiator/input/my-run-title.csv" with:
|
132
|
+
"""
|
133
|
+
company,website,meta_data_company
|
134
|
+
Apple,apple.com,Apple
|
135
|
+
"""
|
136
|
+
And I cd to "brandiator"
|
137
|
+
When I run `cf production start my_run_title`
|
138
|
+
Then the output should match:
|
139
|
+
"""
|
140
|
+
A run with title my-run-title using the line brandiator was successfully created.
|
141
|
+
"""
|