cbgit 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/gitbuild +14 -13
  3. data/lib/cbgit/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1dd5ba4d3710ddad57600bb6c804f1ded2c652bf
4
- data.tar.gz: 8c8238da1a49450cef23425fcf4f17e0ac28c913
3
+ metadata.gz: 29ac1484be87d5a91ae309dd6cab38ed50351b11
4
+ data.tar.gz: b730e6f50f2913b251a34674d8fe316dfe8071ab
5
5
  SHA512:
6
- metadata.gz: cb3aa975e99cb5981376146b463dc003441e10e8da0798ca357cdda53a36c8ba03d59803440b38b6c604c9a979443e4025c74bc44c0716978b0cd64f40d7ba77
7
- data.tar.gz: 1c0366016154d2864b8ba401729eab0b00b5b9622bc492d76f2f75c3c496a5fc7cfdf7d064376956847a95378dcd19745be4d47afe13f79bfae893812ca62d8a
6
+ metadata.gz: 0c7164d12b28b93c6558454d6d735f6c51cf4fa96d3d82061b737e8fce57a8085fdef36832df4f0ca5dff43e1bb2212effb7dde5ef03210d4dc8f28737794115
7
+ data.tar.gz: b9ccc321e0c984f27cb5310184991283c88555f849851c84634856f84d78f3c497bab1d560ed9a1ffea06bc22d25cfb305eb1fc7bb7866c64d080c96fa4f6218
@@ -88,11 +88,20 @@ def git command, *args
88
88
  @g.lib.send :command, command, args
89
89
  end
90
90
 
91
- PULLS_LIMIT = 1000
92
- def fetch_github_pulls repo=calculate_github_repo
93
- # Access pull requests
91
+ ISSUES_LIMIT = 1000
92
+ def fetch_github_pulls repo
93
+ # Access pull requests via issues API, because PRs API does not expose labels
94
+ # but the issues API does. Technically, all the PRs are issues, so we just
95
+ # pull all the issues and sort the ones that are not PRs out.
94
96
  @logger.debug "Fetching pull requests from #{repo}"
95
- pulls = Octokit.pulls(repo, state: :open, per_page: PULLS_LIMIT)
97
+ Octokit.issues(repo, state: :open, per_page: ISSUES_LIMIT)
98
+ .select { |i| i[:pull_request] }
99
+ end
100
+
101
+ def fetch_github_pulls_to_build repo=calculate_github_repo
102
+ fetch_github_pulls(repo).select { |pull|
103
+ pull[:labels].find { |label| label[:name] == OPTS[:BUILD_NAME] }
104
+ }
96
105
  end
97
106
 
98
107
  def calculate_github_repo
@@ -120,10 +129,6 @@ def calculate_build_number
120
129
  end
121
130
  end
122
131
 
123
- def pull_tag_regex
124
- /\B\##{OPTS[:BUILD_NAME]}\b/
125
- end
126
-
127
132
  # --------------------------------------------------
128
133
  # MAIN SCRIPT
129
134
 
@@ -143,8 +148,7 @@ begin
143
148
 
144
149
  # --------------------------------------------------------------------
145
150
  # Figure out branches we will merge, by looking for the magic tag
146
- pulls = fetch_github_pulls
147
- pulls = pulls.select{ |pull| pull.body.match pull_tag_regex }
151
+ pulls = fetch_github_pulls_to_build
148
152
  raise 'No pull requests to merge!' if pulls.empty?
149
153
  brnames = pulls.map{ |b| b.head.ref }
150
154
  puts "---- Found Github branches to build:\n#{brnames.join "\n" }"
@@ -237,6 +241,3 @@ rescue
237
241
  branch.delete rescue nil
238
242
  raise
239
243
  end
240
-
241
-
242
-
@@ -1,3 +1,3 @@
1
1
  module Cbgit
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Cham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-29 00:00:00.000000000 Z
11
+ date: 2014-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler