pr_comet 0.3.0 → 0.3.1

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: 85cd89906ec3936b19baf0285df362c1c85e174b3e629b3561606ce2603da969
4
- data.tar.gz: 315b3d930e793c616a3e141acf8c1cbf21212b4ac18f22515588b4e3a00e8457
3
+ metadata.gz: e882c3c446f91a7603e9d2a0dbac7aca7b105fa55826431b129d05074dde0e80
4
+ data.tar.gz: '0380d1b35fcf50352fef56118132eb97245a7937b4cdcdbacf27e3e7301a9fde'
5
5
  SHA512:
6
- metadata.gz: a6ec85517c9fae4c6fd3bef6bdfeeae6616d8e9737eef41e1901f7e483e1f92572dff967c2f8202d58df4c99a648a6291cd5d104c532762d80e48b67590060ab
7
- data.tar.gz: 625ac832cb54b16f2d868c47c3453c7e0fd826c056cf8912259f5ffadb1fdcf1daaa39f3487434e4a963cc62131678776cc6b96bf38fd8b0cd47c2878c713569
6
+ metadata.gz: 2cf23c4b2bd722fc1c8fad866a58d83d13957e9b78cb3cf6e8967ad8a26cbf313fccb5ffb17934de060346253efac8b20416515d10ed597191d68151d11ba907
7
+ data.tar.gz: 416678d456f984af5c1352d8a644fa2bc8ee33da6923e6336b43d7127807fb556d7fbd7577cfe1095380cacdd2e0ea6aeebbd8e36c13946a7d4c8be771acd4f2
@@ -5,7 +5,7 @@
5
5
  version: 2.1
6
6
 
7
7
  orbs:
8
- ruby-orbs: sue445/ruby-orbs@1.4.3
8
+ ruby-orbs: sue445/ruby-orbs@1.4.4
9
9
  code-climate: rvla/code-climate@0.0.2
10
10
 
11
11
  references:
@@ -0,0 +1,15 @@
1
+ # [Usage]
2
+ #
3
+ # $ gem install gem_comet
4
+ # $ gem_comet init
5
+ # $ gem_comet release {version number, like as "1.2.3"}
6
+ # $ gem_comet changelog
7
+ # $ gem_comet versions
8
+
9
+ version: 1.1
10
+
11
+ release:
12
+ base_branch: master
13
+ release_branch: production
14
+ version_file_path: lib/pr_comet/version.rb
15
+ changelog_file_path: CHANGELOG.md
@@ -1,7 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-06-28 23:30:29 +0000 using RuboCop version 0.72.0.
3
+ # on 2019-10-30 23:39:25 +0000 using RuboCop version 0.76.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ RSpec/LeakyConstantDeclaration:
11
+ Exclude:
12
+ - 'spec/pr_comet/command_line_spec.rb'
@@ -0,0 +1,64 @@
1
+ # Change log
2
+
3
+ ## v0.3.1 (Nov 02, 2019)
4
+
5
+ ### Feature
6
+
7
+ * [#60](https://github.com/ryz310/pr_comet/pull/60) Stub pr comet ([@ryz310](https://github.com/ryz310))
8
+
9
+ ### RuboCop
10
+
11
+ * [#37](https://github.com/ryz310/pr_comet/pull/37) Re-generate .rubocop_todo.yml with RuboCop v0.73.0 ([@ryz310](https://github.com/ryz310))
12
+ * [#38](https://github.com/ryz310/pr_comet/pull/38) Performance/RegexpMatch-20190729233036 ([@ryz310](https://github.com/ryz310))
13
+ * [#39](https://github.com/ryz310/pr_comet/pull/39) Re-generate .rubocop_todo.yml with RuboCop v0.74.0 ([@ryz310](https://github.com/ryz310))
14
+ * [#45](https://github.com/ryz310/pr_comet/pull/45) Re-generate .rubocop_todo.yml with RuboCop v0.75.0 ([@ryz310](https://github.com/ryz310))
15
+ * [#50](https://github.com/ryz310/pr_comet/pull/50) Re-generate .rubocop_todo.yml with RuboCop v0.75.1 ([@ryz310](https://github.com/ryz310))
16
+ * [#55](https://github.com/ryz310/pr_comet/pull/55) Re-generate .rubocop_todo.yml with RuboCop v0.76.0 ([@ryz310](https://github.com/ryz310))
17
+
18
+ ### Misc
19
+
20
+ * [#44](https://github.com/ryz310/pr_comet/pull/44) Bump rubocop-rspec from 1.34.1 to 1.36.0 ([@ryz310](https://github.com/ryz310))
21
+ * [#40](https://github.com/ryz310/pr_comet/pull/40) ryz310/dependabot/bundler/simplecov-0.17.1 ([@ryz310](https://github.com/ryz310))
22
+ * [#43](https://github.com/ryz310/pr_comet/pull/43) ryz310/dependabot/bundler/rake-tw-13.0 ([@ryz310](https://github.com/ryz310))
23
+ * [#48](https://github.com/ryz310/pr_comet/pull/48) ryz310/dependabot/bundler/rspec-3.9.0 ([@ryz310](https://github.com/ryz310))
24
+ * [#47](https://github.com/ryz310/pr_comet/pull/47) ryz310/dependabot/bundler/rubocop-performance-1.5.0 ([@ryz310](https://github.com/ryz310))
25
+ * [#53](https://github.com/ryz310/pr_comet/pull/53) Configure Renovate ([@ryz310](https://github.com/ryz310))
26
+ * [#56](https://github.com/ryz310/pr_comet/pull/56) Update ruby-orbs orb to v1.4.4 ([@ryz310](https://github.com/ryz310))
27
+ * [#61](https://github.com/ryz310/pr_comet/pull/61) Install gem_comet :comet: ([@ryz310](https://github.com/ryz310))
28
+
29
+ ## v0.3.0 (Jul 12, 2019)
30
+
31
+ ### Feature
32
+
33
+ * [#34](https://github.com/ryz310/pr_comet/pull/34) Support blank PR creation ([@ryz310](https://github.com/ryz310))
34
+
35
+ ## v0.2.1 (Jul 12, 2019)
36
+
37
+ ### Misc
38
+
39
+ * [#28](https://github.com/ryz310/pr_comet/pull/28) Re-generate .rubocop_todo.yml with RuboCop v0.72.0 ([@ryz310](https://github.com/ryz310))
40
+ * [#29](https://github.com/ryz310/pr_comet/pull/29) Migrate cirecle ci config to v2.1 ([@ryz310](https://github.com/ryz310))
41
+ * [#30](https://github.com/ryz310/pr_comet/pull/30) Improvement of the test coverage ([@ryz310](https://github.com/ryz310))
42
+
43
+ ## v0.2.0 (Jun 09, 2019)
44
+
45
+ ### Feature
46
+
47
+ * [#16](https://github.com/ryz310/pr_comet/pull/16) Use rainbow gem ([@ryz310](https://github.com/ryz310))
48
+ * [#18](https://github.com/ryz310/pr_comet/pull/18) Support GitHub project ([@ryz310](https://github.com/ryz310))
49
+
50
+ ### Misc
51
+
52
+ * [#5](https://github.com/ryz310/pr_comet/pull/5) Re-generate .rubocop_todo.yml with RuboCop v0.68.0 ([@ryz310](https://github.com/ryz310))
53
+ * [#12](https://github.com/ryz310/pr_comet/pull/12) Re-generate .rubocop_todo.yml with RuboCop v0.68.1 ([@ryz310](https://github.com/ryz310))
54
+ * [#13](https://github.com/ryz310/pr_comet/pull/13) Re-generate .rubocop_todo.yml with RuboCop v0.69.0 ([@ryz310](https://github.com/ryz310))
55
+ * [#15](https://github.com/ryz310/pr_comet/pull/15) Re-generate .rubocop_todo.yml with RuboCop v0.70.0 ([@ryz310](https://github.com/ryz310))
56
+ * [#17](https://github.com/ryz310/pr_comet/pull/17) Re-generate .rubocop_todo.yml with RuboCop v0.71.0 ([@ryz310](https://github.com/ryz310))
57
+
58
+ ## v0.1.1 (Apr 08, 2019)
59
+
60
+ Fix bugs.
61
+
62
+ ## v0.1.0 (Apr 08, 2019)
63
+
64
+ Initial release! :rocket:
@@ -1,30 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pr_comet (0.3.0)
4
+ pr_comet (0.3.1)
5
5
  octokit
6
6
  rainbow
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.6.0)
12
- public_suffix (>= 2.0.2, < 4.0)
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
13
  ast (2.4.0)
14
14
  byebug (11.0.1)
15
15
  coderay (1.1.2)
16
16
  diff-lcs (1.3)
17
17
  docile (1.3.2)
18
- faraday (0.15.4)
18
+ faraday (0.17.0)
19
19
  multipart-post (>= 1.2, < 3)
20
- jaro_winkler (1.5.3)
20
+ jaro_winkler (1.5.4)
21
21
  json (2.2.0)
22
22
  method_source (0.9.2)
23
23
  multipart-post (2.1.1)
24
24
  octokit (4.14.0)
25
25
  sawyer (~> 0.8.0, >= 0.5.3)
26
- parallel (1.17.0)
27
- parser (2.6.3.0)
26
+ parallel (1.18.0)
27
+ parser (2.6.5.0)
28
28
  ast (~> 2.4.0)
29
29
  pry (0.12.2)
30
30
  coderay (~> 1.1.0)
@@ -32,40 +32,40 @@ GEM
32
32
  pry-byebug (3.7.0)
33
33
  byebug (~> 11.0)
34
34
  pry (~> 0.10)
35
- public_suffix (3.1.1)
35
+ public_suffix (4.0.1)
36
36
  rainbow (3.0.0)
37
- rake (10.5.0)
38
- rspec (3.8.0)
39
- rspec-core (~> 3.8.0)
40
- rspec-expectations (~> 3.8.0)
41
- rspec-mocks (~> 3.8.0)
42
- rspec-core (3.8.2)
43
- rspec-support (~> 3.8.0)
44
- rspec-expectations (3.8.4)
37
+ rake (13.0.0)
38
+ rspec (3.9.0)
39
+ rspec-core (~> 3.9.0)
40
+ rspec-expectations (~> 3.9.0)
41
+ rspec-mocks (~> 3.9.0)
42
+ rspec-core (3.9.0)
43
+ rspec-support (~> 3.9.0)
44
+ rspec-expectations (3.9.0)
45
45
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.8.0)
47
- rspec-mocks (3.8.1)
46
+ rspec-support (~> 3.9.0)
47
+ rspec-mocks (3.9.0)
48
48
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.8.0)
50
- rspec-support (3.8.2)
49
+ rspec-support (~> 3.9.0)
50
+ rspec-support (3.9.0)
51
51
  rspec_junit_formatter (0.4.1)
52
52
  rspec-core (>= 2, < 4, != 2.12.0)
53
- rubocop (0.72.0)
53
+ rubocop (0.76.0)
54
54
  jaro_winkler (~> 1.5.1)
55
55
  parallel (~> 1.10)
56
56
  parser (>= 2.6)
57
57
  rainbow (>= 2.2.2, < 4.0)
58
58
  ruby-progressbar (~> 1.7)
59
59
  unicode-display_width (>= 1.4.0, < 1.7)
60
- rubocop-performance (1.4.0)
60
+ rubocop-performance (1.5.0)
61
61
  rubocop (>= 0.71.0)
62
- rubocop-rspec (1.33.0)
63
- rubocop (>= 0.60.0)
62
+ rubocop-rspec (1.36.0)
63
+ rubocop (>= 0.68.1)
64
64
  ruby-progressbar (1.10.1)
65
65
  sawyer (0.8.2)
66
66
  addressable (>= 2.3.5)
67
67
  faraday (> 0.8, < 2.0)
68
- simplecov (0.17.0)
68
+ simplecov (0.17.1)
69
69
  docile (~> 1.1)
70
70
  json (>= 1.8, < 3)
71
71
  simplecov-html (~> 0.10.0)
@@ -80,7 +80,7 @@ DEPENDENCIES
80
80
  bundler (~> 1.16)
81
81
  pr_comet!
82
82
  pry-byebug
83
- rake (~> 10.0)
83
+ rake (~> 13.0)
84
84
  rspec
85
85
  rspec_junit_formatter
86
86
  rubocop
data/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  [![CircleCI](https://circleci.com/gh/ryz310/pr_comet.svg?style=svg)](https://circleci.com/gh/ryz310/pr_comet) [![Gem Version](https://badge.fury.io/rb/pr_comet.svg)](https://badge.fury.io/rb/pr_comet) [![Maintainability](https://api.codeclimate.com/v1/badges/962618c106a548ed762b/maintainability)](https://codeclimate.com/github/ryz310/pr_comet/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/962618c106a548ed762b/test_coverage)](https://codeclimate.com/github/ryz310/pr_comet/test_coverage)
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pr_comet`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- TODO: Delete this and the text above, and describe your gem
5
+ A helper library that makes it easy to create pull requests.
8
6
 
9
7
  ## Installation
10
8
 
@@ -24,7 +22,77 @@ Or install it yourself as:
24
22
 
25
23
  ## Usage
26
24
 
27
- TODO: Write usage instructions here
25
+ ```ruby
26
+ # Initialize.
27
+ pr_comet = PrComet.new(base: 'master', branch: '{branch name}')
28
+
29
+ # Modify arbitrary files and commit into the block.
30
+ pr_comet.commit '{commit message}' do
31
+ file = File.read('path/to/file')
32
+ file.sub!('hoge', 'fuga')
33
+ File.write('path/to/file', file)
34
+ end
35
+
36
+ # You can also change files outer the block.
37
+ `bundle update`
38
+ pr_comet.commit '$ bundle update'
39
+
40
+ # Create a new pull request.
41
+ pr_comet.create!(
42
+ title: 'New pull request',
43
+ body: '{New pull request body}',
44
+ labels: ['label 1', 'label 2'] # optional
45
+ )
46
+ ```
47
+
48
+ ## Rspec
49
+
50
+ ### Testing
51
+
52
+ You can stub `PrComet` class for testing.
53
+ Add the following code to `spec/spec_helper`:
54
+
55
+ ```ruby
56
+ require 'pr_comet/rspec'
57
+ ```
58
+
59
+ Then you can use `#stub_pr_comet!`.
60
+ It makes `PrComet` class to stubbing and `PrComet.new` will return stubbed `PrComet` instance.
61
+ The stubbed `PrComet#commit` does not execute `$ git commit`, but it executes given block code.
62
+
63
+ ```ruby
64
+ def create_pr
65
+ pr_comet = PrComet.new(base: 'master', branch: 'any-branch') # stubbed.
66
+ pr_comet.commit 'Hello world.' do # stubbed.
67
+ File.write('path/to/file.txt', 'Hello world.') # not stubbed.
68
+ end
69
+ pr_comet.create!(title: 'New pull request') # stubbed.
70
+ end
71
+
72
+ stub_pr_comet!
73
+ allow(File).to receive(:write)
74
+ create_pr
75
+ expect(File).to have_received(:write).with('path/to/file.txt', 'Hello world.')
76
+ ```
77
+
78
+ If you want to test about `PrComet`, you can use `#stub_pr_comet!` return value.
79
+ It returns any instance of `PrComet`.
80
+
81
+ ```ruby
82
+ def create_pr
83
+ pr_comet = PrComet.new(base: 'master', branch: 'any-branch')
84
+ pr_comet.commit 'commit message' do
85
+ # ...
86
+ end
87
+ pr_comet.create!(title: 'New pull request')
88
+ end
89
+
90
+ pr_comet = stub_pr_comet!
91
+ create_pr
92
+ expect(PrComet).to have_received(:new).with(base: 'master', branch: 'any-branch')
93
+ expect(pr_comet).to have_received(:commit).with('commit message')
94
+ expect(pr_comet).to have_received(:create!).with(title: 'New pull request')
95
+ ```
28
96
 
29
97
  ## Development
30
98
 
@@ -13,7 +13,7 @@ release_pr = PrComet.new(base: 'production', branch: 'master')
13
13
 
14
14
  # Verifying
15
15
  abort 'usage: bin/release VERSION' if version.nil?
16
- abort 'A version must be like a `1.2.3`' unless version =~ VERSION_FORMAT
16
+ abort 'A version must be like a `1.2.3`' unless VERSION_FORMAT.match?(version)
17
17
 
18
18
  # Modify a version file
19
19
  update_pr.commit ':comet: Update version' do
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pr_comet'
4
+ require 'pr_comet/rspec/stub'
5
+
6
+ RSpec.configure do |config|
7
+ config.include PrComet::Stub
8
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class PrComet
4
+ # Test helper module for RSpec
5
+ module Stub
6
+ def stub_pr_comet!
7
+ instance_double(PrComet, create!: true).tap do |pr_comet|
8
+ allow(pr_comet).to receive(:commit) { |_message, &block| block&.call }
9
+ allow(PrComet).to receive(:new).and_return(pr_comet)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class PrComet
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_development_dependency 'bundler', '~> 1.16'
29
29
  spec.add_development_dependency 'pry-byebug'
30
- spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rake', '~> 13.0'
31
31
  spec.add_development_dependency 'rspec'
32
32
  spec.add_development_dependency 'rspec_junit_formatter'
33
33
  spec.add_development_dependency 'rubocop'
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ]
5
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pr_comet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryz310
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-12 00:00:00.000000000 Z
11
+ date: 2019-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '13.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '13.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -187,10 +187,12 @@ extra_rdoc_files: []
187
187
  files:
188
188
  - ".circleci/config.yml"
189
189
  - ".envrc.skeleton"
190
+ - ".gem_comet.yml"
190
191
  - ".gitignore"
191
192
  - ".rspec"
192
193
  - ".rubocop.yml"
193
194
  - ".rubocop_todo.yml"
195
+ - CHANGELOG.md
194
196
  - CODE_OF_CONDUCT.md
195
197
  - Gemfile
196
198
  - Gemfile.lock
@@ -205,8 +207,11 @@ files:
205
207
  - lib/pr_comet/errors.rb
206
208
  - lib/pr_comet/git/command.rb
207
209
  - lib/pr_comet/github/client.rb
210
+ - lib/pr_comet/rspec.rb
211
+ - lib/pr_comet/rspec/stub.rb
208
212
  - lib/pr_comet/version.rb
209
213
  - pr_comet.gemspec
214
+ - renovate.json
210
215
  homepage: https://github.com/ryz310/pr_comet
211
216
  licenses:
212
217
  - MIT