rubyhub 0.1.7 → 0.2.0

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
  SHA256:
3
- metadata.gz: d584e46421546a1c4e3723c2999c58b542aa7e405fc26210e35d01858ed74dd5
4
- data.tar.gz: b1b1db4ce84974c3c0c701ffd6e695260509c4bb8cadea6455852a87a6e9e8f5
3
+ metadata.gz: 867d8da954342520ec12a0ba8cef25861f9540de1d48e58cca6e71a5f27c6475
4
+ data.tar.gz: 481a610c20b1e363a4af41784c6c75c2ccbd48d42fd7e428d57fca139689078c
5
5
  SHA512:
6
- metadata.gz: 858a46058552b9257c9855509e9e52f4f97ebcdae78cb97c928344bbe8d2ba7743bd1e14daf17b8bd5ec7a0ce28e8ce150cab829f5b5cc90594519dca0a4cc0d
7
- data.tar.gz: 8f392c3c51c6d877fb9ee35e1da63ae31ea6a5eec016a3c959f1626e24d624824b39df93a97bca8072406ac846e35d668ee36b8076d7b9983c22793806782c40
6
+ metadata.gz: 345ba10ee196691a920a9518862837c3758bc3187ebf3424b57d39b479e71a90313bedc7221b2213dabf0582235a6c244c31f70b7b25da88d58fbfba84615fd2
7
+ data.tar.gz: c9c181afcdaf779b0b2a0d9e0b4a517ead44822f47c48d28fa7f5a9d620413c04ae7f7348054ca57288ac6e99601d443aaad05affeb1510f5ca5cb4ae0dd68c1
@@ -0,0 +1,273 @@
1
+ version: 2.1
2
+
3
+ aliases:
4
+ working_directory: &working_directory
5
+ working_directory: ~/rubyhub
6
+
7
+ executors:
8
+ default:
9
+ description: The official CircleCI Ruby Docker image
10
+ parameters:
11
+ tag:
12
+ description: The circleci/ruby Docker image version tag
13
+ type: string
14
+ default: latest
15
+ docker:
16
+ - image: circleci/ruby:<< parameters.tag >>-node
17
+ environment:
18
+ - BUNDLE_JOBS: 4
19
+ - BUNDLE_PATH: vendor/bundle
20
+ - BUNDLE_RETRY: 3
21
+ <<: *working_directory
22
+
23
+ commands:
24
+ cc-setup-coverage:
25
+ description: Setup Code Climate
26
+ parameters:
27
+ url:
28
+ description: Pre-built binary URL
29
+ default: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
30
+ type: string
31
+ version:
32
+ default: latest
33
+ type: string
34
+ steps:
35
+ - restore_cache:
36
+ key: cc-setup-<< parameters.version >>
37
+ - run:
38
+ name: Setup coverage
39
+ command: |
40
+ if [[ $(command -v cc-test-reporter) == "" ]]; then
41
+ mkdir -p tmp/
42
+ sudo curl -s -o ./tmp/cc-test-reporter -L << parameters.url >>
43
+ sudo chmod +x ./tmp/cc-test-reporter
44
+ else
45
+ echo "Already installed."
46
+ fi
47
+ - save_cache:
48
+ key: cc-setup-<< parameters.version >>
49
+ paths:
50
+ - ./tmp/cc-test-reporter
51
+
52
+ cc-sum-coverage:
53
+ description: Combine (sum) multiple pre-formatted coverage payloads into one
54
+ parameters:
55
+ input:
56
+ description: File glob of the files to combine
57
+ type: string
58
+ output:
59
+ description: The output path
60
+ default: ./tmp/coverage/codeclimate.json
61
+ type: string
62
+ parts:
63
+ description: The total number of parts to combine (sum)
64
+ default: 1
65
+ type: integer
66
+ steps:
67
+ - run:
68
+ name: Sum coverage
69
+ command: |
70
+ ./tmp/cc-test-reporter sum-coverage << parameters.input >> --output << parameters.output >> \
71
+ --parts << parameters.parts >>
72
+ cc-upload-coverage:
73
+ description: Upload coverage payload to Code Climate
74
+ parameters:
75
+ input:
76
+ description: The input path
77
+ default: ./tmp/coverage/codeclimate.json
78
+ type: string
79
+ steps:
80
+ - run:
81
+ name: Upload coverage
82
+ command: |
83
+ ./tmp/cc-test-reporter upload-coverage --input << parameters.input >>
84
+ cc-format-coverage:
85
+ description: Locate, parse, and re-format supported coverage sources
86
+ parameters:
87
+ input-type:
88
+ description: The type of input source to use
89
+ enum:
90
+ - simplecov
91
+ - lcov
92
+ type: enum
93
+ output:
94
+ description: The output path
95
+ default: coverage/codeclimate.json
96
+ type: string
97
+ steps:
98
+ - run:
99
+ name: Format coverage
100
+ command: |
101
+ ./tmp/cc-test-reporter format-coverage --input-type << parameters.input-type >> \
102
+ --output << parameters.output >>
103
+ bundle-load-cache:
104
+ description: Load cached RubyGems
105
+ parameters:
106
+ key:
107
+ description: The cache key to use
108
+ type: string
109
+ default: bundle-v1
110
+ steps:
111
+ - restore_cache:
112
+ key: 'bundle-v1-<< parameters.key >>-{{ arch }}-{{ checksum "rubyhub.gemspec" }}'
113
+
114
+ bundle-install:
115
+ description: Install gems with Bundler
116
+ steps:
117
+ - run:
118
+ name: install dependencies
119
+ command: |
120
+ gem update --system
121
+ gem install bundler
122
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
123
+ bundle-save-cache:
124
+ description: Save RubyGems to cache
125
+ parameters:
126
+ key:
127
+ description: The cache key to use
128
+ type: string
129
+ default: bundle-v1
130
+ steps:
131
+ - save_cache:
132
+ key: 'bundle-v1-<< parameters.key >>-{{ arch }}-{{ checksum "rubyhub.gemspec" }}'
133
+ paths:
134
+ - vendor/bundle
135
+
136
+ rspec:
137
+ description: Test with RSpec
138
+ steps:
139
+ - run:
140
+ name: Rubocop
141
+ command: bundle exec rubocop
142
+ - run:
143
+ name: Fasterer
144
+ command: bundle exec fasterer
145
+ - attach_workspace:
146
+ at: ~/rubyhub/tmp
147
+ - run: >
148
+ bundle exec rspec --format RspecJunitFormatter --out test_results/rspec.xml
149
+ - cc-format-coverage:
150
+ input-type: simplecov
151
+ output: ./tmp/codeclimate.$CIRCLE_JOB.json
152
+ - persist_to_workspace:
153
+ root: tmp
154
+ paths:
155
+ - codeclimate.*.json
156
+ - store_test_results:
157
+ path: test_results
158
+ - store_artifacts:
159
+ path: test_results
160
+ destination: test-results
161
+
162
+ jobs:
163
+ checkout:
164
+ executor: default
165
+ steps:
166
+ - restore_cache:
167
+ key: checkout-{{ .Branch }}-{{ .Revision }}
168
+ - checkout
169
+ - save_cache:
170
+ key: checkout-{{ .Branch }}-{{ .Revision }}
171
+ paths:
172
+ - .
173
+
174
+ cc-setup-coverage:
175
+ executor: default
176
+ steps:
177
+ - cc-setup-coverage
178
+ - persist_to_workspace:
179
+ root: ./tmp
180
+ paths:
181
+ - cc-test-reporter
182
+
183
+ ruby-2-5:
184
+ executor:
185
+ name: default
186
+ tag: "2.5"
187
+ steps:
188
+ - restore_cache:
189
+ key: checkout-{{ .Branch }}-{{ .Revision }}
190
+ - bundle-load-cache:
191
+ key: ruby-2.5
192
+ - bundle-install
193
+ - bundle-save-cache:
194
+ key: ruby-2.5
195
+ - rspec
196
+
197
+ ruby-2-6:
198
+ executor:
199
+ name: default
200
+ tag: "2.6"
201
+ steps:
202
+ - restore_cache:
203
+ key: checkout-{{ .Branch }}-{{ .Revision }}
204
+ - bundle-load-cache:
205
+ key: ruby-2.6
206
+ - bundle-install
207
+ - bundle-save-cache:
208
+ key: ruby-2.6
209
+ - rspec
210
+
211
+ ruby-2-7:
212
+ executor:
213
+ name: default
214
+ tag: "2.7"
215
+ steps:
216
+ - restore_cache:
217
+ key: checkout-{{ .Branch }}-{{ .Revision }}
218
+ - bundle-load-cache:
219
+ key: ruby-2.7
220
+ - bundle-install
221
+ - bundle-save-cache:
222
+ key: ruby-2.7
223
+ - rspec
224
+
225
+ ruby-head:
226
+ executor: default
227
+ steps:
228
+ - restore_cache:
229
+ key: checkout-{{ .Branch }}-{{ .Revision }}
230
+ - bundle-load-cache:
231
+ key: ruby-head
232
+ - bundle-install
233
+ - bundle-save-cache:
234
+ key: ruby-head
235
+ - rspec
236
+
237
+ cc-upload-coverage:
238
+ executor: default
239
+ steps:
240
+ - attach_workspace:
241
+ at: ~/rubyhub/tmp
242
+ - cc-sum-coverage:
243
+ input: tmp/codeclimate.*.json
244
+ parts: 3
245
+ - cc-upload-coverage
246
+
247
+ workflows:
248
+ version: 2
249
+ default: &default
250
+ jobs:
251
+ - checkout
252
+ - cc-setup-coverage
253
+ - ruby-2-5:
254
+ requires:
255
+ - checkout
256
+ - cc-setup-coverage
257
+ - ruby-2-6:
258
+ requires:
259
+ - checkout
260
+ - cc-setup-coverage
261
+ - ruby-2-7:
262
+ requires:
263
+ - checkout
264
+ - cc-setup-coverage
265
+ - ruby-head:
266
+ requires:
267
+ - checkout
268
+ - cc-setup-coverage
269
+ - cc-upload-coverage:
270
+ requires:
271
+ - ruby-2-5
272
+ - ruby-2-6
273
+ - ruby-2-7
@@ -0,0 +1,8 @@
1
+ version: 1
2
+ update_configs:
3
+ - package_manager: "ruby:bundler"
4
+ directory: "/"
5
+ update_schedule: "live"
6
+
7
+ default_labels:
8
+ - "dependencies"
data/.fasterer.yml CHANGED
@@ -17,3 +17,6 @@ speedups:
17
17
  select_last_vs_reverse_detect: true
18
18
  getter_vs_attr_reader: true
19
19
  setter_vs_attr_writer: true
20
+
21
+ exclude_paths:
22
+ - 'vendor/**/*.rb'
data/.gitignore CHANGED
@@ -5,6 +5,7 @@
5
5
  /doc/
6
6
  /pkg/
7
7
  /spec/reports/
8
+ /spec/tmp/
8
9
  /tmp/
9
10
  .history
10
11
 
data/.rubocop.yml CHANGED
@@ -1,6 +1,17 @@
1
1
  require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
+ - rubocop-md
5
+
6
+ Metrics/BlockLength:
7
+ Exclude:
8
+ - spec/**/*
9
+ - rubyhub.gemspec
10
+
11
+ Style/HashSyntax:
12
+ Exclude:
13
+ - spec/rubyhub/operations/pull_request/create_spec.rb
14
+ - spec/rubyhub/configuration_spec.rb
4
15
 
5
16
  Metrics/LineLength:
6
17
  Max: 120
@@ -10,3 +21,15 @@ Style/Documentation:
10
21
 
11
22
  Style/FrozenStringLiteralComment:
12
23
  Enabled: false
24
+
25
+ RSpec/AnyInstance:
26
+ Enabled: false
27
+
28
+ RSpec/MultipleExpectations:
29
+ Enabled: false
30
+
31
+ RSpec/MessageSpies:
32
+ EnforcedStyle: receive
33
+
34
+ RSpec/ExampleLength:
35
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ Changelog
2
+
3
+ [0.2.0] - 2020.04.08
4
+ ###Changed
5
+
6
+ - Added CircleCI configuration
7
+ - Fixed gem version number
8
+ - Added strong dependency for production and development gem dependencies
9
+ - Added PullRequest creation tests.
10
+ - Added `RSpec/MessageSpies EnforcedStyle: receive` and `RSpec/MultipleExpectations Enabled: false` to Rubocop config
11
+ - Added Codeclimate configuration to CI `config.yml`
12
+ - Added badges and codeclimate indicator
13
+ - Added ability to load description for PR from a separate file
14
+ - Added ability to specify description_path to `config.yml`
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubyhub (0.1.2)
5
- thor
4
+ rubyhub (0.2.0)
5
+ thor (~> 1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -11,63 +11,81 @@ GEM
11
11
  coderay (1.1.2)
12
12
  colorize (0.8.1)
13
13
  diff-lcs (1.3)
14
- fasterer (0.8.1)
14
+ docile (1.3.2)
15
+ fasterer (0.8.3)
15
16
  colorize (~> 0.7)
16
17
  ruby_parser (>= 3.14.1)
18
+ ffaker (2.14.0)
17
19
  jaro_winkler (1.5.4)
18
- method_source (0.9.2)
20
+ json (2.3.0)
21
+ method_source (1.0.0)
19
22
  parallel (1.19.1)
20
- parser (2.6.5.0)
23
+ parser (2.7.1.0)
21
24
  ast (~> 2.4.0)
22
- pry (0.12.2)
23
- coderay (~> 1.1.0)
24
- method_source (~> 0.9.0)
25
+ pry (0.13.0)
26
+ coderay (~> 1.1)
27
+ method_source (~> 1.0)
25
28
  rainbow (3.0.0)
26
29
  rake (13.0.1)
30
+ rexml (3.2.4)
27
31
  rspec (3.9.0)
28
32
  rspec-core (~> 3.9.0)
29
33
  rspec-expectations (~> 3.9.0)
30
34
  rspec-mocks (~> 3.9.0)
31
- rspec-core (3.9.0)
32
- rspec-support (~> 3.9.0)
33
- rspec-expectations (3.9.0)
35
+ rspec-core (3.9.1)
36
+ rspec-support (~> 3.9.1)
37
+ rspec-expectations (3.9.1)
34
38
  diff-lcs (>= 1.2.0, < 2.0)
35
39
  rspec-support (~> 3.9.0)
36
- rspec-mocks (3.9.0)
40
+ rspec-mocks (3.9.1)
37
41
  diff-lcs (>= 1.2.0, < 2.0)
38
42
  rspec-support (~> 3.9.0)
39
- rspec-support (3.9.0)
40
- rubocop (0.77.0)
43
+ rspec-support (3.9.2)
44
+ rspec_junit_formatter (0.4.1)
45
+ rspec-core (>= 2, < 4, != 2.12.0)
46
+ rubocop (0.81.0)
41
47
  jaro_winkler (~> 1.5.1)
42
48
  parallel (~> 1.10)
43
- parser (>= 2.6)
49
+ parser (>= 2.7.0.1)
44
50
  rainbow (>= 2.2.2, < 4.0)
51
+ rexml
45
52
  ruby-progressbar (~> 1.7)
46
- unicode-display_width (>= 1.4.0, < 1.7)
47
- rubocop-performance (1.5.1)
53
+ unicode-display_width (>= 1.4.0, < 2.0)
54
+ rubocop-md (0.3.2)
55
+ rubocop (~> 0.60)
56
+ rubocop-performance (1.5.2)
48
57
  rubocop (>= 0.71.0)
49
- rubocop-rspec (1.37.0)
58
+ rubocop-rspec (1.38.1)
50
59
  rubocop (>= 0.68.1)
51
60
  ruby-progressbar (1.10.1)
52
- ruby_parser (3.14.1)
61
+ ruby_parser (3.14.2)
53
62
  sexp_processor (~> 4.9)
54
- sexp_processor (4.13.0)
55
- thor (1.0.0)
56
- unicode-display_width (1.6.0)
63
+ sexp_processor (4.14.1)
64
+ simplecov (0.17.1)
65
+ docile (~> 1.1)
66
+ json (>= 1.8, < 3)
67
+ simplecov-html (~> 0.10.0)
68
+ simplecov-html (0.10.2)
69
+ thor (1.0.1)
70
+ unicode-display_width (1.7.0)
57
71
 
58
72
  PLATFORMS
59
73
  ruby
60
74
 
61
75
  DEPENDENCIES
62
- bundler
63
- fasterer
64
- pry
65
- rake
66
- rspec
67
- rubocop
68
- rubocop-performance
69
- rubocop-rspec
76
+ bundler (~> 2.1)
77
+ fasterer (~> 0.8)
78
+ ffaker (~> 2.14)
79
+ pry (~> 0.13)
80
+ rake (~> 13.0)
81
+ rspec (~> 3.9)
82
+ rspec_junit_formatter (~> 0.4)
83
+ rubocop (~> 0.81)
84
+ rubocop-md (~> 0.3)
85
+ rubocop-performance (~> 1.5)
86
+ rubocop-rspec (~> 1.38)
70
87
  rubyhub!
88
+ simplecov (~> 0.15, < 0.18)
71
89
 
72
90
  BUNDLED WITH
73
- 2.0.2
91
+ 2.1.2
data/README.md CHANGED
@@ -1,7 +1,12 @@
1
+ [![Maintainability](https://api.codeclimate.com/v1/badges/c62b766b3425f4176152/maintainability)](https://codeclimate.com/github/rubygarage/rubyhub/maintainability)
2
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/c62b766b3425f4176152/test_coverage)](https://codeclimate.com/github/rubygarage/rubyhub/test_coverage)
3
+ [![CircleCI](https://circleci.com/gh/circleci/circleci-docs.svg?style=svg)](https://circleci.com/gh/rubygarage/rubyhub)
1
4
  # Rubyhub
2
5
 
3
6
  Rubyhub allows you to create pull requests faster with all сomponents - labels, assignees, reviewers and other stuff you had to put manually each time.
4
7
 
8
+ At this very moment Rubyhub supports operations only with `Github`.
9
+
5
10
  ## Installation
6
11
 
7
12
  Install [Github's Hub](https://github.com/github/hub)
@@ -24,7 +29,7 @@ Or install it yourself as:
24
29
 
25
30
  1. Generate config file
26
31
 
27
- `$ rubyhub install`
32
+ `$ rubyhub init`
28
33
 
29
34
  2. Create the templates for all subteams/needs in your repository and configure each template with provided options
30
35
 
@@ -32,6 +37,8 @@ Or install it yourself as:
32
37
 
33
38
  `$ rubyhub create -t your_template_name`
34
39
 
40
+ See [usage examples](https://github.com/rubygarage/rubyhub/wiki/Usage) or the full [reference documentation](https://github.com/rubygarage/rubyhub/wiki) to see all available commands and flags.
41
+
35
42
  ## Configuration options
36
43
  | Config | Description | Example |
37
44
  |-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
@@ -41,6 +48,7 @@ Or install it yourself as:
41
48
  | labels | Array. List of labels | - needs_review<br>- some_another_label |
42
49
  | jira_base_url | String. The first line of your Pull Request description could be JIRA link to your task<br>Put here the constant part of your URL.<br>Task name would be taken from your branch name.<br><br>feature/MyTask-1399 -> https://sample.atlassian.net/browse/MyTask-1399 | https://sample.atlassian.net/browse/ |
43
50
  | description_main_body | String. Put the description template here. We recommended to use Markdown.<br><br>Note: The first line of your body - would be a title of your pull-request | Feature / RGWEB<br><br>Great moments! |
51
+ | description_path | String. Put the path to your PR's description file. | .github/description.txt
44
52
  | push | Boolean. These options allows to push the code to Github before creating the pull-request | true |
45
53
  | open | Boolean. Open the pull-request after creating | true |
46
54
 
data/lib/rubyhub.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rubyhub/utils/deep_symbolize_keys_helper'
2
-
2
+ require 'rubyhub/utils/hash'
3
+ require 'rubyhub/utils/string'
3
4
  using DeepSymbolizeKeysHelper
4
5
 
5
6
  require 'rubyhub/configuration'
data/lib/rubyhub/cli.rb CHANGED
@@ -7,7 +7,7 @@ module Rubyhub
7
7
  Operations::Configuration::Setup.call
8
8
  end
9
9
 
10
- desc 'pr:create', 'Create Pull Request'
10
+ desc 'create', 'Create Pull Request'
11
11
  method_option :template, aliases: '-t', type: :string
12
12
  def create(*_args)
13
13
  Operations::PullRequest::Create.call(options)
@@ -7,7 +7,7 @@
7
7
  # assignees:
8
8
  # - any
9
9
  # - github
10
- # - assignee
10
+ # - assignees
11
11
  # - you
12
12
  # - want
13
13
  # reviewers:
@@ -17,6 +17,7 @@
17
17
  # - you
18
18
  # - want
19
19
  # description_main_body: describe your changes here
20
+ # description_path: .github/description.txt
20
21
  # jira_base_url: https://sample.atlassian.net/browse/
21
22
  # push: false
22
23
  # open: true
@@ -6,6 +6,7 @@ require 'pry'
6
6
  module Rubyhub
7
7
  class Configuration
8
8
  include Singleton
9
+ attr_reader :options
9
10
 
10
11
  CONFIG_PATH = '.rubyhub.yml'.freeze
11
12
 
@@ -13,10 +14,6 @@ module Rubyhub
13
14
  @options = self.class.exists? ? load_from_file : {}
14
15
  end
15
16
 
16
- def to_h
17
- @options.to_h
18
- end
19
-
20
17
  class << self
21
18
  def exists?
22
19
  File.exist?(CONFIG_PATH)
@@ -5,15 +5,15 @@ module Rubyhub
5
5
  module Configuration
6
6
  class Setup
7
7
  TEMPLATE_PATH = 'lib/rubyhub/config/templates/.rubyhub.yml'.freeze
8
+ CONFIG_EXISTS_MESSAGE = 'Config already exists!'.freeze
9
+ CONFIG_INSTALLED_MESSAGE = 'Config successfully installed!'.freeze
8
10
 
9
11
  class << self
10
12
  def call
11
- if Rubyhub::Configuration.exists?
12
- puts 'Config already exists!'
13
- else
14
- initialize_config
15
- puts 'Config successfully installed!'
16
- end
13
+ return puts CONFIG_EXISTS_MESSAGE if Rubyhub::Configuration.exists?
14
+
15
+ initialize_config
16
+ puts CONFIG_INSTALLED_MESSAGE
17
17
  end
18
18
 
19
19
  private
@@ -1,4 +1,3 @@
1
- require 'pry'
2
1
  module Rubyhub
3
2
  module Operations
4
3
  module PullRequest
@@ -6,8 +5,9 @@ module Rubyhub
6
5
  class << self
7
6
  def call(options)
8
7
  @template = options[:template]
8
+
9
9
  raise ConfigFileDoesNotExistError unless Rubyhub::Configuration.exists?
10
- raise IncorrectTemplateError if !@template || !data || data.empty?
10
+ raise IncorrectTemplateError if !template || !data || data.empty?
11
11
 
12
12
  Rubyhub::PullRequest.new(data).create!
13
13
  end
@@ -17,7 +17,7 @@ module Rubyhub
17
17
  attr_reader :template
18
18
 
19
19
  def data
20
- @data ||= Rubyhub::Configuration.instance.to_h.dig(:template, @template.to_sym)
20
+ @data ||= Rubyhub::Configuration.instance.options.dig(:template, template.to_sym)
21
21
  end
22
22
  end
23
23
  end
@@ -8,12 +8,13 @@ module Rubyhub
8
8
 
9
9
  def to_command
10
10
  build_base_query
11
- add_branch if @base_branch
12
- add_labels if @labels&.any?
13
- add_assignees if @assignees&.any?
14
- add_reviewers if @reviewers&.any?
15
- add_push_settings if @push
16
- add_open_settings if @open
11
+ add_branch
12
+ add_labels
13
+ add_assignees
14
+ add_reviewers
15
+ add_message
16
+ add_push_settings
17
+ add_open_settings
17
18
 
18
19
  @query
19
20
  end
@@ -33,27 +34,27 @@ module Rubyhub
33
34
  end
34
35
 
35
36
  def add_branch
36
- @query << " -b '#{@base_branch}'"
37
+ @query << " -b '#{@base_branch}'" if @base_branch
37
38
  end
38
39
 
39
40
  def add_labels
40
- @query << " -l '#{@labels.join(',')}'"
41
+ @query << " -l '#{@labels.to_a.join(',')}'" if @labels.to_a.any?
41
42
  end
42
43
 
43
44
  def add_assignees
44
- @query << " -a '#{@assignees.join(',')}'"
45
+ @query << " -a '#{@assignees.to_a.join(',')}'" if @assignees.to_a.any?
45
46
  end
46
47
 
47
48
  def add_reviewers
48
- @query << " -r '#{@reviewers.join(',')}'"
49
+ @query << " -r '#{@reviewers.to_a.join(',')}'" if @reviewers.to_a.any?
49
50
  end
50
51
 
51
52
  def add_push_settings
52
- @query << ' --push -f'
53
+ @query << ' --push -f' if @push
53
54
  end
54
55
 
55
56
  def add_open_settings
56
- @query << ' --browse'
57
+ @query << ' --browse' if @open
57
58
  end
58
59
 
59
60
  def add_message
@@ -77,12 +78,12 @@ module Rubyhub
77
78
  end
78
79
 
79
80
  def jira_ticket
80
- [data[:jira_base_url], branch_name].join
81
+ [@jira_base_url, branch_name].join
81
82
  end
82
83
 
83
84
  def message
84
85
  description = "#{branch_type} | #{branch_name.strip}\n\n"
85
- description << "JIRA ticket - #{jira_ticket}" if data[:jira_base_url]
86
+ description << "JIRA ticket - #{jira_ticket}\n\n" if @jira_base_url
86
87
  description << @description_main_body if @description_main_body
87
88
  description
88
89
  end
@@ -11,8 +11,8 @@ module DeepSymbolizeKeysHelper
11
11
 
12
12
  def transform(thing)
13
13
  case thing
14
- when Hash; symbolize_recursive(thing)
15
- when Array; thing.map { |v| transform(v) }
14
+ when Hash then symbolize_recursive(thing)
15
+ when Array then thing.map { |v| transform(v) }
16
16
  else; thing
17
17
  end
18
18
  end
@@ -0,0 +1,10 @@
1
+ class Hash
2
+ def except(*keys)
3
+ slice(*self.keys - keys)
4
+ end
5
+
6
+ def except!(*keys)
7
+ keys.each { |key| delete(key) }
8
+ self
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class String
2
+ def to_a
3
+ [self]
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Rubyhub
2
- VERSION = '0.1.7'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
data/rubyhub.gemspec CHANGED
@@ -19,20 +19,24 @@ Gem::Specification.new do |spec|
19
19
  spec.bindir = 'exe'
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
- spec.post_install_message = %q{
22
+ spec.post_install_message = '
23
23
  Note that Rubyhub requires additional dependencies!
24
24
 
25
25
  Please install https://github.com/github/hub
26
- }
26
+ '
27
27
 
28
- spec.add_dependency 'thor'
28
+ spec.add_dependency 'thor', '~> 1.0'
29
29
 
30
- spec.add_development_dependency 'bundler'
31
- spec.add_development_dependency 'fasterer'
32
- spec.add_development_dependency 'pry'
33
- spec.add_development_dependency 'rake'
34
- spec.add_development_dependency 'rspec'
35
- spec.add_development_dependency 'rubocop'
36
- spec.add_development_dependency 'rubocop-performance'
37
- spec.add_development_dependency 'rubocop-rspec'
30
+ spec.add_development_dependency 'bundler', '~> 2.1'
31
+ spec.add_development_dependency 'fasterer', '~> 0.8'
32
+ spec.add_development_dependency 'ffaker', '~> 2.14'
33
+ spec.add_development_dependency 'pry', '~> 0.13'
34
+ spec.add_development_dependency 'rake', '~> 13.0'
35
+ spec.add_development_dependency 'rspec', '~> 3.9'
36
+ spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
37
+ spec.add_development_dependency 'rubocop', '~> 0.81'
38
+ spec.add_development_dependency 'rubocop-md', '~> 0.3'
39
+ spec.add_development_dependency 'rubocop-performance', '~> 1.5'
40
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.38'
41
+ spec.add_development_dependency 'simplecov', '~> 0.15', '< 0.18'
38
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyhub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Zemlianoy
@@ -9,134 +9,196 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-12-15 00:00:00.000000000 Z
12
+ date: 2020-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: '1.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
34
+ version: '2.1'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: '2.1'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: fasterer
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: '0.8'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: '0.8'
56
+ - !ruby/object:Gem::Dependency
57
+ name: ffaker
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.14'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '2.14'
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: pry
58
72
  requirement: !ruby/object:Gem::Requirement
59
73
  requirements:
60
- - - ">="
74
+ - - "~>"
61
75
  - !ruby/object:Gem::Version
62
- version: '0'
76
+ version: '0.13'
63
77
  type: :development
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - ">="
81
+ - - "~>"
68
82
  - !ruby/object:Gem::Version
69
- version: '0'
83
+ version: '0.13'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rake
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - ">="
88
+ - - "~>"
75
89
  - !ruby/object:Gem::Version
76
- version: '0'
90
+ version: '13.0'
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - ">="
95
+ - - "~>"
82
96
  - !ruby/object:Gem::Version
83
- version: '0'
97
+ version: '13.0'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: rspec
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
88
- - - ">="
102
+ - - "~>"
89
103
  - !ruby/object:Gem::Version
90
- version: '0'
104
+ version: '3.9'
91
105
  type: :development
92
106
  prerelease: false
93
107
  version_requirements: !ruby/object:Gem::Requirement
94
108
  requirements:
95
- - - ">="
109
+ - - "~>"
96
110
  - !ruby/object:Gem::Version
97
- version: '0'
111
+ version: '3.9'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rspec_junit_formatter
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '0.4'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '0.4'
98
126
  - !ruby/object:Gem::Dependency
99
127
  name: rubocop
100
128
  requirement: !ruby/object:Gem::Requirement
101
129
  requirements:
102
- - - ">="
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '0.81'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '0.81'
140
+ - !ruby/object:Gem::Dependency
141
+ name: rubocop-md
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
103
145
  - !ruby/object:Gem::Version
104
- version: '0'
146
+ version: '0.3'
105
147
  type: :development
106
148
  prerelease: false
107
149
  version_requirements: !ruby/object:Gem::Requirement
108
150
  requirements:
109
- - - ">="
151
+ - - "~>"
110
152
  - !ruby/object:Gem::Version
111
- version: '0'
153
+ version: '0.3'
112
154
  - !ruby/object:Gem::Dependency
113
155
  name: rubocop-performance
114
156
  requirement: !ruby/object:Gem::Requirement
115
157
  requirements:
116
- - - ">="
158
+ - - "~>"
117
159
  - !ruby/object:Gem::Version
118
- version: '0'
160
+ version: '1.5'
119
161
  type: :development
120
162
  prerelease: false
121
163
  version_requirements: !ruby/object:Gem::Requirement
122
164
  requirements:
123
- - - ">="
165
+ - - "~>"
124
166
  - !ruby/object:Gem::Version
125
- version: '0'
167
+ version: '1.5'
126
168
  - !ruby/object:Gem::Dependency
127
169
  name: rubocop-rspec
128
170
  requirement: !ruby/object:Gem::Requirement
129
171
  requirements:
130
- - - ">="
172
+ - - "~>"
131
173
  - !ruby/object:Gem::Version
132
- version: '0'
174
+ version: '1.38'
133
175
  type: :development
134
176
  prerelease: false
135
177
  version_requirements: !ruby/object:Gem::Requirement
136
178
  requirements:
137
- - - ">="
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '1.38'
182
+ - !ruby/object:Gem::Dependency
183
+ name: simplecov
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '0.15'
189
+ - - "<"
190
+ - !ruby/object:Gem::Version
191
+ version: '0.18'
192
+ type: :development
193
+ prerelease: false
194
+ version_requirements: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - "~>"
197
+ - !ruby/object:Gem::Version
198
+ version: '0.15'
199
+ - - "<"
138
200
  - !ruby/object:Gem::Version
139
- version: '0'
201
+ version: '0.18'
140
202
  description: Tool for faster creation of GitHub's Pull Requests
141
203
  email:
142
204
  - ''
@@ -145,10 +207,13 @@ executables:
145
207
  extensions: []
146
208
  extra_rdoc_files: []
147
209
  files:
210
+ - ".circleci/config.yml"
211
+ - ".dependabot/config.yml"
148
212
  - ".fasterer.yml"
149
213
  - ".gitignore"
150
214
  - ".rspec"
151
215
  - ".rubocop.yml"
216
+ - CHANGELOG.md
152
217
  - Gemfile
153
218
  - Gemfile.lock
154
219
  - README.md
@@ -165,6 +230,8 @@ files:
165
230
  - lib/rubyhub/operations/pull_request/create.rb
166
231
  - lib/rubyhub/pull_request.rb
167
232
  - lib/rubyhub/utils/deep_symbolize_keys_helper.rb
233
+ - lib/rubyhub/utils/hash.rb
234
+ - lib/rubyhub/utils/string.rb
168
235
  - lib/rubyhub/version.rb
169
236
  - rubyhub.gemspec
170
237
  homepage: https://github.com
@@ -187,8 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
254
  - !ruby/object:Gem::Version
188
255
  version: '0'
189
256
  requirements: []
190
- rubyforge_project:
191
- rubygems_version: 2.7.8
257
+ rubygems_version: 3.0.6
192
258
  signing_key:
193
259
  specification_version: 4
194
260
  summary: Tool for faster creation of GitHub's Pull Requests