story_branch 0.6.0alpha → 0.6.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: c9a02518d7bc7ed6989a8bac354b4586d52268211024e1253f33ca0345c4f08d
4
- data.tar.gz: 38a6bdff3edc0038164d693964738d7a9eff743ddb9fade2c1a3a9c01cd70fd1
3
+ metadata.gz: 1826485750874314fb2570c93b1330a89f88e36571a84fe63482a33ffbb50d34
4
+ data.tar.gz: 2914e9113a13b0ab0546485faa0b8acea1906f84b459f54c2d835433891bbb0c
5
5
  SHA512:
6
- metadata.gz: fdfc646432ce7e0b952659de39efdadc0fc2e09ede2e3e9651d00a3e5840719a14279ae92cec49552572638fa4fdc23eaffe365f65bceec8df97ee494189e84f
7
- data.tar.gz: 2eebfaf7313adbb7d48c8f4d91f054db99d3fc1af63b20bb6996a7e260b104d68d23913224d4429e12b3d9d468e5430b99fcb63988700ddb6a0e49c0d00775ef
6
+ metadata.gz: baf40433309c1939869490828cdb7cbd2749ba9cb22f09579e0003f989fecf84ced996bc0ae64a6babc58debc43c601093659a231c1c3ef5a12e31055f9badde
7
+ data.tar.gz: b24f7b09b8eadee1960cd4a053f6007c23bb46535af08667e5fab08b6bbb15e622664110e05ba2783eacb6e07fe4033d901bd9b0e8d5ab5abd4c71e38fc359d2
@@ -0,0 +1,19 @@
1
+ name: Rubocop
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Rubocop Linter
17
+ uses: andrewmcodes/rubocop-linter-action@v0.1.2
18
+ env:
19
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - 'spec/**/*.rb'
4
+ AllCops:
5
+ Exclude:
6
+ - '**/*.gemspec'
7
+ - 'exe/*'
8
+ - '**/Gemfile'
9
+ - '.github/**/*'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.6.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- story_branch (0.6.0alpha)
4
+ story_branch (0.6.0)
5
5
  blanket_wrapper (~> 3.0)
6
6
  damerau-levenshtein (~> 1.3)
7
7
  jira-ruby (~> 1.7)
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/story_branch.png)](http://badge.fury.io/rb/story_branch)
2
2
  [![CircleCI](https://circleci.com/gh/story-branch/story_branch/tree/master.svg?style=svg)](https://circleci.com/gh/story-branch/story_branch/tree/master)
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/7dbd75908417656853d7/maintainability)](https://codeclimate.com/github/story-branch/story_branch/maintainability)
3
4
 
4
5
  # Story Branch
5
6
 
data/exe/git-finish CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
- # rubocop:disable Style/FrozenStringLiteralComment
1
+ # !/usr/bin/env ruby
3
2
 
4
3
  `story_branch finish`
@@ -35,12 +35,14 @@ module StoryBranch
35
35
 
36
36
  def project_id
37
37
  return @project_id if @project_id
38
+
38
39
  @project_id = old_config_value('project', 'PIVOTAL_PROJECT_ID')
39
40
  @project_id
40
41
  end
41
42
 
42
43
  def api_key
43
44
  return @api_key if @api_key
45
+
44
46
  @api_key = old_config_value('api', 'PIVOTAL_API_KEY')
45
47
  @api_key
46
48
  end
@@ -52,6 +54,7 @@ module StoryBranch
52
54
  def missing_old_config?
53
55
  OLD_CONFIG_FILES.each { |file| return false if File.exist?(file) }
54
56
  return false if env_set?
57
+
55
58
  true
56
59
  end
57
60
 
@@ -12,10 +12,11 @@ module StoryBranch
12
12
 
13
13
  def stories(options = {})
14
14
  stories = if options[:id]
15
- [@repo.issues(options[:id]).get.payload]
15
+ [@repo.issues(options[:id]).get]
16
16
  else
17
- @repo.issues.get(params: options).payload
17
+ @repo.issues.get(params: options)
18
18
  end
19
+
19
20
  stories.reject!(&:pull_request)
20
21
  stories.map { |s| Issue.new(s, @repo) }
21
22
  end
@@ -9,8 +9,9 @@ require_relative './config_manager'
9
9
  require 'tty-prompt'
10
10
 
11
11
  module StoryBranch
12
- # Main story branch class. It is resposnible for the main interaction between
12
+ # Main story branch class. It is responsible for the main interaction between
13
13
  # the user and Pivotal Tracker. It is also responsible for config init.
14
+
14
15
  # rubocop:disable Metrics/ClassLength
15
16
  class Main
16
17
  attr_accessor :tracker
@@ -41,13 +42,11 @@ module StoryBranch
41
42
  end
42
43
 
43
44
  def story_finish
44
- current_story = tracked_story
45
+ current_story
45
46
  return if unstaged_changes?
46
47
  return if nothing_to_add?
47
48
 
48
- # rubocop:disable Metrics/LineLength
49
- commit_message = "[#{finish_tag} ##{current_story[:id]}] #{current_story[:title]}"
50
- # rubocop:enable Metrics/LineLength
49
+ commit_message = build_finish_message
51
50
  proceed = prompt.yes?("Commit with standard message? #{commit_message}")
52
51
  if proceed
53
52
  GitWrapper.commit commit_message
@@ -83,10 +82,14 @@ module StoryBranch
83
82
  true
84
83
  end
85
84
 
86
- def tracked_story
85
+ def current_story
86
+ return @current_story if @current_story
87
+
87
88
  current_story = GitUtils.current_branch_story_parts
88
- if !current_story.empty? && @tracker.get_story_by_id(current_story[:id])
89
- return current_story
89
+
90
+ unless current_story.empty?
91
+ @current_story = @tracker.get_story_by_id(current_story[:id])
92
+ return @current_story if @current_story
90
93
  end
91
94
 
92
95
  prompt.error('No tracked feature associated with this branch')
@@ -152,9 +155,7 @@ module StoryBranch
152
155
  end
153
156
 
154
157
  def prompt
155
- return @prompt if @prompt
156
-
157
- @prompt = TTY::Prompt.new(interrupt: :exit)
158
+ @prompt ||= TTY::Prompt.new(interrupt: :exit)
158
159
  end
159
160
 
160
161
  def finish_tag
@@ -167,6 +168,11 @@ module StoryBranch
167
168
  @finish_tag
168
169
  end
169
170
 
171
+ def build_finish_message
172
+ message_tag = [finish_tag, "##{current_story.id}"].join(' ').strip
173
+ "[#{message_tag}] #{current_story.title}"
174
+ end
175
+
170
176
  def create_feature_branch(story)
171
177
  return if story.nil?
172
178
 
@@ -14,9 +14,9 @@ module StoryBranch
14
14
  # TODO: add other possible args
15
15
  def stories(options = {}, estimated = true)
16
16
  stories = if options[:id]
17
- [@project.stories(options[:id]).get.payload]
17
+ [@project.stories(options[:id]).get]
18
18
  else
19
- @project.stories.get(params: options).payload
19
+ @project.stories.get(params: options)
20
20
  end
21
21
  stories = stories.map { |s| Story.new(s, @project) }
22
22
  return stories if estimated == false
@@ -20,7 +20,7 @@ module StoryBranch
20
20
 
21
21
  def update_state(new_state)
22
22
  params = { current_state: new_state }
23
- @project.stories(@id).put(body: params).payload
23
+ @project.stories(@id).put(body: params)
24
24
  end
25
25
 
26
26
  def to_s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StoryBranch
4
- VERSION = '0.6.0alpha'
4
+ VERSION = '0.6.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: story_branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0alpha
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rui Baltazar
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2019-10-06 00:00:00.000000000 Z
15
+ date: 2019-10-27 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: blanket_wrapper
@@ -261,8 +261,10 @@ files:
261
261
  - ".circleci/setup-rubygems.sh"
262
262
  - ".github/ISSUE_TEMPLATE.md"
263
263
  - ".github/PULL_REQUEST_TEMPLATE.md"
264
+ - ".github/workflows/rubocop.yml"
264
265
  - ".gitignore"
265
266
  - ".rspec"
267
+ - ".rubocop.yml"
266
268
  - ".ruby-version"
267
269
  - ".story_branch.yml"
268
270
  - Changelog.md
@@ -336,9 +338,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
336
338
  version: '2.7'
337
339
  required_rubygems_version: !ruby/object:Gem::Requirement
338
340
  requirements:
339
- - - ">"
341
+ - - ">="
340
342
  - !ruby/object:Gem::Version
341
- version: 1.3.1
343
+ version: '0'
342
344
  requirements: []
343
345
  rubygems_version: 3.0.3
344
346
  signing_key: