robot_sweatshop 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4ad8bb0e13b6949560dbc5540199d64ad5f0772
4
- data.tar.gz: 181c02c2b6ca2c7b5f07e95e0c44a7257e32283f
3
+ metadata.gz: 44fc7ae765713f7f3d0375008ab550a19c034d0e
4
+ data.tar.gz: a7fc84ba9891e3eb244b65407b80428144dbd516
5
5
  SHA512:
6
- metadata.gz: 5874e518f387f6d71e935f7cf93d1fbb660342baa1721981003a365dd9c1c0b1c2fd01aad267dda276cf512dcfad1d3108b661bbf90d30dc452a5273939ebe9e
7
- data.tar.gz: 0131a56ffdac509ddcaab1d9c671ff9d9cf83012cd1d5522785631100cbab69cda8232d86ba79d77af94f0d43e84ddfdee36214e4a267b7e168d26e97583d874
6
+ metadata.gz: 03420bcbf4f02120c1d3a2a72c915929d08b89df47615722083dd9100d5916226c6ab732920837fdb182dcef830b9790787e9abeeb56dae39e3c7889a6b3dca1
7
+ data.tar.gz: 0f1c4c066484dee045d68334e501dda16d8d6b321c3d94797c3198a2e6f9496356744432cb4c955aea50b0de7abfcabece1fb615b69a7c85804420081b2c4aff
data/bin/sweatshop CHANGED
@@ -8,7 +8,7 @@ require 'robot_sweatshop/config'
8
8
  require 'robot_sweatshop/create-config-directories'
9
9
 
10
10
  program :name, 'Robot Sweatshop'
11
- program :version, '0.4.2'
11
+ program :version, '0.4.3'
12
12
  program :description, 'A lightweight, unopinionated CI server'
13
13
  program :help, 'Author', 'Justin Scott <jvscott@gmail.com>'
14
14
 
@@ -12,6 +12,7 @@ using ExtendedEZMQ
12
12
 
13
13
  Contract Hash => Hash
14
14
  def sanitize(data)
15
+ return {} if data.empty?
15
16
  data = data.map { |key, value| {key => value.to_s} }
16
17
  data.reduce(:merge)
17
18
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'robot_sweatshop'
3
- gem.version = '0.4.2'
3
+ gem.version = '0.4.3'
4
4
  gem.licenses = 'MIT'
5
5
  gem.authors = ['Justin Scott']
6
6
  gem.email = 'jvscott@gmail.com'
@@ -34,7 +34,7 @@ describe 'the Job Assembler' do
34
34
  @client.close
35
35
  end
36
36
 
37
- %w(Git JSON MinimalJob).each do |request|
37
+ %w(Git JSON MinimalJob EmptyJSON).each do |request|
38
38
  given "#{request} requests on the Conveyor" do
39
39
  setup do
40
40
  @client.request conveyor_enqueue(request)
@@ -58,6 +58,8 @@ describe 'the Job Assembler' do
58
58
  should 'build the context with a parsed payload' do
59
59
  if request == 'Git'
60
60
  assert_equal 'develop', @worker_data[:context]['branch']
61
+ elsif request == 'EmptyJSON'
62
+ assert_equal true, @worker_data[:context].empty?
61
63
  else
62
64
  assert_equal 'value', @worker_data[:context]['test1']
63
65
  end
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  # http://www.url-encode-decode.com/
3
3
  empty: ''
4
+ emptyjson: '{}'
4
5
  nonjson: not json
5
6
  json: '{"test1": "value", "test2": "value"}'
6
7
  bitbucket: |
data/test/input_spec.rb CHANGED
@@ -22,7 +22,7 @@ given 'the HTTP Input' do
22
22
  include InputHelper
23
23
  include OutputHelper
24
24
 
25
- %w(Bitbucket Github JSON Empty).each do |format|
25
+ %w(Bitbucket Github JSON Empty EmptyJSON).each do |format|
26
26
  context "POSTing #{format} data" do
27
27
  setup do
28
28
  @conveyor = TestProcess.stub :conveyor
@@ -29,7 +29,7 @@ describe 'the Payload Parser' do
29
29
  @client.close
30
30
  end
31
31
 
32
- %w(Bitbucket Github JSON Empty).each do |format|
32
+ %w(Bitbucket Github JSON Empty EmptyJSON).each do |format|
33
33
  given "valid #{format} payloads" do
34
34
  setup do
35
35
  payload = payload_parser_request format
@@ -46,7 +46,7 @@ describe 'the Payload Parser' do
46
46
  assert_kind_of Hash, @response[:data]
47
47
  keys = Payload.hash_keys
48
48
  keys = %w(test1 test2) if format == 'JSON'
49
- keys = [] if format == 'Empty'
49
+ keys = [] if format =~ /Empty/
50
50
  keys.each do |key|
51
51
  payload = @response[:data]
52
52
  assert_not_nil payload[key]
@@ -50,10 +50,11 @@ module InputHelper
50
50
  format = 'Bitbucket' if type == 'Git' # develop branch
51
51
  format = 'Github' if type == 'IgnoredBranch' # master branch
52
52
  format = 'NonJSON' if type == 'NonJSON'
53
+ format = 'EmptyJSON' if type == 'EmptyJSON'
53
54
 
54
55
  job = 'test_job'
55
56
  job = 'git_job' if type == 'Git' || type == 'IgnoredBranch'
56
- job = 'minimal_job' if type == 'MinimalJob'
57
+ job = 'minimal_job' if type == 'MinimalJob' || type == 'EmptyJSON'
57
58
  job = 'unknown_job' if type == 'UnknownJob' # TODO: why does commenting this out still pass payload parser?!
58
59
  job = 'empty_job' if type == 'EmptyJob'
59
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robot_sweatshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Scott