Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore] Increment ruby support #109

Merged
merged 5 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,45 @@ AllCops:
- 'exe/*'
- '**/Gemfile'
- '.github/**/*'

Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true

Layout/SpaceAroundMethodCallOperator:
Enabled: true

Lint/DeprecatedOpenSSLConstant:
Enabled: true

Lint/MixedRegexpCaptureTypes:
Enabled: true

Lint/RaiseException:
Enabled: true

Lint/StructNewOverride:
Enabled: true

Style/ExponentialNotation:
Enabled: true

Style/HashEachMethods:
Enabled: true

Style/HashTransformKeys:
Enabled: true

Style/HashTransformValues:
Enabled: true

Style/RedundantFetchBlock:
Enabled: true

Style/RedundantRegexpCharacterClass:
Enabled: true

Style/RedundantRegexpEscape:
Enabled: true

Style/SlicingWithRange:
Enabled: true
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.1
2.7.1
127 changes: 39 additions & 88 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
story_branch (0.7.1)
story_branch (0.7.2)
blanket_wrapper (~> 3.0)
damerau-levenshtein (~> 1.3)
jira-ruby (~> 1.7)
Expand All @@ -15,12 +15,13 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.3.1)
activesupport (6.0.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
ast (2.4.1)
atlassian-jwt (0.2.0)
jwt (~> 2.1.0)
blanket_wrapper (3.0.2)
Expand All @@ -34,38 +35,42 @@ GEM
equatable (0.6.1)
fakefs (0.20.1)
git (1.5.0)
httparty (0.17.3)
httparty (0.18.1)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
i18n (1.8.2)
i18n (1.8.3)
concurrent-ruby (~> 1.0)
jira-ruby (1.7.1)
jira-ruby (1.8.0)
activesupport
atlassian-jwt
multipart-post
oauth (~> 0.5, >= 0.5.0)
json (2.1.0)
jwt (2.1.0)
kramdown (1.16.2)
method_source (0.9.2)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009)
mime-types-data (3.2020.0512)
minitest (5.14.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
necromancer (0.5.1)
oauth (0.5.4)
ostruct (0.1.0)
pastel (0.7.3)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
pastel (0.7.4)
equatable (~> 0.6)
tty-color (~> 0.5)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rake (13.0.1)
recursive-open-struct (1.1.0)
rouge (3.15.0)
rainbow (3.0.0)
rake (12.3.3)
recursive-open-struct (1.1.2)
regexp_parser (1.7.1)
rexml (3.2.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
Expand All @@ -81,6 +86,18 @@ GEM
rspec-support (3.9.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.86.0)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.0.3, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.0.3)
parser (>= 2.7.0.1)
ruby-progressbar (1.10.1)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand All @@ -93,92 +110,26 @@ GEM
strings-ansi (0.1.0)
thor (0.20.3)
thread_safe (0.3.6)
tty (0.10.0)
bundler (~> 1.16, < 2.0)
equatable (~> 0.5)
pastel (~> 0.7.2)
thor (~> 0.20.0)
tty-box (~> 0.4.1)
tty-color (~> 0.5)
tty-command (~> 0.9.0)
tty-config (~> 0.3.2)
tty-cursor (~> 0.7)
tty-editor (~> 0.5)
tty-file (~> 0.8.0)
tty-font (~> 0.4.0)
tty-logger (~> 0.2.0)
tty-markdown (~> 0.6.0)
tty-pager (~> 0.12)
tty-pie (~> 0.3.0)
tty-platform (~> 0.2)
tty-progressbar (~> 0.17)
tty-prompt (~> 0.19)
tty-screen (~> 0.7)
tty-spinner (~> 0.9)
tty-table (~> 0.11.0)
tty-tree (~> 0.3)
tty-which (~> 0.4)
tty-box (0.4.1)
pastel (~> 0.7.2)
strings (~> 0.1.6)
tty-cursor (~> 0.7)
tty-color (0.5.1)
tty-command (0.9.0)
pastel (~> 0.7.0)
tty-config (0.3.2)
tty-cursor (0.7.0)
tty-editor (0.5.1)
tty-prompt (~> 0.19)
tty-which (~> 0.4)
tty-file (0.8.0)
diff-lcs (~> 1.3)
pastel (~> 0.7.2)
tty-prompt (~> 0.18)
tty-font (0.4.0)
tty-logger (0.2.0)
pastel (~> 0.7.0)
tty-markdown (0.6.0)
kramdown (~> 1.16.2)
pastel (~> 0.7.2)
rouge (~> 3.3)
strings (~> 0.1.4)
tty-color (~> 0.4)
tty-screen (~> 0.6)
tty-pager (0.12.1)
strings (~> 0.1.4)
tty-screen (~> 0.6)
tty-which (~> 0.4)
tty-pie (0.3.0)
pastel (~> 0.7.3)
tty-cursor (~> 0.7)
tty-platform (0.3.0)
tty-progressbar (0.17.0)
strings-ansi (~> 0.1.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.7)
unicode-display_width (~> 1.6)
tty-prompt (0.20.0)
tty-cursor (0.7.1)
tty-pager (0.13.0)
strings (~> 0.1.8)
tty-screen (~> 0.8)
tty-prompt (0.21.0)
necromancer (~> 0.5.0)
pastel (~> 0.7.0)
tty-reader (~> 0.7.0)
tty-reader (0.7.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.7)
wisper (~> 2.0.0)
tty-screen (0.7.0)
tty-spinner (0.9.2)
tty-cursor (~> 0.7)
tty-table (0.11.0)
equatable (~> 0.6)
necromancer (~> 0.5)
pastel (~> 0.7.2)
strings (~> 0.1.5)
tty-screen (~> 0.7)
tty-tree (0.4.0)
tty-which (0.4.2)
tty-screen (0.8.0)
tzinfo (1.2.7)
thread_safe (~> 0.1)
unicode-display_width (1.6.1)
unicode-display_width (1.7.0)
unicode_utils (1.4.0)
wisper (2.0.1)
xdg (3.1.1)
Expand All @@ -188,17 +139,17 @@ PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.17, < 2.0)
bundler (~> 2.1)
fakefs (~> 0.14)
git (~> 1.5)
ostruct (~> 0.1)
pry (~> 0.11)
rake (>= 12.3.3)
rake (~> 12.3, >= 12.3.3)
rspec (~> 3)
rspec_junit_formatter (~> 0.4)
rubocop (~> 0.86)
simplecov (~> 0.16)
story_branch!
tty (~> 0.10)

BUNDLED WITH
1.17.3
2.1.4
2 changes: 0 additions & 2 deletions lib/story_branch/commands/add.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ def create_global_config

return unless tracker == 'jira'

# rubocop:disable Metrics/LineLength
username = prompt.ask('Please provide username (email most of the times) for this key:',
required: true)
# rubocop:enable Metrics/LineLength
@new_config.username = username
end

Expand Down
2 changes: 1 addition & 1 deletion lib/story_branch/git_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.branch_names
# remotes/origin/allow.... <- remote branch (remove 'remotes/origin')
# * allow.... <- * indicates current branch (remove '* ')
# allow <- local branch (do nothing)
regex = %r{(^remotes\/.*\/|\s|[*])}
regex = %r{(^remotes/.*/|\s|[*])}
all_branches.map do |line|
line = line.sub(regex, '')
line
Expand Down
4 changes: 1 addition & 3 deletions lib/story_branch/github/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def initialize(blanket_story, repo)
@title = blanket_story.title
@id = blanket_story.number
@labels = blanket_story.labels.map { |label| Label.new(label) }
@milestone = if blanket_story.milestone
Milestone.new(blanket_story.milestone)
end
@milestone = Milestone.new(blanket_story.milestone) if blanket_story.milestone
@html_url = blanket_story.html_url
end

Expand Down
1 change: 1 addition & 0 deletions lib/story_branch/github/label.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Github
# Github Labels representation
class Label
attr_accessor :name, :color

def initialize(label_data)
@name = label_data.name
@color = label_data.color
Expand Down
2 changes: 1 addition & 1 deletion lib/story_branch/jira/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def dashed_title
private

def transform_url(url)
url.gsub(%r{rest\/api.*$}, "browse/#{@id}")
url.gsub(%r{rest/api.*$}, "browse/#{@id}")
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions lib/story_branch/jira/tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module StoryBranch
module Jira
# JIRA API wrapper for story branch tracker
class Tracker < StoryBranch::TrackerBase
# rubocop:disable Metrics/LineLength
def initialize(tracker_domain:, project_id:, api_key:, username:, extra_query:)
super

Expand All @@ -23,7 +22,6 @@ def initialize(tracker_domain:, project_id:, api_key:, username:, extra_query:)
@username = username
@extra_query = extra_query
end
# rubocop:enable Metrics/LineLength

def valid?
[@api_key, @project_id, @username, @tracker_url].none?(&:nil?)
Expand Down
18 changes: 6 additions & 12 deletions lib/story_branch/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ def current_story
end

def unstaged_changes?
unless GitUtils.status?(:untracked) || GitUtils.status?(:modified)
return false
end
return false unless GitUtils.status?(:untracked) || GitUtils.status?(:modified)

message = <<~MESSAGE
There are unstaged changes
Expand Down Expand Up @@ -166,18 +164,15 @@ def create_feature_branch(story)
branch_name = valid_branch_name(story)
return unless branch_name

# rubocop:disable Metrics/LineLength
feature_branch_name_with_story_id = build_branch_name(branch_name, story.id)

prompt.say("Creating: #{feature_branch_name_with_story_id} with #{current_branch} as parent")
# rubocop:enable Metrics/LineLength
GitWrapper.create_branch feature_branch_name_with_story_id
end

def valid_branch_name(story)
prompt.say "You are checked out at: #{current_branch}"
branch_name = prompt.ask('Provide a new branch name',
default: story.dashed_title)
branch_name = prompt.ask('Provide a new branch name', default: story.dashed_title)
feature_branch_name = StringUtils.truncate(branch_name.chomp)

validate_branch_name(feature_branch_name)
Expand All @@ -187,8 +182,7 @@ def valid_branch_name(story)
# rubocop:disable Metrics/MethodLength
def validate_branch_name(name)
if GitUtils.similar_branch? name
prompt.warn('This name is very similar to an existing branch.'\
' It is recommended to use a more unique name.')
prompt.warn('This name is very similar to an existing branch. It is recommended to use a more unique name.')
decision = prompt.select('What to do?') do |menu|
menu.choice 'Rename the branch', 1
menu.choice 'Proceed with branch name', 2
Expand Down Expand Up @@ -221,11 +215,11 @@ def initialize_tracker
tracker_type = @config.tracker_type
case tracker_type
when 'github'
StoryBranch::Github::Tracker.new(@config.tracker_params)
StoryBranch::Github::Tracker.new(**@config.tracker_params)
when 'pivotal-tracker'
StoryBranch::Pivotal::Tracker.new(@config.tracker_params)
StoryBranch::Pivotal::Tracker.new(**@config.tracker_params)
when 'jira'
StoryBranch::Jira::Tracker.new(@config.tracker_params)
StoryBranch::Jira::Tracker.new(**@config.tracker_params)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/story_branch/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module StoryBranch
VERSION = '0.7.1'
VERSION = '0.7.2'
end
Loading