gistory 0.2.1 → 0.3.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: 3e8eab6d518dee70d3c57035306062a1d3d466fe9fdd468076bece37ea8f21d3
4
- data.tar.gz: 384accb7f97bc56ca2adaaae3963520a1d60f9f96e1b8c9f418077f0a14f5055
3
+ metadata.gz: '013096cf87f86116fb9e56c4649dbfca9fddef5d0ee7b852d716863c878fe85c'
4
+ data.tar.gz: 99a1fdcfe15237525f30b4fc21b2228b41d7a21d72b14a6720ea4f1f896352c9
5
5
  SHA512:
6
- metadata.gz: 2320727fc749c876387b075bf3a26e5e45a74fc688f06fc1d91acf132307f7a3cac6a94bac3b913073f3a61be25a7ee31ed6ad1e275f7890309f9b3cf64dd6f9
7
- data.tar.gz: 2877f804af2ef087f87a6900b6b4cdc834e574015853022d8332896fabbf4a9f9f63c8cf61c38016c463b5c3127234dce41c423890da16b9e99892227de67d9b
6
+ metadata.gz: 20a9c87950c34a0da71cad949bd46b5f3324ad7e0fccd3d7effa1189130ddaa9abdb04f3afdf6b16c796cf993039795666b1f57330c131fc01bf35b11ed0605a
7
+ data.tar.gz: 7980c0628a183fb59b9e3a32d40019a74faea1ba9069a071a3ed2bda994205139314d8d633f17d444a62ae0966b588e5fffc7d0f65919620bc6c055cfa589228
@@ -1,5 +1,9 @@
1
1
  require: rubocop-rspec
2
2
 
3
+ AllCops:
4
+ TargetRubyVersion: 2.4
5
+ NewCops: enable
6
+
3
7
  Metrics/AbcSize:
4
8
  Max: 25
5
9
  Exclude:
@@ -12,9 +16,6 @@ Metrics/BlockLength:
12
16
  Metrics/MethodLength:
13
17
  Max: 20
14
18
 
15
- Layout/EmptyLineAfterGuardClause:
16
- Enabled: false
17
-
18
19
  Layout/LineLength:
19
20
  Max: 120
20
21
 
@@ -41,47 +42,3 @@ RSpec/MultipleExpectations:
41
42
 
42
43
  RSpec/ExampleLength:
43
44
  Max: 15
44
-
45
- # starting rubocop 0.80 newly added cops need to be explicitly enabled:
46
-
47
- Lint/DeprecatedOpenSSLConstant:
48
- Enabled: true
49
-
50
- Layout/EmptyLinesAroundAttributeAccessor:
51
- Enabled: true
52
-
53
- Lint/MixedRegexpCaptureTypes:
54
- Enabled: true
55
-
56
- Lint/RaiseException:
57
- Enabled: true
58
-
59
- Layout/SpaceAroundMethodCallOperator:
60
- Enabled: true
61
-
62
- Lint/StructNewOverride:
63
- Enabled: true
64
-
65
- Style/ExponentialNotation:
66
- Enabled: true
67
-
68
- Style/HashEachMethods:
69
- Enabled: true
70
-
71
- Style/HashTransformKeys:
72
- Enabled: true
73
-
74
- Style/HashTransformValues:
75
- Enabled: true
76
-
77
- Style/RedundantFetchBlock:
78
- Enabled: true
79
-
80
- Style/RedundantRegexpCharacterClass:
81
- Enabled: true
82
-
83
- Style/RedundantRegexpEscape:
84
- Enabled: true
85
-
86
- Style/SlicingWithRange:
87
- Enabled: true
data/Gemfile CHANGED
@@ -4,12 +4,6 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- group :development, :test do
8
- gem "byebug" # debugger
9
- gem "pry" # better console
10
- gem "pry-byebug" # pry integration for byebug
11
- end
12
-
13
7
  group :test do
14
8
  gem "coveralls", require: false
15
9
  gem "simplecov", require: false # code coverage
data/README.md CHANGED
@@ -51,3 +51,4 @@ only show the latest version changes up until it was removed.
51
51
  - remove bundler dep
52
52
  - add yard doc
53
53
  - do not print the warning text if there were no more changes in the lock file
54
+ - link the commit SHA to the repo's hosting service, if any
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "bundler", "~> 1.0"
28
28
  spec.add_dependency "colorize"
29
29
 
30
- spec.add_development_dependency "pry"
31
- spec.add_development_dependency "pry-byebug"
30
+ spec.add_development_dependency "pry", "~> 0.13.1"
31
+ spec.add_development_dependency "pry-byebug", "~> 3.9.0"
32
32
  spec.add_development_dependency "rake", "~> 13.0"
33
33
  spec.add_development_dependency "rspec", "~> 3.9"
34
34
  spec.add_development_dependency "rubocop"
@@ -31,6 +31,7 @@ module Gistory
31
31
  def parse_gem_name
32
32
  gem_name = @args.shift
33
33
  raise(Gistory::ParserError, "No gem specified") unless gem_name
34
+
34
35
  @config.gem_name = gem_name
35
36
  end
36
37
 
@@ -49,6 +50,7 @@ module Gistory
49
50
 
50
51
  add_max_fetched_commits(parser, config)
51
52
  add_use_commits_from_all_branches(parser, config)
53
+ add_output_commit_hashes_only(parser, config)
52
54
  add_help(parser)
53
55
  add_version(parser)
54
56
  end
@@ -58,6 +60,7 @@ module Gistory
58
60
  description = "max number of commits to be fetched (default #{default})"
59
61
  parser.on("-m", "--max-fetched-commits [Integer]", Integer, description) do |m|
60
62
  raise(Gistory::ParserError, "argument --max-fetched-commits must be an integer") if m.nil?
63
+
61
64
  config.max_fetched_commits = m
62
65
  end
63
66
  end
@@ -70,6 +73,15 @@ module Gistory
70
73
  end
71
74
  end
72
75
 
76
+ def add_output_commit_hashes_only(parser, config)
77
+ option_switch = "--hashes-only"
78
+ parser.on(option_switch,
79
+ "output commit hashes only so they can be piped",
80
+ "for example: gistory #{option_switch} sidekiq | xargs git show") do |ho|
81
+ config.output_commit_hashes_only = ho
82
+ end
83
+ end
84
+
73
85
  def add_help(parser)
74
86
  parser.on_tail("-h", "--help", "Show this message") do
75
87
  @io.puts parser
@@ -30,6 +30,18 @@ module Gistory
30
30
  raise(Gistory::Error, "Gem '#{gem_name}' not found in lock file, maybe a typo?")
31
31
  end
32
32
 
33
+ if Gistory.config.output_commit_hashes_only?
34
+ print_commit_hashes_only(changes)
35
+ else
36
+ print_full_output(gem_name, changes)
37
+ end
38
+ end
39
+
40
+ def print_commit_hashes_only(changes)
41
+ changes.each { |change| @io.puts change.short_hash }
42
+ end
43
+
44
+ def print_full_output(gem_name, changes)
33
45
  @io.puts "Gem: #{gem_name}"
34
46
  @io.puts "Current version: #{changes.first.version}"
35
47
  @io.puts ""
@@ -3,15 +3,20 @@
3
3
  module Gistory
4
4
  class Configuration
5
5
  attr_accessor :gem_name, :max_fetched_commits
6
- attr_writer :all_branches
6
+ attr_writer :all_branches, :output_commit_hashes_only
7
7
 
8
8
  def initialize
9
9
  @max_fetched_commits = 100
10
10
  @all_branches = false
11
+ @output_commit_hashes_only = false
11
12
  end
12
13
 
13
14
  def all_branches?
14
15
  @all_branches
15
16
  end
17
+
18
+ def output_commit_hashes_only?
19
+ @output_commit_hashes_only
20
+ end
16
21
  end
17
22
  end
@@ -45,6 +45,7 @@ module Gistory
45
45
  def git(command)
46
46
  out = `git #{command}`
47
47
  raise "Git CLI command failed" unless $CHILD_STATUS.success?
48
+
48
49
  out
49
50
  end
50
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gistory
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gistory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Medina
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-27 00:00:00.000000000 Z
11
+ date: 2020-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.13.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.13.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry-byebug
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 3.9.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 3.9.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement