update_status 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.8.7"
4
+ - "1.9.2"
5
+ - "1.9.3"
6
+ # uncomment this line if your project needs to run something other than `rake`:
7
+ script: bundle exec rspec spec
@@ -1,5 +1,7 @@
1
1
  = status
2
2
 
3
+ {<img src="https://secure.travis-ci.org/dougdroper/status.png?branch=master" alt="Build Status" />}[https://travis-ci.org/dougdroper/status]
4
+
3
5
  Updates pull requests on github using the statuses api (http://developer.github.com/v3/repos/statuses/), with latest build from Jenkins and QA status
4
6
 
5
7
  = Usage
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -54,6 +54,10 @@ module Status
54
54
  Status.config.attrs["ci_url"]
55
55
  end
56
56
 
57
+ def ci_token
58
+ "0a9f342928d2e2fc953425061b314b83"
59
+ end
60
+
57
61
  def ci_user
58
62
  Status.config.attrs["username"]
59
63
  end
@@ -17,6 +17,7 @@ module Status
17
17
 
18
18
  def get_ci_status
19
19
  response = Request.new(:ci).get(path)
20
+ raise response.inspect
20
21
  return "pending" if response == "not found"
21
22
  return "pending" if response["building"] == true
22
23
  return "failure" unless response["result"].downcase == "success"
@@ -24,7 +25,7 @@ module Status
24
25
  end
25
26
 
26
27
  def path
27
- "/job/#{Status.branch}/lastBuild/api/json"
28
+ "/job/#{Status.branch}/lastBuild/api/json?token=#{Status.ci_token}"
28
29
  end
29
30
  end
30
31
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Status
4
4
  class NotFoundException < Exception
5
- def initialize
6
- puts "Not found"
7
- puts "Make sure #{ENV['HOME']}/.status.conf is set up correctly"
5
+ def initialize(e)
6
+ puts e.inspect
7
+ puts "Make sure #{ENV['HOME']}/.status.conf is set up correctly and you can connect to githubs api"
8
8
  abort("exit")
9
9
  end
10
10
  end
@@ -37,22 +37,22 @@ module Status
37
37
  def initialize(type=:github)
38
38
  @klass = {:github => GithubRequest, :ci => CiRequest}[type]
39
39
  @klass = @klass.new
40
- @site = RestClient::Resource.new(@klass.url, @klass.options, :headers => { :accept => :json, :content_type => :json })
40
+ @site = RestClient::Resource.new(@klass.url, :headers => { :accept => :json, :content_type => :json })
41
41
  end
42
42
 
43
43
  def get(path)
44
44
  begin
45
45
  MultiJson.decode @site[path].get
46
- rescue
47
- raise NotFoundException.new
46
+ rescue Exception => e
47
+ raise NotFoundException.new(e)
48
48
  end
49
49
  end
50
50
 
51
51
  def post(path, data)
52
52
  begin
53
53
  MultiJson.decode @site[path].post(MultiJson.encode(data))
54
- rescue
55
- raise NotFoundException.new
54
+ rescue Exception => e
55
+ raise NotFoundException.new(e)
56
56
  end
57
57
  end
58
58
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "update_status"
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Douglas Roper"]
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  ".document",
22
+ ".travis.yml",
22
23
  "Gemfile",
23
24
  "Gemfile.lock",
24
25
  "LICENSE.txt",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: update_status
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Douglas Roper
@@ -137,6 +137,7 @@ extra_rdoc_files:
137
137
  - README.rdoc
138
138
  files:
139
139
  - .document
140
+ - .travis.yml
140
141
  - Gemfile
141
142
  - Gemfile.lock
142
143
  - LICENSE.txt