gem_comet 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bbec4f515a13acb563d4dca9c7bc63e3492f17e446e9ada1ccc86f62fbb00680
4
+ data.tar.gz: 1302c4a0f6d061cda13b81aae7e0eaa684c41d6028fb93683e1b64c0217e7510
5
+ SHA512:
6
+ metadata.gz: fa8a244390ffa140899791e78d89c99f1141354488544a3b60ee8a52ff70b686cd7dcfc58e6187cb7ec6f3373bb2ed7a7c97c80362cf255c55a10bd488fc2e11
7
+ data.tar.gz: 76b0a7a63bfbd314d9dd7c6078222839ebd8e932d3578361abcd0aa3d4217b6c0c19aee9ca7bf33eb7d1d21fdad9a0023692d465e0330ab678b3514fa137c1bc
@@ -0,0 +1,197 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2.1
6
+
7
+ orbs:
8
+ ruby-orbs: sue445/ruby-orbs@1.4.3
9
+ code-climate: rvla/code-climate@0.0.2
10
+
11
+ references:
12
+ - &ruby_version
13
+ ruby_version:
14
+ type: enum
15
+ enum: ['2.4', '2.5', '2.6', 'latest']
16
+ default: '2.4'
17
+
18
+ executors:
19
+ default:
20
+ parameters:
21
+ <<: *ruby_version
22
+ docker:
23
+ - image: circleci/ruby:<< parameters.ruby_version >>-node-browsers
24
+ working_directory: ~/repo
25
+
26
+ commands:
27
+ run_rspec:
28
+ description: Run RSpec
29
+ steps:
30
+ - code-climate/install
31
+ - run:
32
+ name: Execute RSpec
33
+ command: |
34
+ mkdir /tmp/test-results
35
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
36
+ cc-test-reporter before-build
37
+ bundle exec rspec --format documentation \
38
+ --color \
39
+ --format RspecJunitFormatter \
40
+ --out /tmp/test-results/rspec.xml \
41
+ $TEST_FILES
42
+ - code-climate/format-coverage:
43
+ input-type: simplecov
44
+ prefix: $(readlink -f .)
45
+ coverage-file: coverage/.resultset.json
46
+ output: coverage/codeclimate.$CIRCLE_BUILD_NUM.json
47
+ - persist_to_workspace:
48
+ root: coverage
49
+ paths:
50
+ - codeclimate.*.json
51
+ - store_test_results:
52
+ path: /tmp/test-results
53
+ - store_artifacts:
54
+ path: /tmp/test-results
55
+ destination: test-results
56
+ rubocop:
57
+ steps:
58
+ - run:
59
+ name: Run RuboCop
60
+ command: bundle exec rubocop
61
+ yardoc:
62
+ description: 'Generate YARDoc'
63
+ steps:
64
+ - run: bundle exec yardoc -o ./yardoc
65
+ - store_artifacts:
66
+ path: ./yardoc
67
+ destination: yardoc
68
+ rake_build:
69
+ steps:
70
+ - run:
71
+ name: Rake Build
72
+ command: bundle exec rake build
73
+ rubocop_challenge:
74
+ steps:
75
+ - run:
76
+ name: Rubocop Challenge
77
+ command: |
78
+ gem install rubocop_challenger --pre
79
+ rubocop_challenger go --email=ryz310@gmail.com --name=ryz310
80
+ release:
81
+ description: Release to RubyGems.org
82
+ steps:
83
+ - run:
84
+ name: Create Rubygems Credentials
85
+ command: |
86
+ mkdir ~/.gem || true
87
+ echo -e "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}" > ~/.gem/credentials
88
+ chmod 0600 ~/.gem/credentials
89
+ - run:
90
+ name: Release Gem
91
+ command: |
92
+ git push --set-upstream origin ${CIRCLE_BRANCH}
93
+ bundle exec rake release --trace
94
+ setup:
95
+ description: Setup for Job Working
96
+ parameters:
97
+ <<: *ruby_version
98
+ steps:
99
+ - checkout
100
+ - ruby-orbs/bundle-install:
101
+ cache_key_prefix: v1-dependencies-<< parameters.ruby_version >>
102
+ test_and_build:
103
+ description: Build the RubyGem
104
+ steps:
105
+ - run_rspec
106
+ - rake_build
107
+
108
+ jobs:
109
+ build:
110
+ parameters:
111
+ <<: *ruby_version
112
+ executor:
113
+ name: default
114
+ ruby_version: << parameters.ruby_version >>
115
+ steps:
116
+ - setup:
117
+ ruby_version: << parameters.ruby_version >>
118
+ - test_and_build
119
+ upload-coverage:
120
+ executor: default
121
+ steps:
122
+ - attach_workspace:
123
+ at: ~/repo
124
+ - code-climate/install
125
+ - code-climate/sum-coverage:
126
+ input: codeclimate.*.json
127
+ parts: 4
128
+ - code-climate/upload-coverage
129
+ rubocop:
130
+ executor: default
131
+ steps:
132
+ - setup
133
+ - rubocop
134
+ yardoc:
135
+ executor: default
136
+ steps:
137
+ - setup
138
+ - yardoc
139
+ rubocop_challenge:
140
+ executor: default
141
+ steps:
142
+ - checkout
143
+ - rubocop_challenge
144
+ release:
145
+ executor: default
146
+ steps:
147
+ - setup
148
+ - release
149
+
150
+ workflows:
151
+ version: 2
152
+
153
+ commit:
154
+ jobs:
155
+ - build:
156
+ name: build_on_ruby_2.4
157
+ ruby_version: '2.4'
158
+ - build:
159
+ name: build_on_ruby_2.5
160
+ ruby_version: '2.5'
161
+ - build:
162
+ name: build_on_ruby_2.6
163
+ ruby_version: '2.6'
164
+ - build:
165
+ name: build_on_ruby_latest
166
+ ruby_version: 'latest'
167
+ - rubocop
168
+ - yardoc
169
+ - upload-coverage:
170
+ requires:
171
+ - build_on_ruby_2.4
172
+ - build_on_ruby_2.5
173
+ - build_on_ruby_2.6
174
+ - build_on_ruby_latest
175
+ - release:
176
+ context: RubyGems API Key
177
+ requires:
178
+ - build_on_ruby_2.4
179
+ - build_on_ruby_2.5
180
+ - build_on_ruby_2.6
181
+ - build_on_ruby_latest
182
+ - rubocop
183
+ filters:
184
+ branches:
185
+ only:
186
+ - release
187
+
188
+ challenge:
189
+ triggers:
190
+ - schedule:
191
+ cron: "30 23 * * *" # 8:30am every day (JST)
192
+ filters:
193
+ branches:
194
+ only:
195
+ - master
196
+ jobs:
197
+ - rubocop_challenge
data/.envrc.skeleton ADDED
@@ -0,0 +1 @@
1
+ export GITHUB_ACCESS_TOKEN={GITHUB_ACCESS_TOKEN}
data/.gem_comet.yml ADDED
@@ -0,0 +1,6 @@
1
+ version: 1
2
+
3
+ release:
4
+ base_branch: master
5
+ release_branch: release
6
+ version_file_path: lib/gem_comet/version.rb
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,22 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+
5
+ inherit_from: .rubocop_todo.yml
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 2.4
9
+
10
+ Metrics/BlockLength:
11
+ Exclude:
12
+ - 'gem_comet.gemspec'
13
+ - 'spec/**/*'
14
+
15
+ Metrics/LineLength:
16
+ Max: 100
17
+
18
+ RSpec/MultipleExpectations:
19
+ Max: 4
20
+
21
+ RSpec/NestedGroups:
22
+ Max: 4
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,7 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-07-15 21:08:17 +0900 using RuboCop version 0.72.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ryz310@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in gem_comet.gemspec
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,99 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gem_comet (0.1.0)
5
+ pr_comet (~> 0.3.0)
6
+ thor
7
+ type_struct
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.6.0)
13
+ public_suffix (>= 2.0.2, < 4.0)
14
+ ast (2.4.0)
15
+ byebug (11.0.1)
16
+ coderay (1.1.2)
17
+ diff-lcs (1.3)
18
+ docile (1.3.2)
19
+ faraday (0.15.4)
20
+ multipart-post (>= 1.2, < 3)
21
+ jaro_winkler (1.5.3)
22
+ json (2.2.0)
23
+ method_source (0.9.2)
24
+ multipart-post (2.1.1)
25
+ octokit (4.14.0)
26
+ sawyer (~> 0.8.0, >= 0.5.3)
27
+ parallel (1.17.0)
28
+ parser (2.6.3.0)
29
+ ast (~> 2.4.0)
30
+ pr_comet (0.3.0)
31
+ octokit
32
+ rainbow
33
+ pry (0.12.2)
34
+ coderay (~> 1.1.0)
35
+ method_source (~> 0.9.0)
36
+ pry-byebug (3.7.0)
37
+ byebug (~> 11.0)
38
+ pry (~> 0.10)
39
+ public_suffix (3.1.1)
40
+ rainbow (3.0.0)
41
+ rake (10.5.0)
42
+ rspec (3.8.0)
43
+ rspec-core (~> 3.8.0)
44
+ rspec-expectations (~> 3.8.0)
45
+ rspec-mocks (~> 3.8.0)
46
+ rspec-core (3.8.2)
47
+ rspec-support (~> 3.8.0)
48
+ rspec-expectations (3.8.4)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.8.0)
51
+ rspec-mocks (3.8.1)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.8.0)
54
+ rspec-support (3.8.2)
55
+ rspec_junit_formatter (0.4.1)
56
+ rspec-core (>= 2, < 4, != 2.12.0)
57
+ rubocop (0.72.0)
58
+ jaro_winkler (~> 1.5.1)
59
+ parallel (~> 1.10)
60
+ parser (>= 2.6)
61
+ rainbow (>= 2.2.2, < 4.0)
62
+ ruby-progressbar (~> 1.7)
63
+ unicode-display_width (>= 1.4.0, < 1.7)
64
+ rubocop-performance (1.4.0)
65
+ rubocop (>= 0.71.0)
66
+ rubocop-rspec (1.33.0)
67
+ rubocop (>= 0.60.0)
68
+ ruby-progressbar (1.10.1)
69
+ sawyer (0.8.2)
70
+ addressable (>= 2.3.5)
71
+ faraday (> 0.8, < 2.0)
72
+ simplecov (0.17.0)
73
+ docile (~> 1.1)
74
+ json (>= 1.8, < 3)
75
+ simplecov-html (~> 0.10.0)
76
+ simplecov-html (0.10.2)
77
+ thor (0.20.3)
78
+ type_struct (0.7.4)
79
+ unicode-display_width (1.6.0)
80
+ yard (0.9.20)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ bundler (~> 1.16)
87
+ gem_comet!
88
+ pry-byebug
89
+ rake (~> 10.0)
90
+ rspec
91
+ rspec_junit_formatter
92
+ rubocop
93
+ rubocop-performance
94
+ rubocop-rspec
95
+ simplecov
96
+ yard
97
+
98
+ BUNDLED WITH
99
+ 1.16.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 ryz310
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ [![CircleCI](https://circleci.com/gh/ryz310/gem_comet.svg?style=svg)](https://circleci.com/gh/ryz310/gem_comet) [![Maintainability](https://api.codeclimate.com/v1/badges/bf80edef201ffe5f3c67/maintainability)](https://codeclimate.com/github/ryz310/gem_comet/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/bf80edef201ffe5f3c67/test_coverage)](https://codeclimate.com/github/ryz310/gem_comet/test_coverage)
2
+
3
+ # GemComet
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/gem_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
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'gem_comet'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install gem_comet
24
+
25
+ ## Usage
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gem_comet. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
42
+
43
+ ## Code of Conduct
44
+
45
+ Everyone interacting in the GemComet project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gem_comet/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'gem_comet'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/gem_comet ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'gem_comet'
5
+
6
+ GemComet::CLI.start
data/gem_comet.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'gem_comet/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'gem_comet'
9
+ spec.version = GemComet::VERSION
10
+ spec.authors = ['ryz310']
11
+ spec.email = ['ryz310@gmail.com']
12
+
13
+ spec.summary = 'Release a gem quickly like comets'
14
+ spec.description = 'Provides CLI command of gem release'
15
+ spec.homepage = 'https://github.com/ryz310/gem_comet'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_runtime_dependency 'pr_comet', '~> 0.3.0'
26
+ spec.add_runtime_dependency 'thor'
27
+ spec.add_runtime_dependency 'type_struct'
28
+
29
+ spec.add_development_dependency 'bundler', '~> 1.16'
30
+ spec.add_development_dependency 'pry-byebug'
31
+ spec.add_development_dependency 'rake', '~> 10.0'
32
+ spec.add_development_dependency 'rspec'
33
+ spec.add_development_dependency 'rspec_junit_formatter'
34
+ spec.add_development_dependency 'rubocop'
35
+ spec.add_development_dependency 'rubocop-performance'
36
+ spec.add_development_dependency 'rubocop-rspec'
37
+ spec.add_development_dependency 'simplecov'
38
+ spec.add_development_dependency 'yard'
39
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemComet
4
+ # CLI commands definition
5
+ class CLI < Thor
6
+ include Thor::Actions
7
+
8
+ def self.source_root
9
+ File.dirname(__FILE__)
10
+ end
11
+
12
+ desc 'init', 'Creates a configure file'
13
+ def init
14
+ template '../../template/.gem_comet.yml.erb', '.gem_comet.yml',
15
+ version: GemComet::Config::CURRENT_VERSION
16
+ end
17
+
18
+ desc 'release VERSION', 'Creates update PR and release PR'
19
+ def release(version)
20
+ Release.call(version: version)
21
+ end
22
+
23
+ desc 'version', 'Shows current version'
24
+ def version
25
+ puts GemComet::VERSION
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemComet
4
+ # Loads the config file
5
+ class Config < ServiceAbstract
6
+ CURRENT_VERSION = 1
7
+
8
+ V1 = TypeStruct.new(
9
+ version: CURRENT_VERSION,
10
+ release: TypeStruct.new(
11
+ base_branch: String,
12
+ release_branch: String,
13
+ version_file_path: String
14
+ )
15
+ )
16
+
17
+ private
18
+
19
+ attr_reader :file_path
20
+
21
+ def initialize(file_path:)
22
+ @file_path = file_path
23
+ end
24
+
25
+ def call
26
+ V1.from_hash(YAML.safe_load(File.open(file_path)))
27
+ rescue Errno::ENOENT
28
+ raise 'Not initialized. Please run `$ gem_comet init`.'
29
+ rescue TypeStruct::MultiTypeError => e
30
+ puts e.message
31
+ raise "Unexpected file format. Please check your '#{file_path}'."
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemComet
4
+ class Release
5
+ # Creates a pull request for your gem release
6
+ class ReleasePR < ServiceAbstract
7
+ private
8
+
9
+ attr_reader :version, :pr_comet
10
+
11
+ def initialize(version:, base_branch:, release_branch:)
12
+ @version = version
13
+ @pr_comet = PrComet.new(base: release_branch, branch: base_branch)
14
+ end
15
+
16
+ def call
17
+ create_pull_request
18
+ end
19
+
20
+ def create_pull_request
21
+ pr_comet.create!(title: "Release v#{version}", body: '', validate: false)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemComet
4
+ class Release
5
+ # Creates a pull request for release preparation
6
+ class UpdatePR < ServiceAbstract
7
+ private
8
+
9
+ attr_reader :version, :pr_comet, :version_file_path
10
+
11
+ def initialize(version:, base_branch:, version_file_path:)
12
+ @version = version
13
+ @pr_comet = PrComet.new(base: base_branch, branch: "update/v#{version}")
14
+ @version_file_path = version_file_path
15
+ end
16
+
17
+ def call
18
+ update_version_file
19
+ bundle_update
20
+ create_pull_request
21
+ end
22
+
23
+ def update_version_file
24
+ pr_comet.commit ':comet: Update version number' do
25
+ version_file = File.read(version_file_path)
26
+ version_file.sub!(
27
+ /VERSION\s*=\s*(['"])(.+?)(['"])/,
28
+ "VERSION = \\1#{version}\\3"
29
+ )
30
+ File.write(version_file_path, version_file)
31
+ end
32
+ end
33
+
34
+ def bundle_update
35
+ pr_comet.commit(':comet: $ bundle update') { `bundle update` }
36
+ end
37
+
38
+ def create_pull_request
39
+ pr_comet.create!(title: "Update v#{version}", body: '')
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemComet
4
+ # Creates pull requests for gem release and that preparation
5
+ class Release < ServiceAbstract
6
+ CONFIG_FILE_PATH = '.gem_comet.yml'
7
+
8
+ private
9
+
10
+ attr_reader :version, :config
11
+
12
+ def initialize(version:)
13
+ verify_version_number(version)
14
+
15
+ @version = version
16
+ @config = Config.call(file_path: CONFIG_FILE_PATH)
17
+ end
18
+
19
+ def call
20
+ UpdatePR.call(update_pr_args)
21
+ ReleasePR.call(release_pr_args)
22
+ end
23
+
24
+ def update_pr_args
25
+ {
26
+ version: version,
27
+ base_branch: config.release.base_branch,
28
+ version_file_path: config.release.version_file_path
29
+ }
30
+ end
31
+
32
+ def release_pr_args
33
+ {
34
+ version: version,
35
+ base_branch: config.release.base_branch,
36
+ release_branch: config.release.release_branch
37
+ }
38
+ end
39
+
40
+ def verify_version_number(version)
41
+ return if version.match?(/\A\d+\.\d+\.\d+(\.(pre|beta|rc)\d?)?\z/)
42
+
43
+ raise 'Verion number must be like a "1.2.3".'
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemComet
4
+ # The abstract class for service classes
5
+ class ServiceAbstract
6
+ def self.call(*args)
7
+ new(*args).send(:call)
8
+ end
9
+
10
+ private
11
+
12
+ def initialize(_args)
13
+ raise "Please implement #{self.class}##{__method__}"
14
+ end
15
+
16
+ def call
17
+ raise "Please implement #{self.class}##{__method__}"
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GemComet
4
+ VERSION = '0.1.0'
5
+ end
data/lib/gem_comet.rb ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+ require 'type_struct'
5
+ require 'pr_comet'
6
+ require 'yaml'
7
+ require 'gem_comet/version'
8
+ require 'gem_comet/service_abstract'
9
+ require 'gem_comet/config'
10
+ require 'gem_comet/release'
11
+ require 'gem_comet/release/update_pr'
12
+ require 'gem_comet/release/release_pr'
13
+ require 'gem_comet/cli'
@@ -0,0 +1,6 @@
1
+ version: <%= config[:version] %>
2
+
3
+ release:
4
+ base_branch: master
5
+ release_branch: release
6
+ version_file_path: '{Path of your version file}'
metadata ADDED
@@ -0,0 +1,252 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_comet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ryz310
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pr_comet
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: type_struct
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.16'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.16'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec_junit_formatter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-performance
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop-rspec
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: yard
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ description: Provides CLI command of gem release
196
+ email:
197
+ - ryz310@gmail.com
198
+ executables:
199
+ - gem_comet
200
+ extensions: []
201
+ extra_rdoc_files: []
202
+ files:
203
+ - ".circleci/config.yml"
204
+ - ".envrc.skeleton"
205
+ - ".gem_comet.yml"
206
+ - ".gitignore"
207
+ - ".rspec"
208
+ - ".rubocop.yml"
209
+ - ".rubocop_todo.yml"
210
+ - CODE_OF_CONDUCT.md
211
+ - Gemfile
212
+ - Gemfile.lock
213
+ - LICENSE.txt
214
+ - README.md
215
+ - Rakefile
216
+ - bin/console
217
+ - bin/setup
218
+ - exe/gem_comet
219
+ - gem_comet.gemspec
220
+ - lib/gem_comet.rb
221
+ - lib/gem_comet/cli.rb
222
+ - lib/gem_comet/config.rb
223
+ - lib/gem_comet/release.rb
224
+ - lib/gem_comet/release/release_pr.rb
225
+ - lib/gem_comet/release/update_pr.rb
226
+ - lib/gem_comet/service_abstract.rb
227
+ - lib/gem_comet/version.rb
228
+ - template/.gem_comet.yml.erb
229
+ homepage: https://github.com/ryz310/gem_comet
230
+ licenses:
231
+ - MIT
232
+ metadata: {}
233
+ post_install_message:
234
+ rdoc_options: []
235
+ require_paths:
236
+ - lib
237
+ required_ruby_version: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - ">="
240
+ - !ruby/object:Gem::Version
241
+ version: '0'
242
+ required_rubygems_version: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - ">="
245
+ - !ruby/object:Gem::Version
246
+ version: '0'
247
+ requirements: []
248
+ rubygems_version: 3.0.3
249
+ signing_key:
250
+ specification_version: 4
251
+ summary: Release a gem quickly like comets
252
+ test_files: []