circleci-bundle-update-pr 1.13.0 → 1.14.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
  SHA256:
3
- metadata.gz: 730944a68610db32ff05eed70a7679dd3eb435e6b70c5cd6a4e87a89635bbb45
4
- data.tar.gz: e10e148aec42a589409f667a0a61acefc5d46025c4f78d1b608334d3eecabe55
3
+ metadata.gz: 241236ccdbb295ae0cdc591030ae68f962e60b39b8ca72dd90c1761ac2473a38
4
+ data.tar.gz: aeeafc7e65b66ad9e8042a88fe763d21ead19dc0b62bd971a7640f5b6f3a669e
5
5
  SHA512:
6
- metadata.gz: 81cca2a76b7348417a52bad36b610be96355cf0748ca5a8df095575dfd431b1ba6538bf8ac9c7c6ba38080a121f91dd3458268f0c607be3a484e8e170f3455ed
7
- data.tar.gz: 587c1b13c5d72cab5c3fb5c11ddb2c18ece7f41c5767f8eeab5bbfc19a609c476b8b5e2718dc92db22914e551ae2989daacf86a90a5bf78d4eb46fec7df59511
6
+ metadata.gz: df2bd5da29378b5f2608b942c33d484eeb772a05b13e6b6c1134ab907fa4d606c50d6db95d2e4636278d9b569b958e0a71d2647b186a84302b45d1ee31c29871
7
+ data.tar.gz: 971933e80b2149bbae90601d48ef6a56f3d0491d1f7a1cef4767a1f16c0962c0a1dc11372d66f77b1983d98164e16518b67d017f64861a2a53f60899acb4ea3c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- circleci-bundle-update-pr (1.13.0)
4
+ circleci-bundle-update-pr (1.14.0)
5
5
  compare_linker (>= 1.4.0)
6
6
  octokit
7
7
 
@@ -18,7 +18,7 @@ GEM
18
18
  multipart-post (>= 1.2, < 3)
19
19
  httpclient (2.8.3)
20
20
  multipart-post (2.0.0)
21
- octokit (4.12.0)
21
+ octokit (4.13.0)
22
22
  sawyer (~> 0.8.0, >= 0.5.3)
23
23
  public_suffix (3.0.3)
24
24
  rake (12.3.1)
@@ -28,7 +28,7 @@ GEM
28
28
  rspec-mocks (~> 3.8.0)
29
29
  rspec-core (3.8.0)
30
30
  rspec-support (~> 3.8.0)
31
- rspec-expectations (3.8.1)
31
+ rspec-expectations (3.8.2)
32
32
  diff-lcs (>= 1.2.0, < 2.0)
33
33
  rspec-support (~> 3.8.0)
34
34
  rspec-mocks (3.8.0)
@@ -51,4 +51,4 @@ DEPENDENCIES
51
51
  rspec (~> 3.7)
52
52
 
53
53
  BUNDLED WITH
54
- 1.16.5
54
+ 1.16.6
data/README.md CHANGED
@@ -118,6 +118,41 @@ Usage: circleci-bundle-update-pr [options]
118
118
  -d, --duplicate Make PR even if it has already existed
119
119
  ```
120
120
 
121
+ ## Tips
122
+
123
+ ### Customize PR description
124
+
125
+ If `.circleci/BUNDLE_UPDATE_NOTE.md` exists, the content will be appended to PR description.
126
+
127
+ e.g. `.circleci/BUNDLE_UPDATE_NOTE.md` is the below.
128
+
129
+ ```
130
+ ## Notice
131
+
132
+ * example1
133
+ * example2
134
+ ```
135
+
136
+ PR description will be created as the below.
137
+
138
+ ```
139
+ **Updated RubyGems:**
140
+
141
+ * [ ] [octokit](https://github.com/octokit/octokit.rb): [`4.9.0...4.10.0`](https://github.com/octokit/octokit.rb/compare/v4.9.0...v4.10.0)
142
+ * [ ] [public_suffix](https://github.com/weppos/publicsuffix-ruby): [`3.0.2...3.0.3`](https://github.com/weppos/publicsuffix-ruby/compare/v3.0.2...v3.0.3)
143
+
144
+ Powered by [circleci-bundle-update-pr](https://rubygems.org/gems/circleci-bundle-update-pr)
145
+
146
+ ---
147
+
148
+ ## Notice
149
+
150
+ * example1
151
+ * example2
152
+ ```
153
+
154
+ `.circleci/BUNDLE_UPDATE_NOTE.md` or `CIRCLECI_BUNDLE_UPDATE_NOTE.md`, either one is OK. It gives priority `.circleci/BUNDLE_UPDATE_NOTE.md` over `CIRCLECI_BUNDLE_UPDATE_NOTE.md`.
155
+
121
156
  ## Contributing
122
157
 
123
158
  1. Fork it ( https://github.com/masutaka/circleci-bundle-update-pr/fork )
@@ -1,6 +1,7 @@
1
1
  require "circleci/bundle/update/pr/version"
2
2
  require "octokit"
3
3
  require "compare_linker"
4
+ require "circleci/bundle/update/pr/note"
4
5
 
5
6
  module Circleci
6
7
  module Bundle
@@ -125,6 +126,15 @@ module Circleci
125
126
  Powered by [circleci-bundle-update-pr](https://rubygems.org/gems/circleci-bundle-update-pr)
126
127
  EOB
127
128
 
129
+ if Note.exist?
130
+ body << <<-EOB
131
+
132
+ ---
133
+
134
+ #{Note.read}
135
+ EOB
136
+ end
137
+
128
138
  client.update_pull_request(repo_full_name, pr_number, body: body)
129
139
  end
130
140
  private_class_method :update_pull_request_body
@@ -0,0 +1,24 @@
1
+ module Circleci
2
+ module Bundle
3
+ module Update
4
+ module Pr
5
+ module Note
6
+ module_function
7
+
8
+ def exist?
9
+ File.exist?('.circleci/BUNDLE_UPDATE_NOTE.md') ||
10
+ File.exist?('CIRCLECI_BUNDLE_UPDATE_NOTE.md')
11
+ end
12
+
13
+ def read
14
+ if File.exist?('.circleci/BUNDLE_UPDATE_NOTE.md')
15
+ File.read('.circleci/BUNDLE_UPDATE_NOTE.md')
16
+ elsif File.exist?('CIRCLECI_BUNDLE_UPDATE_NOTE.md')
17
+ File.read('CIRCLECI_BUNDLE_UPDATE_NOTE.md')
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -2,7 +2,7 @@ module Circleci
2
2
  module Bundle
3
3
  module Update
4
4
  module Pr
5
- VERSION = "1.13.0"
5
+ VERSION = '1.14.0'
6
6
  end
7
7
  end
8
8
  end
@@ -0,0 +1,82 @@
1
+ require 'tmpdir'
2
+
3
+ describe Circleci::Bundle::Update::Pr::Note do
4
+ let!(:home_dir) { Dir.pwd }
5
+ let(:work_dir) { Dir.mktmpdir }
6
+
7
+ before do
8
+ Dir.chdir work_dir
9
+ Dir.mkdir '.circleci'
10
+ end
11
+
12
+ after do
13
+ Dir.chdir home_dir
14
+ FileUtils.rm_rf work_dir
15
+ end
16
+
17
+ describe '.exist?' do
18
+ subject { Circleci::Bundle::Update::Pr::Note.exist? }
19
+
20
+ context 'given only .circleci/BUNDLE_UPDATE_NOTE.md' do
21
+ before do
22
+ FileUtils.touch('.circleci/BUNDLE_UPDATE_NOTE.md')
23
+ end
24
+
25
+ it { is_expected.to be_truthy }
26
+ end
27
+
28
+ context 'given only CIRCLECI_BUNDLE_UPDATE_NOTE.md' do
29
+ before do
30
+ FileUtils.touch('CIRCLECI_BUNDLE_UPDATE_NOTE.md')
31
+ end
32
+
33
+ it { is_expected.to be_truthy }
34
+ end
35
+
36
+ context 'given .circleci/BUNDLE_UPDATE_NOTE.md and CIRCLECI_BUNDLE_UPDATE_NOTE.md' do
37
+ before do
38
+ FileUtils.touch('.circleci/BUNDLE_UPDATE_NOTE.md')
39
+ FileUtils.touch('CIRCLECI_BUNDLE_UPDATE_NOTE.md')
40
+ end
41
+
42
+ it { is_expected.to be_truthy }
43
+ end
44
+
45
+ context 'given nothing' do
46
+ it { is_expected.to be_falsy }
47
+ end
48
+ end
49
+
50
+ describe '.read' do
51
+ subject { Circleci::Bundle::Update::Pr::Note.read }
52
+
53
+ context 'given .circleci/BUNDLE_UPDATE_NOTE.md' do
54
+ before do
55
+ File.open('.circleci/BUNDLE_UPDATE_NOTE.md', 'w') { |f| f.write('I am .circleci/BUNDLE_UPDATE_NOTE.md') }
56
+ end
57
+
58
+ it { is_expected.to eq 'I am .circleci/BUNDLE_UPDATE_NOTE.md' }
59
+ end
60
+
61
+ context 'given CIRCLECI_BUNDLE_UPDATE_NOTE.md' do
62
+ before do
63
+ File.open('CIRCLECI_BUNDLE_UPDATE_NOTE.md', 'w') { |f| f.write('I am CIRCLECI_BUNDLE_UPDATE_NOTE.md') }
64
+ end
65
+
66
+ it { is_expected.to eq 'I am CIRCLECI_BUNDLE_UPDATE_NOTE.md' }
67
+ end
68
+
69
+ context 'given .circleci/BUNDLE_UPDATE_NOTE.md and CIRCLECI_BUNDLE_UPDATE_NOTE.md' do
70
+ before do
71
+ File.open('.circleci/BUNDLE_UPDATE_NOTE.md', 'w') { |f| f.write('I am .circleci/BUNDLE_UPDATE_NOTE.md') }
72
+ File.open('CIRCLECI_BUNDLE_UPDATE_NOTE.md', 'w') { |f| f.write('I am CIRCLECI_BUNDLE_UPDATE_NOTE.md') }
73
+ end
74
+
75
+ it { is_expected.to eq 'I am .circleci/BUNDLE_UPDATE_NOTE.md' }
76
+ end
77
+
78
+ context 'given nothing' do
79
+ it { is_expected.to be_nil }
80
+ end
81
+ end
82
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circleci-bundle-update-pr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Masuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-06 00:00:00.000000000 Z
11
+ date: 2018-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -99,7 +99,9 @@ files:
99
99
  - bin/circleci-bundle-update-pr
100
100
  - circleci-bundle-update-pr.gemspec
101
101
  - lib/circleci/bundle/update/pr.rb
102
+ - lib/circleci/bundle/update/pr/note.rb
102
103
  - lib/circleci/bundle/update/pr/version.rb
104
+ - spec/circleci/bundle/update/pr/note_spec.rb
103
105
  - spec/circleci/bundle/update/pr_spec.rb
104
106
  - spec/spec_helper.rb
105
107
  homepage: https://github.com/masutaka/circleci-bundle-update-pr
@@ -127,5 +129,6 @@ signing_key:
127
129
  specification_version: 4
128
130
  summary: Create GitHub PullRequest of bundle update in CircleCI
129
131
  test_files:
132
+ - spec/circleci/bundle/update/pr/note_spec.rb
130
133
  - spec/circleci/bundle/update/pr_spec.rb
131
134
  - spec/spec_helper.rb