update_status 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,30 +6,47 @@ Updates pull requests on github using the statuses api (http://developer.github.
6
6
 
7
7
  = Usage
8
8
 
9
+ <tt>gem install update_status</tt>
10
+
11
+
9
12
  on your branch run
10
13
 
11
- $: status
14
+ $: <tt>status</tt>
15
+
16
+ This will generate a .status.yml file in the current directory, you will need to edit this file with your credentials.
17
+
18
+ .status.yml:
12
19
 
13
- This will take you through some config:
14
- eg
20
+ ---
21
+ :username: Jenkins username
15
22
 
16
- :owner => "dougdroper",
23
+ :token: Githubs API token (http://developer.github.com/v3/oauth/)
17
24
 
18
- :repo => "status",
25
+ :owner: eg. dougdroper
19
26
 
20
- :ci_url => "http://jenkins-ci.org",
27
+ :password: Jenkins password
21
28
 
22
- :token => "your github token http://developer.github.com/v3/oauth/",
29
+ :repo: eg. status
23
30
 
24
- :username => "your ci username",
31
+ :ci_url: eg. http://ci.jenkins.com
25
32
 
26
- :password => "your ci password"
33
+ add .status.yml to .gitignore
27
34
 
28
35
  When your branch has passed QA
29
36
 
30
- $: status pass
37
+ $: <tt>status -s pass</tt>
38
+
39
+ You can pass a different branch
40
+
41
+ $: <tt>status -b other_feature_branch</tt>
42
+
43
+ or
44
+
45
+ $: <tt>status -b other_feature_branch -s pass</tt>
31
46
 
47
+ help
32
48
 
49
+ $: <tt>status -h</tt>
33
50
 
34
51
  == Contributing to status
35
52
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -34,6 +34,7 @@ module Status
34
34
  def state
35
35
  return "success" if @jenkins.pass? && @qa_status == "pass"
36
36
  return "pending" if @jenkins.pass? && @qa_status != "pass"
37
+ return "pending" if !@jenkins.pass? && @qa_status != "pass"
37
38
  git_state
38
39
  end
39
40
 
@@ -3,7 +3,7 @@
3
3
  module Status
4
4
  class Jenkins
5
5
  def initialize(branch)
6
- @branch = branch
6
+ @branch = branch.gsub(/\//, "_")
7
7
  end
8
8
 
9
9
  def state
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Status
4
4
  class NotFoundException < Exception
5
- def initialize(e)
5
+ def initialize(klass, e)
6
+ puts klass.class.inspect + " error"
6
7
  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
@@ -44,7 +44,7 @@ module Status
44
44
  begin
45
45
  MultiJson.decode @site[path].get
46
46
  rescue Exception => e
47
- raise NotFoundException.new(e)
47
+ raise NotFoundException.new(@klass, e)
48
48
  end
49
49
  end
50
50
 
@@ -52,7 +52,7 @@ module Status
52
52
  begin
53
53
  MultiJson.decode @site[path].post(MultiJson.encode(data))
54
54
  rescue Exception => e
55
- raise NotFoundException.new(e)
55
+ raise NotFoundException.new(@klass, e)
56
56
  end
57
57
  end
58
58
  end
@@ -23,6 +23,11 @@ describe Status::Github::Statuses do
23
23
  subject.new("pending", "feature_branch").send(:state).should == "pending"
24
24
  end
25
25
 
26
+ it "has a payload pending state when ci is pending but qa hasn't passed" do
27
+ @jenkins.stub(:new => stub(:state => "pending", :pass? => false))
28
+ subject.new("pending", "feature_branch").send(:state).should == "pending"
29
+ end
30
+
26
31
  it "has a payload success state when ci is passing and qa has passed" do
27
32
  @jenkins.stub(:new => stub(:state => "success", :pass? => true))
28
33
  subject.new("pass", "feature_branch").send(:state).should == "success"
@@ -11,6 +11,10 @@ describe Status::Jenkins do
11
11
  end
12
12
 
13
13
  context "#state" do
14
+ it "has a path with underscores" do
15
+ Status::Jenkins.new("dr/feature").path.should == "/job/dr_feature/lastBuild/api/json"
16
+ end
17
+
14
18
  it "is success when ci result is success" do
15
19
  Status::Request.stub(:new => stub(:get => {"building" => false, "result" => "success"}))
16
20
  subject.state.should == "success"
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "update_status"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
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"]
12
- s.date = "2012-12-12"
12
+ s.date = "2012-12-18"
13
13
  s.description = "Updates pull requests on github, with latest build from Jenkins and QA status"
14
14
  s.email = "douglasroper@notonthehighstreet.com"
15
15
  s.executables = ["status"]
metadata CHANGED
@@ -1,138 +1,141 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: update_status
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 1
10
+ version: 0.2.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Douglas Roper
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-12-12 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-12-18 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: multi_json
16
- requirement: !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
17
23
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 17
28
+ segments:
29
+ - 1
30
+ - 0
31
+ - 3
21
32
  version: 1.0.3
22
33
  type: :runtime
34
+ requirement: *id001
23
35
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 1.0.3
30
- - !ruby/object:Gem::Dependency
36
+ - !ruby/object:Gem::Dependency
31
37
  name: rest-client
32
- requirement: !ruby/object:Gem::Requirement
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
33
39
  none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 11
44
+ segments:
45
+ - 1
46
+ - 6
47
+ - 2
37
48
  version: 1.6.2
38
49
  type: :runtime
50
+ requirement: *id002
39
51
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 1.6.2
46
- - !ruby/object:Gem::Dependency
52
+ - !ruby/object:Gem::Dependency
47
53
  name: rspec
48
- requirement: !ruby/object:Gem::Requirement
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
49
55
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 35
60
+ segments:
61
+ - 2
62
+ - 11
63
+ - 0
53
64
  version: 2.11.0
54
65
  type: :development
66
+ requirement: *id003
55
67
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: 2.11.0
62
- - !ruby/object:Gem::Dependency
68
+ - !ruby/object:Gem::Dependency
63
69
  name: rdoc
64
- requirement: !ruby/object:Gem::Requirement
70
+ version_requirements: &id004 !ruby/object:Gem::Requirement
65
71
  none: false
66
- requirements:
72
+ requirements:
67
73
  - - ~>
68
- - !ruby/object:Gem::Version
69
- version: '3.12'
74
+ - !ruby/object:Gem::Version
75
+ hash: 31
76
+ segments:
77
+ - 3
78
+ - 12
79
+ version: "3.12"
70
80
  type: :development
81
+ requirement: *id004
71
82
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '3.12'
78
- - !ruby/object:Gem::Dependency
83
+ - !ruby/object:Gem::Dependency
79
84
  name: bundler
80
- requirement: !ruby/object:Gem::Requirement
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
81
86
  none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 29
91
+ segments:
92
+ - 1
93
+ - 2
94
+ - 1
85
95
  version: 1.2.1
86
96
  type: :development
97
+ requirement: *id005
87
98
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: 1.2.1
94
- - !ruby/object:Gem::Dependency
99
+ - !ruby/object:Gem::Dependency
95
100
  name: jeweler
96
- requirement: !ruby/object:Gem::Requirement
101
+ version_requirements: &id006 !ruby/object:Gem::Requirement
97
102
  none: false
98
- requirements:
103
+ requirements:
99
104
  - - ~>
100
- - !ruby/object:Gem::Version
105
+ - !ruby/object:Gem::Version
106
+ hash: 63
107
+ segments:
108
+ - 1
109
+ - 8
110
+ - 4
101
111
  version: 1.8.4
102
112
  type: :development
113
+ requirement: *id006
103
114
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ~>
108
- - !ruby/object:Gem::Version
109
- version: 1.8.4
110
- - !ruby/object:Gem::Dependency
115
+ - !ruby/object:Gem::Dependency
111
116
  name: rcov
112
- requirement: !ruby/object:Gem::Requirement
117
+ version_requirements: &id007 !ruby/object:Gem::Requirement
113
118
  none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
124
+ - 0
125
+ version: "0"
118
126
  type: :development
127
+ requirement: *id007
119
128
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- description: Updates pull requests on github, with latest build from Jenkins and QA
127
- status
129
+ description: Updates pull requests on github, with latest build from Jenkins and QA status
128
130
  email: douglasroper@notonthehighstreet.com
129
- executables:
131
+ executables:
130
132
  - status
131
133
  extensions: []
132
- extra_rdoc_files:
134
+
135
+ extra_rdoc_files:
133
136
  - LICENSE.txt
134
137
  - README.rdoc
135
- files:
138
+ files:
136
139
  - .document
137
140
  - .travis.yml
138
141
  - Gemfile
@@ -156,31 +159,37 @@ files:
156
159
  - status.gemspec
157
160
  - update_status.gemspec
158
161
  homepage: http://github.com/dougdroper/status
159
- licenses:
162
+ licenses:
160
163
  - MIT
161
164
  post_install_message:
162
165
  rdoc_options: []
163
- require_paths:
166
+
167
+ require_paths:
164
168
  - lib
165
- required_ruby_version: !ruby/object:Gem::Requirement
169
+ required_ruby_version: !ruby/object:Gem::Requirement
166
170
  none: false
167
- requirements:
168
- - - ! '>='
169
- - !ruby/object:Gem::Version
170
- version: '0'
171
- segments:
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ hash: 3
175
+ segments:
172
176
  - 0
173
- hash: 3307849087401865744
174
- required_rubygems_version: !ruby/object:Gem::Requirement
177
+ version: "0"
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
179
  none: false
176
- requirements:
177
- - - ! '>='
178
- - !ruby/object:Gem::Version
179
- version: '0'
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ hash: 3
184
+ segments:
185
+ - 0
186
+ version: "0"
180
187
  requirements: []
188
+
181
189
  rubyforge_project:
182
190
  rubygems_version: 1.8.24
183
191
  signing_key:
184
192
  specification_version: 3
185
193
  summary: Status update for pull requests
186
194
  test_files: []
195
+