ciquantum 0.0.18 → 0.0.19

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.
@@ -22,9 +22,13 @@ module CIQuantum
22
22
  return config[command]
23
23
  end
24
24
 
25
- def commit_from_request request
26
- hash = JSON.parse request.body.read.strip
27
- return (hash["repository"]["name"] == config.project) ? hash["after"] : nil
25
+ def commit_from_request body
26
+ begin
27
+ hash = JSON.parse body
28
+ return (hash["repository"]["name"] == config.project) ? hash["after"] : nil
29
+ rescue
30
+ nil
31
+ end
28
32
  end
29
33
 
30
34
  end
@@ -23,10 +23,9 @@ module CIQuantum
23
23
  return config[command]
24
24
  end
25
25
 
26
- def commit_from_request request
26
+ def commit_from_request body
27
27
  begin
28
- xml = request.body.read
29
- return Changeset.new(xml).commit
28
+ return Changeset.new(body).commit
30
29
  rescue Unfuddle::ChangesetError => e
31
30
  nil
32
31
  end
@@ -51,6 +51,7 @@ module CIQuantum
51
51
  end
52
52
 
53
53
  def current_branch_contains_commit? commit_sha
54
+ return false if commit_sha.nil? || commit_sha.empty?
54
55
  branches_with_commit(commit_sha).include?(branch)
55
56
  end
56
57
 
@@ -82,8 +82,9 @@ module CIQuantum
82
82
  end
83
83
 
84
84
  post '/push' do
85
- puts "Request received on push:\n#{request.body.read}"
86
- commit = quantum.adapter.commit_from_request request
85
+ str = request.body.read.strip
86
+ puts "Request received on push:\n#{str}"
87
+ commit = quantum.adapter.commit_from_request str
87
88
  if quantum.git.current_branch_contains_commit? commit
88
89
  quantum.build
89
90
  end
@@ -1,3 +1,3 @@
1
1
  module CIQuantum
2
- Version = VERSION = "0.0.18"
2
+ Version = VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ciquantum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-07-05 00:00:00.000000000 Z
14
+ date: 2012-07-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler