lock_diff 0.4.2 → 0.8.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
- SHA1:
3
- metadata.gz: 54743197176c06b5104c91eb515f6e2280b3c244
4
- data.tar.gz: 87dc61b1fc08f521d743c43a00cbc2069dc0e9b7
2
+ SHA256:
3
+ metadata.gz: 433d96aaf83ef0b0009a6ed9ddfed2251a7f682ca1da5c0433b64a2c3a694704
4
+ data.tar.gz: 626eba39a4fc1b6a055c71dc3c6360f837845940bf0be0b93c4ab4ec474a4de9
5
5
  SHA512:
6
- metadata.gz: adfab7647a888defe0259dcc67059456bac7473a6c1d5059115adcd9f0333d378a2039ee590589d1b033aaf35eda6f950327b0ab5598dcabc9a628231392804c
7
- data.tar.gz: 6a388bd9d05b23b63f7cbcdd233c4bb170a2cd853169a2f4e4423e798862e220fe084ed410415bcc1f8d358004ce2fbf4a487d75b6c467ad47b088ce5b4275a5
6
+ metadata.gz: 0d5c534ac9ac0cc94a5e5ac898f59a239ce378ccdc85eda147d42611cef4f438f5f6d467c5e715a45460bce3745ddccc230024cd3374b43aeba135b11af422aa
7
+ data.tar.gz: 5fd70f934b7c13b0ee22e48dccfc70db05ae89776ad12c34158549c89c5c230249953710e48a9c26bea0687b1689bb1ae4bc3254e31e431bca373cd0dd9afa17
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: /
5
+ schedule:
6
+ interval: daily
@@ -0,0 +1,27 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
16
+
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: true
24
+ - name: Run tests
25
+ run: bundle exec rspec
26
+ env:
27
+ GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/README.md CHANGED
@@ -1,13 +1,8 @@
1
1
  # LockDiff
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/lock_diff.svg)](https://badge.fury.io/rb/lock_diff)
4
- [![GitHub tag](https://img.shields.io/github/tag/vividmuimui/lock_diff.svg)](https://github.com/vividmuimui/lock_diff/tags)
5
- [![Build Status](https://travis-ci.org/vividmuimui/lock_diff.svg?branch=master)](https://travis-ci.org/vividmuimui/lock_diff)
6
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d05b439bc5064e30ad84ecfa8e57b448)](https://www.codacy.com/app/vividmuimui/lock_diff?utm_source=github.com&utm_medium=referral&utm_content=vividmuimui/lock_diff&utm_campaign=badger)
7
- [![Dependency Status](https://gemnasium.com/badges/github.com/vividmuimui/lock_diff.svg)](https://gemnasium.com/github.com/vividmuimui/lock_diff)
4
+ ![Build Status](https://github.com/vividmuimui/lock_diff/actions/workflows/ruby.yml/badge.svg)
8
5
  [![Code Climate](https://codeclimate.com/github/vividmuimui/lock_diff/badges/gpa.svg)](https://codeclimate.com/github/vividmuimui/lock_diff)
9
- [![Issue Count](https://codeclimate.com/github/vividmuimui/lock_diff/badges/issue_count.svg)](https://codeclimate.com/github/vividmuimui/lock_diff)
10
- [![ghit.me](https://ghit.me/badge.svg?repo=vividmuimui/lock_diff)](https://ghit.me/repo/vividmuimui/lock_diff)
11
6
 
12
7
  This gem detects changes to your package manager (e.g. Gemfile) and generates a Markdown-formatted diff including:
13
8
 
@@ -109,7 +104,7 @@ TODO:
109
104
 
110
105
  ## Contributing
111
106
 
112
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lock_diff. 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.
107
+ Bug reports and pull requests are welcome on GitHub at https://github.com/vividmuimui/lock_diff. 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.
113
108
 
114
109
  ## License
115
110
 
@@ -117,7 +112,7 @@ The gem is available as open source under the terms of the [MIT License](http://
117
112
 
118
113
  ### Original
119
114
 
120
- Most source code in this pepository is by https://github.com/kyanny/compare_linker .
115
+ Most of the source code in this repository is by https://github.com/kyanny/compare_linker.
121
116
 
122
117
  ```
123
118
  Copyright (c) 2014 Kensuke Nagae
@@ -147,4 +142,4 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
147
142
 
148
143
  ## Code of Conduct
149
144
 
150
- Everyone interacting in the LockDiff project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lock_diff/blob/master/CODE_OF_CONDUCT.md).
145
+ Everyone interacting in the LockDiff project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/vividmuimui/lock_diff/blob/master/CODE_OF_CONDUCT.md).
@@ -4,4 +4,4 @@ require "lock_diff"
4
4
  require "lock_diff/cli/option_parser"
5
5
 
6
6
  options = LockDiff::Cli::OptionParser.parse(ARGV, require_flags: %i(repository))
7
- LockDiff.run_by_latest_tachikoma(options)
7
+ LockDiff.run_by_latest_tachikoma(**options)
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LockDiff
4
+ class Changelog
5
+ attr_reader :url
6
+
7
+ def initialize(url)
8
+ @url = url
9
+ end
10
+
11
+ def name
12
+ File.basename(@url)
13
+ end
14
+ end
15
+ end
@@ -57,28 +57,19 @@ module LockDiff
57
57
  end
58
58
  end
59
59
 
60
- def changelog_url
61
- @changelog_url ||= begin
62
- ref =
63
- case status
64
- when UPGRADE, NEW
65
- @new_package.ref
66
- when DOWNGRADE, DELETE
67
- nil # default branch(master)
68
- end
60
+ def changelogs
61
+ return nil if [DOWNGRADE, DELETE].include?(status)
69
62
 
70
- Github::ChangelogUrlFinder.new(
71
- repository: package.repository,
72
- repository_url: package.repository_url,
73
- ref: ref
74
- ).call
63
+ Github::ChangelogUrlFinder.new(
64
+ repository: package.repository,
65
+ repository_url: package.repository_url,
66
+ ref: @new_package.ref,
67
+ package_name: package.name
68
+ ).call.map do |url|
69
+ Changelog.new(url)
75
70
  end
76
71
  end
77
72
 
78
- def changelog_name
79
- File.basename(changelog_url)
80
- end
81
-
82
73
  def commits_url
83
74
  return unless package.repository_url
84
75
  old_ref = @old_package.ref
@@ -41,7 +41,7 @@ module LockDiff
41
41
  text << repository
42
42
  text << status
43
43
  text << commits_text
44
- text << changelog
44
+ text << changelogs
45
45
  "| #{text.join(' | ')} |"
46
46
  end
47
47
 
@@ -77,15 +77,16 @@ module LockDiff
77
77
  end
78
78
  end
79
79
 
80
- def changelog
81
- if diff_info.changelog_url
82
- "[#{diff_info.changelog_name}](#{diff_info.changelog_url})"
80
+ def changelogs
81
+ if diff_info.changelogs
82
+ diff_info.changelogs.map do |changelog|
83
+ "[#{changelog.name}](#{changelog.url})"
84
+ end.join(" ")
83
85
  else
84
86
  ""
85
87
  end
86
88
  end
87
89
  end
88
-
89
90
  end
90
91
  end
91
92
  end
@@ -1,34 +1,26 @@
1
1
  module LockDiff
2
2
  module Github
3
3
  class ChangelogUrlFinder
4
- CHANGE_LOG_CANDIDATES = %w(
5
- changelog
6
- changes
7
- history
8
- releases
9
- releasenote
10
- news
11
- )
12
-
13
- def initialize(repository:, repository_url:, ref:)
4
+ def initialize(repository:, repository_url:, ref:, package_name:)
14
5
  @repository = repository
15
6
  @repository_url = repository_url
16
7
  @ref = ref
8
+ @package_name = package_name
17
9
  end
18
10
 
19
11
  def call
20
- find_change_log_url || find_release_url
12
+ directories.flat_map(&:change_log_urls).push(find_release_url).compact
21
13
  end
22
14
 
23
15
  private
24
16
 
25
- def find_change_log_url
26
- Github.client.contents(@repository, ref: @ref).
27
- select(&:file?).
28
- find { |content|
29
- name = content.name.downcase.delete('_')
30
- CHANGE_LOG_CANDIDATES.any? { |candidate| name.start_with? candidate }
31
- }&.html_url
17
+ def directories
18
+ [
19
+ Directory.new(@repository, @ref),
20
+ Directory.new(@repository, @ref, path: @package_name),
21
+ Directory.new(@repository, @ref, path: "gems/#{@package_name}"),
22
+ Directory.new(@repository, @ref, path: 'docs')
23
+ ]
32
24
  end
33
25
 
34
26
  def find_release_url
@@ -37,7 +29,6 @@ module LockDiff
37
29
  @repository_url + "/releases"
38
30
  end
39
31
  end
40
-
41
32
  end
42
33
  end
43
34
  end
@@ -6,14 +6,34 @@ module LockDiff
6
6
 
7
7
  def_delegators :@content, :name, :html_url
8
8
 
9
+ CHANGE_LOG_CANDIDATES = %w[
10
+ changelog
11
+ changes
12
+ history
13
+ releases
14
+ releasenote
15
+ news
16
+ ].freeze
17
+
9
18
  def initialize(content)
10
19
  @content = content
11
20
  end
12
21
 
22
+ def change_log?
23
+ file? && CHANGE_LOG_CANDIDATES.any? do |candidate|
24
+ normalized_name.start_with?(candidate)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def normalized_name
31
+ @normalized_name ||= name.downcase.delete('_')
32
+ end
33
+
13
34
  def file?
14
35
  @content.type == 'file'
15
36
  end
16
-
17
37
  end
18
38
  end
19
39
  end
@@ -0,0 +1,23 @@
1
+ module LockDiff
2
+ module Github
3
+ class Directory
4
+ def initialize(repository, ref, path: nil)
5
+ @repository = repository
6
+ @ref = ref
7
+ @path = path
8
+ end
9
+
10
+ def change_log_urls
11
+ contents.select(&:change_log?).map(&:html_url)
12
+ rescue Octokit::NotFound
13
+ []
14
+ end
15
+
16
+ private
17
+
18
+ def contents
19
+ @contents ||= Github.client.contents(@repository, ref: @ref, path: @path)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -2,6 +2,7 @@ require_relative "github/access_token"
2
2
  require_relative "github/changelog_url_finder"
3
3
  require_relative "github/client"
4
4
  require_relative "github/content"
5
+ require_relative "github/directory"
5
6
  require_relative "github/url_detector"
6
7
  require_relative "github/pull_request"
7
8
  require_relative "github/repository_name_detector"
@@ -1,3 +1,3 @@
1
1
  module LockDiff
2
- VERSION = "0.4.2"
2
+ VERSION = "0.8.0"
3
3
  end
data/lib/lock_diff.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "logger"
2
2
  require "forwardable"
3
3
 
4
+ require "lock_diff/changelog"
4
5
  require "lock_diff/diff_info"
5
6
  require "lock_diff/formatter/github_markdown"
6
7
  require "lock_diff/gem"
data/lock_diff.gemspec CHANGED
@@ -26,10 +26,11 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency "octokit", "~> 4.0"
27
27
  spec.add_dependency "httpclient"
28
28
 
29
- spec.add_development_dependency "bundler", "~> 1.15"
30
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "bundler", "> 1.15"
30
+ spec.add_development_dependency "rake", ">= 13"
31
31
  spec.add_development_dependency "rspec", "~> 3.0"
32
32
  spec.add_development_dependency "pry"
33
33
  spec.add_development_dependency "pry-byebug"
34
- spec.add_development_dependency "codacy-coverage"
34
+ spec.add_development_dependency "vcr"
35
+ spec.add_development_dependency "webmock"
35
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lock_diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vividmuimui
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-27 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.15'
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
54
  version: '1.15'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13'
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: '10.0'
68
+ version: '13'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,21 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: codacy-coverage
112
+ name: vcr
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: webmock
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -132,9 +146,10 @@ executables:
132
146
  extensions: []
133
147
  extra_rdoc_files: []
134
148
  files:
149
+ - ".github/dependabot.yml"
150
+ - ".github/workflows/ruby.yml"
135
151
  - ".gitignore"
136
152
  - ".rspec"
137
- - ".travis.yml"
138
153
  - CODE_OF_CONDUCT.md
139
154
  - Gemfile
140
155
  - LICENSE.txt
@@ -145,6 +160,7 @@ files:
145
160
  - exe/lock_diff
146
161
  - exe/lock_diff_for_tachikoma
147
162
  - lib/lock_diff.rb
163
+ - lib/lock_diff/changelog.rb
148
164
  - lib/lock_diff/cli/option_parser.rb
149
165
  - lib/lock_diff/diff_info.rb
150
166
  - lib/lock_diff/formatter/github_markdown.rb
@@ -158,6 +174,7 @@ files:
158
174
  - lib/lock_diff/github/changelog_url_finder.rb
159
175
  - lib/lock_diff/github/client.rb
160
176
  - lib/lock_diff/github/content.rb
177
+ - lib/lock_diff/github/directory.rb
161
178
  - lib/lock_diff/github/pull_request.rb
162
179
  - lib/lock_diff/github/repository_name_detector.rb
163
180
  - lib/lock_diff/github/tag_finder.rb
@@ -185,8 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
202
  - !ruby/object:Gem::Version
186
203
  version: '0'
187
204
  requirements: []
188
- rubyforge_project:
189
- rubygems_version: 2.6.14.1
205
+ rubygems_version: 3.0.3
190
206
  signing_key:
191
207
  specification_version: 4
192
208
  summary: This gem detects changes to your package manager (e.g. Gemfile) and generates
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4.0
4
- - 2.4.2
5
- script:
6
- - bundle exec rspec
7
- notifications:
8
- slack:
9
- secure: DKSdr5uEtNXGpAARGV+Q694eNv9IGi30RjSIjk8lRZrmLxE0WJbk/17FkmjgVF2w1onO/knFWgCiPBoIncihy4hh6nfAJZDaRI8AwXqYGGi10KeUBu4309r/7SL60KnFUFsQ9o47tar09TY6HS55IesNjN2/mKIEJlpw2c7McPz58rIzlFizTW5OPShsfWQnuLAz9iUYjknZfrntirav+mwkqVKqDZoMM7MRzedk1KjlkRbun/EVrgMEYPqsbpmhfYV0DZkcymorhH6d/FBsrWeqB7QMT6KwROMBHDZGeGzYgaN3KgjZV35gw6pK2VlsETm7E/Fk9Imrjalq87Q28aqX5nq/MR6Llo9yfE4J7PkGOTxcvZlXqp/W+2xT/8Ne6Dy29gb/7TeJY9K4nmkbkrmkanKBBmvIjbhwT46BOPjn1Sz4kbceoZNgihI2hMMPypH61+U6v0eUcGLuxRyDaUsyrgRnBEDHFZHMpfZ1eE7uXnCO9IvqGm5Tn4goP0s67H98CFhP+j3cIM2HKdns6ZyGsAHVakw7bnB90mKc9bIaaPSKEyZZD4MpkJxnMxR453OlSwJZIXesIkbBJMZA4wdOAsPQSBaSCY2w566LsUs4izRVLpdeILa/NOaxb+l1OvmejGyiihUjSUfH7fiIhoD5E0+SgOsDIdd0TV17rb4=