cloudfactory 0.0.13 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -6
- data/bin/cf +4 -0
- data/cf.gemspec +5 -1
- data/features/login.feature +30 -0
- data/features/support/env.rb +5 -0
- data/features/target_url.feature +4 -4
- data/lib/cf/account.rb +2 -6
- data/lib/cf/cli.rb +91 -11
- data/lib/cf/cli/config.rb +34 -10
- data/lib/cf/cli/line.rb +6 -4
- data/lib/cf/cli/production.rb +14 -3
- data/lib/cf/cli/templates/sample-line/line.yml.erb +9 -9
- data/lib/cf/final_output.rb +1 -1
- data/lib/cf/run.rb +16 -13
- data/lib/cf/version.rb +1 -1
- data/lib/generators/cf/install/templates/cloud_factory.rb +1 -0
- data/spec/run_spec.rb +1 -1
- data/spec/spec_helper.rb +10 -15
- metadata +189 -226
data/Gemfile
CHANGED
@@ -1,10 +1,4 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
group :development do
|
4
|
-
gem 'aruba', :git => 'git://github.com/cucumber/aruba.git'
|
5
|
-
gem 'ruby-debug', :platforms => :mri_18
|
6
|
-
gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :mri_19
|
7
|
-
end
|
8
|
-
|
9
3
|
# All the gem's dependencies are specified in cloud_factory.gemspec
|
10
4
|
gemspec
|
data/bin/cf
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
|
4
|
+
require 'rubygems' unless defined?(Gem)
|
5
|
+
require 'bundler/setup'
|
6
|
+
|
3
7
|
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
|
4
8
|
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
5
9
|
|
data/cf.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
3
|
require "cf/version"
|
4
4
|
|
@@ -61,9 +61,13 @@ EOF
|
|
61
61
|
s.add_dependency "rest-client"
|
62
62
|
s.add_dependency "json"
|
63
63
|
s.add_dependency "thor", "~> 0.14.6"
|
64
|
+
s.add_dependency "highline"
|
64
65
|
s.add_dependency "httparty", "~> 0.7.8"
|
65
66
|
s.add_dependency "terminal-table", "~> 1.4.2"
|
67
|
+
s.add_dependency "millisami-csv-hash"
|
66
68
|
|
69
|
+
|
70
|
+
s.add_development_dependency "aruba"
|
67
71
|
s.add_development_dependency "rails", "~> 3.0.3"
|
68
72
|
s.add_development_dependency "bundler", "~> 1.0.0"
|
69
73
|
s.add_development_dependency "generator_spec", "~> 0.8.3"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Login credentials
|
2
|
+
In order to talk with cloud factory
|
3
|
+
As a CLI user
|
4
|
+
I want to setup login credentials
|
5
|
+
|
6
|
+
@announce, @moderate_slow_process
|
7
|
+
Scenario: Login
|
8
|
+
When I run `cf login` interactively
|
9
|
+
And I type "sachin@sproutify.com"
|
10
|
+
And I type "secret"
|
11
|
+
Then the output should match:
|
12
|
+
"""
|
13
|
+
john@doe.com and secret
|
14
|
+
"""
|
15
|
+
|
16
|
+
# Then the file ".cf_credentials" should contain exactly:
|
17
|
+
# """
|
18
|
+
# ---
|
19
|
+
# :target_url: http://sandbox.staging.cloudfactory.com/api/
|
20
|
+
# :api_version: v1
|
21
|
+
# :api_key: theapikey
|
22
|
+
#
|
23
|
+
# """
|
24
|
+
# Then the output should match:
|
25
|
+
# """
|
26
|
+
#
|
27
|
+
# Your cloudfactory credentials saved.
|
28
|
+
# All the best to run your factory on top of CloudFactory.com
|
29
|
+
#
|
30
|
+
# """
|
data/features/support/env.rb
CHANGED
@@ -8,6 +8,11 @@ Before('@slow_process') do
|
|
8
8
|
@aruba_timeout_seconds = 4
|
9
9
|
end
|
10
10
|
|
11
|
+
Before('@moderate_slow_process') do
|
12
|
+
@aruba_io_wait_seconds = 2
|
13
|
+
@aruba_timeout_seconds = 2
|
14
|
+
end
|
15
|
+
|
11
16
|
Before('@too_slow_process') do
|
12
17
|
@aruba_io_wait_seconds = 4
|
13
18
|
@aruba_timeout_seconds = 50
|
data/features/target_url.feature
CHANGED
@@ -16,7 +16,7 @@ Feature: Target URL
|
|
16
16
|
"""
|
17
17
|
|
18
18
|
Your cloudfactory target url is saved as http://sandbox.staging.cloudfactory.com/api/
|
19
|
-
|
19
|
+
Since the target is changed, do cf login to set the valid api key.
|
20
20
|
|
21
21
|
"""
|
22
22
|
|
@@ -33,7 +33,7 @@ Feature: Target URL
|
|
33
33
|
"""
|
34
34
|
|
35
35
|
Your cloudfactory target url is saved as http://lvh.me:3000/api/
|
36
|
-
|
36
|
+
Since the target is changed, do cf login to set the valid api key.
|
37
37
|
|
38
38
|
"""
|
39
39
|
|
@@ -50,7 +50,7 @@ Feature: Target URL
|
|
50
50
|
"""
|
51
51
|
|
52
52
|
Your cloudfactory target url is saved as http://sandbox.cloudfactory.com/api/
|
53
|
-
|
53
|
+
Since the target is changed, do cf login to set the valid api key.
|
54
54
|
|
55
55
|
"""
|
56
56
|
|
@@ -76,7 +76,7 @@ Feature: Target URL
|
|
76
76
|
"""
|
77
77
|
|
78
78
|
You have not set the target url yet.
|
79
|
-
Set
|
79
|
+
Set it with: cf target staging or see the help.
|
80
80
|
|
81
81
|
"""
|
82
82
|
|
data/lib/cf/account.rb
CHANGED
@@ -20,12 +20,8 @@ module CF
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def login(email, passwd)
|
23
|
-
resp = post('/
|
24
|
-
|
25
|
-
if resp.code != 200
|
26
|
-
self.errors = resp.error.message
|
27
|
-
end
|
28
|
-
return resp
|
23
|
+
resp = post('/account_login.json', :user => {:email => email, :password => passwd})
|
24
|
+
resp
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
data/lib/cf/cli.rb
CHANGED
@@ -6,6 +6,8 @@ end
|
|
6
6
|
require 'yaml'
|
7
7
|
require 'fileutils'
|
8
8
|
require 'thor'
|
9
|
+
require "highline/import"
|
10
|
+
require 'csv-hash'
|
9
11
|
|
10
12
|
require File.expand_path('../../cf', __FILE__) #=> requiring the gem
|
11
13
|
require 'active_support/core_ext/string/inflections'
|
@@ -17,26 +19,53 @@ require "#{cli_directory}/line"
|
|
17
19
|
require "#{cli_directory}/form"
|
18
20
|
require "#{cli_directory}/production"
|
19
21
|
|
22
|
+
if ENV['TEST']
|
23
|
+
require 'ruby-debug'
|
24
|
+
end
|
25
|
+
|
20
26
|
module Cf
|
21
27
|
class CLI < Thor
|
22
28
|
include Thor::Actions
|
23
29
|
include Cf::Config
|
24
30
|
|
25
|
-
desc "
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
desc "login", "Setup the cloudfactory credentials"
|
32
|
+
def login
|
33
|
+
email = ask("Enter your email:")
|
34
|
+
passwd = ask_password("Enter the password: ")
|
35
|
+
|
36
|
+
set_target_uri(false)
|
37
|
+
resp = CF::Account.login(email, passwd)
|
38
|
+
if resp.error.blank? and resp.api_key.present?
|
39
|
+
File.open(config_file, 'w') {|f| f.write({ :target_url => CF.api_url, :api_version => CF.api_version, :api_key => resp.api_key }.to_yaml) }
|
40
|
+
say("\nNow you're logged in.\nTo get started, run cf help\n", :green)
|
31
41
|
else
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
42
|
+
say("\n#{resp.error.message}\nTry again with valid one.\n", :red)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
no_tasks do
|
47
|
+
def ask_password(message)
|
48
|
+
::HighLine.new.ask(message) do |q|
|
49
|
+
q.echo = false
|
37
50
|
end
|
38
51
|
end
|
39
52
|
end
|
53
|
+
|
54
|
+
# desc "target", "Setup the cloudfactory credentials. e.g. cf target staging #=> http://sandbox.staging.cloudfactory.com (options: staging/development/production)"
|
55
|
+
# def target(target_url=nil)
|
56
|
+
# if target_url.present?
|
57
|
+
# target_set_url = save_config(target_url)
|
58
|
+
# say("\nYour cloudfactory target url is saved as #{target_set_url}", :green)
|
59
|
+
# say("Since the target is changed, do cf login to set the valid api key.\n", :green)
|
60
|
+
# else
|
61
|
+
# if load_config
|
62
|
+
# say("\n#{load_config[:target_url]}\n", :green)
|
63
|
+
# else
|
64
|
+
# say("\nYou have not set the target url yet.", :red)
|
65
|
+
# say("Set it with: cf target staging or see the help.\n", :red)
|
66
|
+
# end
|
67
|
+
# end
|
68
|
+
# end
|
40
69
|
|
41
70
|
desc "line", "Commands to manage the Lines. For more info, cf line help"
|
42
71
|
subcommand "line", Cf::Line
|
@@ -48,5 +77,56 @@ module Cf
|
|
48
77
|
# cannot use Run for the class name coz its a reserved word for Thor
|
49
78
|
# later it can be replaced with hacked millisami-thor version of the thor library with run-time dependency via Bundler
|
50
79
|
subcommand "production", Cf::Production
|
80
|
+
|
81
|
+
desc "output <run-title>", "Get the output of run. For more info, cf output help"
|
82
|
+
method_option :station_index, :type => :numeric, :aliases => "-s", :desc => "the index of the station"
|
83
|
+
def output(run_title=nil)
|
84
|
+
if run_title.present?
|
85
|
+
run_title = run_title.parameterize
|
86
|
+
line_source = Dir.pwd
|
87
|
+
yaml_source = "#{line_source}/line.yml"
|
88
|
+
|
89
|
+
unless File.exist?(yaml_source)
|
90
|
+
say "The line.yml file does not exist in this directory", :red
|
91
|
+
return
|
92
|
+
end
|
93
|
+
|
94
|
+
set_target_uri(false)
|
95
|
+
if set_api_key(yaml_source)
|
96
|
+
CF.account_name = CF::Account.info.name if CF.account_name.blank?
|
97
|
+
run = CF::Run.find(run_title)
|
98
|
+
if run.errors.blank?
|
99
|
+
say("Fetching output for run: #{run_title}", :green)
|
100
|
+
|
101
|
+
if options[:station_index].present?
|
102
|
+
# Output for specific station
|
103
|
+
output = CF::Run.output(:title => run_title, :station => options[:station_index])
|
104
|
+
else
|
105
|
+
# Ouput for the whole production run
|
106
|
+
output = CF::Run.final_output(run_title)
|
107
|
+
end
|
108
|
+
res_array = []
|
109
|
+
output.each do |o|
|
110
|
+
res_array << o.to_hash
|
111
|
+
end
|
112
|
+
csv_str = CSVHash(res_array,res_array.first.keys)
|
113
|
+
|
114
|
+
FileUtils.mkdir("#{line_source}/output") unless Dir.exist?("#{line_source}/output")
|
115
|
+
csv_file_name = "#{line_source}/output/#{run_title}-#{Time.now.strftime("%e %b %Y %H:%m-%S%p").parameterize}.csv"
|
116
|
+
File.open(csv_file_name, 'w') {|f| f.write(csv_str) }
|
117
|
+
say("Output saved at #{csv_file_name}\n", :yellow)
|
118
|
+
else
|
119
|
+
say("Error: #{run.errors.inspect}")
|
120
|
+
end
|
121
|
+
|
122
|
+
else
|
123
|
+
say("\nAPI key missing in line.yml file\n")
|
124
|
+
end
|
125
|
+
else
|
126
|
+
say("\nThe run title must be provided to get the output.", :red)
|
127
|
+
say("\te.g. cf output my-run-title\n", :yellow)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
51
131
|
end
|
52
132
|
end
|
data/lib/cf/cli/config.rb
CHANGED
@@ -25,33 +25,57 @@ module Cf
|
|
25
25
|
CF.api_url = load_config[:target_url]
|
26
26
|
CF.api_version = load_config[:api_version]
|
27
27
|
else
|
28
|
-
CF.api_url = "http://sandbox.cloudfactory.com/api"
|
28
|
+
CF.api_url = "http://sandbox.cloudfactory.com/api/"
|
29
29
|
CF.api_version = "v1"
|
30
30
|
end
|
31
31
|
|
32
32
|
if live
|
33
|
-
if CF.api_url == "http://sandbox.staging.cloudfactory.com/api"
|
34
|
-
CF.api_url = "http://staging.cloudfactory.com/api"
|
33
|
+
if CF.api_url == "http://sandbox.staging.cloudfactory.com/api/"
|
34
|
+
CF.api_url = "http://staging.cloudfactory.com/api/"
|
35
35
|
end
|
36
|
-
|
37
|
-
if CF.api_url == "http://sandbox.cloudfactory.com/api"
|
38
|
-
CF.api_url = "http://cloudfactory.com/api"
|
36
|
+
|
37
|
+
if CF.api_url == "http://sandbox.cloudfactory.com/api/"
|
38
|
+
CF.api_url = "http://cloudfactory.com/api/"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def get_api_key(
|
44
|
-
|
45
|
-
|
43
|
+
def get_api_key(yaml_file)
|
44
|
+
yml = YAML::load(File.read(yaml_file))
|
45
|
+
yml['api_key'].presence
|
46
46
|
end
|
47
47
|
|
48
48
|
def set_api_key(yaml_source)
|
49
|
-
# debugger
|
50
49
|
api_key = get_api_key(yaml_source)
|
51
50
|
if api_key.blank?
|
51
|
+
|
52
|
+
# api_key not found in line.yml file, so checking in the .cf_credentials
|
53
|
+
if File.exist?(config_file)
|
54
|
+
api_key = get_api_key(config_file)
|
55
|
+
if api_key.blank?
|
56
|
+
return false
|
57
|
+
else
|
58
|
+
CF.api_key = api_key if CF.api_key.blank?
|
59
|
+
raise "Error: Invalid api key => #{CF.api_key} for target #{CF.api_url}" unless CF::Account.valid?
|
60
|
+
return true
|
61
|
+
end
|
62
|
+
end
|
52
63
|
return false
|
53
64
|
else
|
54
65
|
CF.api_key = api_key if CF.api_key.blank?
|
66
|
+
# Do check whether the api_key is valid by calling the CF::Account#valid?
|
67
|
+
# Cf::CliError.new("Error: Invalid api key => #{CF.api_key}") unless CF::Account.valid?
|
68
|
+
raise "Error: Invalid api key => #{CF.api_key} for target #{CF.api_url}" unless CF::Account.valid?
|
69
|
+
|
70
|
+
# Check the file ~/.cf_credentials. If it exists, check for the api_key line. If not set, then append it.
|
71
|
+
# This is needed for certain commands like cf line list, cf production list <line-title>
|
72
|
+
# if File.exist?(config_file)
|
73
|
+
# yaml_dump = YAML::load(File.read(config_file))
|
74
|
+
# unless yaml_dump.keys.include?(:api_key)
|
75
|
+
# open(config_file, 'a') {|f| f.puts ":api_key: #{api_key}"}
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
|
55
79
|
return true
|
56
80
|
end
|
57
81
|
end
|
data/lib/cf/cli/line.rb
CHANGED
@@ -228,10 +228,12 @@ module Cf
|
|
228
228
|
end
|
229
229
|
|
230
230
|
# helper function like in Rails
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
231
|
+
no_tasks {
|
232
|
+
def pluralize(number, text)
|
233
|
+
return text.pluralize if number != 1
|
234
|
+
text
|
235
|
+
end
|
236
|
+
}
|
235
237
|
|
236
238
|
end
|
237
239
|
end
|
data/lib/cf/cli/production.rb
CHANGED
@@ -42,17 +42,28 @@ module Cf
|
|
42
42
|
CF.account_name = CF::Account.info.name
|
43
43
|
line = CF::Line.info(line_title)
|
44
44
|
input_data_path = "#{Dir.pwd}/#{input_data}"
|
45
|
+
|
45
46
|
if line.error.blank?
|
46
47
|
say "Creating a production run with title #{run_title}", :green
|
47
48
|
run = CF::Run.create(line, run_title, input_data_path)
|
48
|
-
|
49
|
+
if run.errors.blank?
|
50
|
+
say("A run with title #{run.title} created successfully.", :green)
|
51
|
+
say("View your run at http://#{CF.account_name}.#{CF.api_url.split("/")[-2]}/runs/#{CF.account_name}/#{run.title}", :yellow)
|
52
|
+
else
|
53
|
+
say("Error: #{run.errors}", :red)
|
54
|
+
end
|
49
55
|
else
|
50
56
|
# first create line
|
51
|
-
say
|
57
|
+
say("Creating the line: #{line_title}", :green)
|
52
58
|
Cf::Line.new.create
|
53
59
|
# Now create a production run with the title run_title
|
54
60
|
run = CF::Run.create(CF::Line.info(line_title), run_title, input_data_path)
|
55
|
-
|
61
|
+
if run.errors.blank?
|
62
|
+
say("A run with title #{run.title} using the line #{line_title} was successfully created.", :red)
|
63
|
+
else
|
64
|
+
say("Error: #{run.errors}", :red)
|
65
|
+
end
|
66
|
+
|
56
67
|
end
|
57
68
|
else
|
58
69
|
say "The api_key is missing in the line.yml file", :red
|
@@ -4,26 +4,26 @@
|
|
4
4
|
# See docs at http://developers.cloudfactory.com/lines/yaml.html
|
5
5
|
# See examples at http://developers.cloudfactory.com/lines/examples.html
|
6
6
|
# Fill in your API key below! (See http://developers.cloudfactory.com/account#settings)
|
7
|
-
api_key: fill_in_your_api_key
|
7
|
+
# api_key: fill_in_your_api_key #(optional) If this key is not in this file, then make sure that you did `cf login` after installing the gem.
|
8
8
|
title: <%= title.underscore.dasherize %>
|
9
9
|
description: A sample line generated via CLI to use both standard and custom form.
|
10
|
-
department: Data Processing #
|
10
|
+
department: Data Processing #Digitization, Web Research, etc
|
11
11
|
|
12
|
-
|
12
|
+
## Line Input Formats (see http://developers.cloudfactory.com/lines/yaml.html#line-input-formats)
|
13
13
|
# input_formats:
|
14
14
|
# - name: company
|
15
15
|
# required: true
|
16
|
-
# valid_type: general #
|
16
|
+
# valid_type: general #general, url, date, email, ...
|
17
17
|
|
18
|
-
|
18
|
+
## Stations (see http://developers.cloudfactory.com/lines/yaml.html#stations)
|
19
19
|
# stations:
|
20
20
|
# # Sample Station #1: Human Worker
|
21
21
|
# - station:
|
22
22
|
# station_index: 1
|
23
|
-
# station_type: work #
|
23
|
+
# station_type: work #work, improve, tournament
|
24
24
|
# # Worker (see http://developers.cloudfactory.com/lines/yaml.html#workers)
|
25
25
|
# worker:
|
26
|
-
# worker_type: human #
|
26
|
+
# worker_type: human #"human" or name of robot (google_translate_robot, etc)
|
27
27
|
# num_workers: 2
|
28
28
|
# reward: 5
|
29
29
|
# # Task Form (see http://developers.cloudfactory.com/lines/yaml.html#task-forms)
|
@@ -41,10 +41,10 @@ department: Data Processing # Digitization, Web Research, etc
|
|
41
41
|
# # Sample Station #2: Robot Worker
|
42
42
|
# - station:
|
43
43
|
# station_index: 2
|
44
|
-
# station_type: work #
|
44
|
+
# station_type: work #work, improve, tournament
|
45
45
|
# # Worker (see http://developers.cloudfactory.com/lines/yaml.html#workers)
|
46
46
|
# worker:
|
47
|
-
# worker_type: google_translate_robot #
|
47
|
+
# worker_type: google_translate_robot #"human" or name of robot (content_scraper_robot, etc)
|
48
48
|
# # Robot Settings (see http://developers.cloudfactory.com/robots/)
|
49
49
|
# settings:
|
50
50
|
# data: ["{sentence}"]
|
data/lib/cf/final_output.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module CF
|
2
2
|
class FinalOutput
|
3
3
|
include Client
|
4
|
-
attr_accessor :
|
4
|
+
attr_accessor :final_outputs, :unit_id, :final_output, :output
|
5
5
|
|
6
6
|
# def self.get_result(run_id)
|
7
7
|
# resp = get("/runs/#{run_id}/results.json")
|
data/lib/cf/run.rb
CHANGED
@@ -118,25 +118,28 @@ module CF
|
|
118
118
|
|
119
119
|
def self.final_output(title)
|
120
120
|
resp = get("/runs/#{CF.account_name}/#{title.downcase}/output.json")
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
end
|
132
|
-
|
121
|
+
return resp['output']
|
122
|
+
# debugger
|
123
|
+
# @final_output =[]
|
124
|
+
# resp['output'].each do |r|
|
125
|
+
# result = FinalOutput.new()
|
126
|
+
# r.to_hash.each_pair do |k,v|
|
127
|
+
# result.send("#{k}=",v) if result.respond_to?(k)
|
128
|
+
# end
|
129
|
+
# # if result.final_output == nil
|
130
|
+
# # result.final_output = resp.output
|
131
|
+
# # end
|
132
|
+
# @final_output << result
|
133
|
+
# end
|
134
|
+
# debugger
|
135
|
+
# return @final_output
|
133
136
|
end
|
134
137
|
|
135
138
|
def self.output(options={})
|
136
139
|
station_no = options[:station]
|
137
140
|
title = options[:title]
|
138
141
|
resp = get("/runs/#{CF.account_name}/#{title.downcase}/output/#{station_no}.json")
|
139
|
-
return resp['output']
|
142
|
+
return resp['output']
|
140
143
|
end
|
141
144
|
|
142
145
|
def output(options={})
|
data/lib/cf/version.rb
CHANGED
data/spec/run_spec.rb
CHANGED
@@ -170,8 +170,8 @@ module CF
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
end
|
173
|
+
|
173
174
|
run = CF::Run.create(line, "run-name-run", File.expand_path("../../fixtures/input_data/test.csv", __FILE__))
|
174
|
-
# debugger
|
175
175
|
@final_output = run.final_output
|
176
176
|
@final_output.first.meta_data['company'].should eql("Apple")
|
177
177
|
@final_output.first.final_outputs.last['first-name'].should eql("Bob")
|
data/spec/spec_helper.rb
CHANGED
@@ -1,24 +1,19 @@
|
|
1
1
|
require 'cf'
|
2
2
|
require 'vcr'
|
3
3
|
require 'webmock'
|
4
|
+
require 'ruby-debug'
|
4
5
|
|
5
6
|
RSpec.configure do |config|
|
6
|
-
config.before(:
|
7
|
-
|
8
|
-
|
9
|
-
# TEST=true bundle exec rspec spec/.....
|
10
|
-
if ENV['TEST']
|
11
|
-
require 'ruby-debug'
|
12
|
-
::Debugger.start
|
13
|
-
::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings)
|
7
|
+
config.before(:suite) do
|
8
|
+
::Debugger.start
|
9
|
+
::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings)
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
11
|
+
API_CONFIG = YAML.load_file(File.expand_path("../../fixtures/api_credentials.yml", __FILE__))
|
12
|
+
CF.configure do |config|
|
13
|
+
config.account_name = API_CONFIG['account_name']
|
14
|
+
config.api_version = API_CONFIG['api_version']
|
15
|
+
config.api_url = API_CONFIG['api_url']
|
16
|
+
config.api_key = API_CONFIG['api_key']
|
22
17
|
end
|
23
18
|
end
|
24
19
|
config.filter_run :focus => true
|
metadata
CHANGED
@@ -1,288 +1,244 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudfactory
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 13
|
10
|
-
version: 0.0.13
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- CloudFactory.com
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-08 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: i18n
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2157320800 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: activesupport
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: *2157320800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activesupport
|
27
|
+
requirement: &2157320240 !ruby/object:Gem::Requirement
|
38
28
|
none: false
|
39
|
-
requirements:
|
29
|
+
requirements:
|
40
30
|
- - ~>
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 1
|
43
|
-
segments:
|
44
|
-
- 3
|
45
|
-
- 0
|
46
|
-
- 3
|
31
|
+
- !ruby/object:Gem::Version
|
47
32
|
version: 3.0.3
|
48
33
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: hashie
|
52
34
|
prerelease: false
|
53
|
-
|
35
|
+
version_requirements: *2157320240
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: hashie
|
38
|
+
requirement: &2157319700 !ruby/object:Gem::Requirement
|
54
39
|
none: false
|
55
|
-
requirements:
|
40
|
+
requirements:
|
56
41
|
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
hash: 23
|
59
|
-
segments:
|
60
|
-
- 1
|
61
|
-
- 0
|
62
|
-
- 0
|
42
|
+
- !ruby/object:Gem::Version
|
63
43
|
version: 1.0.0
|
64
44
|
type: :runtime
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: rest-client
|
68
45
|
prerelease: false
|
69
|
-
|
46
|
+
version_requirements: *2157319700
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rest-client
|
49
|
+
requirement: &2157319260 !ruby/object:Gem::Requirement
|
70
50
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
78
55
|
type: :runtime
|
79
|
-
version_requirements: *id004
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: json
|
82
56
|
prerelease: false
|
83
|
-
|
57
|
+
version_requirements: *2157319260
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: json
|
60
|
+
requirement: &2157318720 !ruby/object:Gem::Requirement
|
84
61
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
segments:
|
90
|
-
- 0
|
91
|
-
version: "0"
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
92
66
|
type: :runtime
|
93
|
-
version_requirements: *id005
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: thor
|
96
67
|
prerelease: false
|
97
|
-
|
68
|
+
version_requirements: *2157318720
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: &2157318100 !ruby/object:Gem::Requirement
|
98
72
|
none: false
|
99
|
-
requirements:
|
73
|
+
requirements:
|
100
74
|
- - ~>
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
hash: 43
|
103
|
-
segments:
|
104
|
-
- 0
|
105
|
-
- 14
|
106
|
-
- 6
|
75
|
+
- !ruby/object:Gem::Version
|
107
76
|
version: 0.14.6
|
108
77
|
type: :runtime
|
109
|
-
version_requirements: *id006
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: httparty
|
112
78
|
prerelease: false
|
113
|
-
|
79
|
+
version_requirements: *2157318100
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: highline
|
82
|
+
requirement: &2157317680 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2157317680
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: httparty
|
93
|
+
requirement: &2157317080 !ruby/object:Gem::Requirement
|
114
94
|
none: false
|
115
|
-
requirements:
|
95
|
+
requirements:
|
116
96
|
- - ~>
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
hash: 19
|
119
|
-
segments:
|
120
|
-
- 0
|
121
|
-
- 7
|
122
|
-
- 8
|
97
|
+
- !ruby/object:Gem::Version
|
123
98
|
version: 0.7.8
|
124
99
|
type: :runtime
|
125
|
-
version_requirements: *id007
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: terminal-table
|
128
100
|
prerelease: false
|
129
|
-
|
101
|
+
version_requirements: *2157317080
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: terminal-table
|
104
|
+
requirement: &2157316500 !ruby/object:Gem::Requirement
|
130
105
|
none: false
|
131
|
-
requirements:
|
106
|
+
requirements:
|
132
107
|
- - ~>
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
hash: 3
|
135
|
-
segments:
|
136
|
-
- 1
|
137
|
-
- 4
|
138
|
-
- 2
|
108
|
+
- !ruby/object:Gem::Version
|
139
109
|
version: 1.4.2
|
140
110
|
type: :runtime
|
141
|
-
version_requirements: *id008
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: rails
|
144
111
|
prerelease: false
|
145
|
-
|
112
|
+
version_requirements: *2157316500
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: millisami-csv-hash
|
115
|
+
requirement: &2157316060 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :runtime
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *2157316060
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: aruba
|
126
|
+
requirement: &2157315580 !ruby/object:Gem::Requirement
|
146
127
|
none: false
|
147
|
-
requirements:
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *2157315580
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: rails
|
137
|
+
requirement: &2157314900 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
148
140
|
- - ~>
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
hash: 1
|
151
|
-
segments:
|
152
|
-
- 3
|
153
|
-
- 0
|
154
|
-
- 3
|
141
|
+
- !ruby/object:Gem::Version
|
155
142
|
version: 3.0.3
|
156
143
|
type: :development
|
157
|
-
version_requirements: *id009
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: bundler
|
160
144
|
prerelease: false
|
161
|
-
|
145
|
+
version_requirements: *2157314900
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: bundler
|
148
|
+
requirement: &2157314320 !ruby/object:Gem::Requirement
|
162
149
|
none: false
|
163
|
-
requirements:
|
150
|
+
requirements:
|
164
151
|
- - ~>
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
hash: 23
|
167
|
-
segments:
|
168
|
-
- 1
|
169
|
-
- 0
|
170
|
-
- 0
|
152
|
+
- !ruby/object:Gem::Version
|
171
153
|
version: 1.0.0
|
172
154
|
type: :development
|
173
|
-
version_requirements: *id010
|
174
|
-
- !ruby/object:Gem::Dependency
|
175
|
-
name: generator_spec
|
176
155
|
prerelease: false
|
177
|
-
|
156
|
+
version_requirements: *2157314320
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: generator_spec
|
159
|
+
requirement: &2157313740 !ruby/object:Gem::Requirement
|
178
160
|
none: false
|
179
|
-
requirements:
|
161
|
+
requirements:
|
180
162
|
- - ~>
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
hash: 57
|
183
|
-
segments:
|
184
|
-
- 0
|
185
|
-
- 8
|
186
|
-
- 3
|
163
|
+
- !ruby/object:Gem::Version
|
187
164
|
version: 0.8.3
|
188
165
|
type: :development
|
189
|
-
version_requirements: *id011
|
190
|
-
- !ruby/object:Gem::Dependency
|
191
|
-
name: rspec-rails
|
192
166
|
prerelease: false
|
193
|
-
|
167
|
+
version_requirements: *2157313740
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: rspec-rails
|
170
|
+
requirement: &2157313220 !ruby/object:Gem::Requirement
|
194
171
|
none: false
|
195
|
-
requirements:
|
196
|
-
- -
|
197
|
-
- !ruby/object:Gem::Version
|
198
|
-
|
199
|
-
segments:
|
200
|
-
- 0
|
201
|
-
version: "0"
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
202
176
|
type: :development
|
203
|
-
version_requirements: *id012
|
204
|
-
- !ruby/object:Gem::Dependency
|
205
|
-
name: cucumber
|
206
177
|
prerelease: false
|
207
|
-
|
178
|
+
version_requirements: *2157313220
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: cucumber
|
181
|
+
requirement: &2157312740 !ruby/object:Gem::Requirement
|
208
182
|
none: false
|
209
|
-
requirements:
|
210
|
-
- -
|
211
|
-
- !ruby/object:Gem::Version
|
212
|
-
|
213
|
-
segments:
|
214
|
-
- 0
|
215
|
-
version: "0"
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
216
187
|
type: :development
|
217
|
-
version_requirements: *id013
|
218
|
-
- !ruby/object:Gem::Dependency
|
219
|
-
name: rdoc
|
220
188
|
prerelease: false
|
221
|
-
|
189
|
+
version_requirements: *2157312740
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: rdoc
|
192
|
+
requirement: &2157312100 !ruby/object:Gem::Requirement
|
222
193
|
none: false
|
223
|
-
requirements:
|
194
|
+
requirements:
|
224
195
|
- - ~>
|
225
|
-
- !ruby/object:Gem::Version
|
226
|
-
hash: 21
|
227
|
-
segments:
|
228
|
-
- 3
|
229
|
-
- 5
|
230
|
-
- 3
|
196
|
+
- !ruby/object:Gem::Version
|
231
197
|
version: 3.5.3
|
232
198
|
type: :development
|
233
|
-
version_requirements: *id014
|
234
|
-
- !ruby/object:Gem::Dependency
|
235
|
-
name: vcr
|
236
199
|
prerelease: false
|
237
|
-
|
200
|
+
version_requirements: *2157312100
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: vcr
|
203
|
+
requirement: &2157311640 !ruby/object:Gem::Requirement
|
238
204
|
none: false
|
239
|
-
requirements:
|
240
|
-
- -
|
241
|
-
- !ruby/object:Gem::Version
|
242
|
-
|
243
|
-
segments:
|
244
|
-
- 0
|
245
|
-
version: "0"
|
205
|
+
requirements:
|
206
|
+
- - ! '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
246
209
|
type: :development
|
247
|
-
version_requirements: *id015
|
248
|
-
- !ruby/object:Gem::Dependency
|
249
|
-
name: rake
|
250
210
|
prerelease: false
|
251
|
-
|
211
|
+
version_requirements: *2157311640
|
212
|
+
- !ruby/object:Gem::Dependency
|
213
|
+
name: rake
|
214
|
+
requirement: &2157310940 !ruby/object:Gem::Requirement
|
252
215
|
none: false
|
253
|
-
requirements:
|
254
|
-
- -
|
255
|
-
- !ruby/object:Gem::Version
|
256
|
-
|
257
|
-
segments:
|
258
|
-
- 0
|
259
|
-
version: "0"
|
216
|
+
requirements:
|
217
|
+
- - ! '>='
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0'
|
260
220
|
type: :development
|
261
|
-
version_requirements: *id016
|
262
|
-
- !ruby/object:Gem::Dependency
|
263
|
-
name: webmock
|
264
221
|
prerelease: false
|
265
|
-
|
222
|
+
version_requirements: *2157310940
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: webmock
|
225
|
+
requirement: &2157310400 !ruby/object:Gem::Requirement
|
266
226
|
none: false
|
267
|
-
requirements:
|
268
|
-
- -
|
269
|
-
- !ruby/object:Gem::Version
|
270
|
-
|
271
|
-
segments:
|
272
|
-
- 0
|
273
|
-
version: "0"
|
227
|
+
requirements:
|
228
|
+
- - ! '>='
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
274
231
|
type: :development
|
275
|
-
|
232
|
+
prerelease: false
|
233
|
+
version_requirements: *2157310400
|
276
234
|
description: A Ruby wrapper and CLI for to interact with Cloudfactory.com REST API
|
277
|
-
email:
|
235
|
+
email:
|
278
236
|
- info@cloudfactory.com
|
279
|
-
executables:
|
237
|
+
executables:
|
280
238
|
- cf
|
281
239
|
extensions: []
|
282
|
-
|
283
240
|
extra_rdoc_files: []
|
284
|
-
|
285
|
-
files:
|
241
|
+
files:
|
286
242
|
- .gitignore
|
287
243
|
- .rspec
|
288
244
|
- Gemfile
|
@@ -330,6 +286,7 @@ files:
|
|
330
286
|
- features/line_creation.feature
|
331
287
|
- features/line_deletion.feature
|
332
288
|
- features/line_generation.feature
|
289
|
+
- features/login.feature
|
333
290
|
- features/run.feature
|
334
291
|
- features/support/cli_steps.rb
|
335
292
|
- features/support/env.rb
|
@@ -402,43 +359,49 @@ files:
|
|
402
359
|
- spec/text_appending_robot_spec.rb
|
403
360
|
homepage: http://cloudfactory.com
|
404
361
|
licenses: []
|
405
|
-
|
406
|
-
|
362
|
+
post_install_message: ! " ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
|
363
|
+
☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁\n \n Sweet. You now have the 'cf' command installed. Test
|
364
|
+
drive it with:\n > cf help\n\n 1. Sign up for your CloudFactory account and get
|
365
|
+
your API key\n http://cloudfactory.com/users/sign_up\n Get API key from welcome
|
366
|
+
email or http://cloudfactory.com/account#settings\n\n 2. Generate your first assembly
|
367
|
+
line...\n > cf line generate <line-title>\n\n 3. Edit the generated line.yml to
|
368
|
+
design your perfect assembly line\n See http://developers.cloudfactory.com/lines/yaml.html\n\n
|
369
|
+
\ 4. Create your line in CloudFactory\n > cf line create\n\n 5. Do a test production
|
370
|
+
run in the sandbox first...\n > cf production start TITLE -i=INPUT_DATA.CSV\n\n
|
371
|
+
\ 6. Go live! Send your production run to real workers...\n > cf production start
|
372
|
+
TITLE -i=INPUT_DATA.CSV --live\n \n ------------------------------------------------------------------------------\n
|
373
|
+
\n Follow @thecloudfactory on Twitter for announcements, updates, and news.\n https://twitter.com/thecloudfactory\n\n
|
374
|
+
\ Add your project or organization to the apps wiki!\n https://github.com/sprout/cloudfactory_ruby/wiki/Apps\n
|
375
|
+
\ \n ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
|
376
|
+
☁ ☁\n"
|
407
377
|
rdoc_options: []
|
408
|
-
|
409
|
-
require_paths:
|
378
|
+
require_paths:
|
410
379
|
- lib
|
411
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
380
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
412
381
|
none: false
|
413
|
-
requirements:
|
414
|
-
- -
|
415
|
-
- !ruby/object:Gem::Version
|
416
|
-
|
417
|
-
|
418
|
-
- 0
|
419
|
-
version: "0"
|
420
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
382
|
+
requirements:
|
383
|
+
- - ! '>='
|
384
|
+
- !ruby/object:Gem::Version
|
385
|
+
version: '0'
|
386
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
421
387
|
none: false
|
422
|
-
requirements:
|
423
|
-
- -
|
424
|
-
- !ruby/object:Gem::Version
|
425
|
-
|
426
|
-
segments:
|
427
|
-
- 0
|
428
|
-
version: "0"
|
388
|
+
requirements:
|
389
|
+
- - ! '>='
|
390
|
+
- !ruby/object:Gem::Version
|
391
|
+
version: '0'
|
429
392
|
requirements: []
|
430
|
-
|
431
393
|
rubyforge_project: cloudfactory
|
432
394
|
rubygems_version: 1.8.6
|
433
395
|
signing_key:
|
434
396
|
specification_version: 3
|
435
397
|
summary: A Ruby wrapper and CLI for Cloudfactory.com
|
436
|
-
test_files:
|
398
|
+
test_files:
|
437
399
|
- features/form_generation.feature
|
438
400
|
- features/form_preview.feature
|
439
401
|
- features/line_creation.feature
|
440
402
|
- features/line_deletion.feature
|
441
403
|
- features/line_generation.feature
|
404
|
+
- features/login.feature
|
442
405
|
- features/run.feature
|
443
406
|
- features/support/cli_steps.rb
|
444
407
|
- features/support/env.rb
|