chandler 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7106a3817c6b804c4e46f9debbadf26fc3f30fc6
4
- data.tar.gz: ec0e62704eb8867142e5bb81b082a92b66bab4ae
3
+ metadata.gz: ec007e148274235db641d253dd9fa9fe1acbb945
4
+ data.tar.gz: 1f28e083665578567a9dd64f53034011ab894b2c
5
5
  SHA512:
6
- metadata.gz: ff409c22243a01e099e80bbba377b10a46e2cdb5f89252388de03f821ff3acf180b917ce6e35909e78a3c33ae2749ac8927d4d7d63fed3bc8ce22a10b902269f
7
- data.tar.gz: b1d77ab60077e0c173090f979f35b4bf4af1dd1ab2fd4b0be137d67af10bb6247bcf3d8cb8aae1ad80f80c958dc7248ef88d4e10da085d79d2d3d8384b3de6ef
6
+ metadata.gz: ac6bbf38b10b06cd5ee908b41fe69f1561729dd235bb9a44a8b97cec9e06ac8aaaecd848e4c26d39d5fb4b6e8327d4985f84b46c034587d34da442bf6f53c162
7
+ data.tar.gz: 684fbf5edf1686d1b258c9b10d6a86f5dc1d66ed68f5dfcc55bb035d9133cd85e9ba86c00a93bc956b155c9c55c4bc5b012d14c10394ae57eb2ea9b77af04cdb
@@ -8,6 +8,10 @@ chandler is in a pre-1.0 state. This means that its APIs and behavior are subjec
8
8
 
9
9
  * Your contribution here!
10
10
 
11
+ ## [0.5.0][] (2016-10-07)
12
+
13
+ * Adds support for using `CHANDLER_GITHUB_API_TOKEN` to authenticate your API requests - Orta
14
+
11
15
  ## [0.4.0][] (2016-09-23)
12
16
 
13
17
  * Support for reStructuredText `definition-list` style CHANGELOG layouts.
@@ -42,7 +46,8 @@ chandler is in a pre-1.0 state. This means that its APIs and behavior are subjec
42
46
  * Initial release
43
47
 
44
48
  [Semver]: http://semver.org
45
- [Unreleased]: https://github.com/mattbrictson/chandler/compare/v0.4.0...HEAD
49
+ [Unreleased]: https://github.com/mattbrictson/chandler/compare/v0.5.0...HEAD
50
+ [0.5.0]: https://github.com/mattbrictson/chandler/compare/v0.4.0...v0.5.0
46
51
  [0.4.0]: https://github.com/mattbrictson/chandler/compare/v0.3.1...v0.4.0
47
52
  [0.3.1]: https://github.com/mattbrictson/chandler/compare/v0.3.0...v0.3.1
48
53
  [0.3.0]: https://github.com/mattbrictson/chandler/compare/v0.2.0...v0.3.0
data/Gemfile CHANGED
@@ -4,7 +4,8 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  # Optional development dependencies; requires bundler >= 1.10.
7
- # Note that these gems assume a Ruby 2.2 environment. Install them using:
7
+ # Note that these gems assume a Ruby environment greater than 2.2.5.
8
+ # Install them using:
8
9
  #
9
10
  # bundle install --with guard
10
11
  #
data/README.md CHANGED
@@ -36,9 +36,11 @@ chandler takes the hassle out of maintaining these two separate formats: your CH
36
36
  gem install chandler
37
37
  ```
38
38
 
39
- ### 2. Configure .netrc
39
+ ### 2. Configure .netrc or set ENV vars
40
40
 
41
- In order to access the GitHub API on your behalf, you must provide chandler with your GitHub credentials. Do this by creating a `~/.netrc` file with your GitHub username and password, like this:
41
+ In order to access the GitHub API on your behalf, you must provide chandler with your GitHub credentials.
42
+
43
+ Do this by creating a `~/.netrc` file with your GitHub username and password, like this:
42
44
 
43
45
  ```
44
46
  machine api.github.com
@@ -46,6 +48,8 @@ machine api.github.com
46
48
  password c0d3b4ssssss!
47
49
  ```
48
50
 
51
+ Or expose an ENV variable: `CHANDLER_GITHUB_API_TOKEN` inside your CI.
52
+
49
53
  For more security, you can use an OAuth access token in place of your password. [Here's how to generate one][access-token]. Make sure to enable `public_repo` scope for the token.
50
54
 
51
55
 
@@ -6,7 +6,7 @@ require "chandler/logger"
6
6
  module Chandler
7
7
  class Configuration
8
8
  attr_accessor :changelog_path, :git_path, :github_repository, :dry_run,
9
- :tag_prefix, :logger
9
+ :tag_prefix, :logger, :environment
10
10
 
11
11
  def initialize
12
12
  @changelog_path = "CHANGELOG.md"
@@ -23,9 +23,28 @@ module Chandler
23
23
  @git ||= Chandler::Git.new(:path => git_path, :tag_mapper => tag_mapper)
24
24
  end
25
25
 
26
+ def octokit
27
+ @octokit ||= Octokit::Client.new(octokit_options)
28
+ end
29
+
30
+ def octokit_options
31
+ chandler_token_key = "CHANDLER_GITHUB_API_TOKEN"
32
+ if environment[chandler_token_key]
33
+ { :access_token => environment[chandler_token_key] }
34
+ else
35
+ { :netrc => true }
36
+ end
37
+ end
38
+
39
+ def environment
40
+ @environment ||= ENV
41
+ end
42
+
26
43
  def github
27
- @github ||=
28
- Chandler::GitHub.new(:repository => github_repository, :config => self)
44
+ @github ||= Chandler::GitHub.new(
45
+ :repository => github_repository,
46
+ :config => self
47
+ )
29
48
  end
30
49
 
31
50
  def changelog
@@ -2,8 +2,9 @@ require "octokit"
2
2
 
3
3
  module Chandler
4
4
  # A facade for performing GitHub API operations on a given GitHub repository
5
- # (specified as a git URL or as `owner/repo` format). Requires that
6
- # "~/.netrc" is properly configured with GitHub credentials.
5
+ # (specified as a git URL or as `owner/repo` format). Requires either that
6
+ # "~/.netrc" is properly configured with GitHub credentials or an auth token
7
+ # is available in the host environment at "CHANDLER_GITHUB_API_TOKEN""
7
8
  #
8
9
  class GitHub
9
10
  MissingCredentials = Class.new(StandardError)
@@ -52,7 +53,7 @@ module Chandler
52
53
 
53
54
  def client
54
55
  @client ||= begin
55
- octokit = Octokit::Client.new(:netrc => true)
56
+ octokit = config.octokit
56
57
  octokit.login ? octokit : fail_missing_credentials
57
58
  end
58
59
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Chandler
3
- VERSION = "0.4.0".freeze
3
+ VERSION = "0.5.0".freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chandler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brictson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-23 00:00:00.000000000 Z
11
+ date: 2016-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: netrc
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  requirements: []
196
196
  rubyforge_project:
197
- rubygems_version: 2.6.6
197
+ rubygems_version: 2.5.1
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: Syncs CHANGELOG entries to GitHub's release notes