robot_sweatshop 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/Rakefile +2 -2
  4. data/bin/sweatshop +5 -7
  5. data/bin/sweatshop-input-http +1 -1
  6. data/bin/sweatshop-job-assembler +7 -7
  7. data/bin/sweatshop-job-worker +4 -3
  8. data/bin/sweatshop-payload-parser +6 -6
  9. data/bin/sweatshop-queue-broadcaster +2 -1
  10. data/bin/sweatshop-queue-handler +2 -1
  11. data/config.defaults.yaml +5 -5
  12. data/lib/robot_sweatshop.rb +5 -0
  13. data/lib/{sweatshop → robot_sweatshop}/cli.rb +0 -0
  14. data/lib/{sweatshop → robot_sweatshop}/cli/common.rb +0 -0
  15. data/lib/{sweatshop → robot_sweatshop}/cli/config.rb +0 -0
  16. data/lib/{sweatshop → robot_sweatshop}/cli/job.rb +3 -3
  17. data/lib/{sweatshop → robot_sweatshop}/cli/start.rb +2 -2
  18. data/lib/{sweatshop → robot_sweatshop}/config.rb +0 -0
  19. data/lib/{sweatshop → robot_sweatshop}/create-config-directories.rb +1 -1
  20. data/lib/{sweatshop → robot_sweatshop}/moneta-queue.rb +1 -1
  21. data/lib/{sweatshop → robot_sweatshop}/payload.rb +0 -0
  22. data/lib/{sweatshop → robot_sweatshop}/payload/bitbucket.rb +0 -0
  23. data/lib/{sweatshop → robot_sweatshop}/payload/github.rb +0 -0
  24. data/lib/{sweatshop → robot_sweatshop}/payload/json.rb +0 -0
  25. data/lib/{sweatshop → robot_sweatshop}/payload/payload.rb +0 -0
  26. data/lib/{sweatshop → robot_sweatshop}/queue-helper.rb +0 -0
  27. data/robot_sweatshop.eye +4 -4
  28. data/robot_sweatshop.gemspec +3 -2
  29. data/{kintama → test}/README.md +0 -0
  30. data/test/data/empty_job.yaml +1 -0
  31. data/{kintama → test}/data/git_job.yaml +0 -0
  32. data/test/data/minimal_job.yaml +3 -0
  33. data/{kintama → test}/data/payload_data.yaml +0 -0
  34. data/{kintama → test}/data/test_job.yaml +0 -0
  35. data/{kintama → test}/end-to-end_spec.rb +0 -0
  36. data/{kintama → test}/input_http_spec.rb +1 -1
  37. data/{kintama → test}/job_assembler_spec.rb +12 -10
  38. data/{kintama → test}/job_worker_spec.rb +0 -0
  39. data/{kintama → test}/moneta-queue_spec.rb +2 -1
  40. data/{kintama → test}/payload_parser_spec.rb +6 -4
  41. data/{kintama → test}/queue_broadcaster_spec.rb +0 -0
  42. data/{kintama → test}/queue_handler_spec.rb +0 -0
  43. data/{kintama → test}/run_all.rb +0 -0
  44. data/{kintama → test}/shared/helpers.rb +15 -11
  45. data/{kintama → test}/shared/process_spawning.rb +4 -3
  46. metadata +56 -38
  47. data/lib/sweatshop.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbc73c13d57e32651f63077a89b03317769850f3
4
- data.tar.gz: 834bb91075c655c1edc0ac7f4cc445c2048094db
3
+ metadata.gz: 4448ccef7e7ddfd360671112b0f2309514d1fe41
4
+ data.tar.gz: 78e891d82abb784a20ee5fab9df5bf9c15a1c61a
5
5
  SHA512:
6
- metadata.gz: 16784f92f5abe86c20dd6aebe73d79d3d9d18296576ba50ed0018467b205038fb67517a18931a539b4309839f311427b079c5b3b0e4708f7120d7e0baf570365
7
- data.tar.gz: bc6eca3c50fddb92091e7693b7f4aba3232ab96b857a3b495d7a20e557bff3f695cda3149842b718d5c5905011d04bdb4d6d9decaf3cca8a7dcd3c062b8a2e1e
6
+ metadata.gz: ad6c99e1bdebf6d38e6387325beb9644cf2e485bf2b6f1c3e4251f833c841f2bc46855e123c5116c34a7120b95f756438c87158dabbf6d320890f8f7deec74f4
7
+ data.tar.gz: 9d063888952c5c0e057e560b37bd3185e3604a3fa8678ff0cc3d1057136888ec226cce3d0745bdddaf2e3ea06a6ba5b3b19ff4452545ae85ef3a9c74c0a750d7
data/README.md CHANGED
@@ -12,7 +12,7 @@ Robot Sweatshop is a single-purpose CI server that runs collections of arbitrary
12
12
  - `gem install robot_sweatshop`
13
13
  - `sweatshop start` ([you may need sudo on OSX](https://github.com/JScott/robot_sweatshop/wiki))
14
14
  - `sweatshop job example --auto`
15
- - `curl --data '{"your": "json"}' http://localhost:8080/payload-for/example`
15
+ - `curl -X POST http://localhost:8080/payload-for/example`
16
16
  - `cat .robot_sweatshop/log/job-worker.log`
17
17
 
18
18
  # Usage
@@ -23,13 +23,14 @@ Robot Sweatshop uses [Eye](https://github.com/kostya/eye) to handle its processe
23
23
 
24
24
  # Configuration
25
25
 
26
- By default, Robot Sweatshop looks in your current working directory to configure and run. You can supply a custom configuration with `sweatshop config [local|user|system]`. Read [the wiki](https://github.com/JScott/robot_sweatshop/wiki) for more information.
26
+ By default, Robot Sweatshop looks in your current working path to configure and run. You can supply a custom configuration with `sweatshop config [local|user|system]`. Read [the wiki](https://github.com/JScott/robot_sweatshop/wiki) for more information.
27
27
 
28
28
  # Supported payload formats
29
29
 
30
30
  - Github (application/json format only)
31
31
  - Bitbucket
32
32
  - JSON
33
+ - Empty
33
34
 
34
35
  # Security
35
36
 
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ task :test do
5
5
  SimpleCov.command_name 'Kintama Tests'
6
6
  SimpleCov.start do
7
7
  add_filter "/vendor/"
8
- add_filter "/kintama/"
8
+ add_filter "/test/"
9
9
  end
10
- require_relative 'kintama/run_all'
10
+ require_relative 'test/run_all'
11
11
  end
data/bin/sweatshop CHANGED
@@ -1,16 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'bundler/setup'
2
3
  require 'yaml'
3
4
  require 'commander/import'
4
5
  require 'colorize'
5
- require_relative '../lib/sweatshop/cli/common'
6
- require_relative '../lib/sweatshop/cli/job'
7
- require_relative '../lib/sweatshop/cli/start'
8
- require_relative '../lib/sweatshop/cli/config'
9
- require_relative '../lib/sweatshop/config'
10
- require_relative '../lib/sweatshop/create-config-directories'
6
+ require 'robot_sweatshop/cli'
7
+ require 'robot_sweatshop/config'
8
+ require 'robot_sweatshop/create-config-directories'
11
9
 
12
10
  program :name, 'Robot Sweatshop'
13
- program :version, '0.3.0'
11
+ program :version, '0.3.1'
14
12
  program :description, 'A lightweight, unopinionated CI server'
15
13
  program :help, 'Author', 'Justin Scott <jvscott@gmail.com>'
16
14
 
@@ -3,7 +3,7 @@ require 'bundler/setup'
3
3
  require 'sinatra'
4
4
  require 'ezmq'
5
5
  require 'json'
6
- require 'sweatshop/config'
6
+ require 'robot_sweatshop/config'
7
7
 
8
8
  configure do
9
9
  set :port, configatron.http_port
@@ -3,21 +3,21 @@ require 'bundler/setup'
3
3
  require 'yaml'
4
4
  require 'json'
5
5
  require 'contracts'
6
- require 'sweatshop/queue-helper'
7
- require 'sweatshop/config'
6
+ require 'robot_sweatshop/queue-helper'
7
+ require 'robot_sweatshop/config'
8
8
 
9
9
  $stdout.sync = true
10
10
  include Contracts
11
11
 
12
12
  Contract None => Hash
13
13
  def empty_config
14
- puts "Job configuration not found"
14
+ puts "Job configuration not found or empty"
15
15
  {}
16
16
  end
17
17
 
18
18
  Contract None => String
19
- def job_directory
20
- File.expand_path configatron.job_directory
19
+ def job_path
20
+ File.expand_path configatron.job_path
21
21
  end
22
22
 
23
23
  Contract Or[String, nil], Hash => Bool
@@ -44,7 +44,7 @@ end
44
44
 
45
45
  Contract String => Hash
46
46
  def load_config_for(job_name)
47
- load_if_exists("#{job_directory}/#{job_name}.yaml") || empty_config
47
+ load_if_exists("#{job_path}/#{job_name}.yaml") || empty_config
48
48
  end
49
49
 
50
50
  Contract Hash => [Hash, String]
@@ -69,7 +69,7 @@ def assemble_job(request)
69
69
  return false unless error.empty? && can_work_with?(job_config, payload)
70
70
  {
71
71
  commands: job_config['commands'],
72
- context: job_context(job_config['environment'], payload),
72
+ context: job_context(job_config['environment'] || {}, payload),
73
73
  job_name: request['job_name']
74
74
  }
75
75
  end
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'bundler/setup'
2
3
  require 'faker'
3
4
  require 'fileutils'
4
- require_relative '../lib/sweatshop/queue-helper'
5
- require_relative '../lib/sweatshop/config'
5
+ require 'robot_sweatshop/queue-helper'
6
+ require 'robot_sweatshop/config'
6
7
 
7
8
  $stdout.sync = true
8
9
  $stderr.sync = true
@@ -13,7 +14,7 @@ $stderr.sync = true
13
14
  def from_workspace(named: 'no_job_name')
14
15
  workspace = "#{named}-#{@worker_id}"
15
16
  puts "Workspace: #{workspace}"
16
- path = File.expand_path "#{configatron.workspace_directory}/#{workspace}"
17
+ path = File.expand_path "#{configatron.workspace_path}/#{workspace}"
17
18
  FileUtils.mkpath path
18
19
  Dir.chdir(path) { yield if block_given? }
19
20
  end
@@ -3,8 +3,8 @@ require 'bundler/setup'
3
3
  require 'json'
4
4
  require 'ezmq'
5
5
  require 'contracts'
6
- require 'sweatshop/config'
7
- require 'sweatshop/payload'
6
+ require 'robot_sweatshop/config'
7
+ require 'robot_sweatshop/payload'
8
8
 
9
9
  $stdout.sync = true
10
10
  include Contracts
@@ -40,7 +40,8 @@ end
40
40
 
41
41
  Contract String, String => Or[Hash, nil]
42
42
  def payload_hash_from(payload, format)
43
- lib_file = "#{__dir__}/../lib/sweatshop/payload/#{format}.rb"
43
+ # TODO: use require instead of require_relative
44
+ lib_file = "#{__dir__}/../lib/robot_sweatshop/payload/#{format.downcase}.rb"
44
45
  return nil unless File.file?(lib_file)
45
46
  require_relative lib_file
46
47
  Object.const_get("#{format}Payload").new(payload).to_hash
@@ -49,6 +50,7 @@ end
49
50
  Contract Hash => Hash
50
51
  def parse(request)
51
52
  format = detect_format_of request
53
+ return {payload: {}, error: ''} if format == 'empty'
52
54
  payload = payload_hash_from request['payload'], format
53
55
  return {payload: {}, error: "Can't parse #{format} payload"} if payload.nil?
54
56
  {payload: payload, error: ''}
@@ -57,9 +59,7 @@ end
57
59
  Contract Any => Hash
58
60
  def validate(request)
59
61
  return {payload: {}, error: "Invalid JSON request"} unless json? request
60
- request = JSON.load request
61
- return {payload: {}, error: "Empty request"} if request.nil?
62
- request
62
+ JSON.load request
63
63
  end
64
64
 
65
65
  puts 'Started'
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../lib/sweatshop/moneta-queue'
2
+ require 'bundler/setup'
3
3
  require 'ezmq'
4
+ require 'robot_sweatshop/moneta-queue'
4
5
 
5
6
  publisher = EZMQ::Publisher.new port: 5557
6
7
  queues = {}
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../lib/sweatshop/moneta-queue'
2
+ require 'bundler/setup'
3
3
  require 'ezmq'
4
+ require 'robot_sweatshop/moneta-queue'
4
5
 
5
6
  def enqueue(name, item)
6
7
  puts "enqueue #{name} #{item}"
data/config.defaults.yaml CHANGED
@@ -1,9 +1,9 @@
1
1
  ---
2
- pidfile_directory: .robot_sweatshop/run
3
- logfile_directory: .robot_sweatshop/log
4
- job_directory: .robot_sweatshop/jobs
5
- workspace_directory: .robot_sweatshop/workspaces
6
- moneta_directory: .robot_sweatshop/db
2
+ pidfile_path: .robot_sweatshop/run
3
+ logfile_path: .robot_sweatshop/log
4
+ job_path: .robot_sweatshop/jobs
5
+ workspace_path: .robot_sweatshop/workspaces
6
+ moneta_path: .robot_sweatshop/db
7
7
  # user: ci-bot
8
8
  # group: nogroup
9
9
  http_port: 8080
@@ -0,0 +1,5 @@
1
+ require_relative 'robot_sweatshop/moneta-queue'
2
+ require_relative 'robot_sweatshop/queue-helper'
3
+ require_relative 'robot_sweatshop/config'
4
+ require_relative 'robot_sweatshop/payload'
5
+ require_relative 'robot_sweatshop/cli'
File without changes
File without changes
File without changes
@@ -5,10 +5,10 @@ def default_job
5
5
  end
6
6
 
7
7
  def get_job_path(for_job: nil)
8
- "#{configatron.job_directory}/#{for_job}.yaml"
8
+ "#{configatron.job_path}/#{for_job}.yaml"
9
9
  end
10
10
 
11
11
  def list_jobs
12
- job_directory = File.expand_path configatron.job_directory
13
- puts Dir.glob("#{job_directory}/*.yaml").map { |file| File.basename(file, '.yaml') }
12
+ job_path = File.expand_path configatron.job_path
13
+ puts Dir.glob("#{job_path}/*.yaml").map { |file| File.basename(file, '.yaml') }
14
14
  end
@@ -4,9 +4,9 @@ require_relative '../config'
4
4
  def store_config_for_eye
5
5
  config = configatron.to_h
6
6
  config = config.each do |key, value|
7
- config[key] = File.expand_path value if key.to_s.match /_directory/
7
+ config[key] = File.expand_path value if key.to_s.match /_path/
8
8
  end
9
- config[:working_directory] = Dir.pwd
9
+ config[:working_path] = Dir.pwd
10
10
  File.write('/tmp/.robot_sweatshop-eye-config.yaml', config.to_yaml)
11
11
  end
12
12
 
File without changes
@@ -21,7 +21,7 @@ end
21
21
 
22
22
  config = configatron.to_h
23
23
  config.each do |key, value|
24
- if key.to_s.match /_directory/
24
+ if key.to_s.match /_path/
25
25
  path = File.expand_path value
26
26
  create_path path
27
27
  set_dir_permissions for_path: path if configatron.has_key? :user
@@ -6,7 +6,7 @@ require_relative 'config'
6
6
  class MonetaQueue
7
7
  attr_reader :watched_queues
8
8
 
9
- @@store = Moneta.new :File, dir: File.expand_path(configatron.moneta_directory)
9
+ @@store = Moneta.new :File, dir: File.expand_path(configatron.moneta_path)
10
10
 
11
11
  def initialize(name)
12
12
  @name = name
File without changes
File without changes
File without changes
data/robot_sweatshop.eye CHANGED
@@ -1,17 +1,17 @@
1
1
  require 'yaml'
2
2
 
3
3
  CONFIG = YAML.load_file '/tmp/.robot_sweatshop-eye-config.yaml'
4
- PID_PATH = CONFIG[:pidfile_directory]
5
- LOG_PATH = CONFIG[:logfile_directory]
4
+ PID_PATH = CONFIG[:pidfile_path]
5
+ LOG_PATH = CONFIG[:logfile_path]
6
6
 
7
7
  Eye.config do
8
- logger "#{CONFIG[:logfile_directory]}/eye.log"
8
+ logger "#{CONFIG[:logfile_path]}/eye.log"
9
9
  end
10
10
 
11
11
  Eye.application :robot_sweatshop do
12
12
  trigger :flapping, times: 10, within: 1.minute, retry_in: 10.minutes
13
13
  check :cpu, every: 10.seconds, below: 100, times: 3
14
- working_dir CONFIG[:working_directory]
14
+ working_dir CONFIG[:working_path]
15
15
  uid "#{CONFIG[:user]}" if CONFIG[:user]
16
16
  gid "#{CONFIG[:group]}" if CONFIG[:group]
17
17
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'robot_sweatshop'
3
- gem.version = '0.3.0'
3
+ gem.version = '0.3.1'
4
4
  gem.licenses = 'MIT'
5
5
  gem.authors = ['Justin Scott']
6
6
  gem.email = 'jvscott@gmail.com'
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.description = 'A lightweight, unopinionated CI server.'
10
10
 
11
11
  gem.files = `git ls-files`.split("\n")
12
- gem.test_files = `git ls-files -- kintama/**/*`.split("\n")
12
+ gem.test_files = `git ls-files -- test/**/*`.split("\n")
13
13
  gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
14
14
  gem.require_paths = ['lib']
15
15
 
@@ -24,6 +24,7 @@ Gem::Specification.new do |gem|
24
24
  gem.add_runtime_dependency 'configatron'
25
25
  gem.add_runtime_dependency 'moneta'
26
26
  gem.add_runtime_dependency 'contracts'
27
+ gem.add_runtime_dependency 'thin'
27
28
 
28
29
  gem.add_development_dependency 'rake'
29
30
  gem.add_development_dependency 'kintama'
File without changes
@@ -0,0 +1 @@
1
+ ---
File without changes
@@ -0,0 +1,3 @@
1
+ ---
2
+ commands:
3
+ - echo 'm'
File without changes
File without changes
File without changes
@@ -17,7 +17,7 @@ given 'the HTTP Input' do
17
17
  clear_all_queues
18
18
  end
19
19
 
20
- %w(Bitbucket Github JSON).each do |format|
20
+ %w(Bitbucket Github JSON Empty).each do |format|
21
21
  context "POSTing #{format} data" do
22
22
  setup do
23
23
  url = input_http_url for_job: 'test_job'
@@ -16,7 +16,7 @@ describe 'the Job Assembler' do
16
16
  clear_all_queues
17
17
  end
18
18
 
19
- %w(Git JSON).each do |request|
19
+ %w(Git JSON MinimalJob).each do |request|
20
20
  given "#{request} requests in \'payload\'" do
21
21
  setup do
22
22
  payload = example_job_request of_type: request
@@ -43,20 +43,22 @@ describe 'the Job Assembler' do
43
43
  response['context'].each { |_key, value| assert_kind_of String, value }
44
44
  end
45
45
 
46
- should 'build the context with a parsed payload' do
47
- response = @client.request "mirror-#{@jobs_queue}"
48
- response = JSON.load response
49
- assert_kind_of Hash, response['context']
50
- if request == 'Git'
51
- assert_equal 'develop', response['context']['branch']
52
- else
53
- assert_equal 'value', response['context']['test1']
46
+ unless request == 'EmptyPayload'
47
+ should 'build the context with a parsed payload' do
48
+ response = @client.request "mirror-#{@jobs_queue}"
49
+ response = JSON.load response
50
+ assert_kind_of Hash, response['context']
51
+ if request == 'Git'
52
+ assert_equal 'develop', response['context']['branch']
53
+ else
54
+ assert_equal 'value', response['context']['test1']
55
+ end
54
56
  end
55
57
  end
56
58
  end
57
59
  end
58
60
 
59
- %w(IgnoredBranch UnknownJob NonJSON).each do |request|
61
+ %w(IgnoredBranch UnknownJob EmptyJob NonJSON).each do |request|
60
62
  given "#{request} requests in \'payload\'" do
61
63
  setup do
62
64
  payload = example_job_request of_type: request
File without changes
@@ -1,6 +1,7 @@
1
+ require 'bundler/setup'
1
2
  require 'kintama'
3
+ require 'robot_sweatshop/moneta-queue'
2
4
  require_relative 'shared/helpers'
3
- require_relative '../lib/sweatshop/moneta-queue'
4
5
 
5
6
  given 'the Moneta Queue class' do
6
7
  include QueueHelper
@@ -13,11 +13,11 @@ describe 'the Payload Parser' do
13
13
  @client = EZMQ::Client.new port: configatron.payload_parser_port
14
14
  end
15
15
 
16
- %w(Bitbucket Github JSON).each do |format|
16
+ %w(Bitbucket Github JSON Empty).each do |format|
17
17
  given "valid #{format} payloads" do
18
18
  setup do
19
19
  payload = example_payload_request of_format: format
20
- @response = Timeout.timeout($for_a_while) do
20
+ @response = Timeout.timeout($for_a_moment) do
21
21
  @client.request JSON.dump(payload)
22
22
  end
23
23
  end
@@ -30,6 +30,8 @@ describe 'the Payload Parser' do
30
30
  keys = case format
31
31
  when 'JSON'
32
32
  %w(test1 test2)
33
+ when 'Empty'
34
+ []
33
35
  else
34
36
  Payload.hash_keys
35
37
  end
@@ -42,11 +44,11 @@ describe 'the Payload Parser' do
42
44
  end
43
45
  end
44
46
 
45
- %w(Empty NonJSON).each do |format|
47
+ %w(NonJSON).each do |format|
46
48
  given "#{format} payloads" do
47
49
  setup do
48
50
  payload = example_raw_payload of_format: format
49
- @response = Timeout.timeout($for_a_while) do
51
+ @response = Timeout.timeout($for_a_moment) do
50
52
  @client.request "#{payload}"
51
53
  end
52
54
  end
File without changes
File without changes
File without changes
@@ -1,9 +1,9 @@
1
1
  require 'bundler/setup'
2
2
  require 'yaml'
3
3
  require 'json'
4
- require 'sweatshop/moneta-queue'
5
- require 'sweatshop/payload'
6
- require 'sweatshop/config'
4
+ require 'robot_sweatshop/moneta-queue'
5
+ require 'robot_sweatshop/payload'
6
+ require 'robot_sweatshop/config'
7
7
 
8
8
  module QueueHelper
9
9
  def clear_all_queues
@@ -33,7 +33,7 @@ module InHelper
33
33
  when 'Github'
34
34
  'Github-Hookshot'
35
35
  else
36
- 'SomeRandomUserAgent'
36
+ 'SomeUserAgent'
37
37
  end
38
38
  end
39
39
  def example_payload_request(of_format:)
@@ -45,22 +45,26 @@ module InHelper
45
45
  def job_request_data(type)
46
46
  case type
47
47
  when 'Git'
48
- ['Bitbucket', 'git_job'] # develop branch
48
+ ['Bitbucket', 'git_job'] # develop branch payload
49
49
  when 'JSON'
50
50
  ['JSON', 'test_job']
51
+ when 'MinimalJob'
52
+ ['JSON', 'minimal_job']
51
53
  when 'IgnoredBranch'
52
- ['Github', 'git_job'] # master branch
54
+ ['Github', 'git_job'] # master branch payload
53
55
  when 'UnknownJob'
54
56
  ['Bitbucket', 'unknown_job']
57
+ when 'EmptyJob'
58
+ ['JSON', 'empty_job']
55
59
  when 'NonJSON'
56
- ['JSON', 'git_job', 'not json']
60
+ ['NonJSON', 'test_job']
57
61
  else
58
- ['I', 'AM', 'ERROR']
62
+ ['', '']
59
63
  end
60
64
  end
61
65
  def example_job_request(of_type:)
62
- format, job_name, payload = job_request_data of_type
63
- JSON.generate payload: payload || example_raw_payload(of_format: format),
66
+ format, job_name = job_request_data of_type
67
+ JSON.generate payload: example_raw_payload(of_format: format),
64
68
  job_name: job_name,
65
69
  user_agent: user_agent_for(format)
66
70
  end
@@ -73,7 +77,7 @@ module JobHelper
73
77
  job_name: 'test_job'
74
78
  end
75
79
  def reset_test_file
76
- test_file = File.expand_path "#{configatron.workspace_directory}/test_job-testingid/test.txt"
80
+ test_file = File.expand_path "#{configatron.workspace_path}/test_job-testingid/test.txt"
77
81
  FileUtils.rm_rf test_file
78
82
  test_file
79
83
  end
@@ -1,12 +1,13 @@
1
- $for_a_moment = 0.1
1
+ $for_a_moment = 0.2
2
2
  $for_a_while = 0.5
3
3
  $for_io_calls = 1
4
4
  $for_everything = 2
5
5
 
6
6
  Kintama.on_start do
7
7
  puts `#{__dir__}/../../bin/sweatshop start --testing`
8
- FileUtils.cp "#{__dir__}/../data/test_job.yaml", File.expand_path(configatron.job_directory)
9
- FileUtils.cp "#{__dir__}/../data/git_job.yaml", File.expand_path(configatron.job_directory)
8
+ %w(test minimal git empty).each do |job_file|
9
+ FileUtils.cp "#{__dir__}/../data/#{job_file}_job.yaml", File.expand_path(configatron.job_path)
10
+ end
10
11
  sleep $for_everything
11
12
  end
12
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robot_sweatshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Scott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2015-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: thin
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rake
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -249,41 +263,43 @@ files:
249
263
  - bin/sweatshop-queue-handler
250
264
  - bin/sweatshop-queue-watcher
251
265
  - config.defaults.yaml
252
- - kintama/README.md
253
- - kintama/data/git_job.yaml
254
- - kintama/data/payload_data.yaml
255
- - kintama/data/test_job.yaml
256
- - kintama/end-to-end_spec.rb
257
- - kintama/input_http_spec.rb
258
- - kintama/job_assembler_spec.rb
259
- - kintama/job_worker_spec.rb
260
- - kintama/moneta-queue_spec.rb
261
- - kintama/payload_parser_spec.rb
262
- - kintama/queue_broadcaster_spec.rb
263
- - kintama/queue_handler_spec.rb
264
- - kintama/run_all.rb
265
- - kintama/shared/helpers.rb
266
- - kintama/shared/process_spawning.rb
267
266
  - lib/README.md
268
- - lib/sweatshop.rb
269
- - lib/sweatshop/cli.rb
270
- - lib/sweatshop/cli/common.rb
271
- - lib/sweatshop/cli/config.rb
272
- - lib/sweatshop/cli/job.rb
273
- - lib/sweatshop/cli/start.rb
274
- - lib/sweatshop/config.rb
275
- - lib/sweatshop/create-config-directories.rb
276
- - lib/sweatshop/moneta-queue.rb
277
- - lib/sweatshop/payload.rb
278
- - lib/sweatshop/payload/bitbucket.rb
279
- - lib/sweatshop/payload/github.rb
280
- - lib/sweatshop/payload/json.rb
281
- - lib/sweatshop/payload/payload.rb
282
- - lib/sweatshop/queue-helper.rb
267
+ - lib/robot_sweatshop.rb
268
+ - lib/robot_sweatshop/cli.rb
269
+ - lib/robot_sweatshop/cli/common.rb
270
+ - lib/robot_sweatshop/cli/config.rb
271
+ - lib/robot_sweatshop/cli/job.rb
272
+ - lib/robot_sweatshop/cli/start.rb
273
+ - lib/robot_sweatshop/config.rb
274
+ - lib/robot_sweatshop/create-config-directories.rb
275
+ - lib/robot_sweatshop/moneta-queue.rb
276
+ - lib/robot_sweatshop/payload.rb
277
+ - lib/robot_sweatshop/payload/bitbucket.rb
278
+ - lib/robot_sweatshop/payload/github.rb
279
+ - lib/robot_sweatshop/payload/json.rb
280
+ - lib/robot_sweatshop/payload/payload.rb
281
+ - lib/robot_sweatshop/queue-helper.rb
283
282
  - robot_sweatshop.eye
284
283
  - robot_sweatshop.gemspec
285
284
  - robot_sweatshop.production.eye
286
285
  - robot_sweatshop.testing.eye
286
+ - test/README.md
287
+ - test/data/empty_job.yaml
288
+ - test/data/git_job.yaml
289
+ - test/data/minimal_job.yaml
290
+ - test/data/payload_data.yaml
291
+ - test/data/test_job.yaml
292
+ - test/end-to-end_spec.rb
293
+ - test/input_http_spec.rb
294
+ - test/job_assembler_spec.rb
295
+ - test/job_worker_spec.rb
296
+ - test/moneta-queue_spec.rb
297
+ - test/payload_parser_spec.rb
298
+ - test/queue_broadcaster_spec.rb
299
+ - test/queue_handler_spec.rb
300
+ - test/run_all.rb
301
+ - test/shared/helpers.rb
302
+ - test/shared/process_spawning.rb
287
303
  homepage: http://www.github.com/jscott/robot_sweatshop/
288
304
  licenses:
289
305
  - MIT
@@ -304,14 +320,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
320
  version: '0'
305
321
  requirements: []
306
322
  rubyforge_project:
307
- rubygems_version: 2.4.5
323
+ rubygems_version: 2.2.3
308
324
  signing_key:
309
325
  specification_version: 4
310
326
  summary: Robot Sweatshop
311
327
  test_files:
312
- - kintama/data/git_job.yaml
313
- - kintama/data/payload_data.yaml
314
- - kintama/data/test_job.yaml
315
- - kintama/shared/helpers.rb
316
- - kintama/shared/process_spawning.rb
328
+ - test/data/empty_job.yaml
329
+ - test/data/git_job.yaml
330
+ - test/data/minimal_job.yaml
331
+ - test/data/payload_data.yaml
332
+ - test/data/test_job.yaml
333
+ - test/shared/helpers.rb
334
+ - test/shared/process_spawning.rb
317
335
  has_rdoc:
data/lib/sweatshop.rb DELETED
@@ -1,5 +0,0 @@
1
- require_relative 'sweatshop/moneta-queue'
2
- require_relative 'sweatshop/queue-helper'
3
- require_relative 'sweatshop/config'
4
- require_relative 'sweatshop/payload'
5
- require_relative 'sweatshop/cli'