gem_release_helper 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d119030846dc267a66ee8153fd37e9a18938737
4
- data.tar.gz: dfbe0a6a700237dd2ad36a4aec54ea10c5a2893e
3
+ metadata.gz: 09406180e777f47eb6c74e78a8af005d8c78f4bd
4
+ data.tar.gz: 4b1823f475442108b9c1c6eb1b8a7eb94f719d85
5
5
  SHA512:
6
- metadata.gz: b7745d262ae469d4ad66e9edabe4f4e00e72016ec6059e92313cd2704d3b9393798b64caee4fd7c2b887bd2e2d029e574989d6deb10465f37fa9065398c02ed1
7
- data.tar.gz: 13747b0e86029980968bd3a2ff49ea8a2ac523ff172640695f43c9ba4d35a05647a6e2ba71e669f03ce5299a188c88bb800cb42c7639112f9ebe953fa467a1d6
6
+ metadata.gz: f3616a684c12df12da36c70f706e7d7529b98bc8c73f508df5ed05b671aea070c452a759d892f58c35d90bbb51dec86f4185df7dd9ac6eafa0e641bd936e6c50
7
+ data.tar.gz: 42ca0e30aec5334ff1aa2e4b09eef5c1c5589c85449ecec4ac578aaef7498ee34aa6727a0d32cda8d07e8a14bc10421d40131290a39543901a4ed4edd1ed056d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.0.2 - 2016-08-04
2
+ * [improve] Enable basic auth method to access private repo
3
+
1
4
  ## 1.0.1 - 2016-07-22
2
5
  * [improve] Enable to detect/bump version using external file [#2](https://github.com/uu59/gem_release_helper/pull/2)
3
6
  * [improve] Enable to access private repo [#1](https://github.com/uu59/gem_release_helper/pull/1)
data/README.md CHANGED
@@ -29,9 +29,14 @@ Load rake tasks at your Rakefile:
29
29
  require "gem_release_helper/tasks"
30
30
  GemReleaseHelper::Tasks.install({
31
31
  gemspec: "./your_gem.gemspec",
32
- github_name: "user/repo", # if this repo is private, you can access it by set GITHUB_OAUTH_TOKEN to environment variable
32
+ github_name: "user/repo",
33
33
  })
34
34
 
35
+ For a private repository, you can choose a way from below:
36
+
37
+ 1. Set `GITHUB_OAUTH_TOKEN` environment variable.
38
+ 2. Set `GITHUB_USER_NAME` and `GITHUB_TOKEN` environment variable.
39
+ 3. Set by `git config --global github.user [your user name on GitHub]` and `git config --global github.token [your token]` (same as [this manner](https://github.com/blog/180-local-github-config))
35
40
 
36
41
  ## Usage
37
42
 
@@ -132,9 +132,18 @@ module GemReleaseHelper
132
132
  end
133
133
 
134
134
  def pull_request_info(number)
135
- body = open("https://api.github.com/repos/#{github_name}/issues/#{number}", {
136
- "Authentication" => "token #{ENV["GITHUB_OAUTH_TOKEN"]}"
137
- }).read
135
+ header =
136
+ if github_oauth_token
137
+ {
138
+ "Authentication" => "token #{ENV["GITHUB_OAUTH_TOKEN"]}"
139
+ }
140
+ else
141
+ {
142
+ http_basic_authentication: [github_user_name, github_personal_token]
143
+ }
144
+ end
145
+
146
+ body = open("https://api.github.com/repos/#{github_name}/issues/#{number}", header).read
138
147
  JSON.parse(body)
139
148
  end
140
149
 
@@ -161,6 +170,18 @@ module GemReleaseHelper
161
170
  def changelog_path
162
171
  root_dir.join("CHANGELOG.md")
163
172
  end
173
+
174
+ def github_user_name
175
+ ENV["GITHUB_USER_NAME"] || `git config github.user`.strip
176
+ end
177
+
178
+ def github_personal_token
179
+ ENV["GITHUB_TOKEN"] || `git config github.token`.strip
180
+ end
181
+
182
+ def github_oauth_token
183
+ ENV["GITHUB_OAUTH_TOKEN"]
184
+ end
164
185
  end
165
186
  end
166
187
  end
@@ -1,3 +1,3 @@
1
1
  module GemReleaseHelper
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_release_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshihara
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-22 00:00:00.000000000 Z
12
+ date: 2016-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler