lock_diff 0.5.0 → 0.9.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: b72b0103bb0456640f9f87ce36c6aab414b9448d7f362e931a43b32968975fe7
4
- data.tar.gz: bc757035ce6f1abb73351ffe667903f6d07c7cd61197e307db410412060f8b23
3
+ metadata.gz: 2352d3618b0632d5974dd4100d8738ddacedfd2db5f556a7127a63b8dd7b2f33
4
+ data.tar.gz: da7ce8579cd45e5c420916388726bacb1ec99c4141293e4b7261ea8dca74af6e
5
5
  SHA512:
6
- metadata.gz: 03d27cc09817e1695418a4acb7efab5cddd6208a7a73362237292dd827b2507397251ef2d78331bd40db6bbf16a052549476eb2577a7ba12c9ab1351941bbe10
7
- data.tar.gz: bce05c0eb4ce1df1595cd0e7c88111c9c25b0412a84ca769ac3f5997c451a6abbaa1a50ac29c25424f66c420249cbcb83fbea69adf06fed7c3c550d818067739
6
+ metadata.gz: cbf16abdf3b4053a28d1f59422b1e12d02cd6e184b2d2a6c28f6a5257f089cd9a22322bbb8021220f2758ed517a967e60abc85743d98851d03f293c497da8ee5
7
+ data.tar.gz: 90bf7c687b6768a27acc11b67791363b9495cdf4ba5b4e5dd9a07d30e9b508322998fcb656d355a57e93403b61707d35e2f1763c96ff8e68ec10ead34b3b19f0
@@ -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,8 +1,7 @@
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
- [![Build Status](https://travis-ci.org/vividmuimui/lock_diff.svg?branch=master)](https://travis-ci.org/vividmuimui/lock_diff)
5
- [![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)
4
+ ![Build Status](https://github.com/vividmuimui/lock_diff/actions/workflows/ruby.yml/badge.svg)
6
5
  [![Code Climate](https://codeclimate.com/github/vividmuimui/lock_diff/badges/gpa.svg)](https://codeclimate.com/github/vividmuimui/lock_diff)
7
6
 
8
7
  This gem detects changes to your package manager (e.g. Gemfile) and generates a Markdown-formatted diff including:
data/exe/lock_diff CHANGED
@@ -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 number))
7
- LockDiff.run(options)
7
+ LockDiff.run(**options)
@@ -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)
@@ -63,7 +63,8 @@ module LockDiff
63
63
  Github::ChangelogUrlFinder.new(
64
64
  repository: package.repository,
65
65
  repository_url: package.repository_url,
66
- ref: @new_package.ref
66
+ ref: @new_package.ref,
67
+ package_name: package.name
67
68
  ).call.map do |url|
68
69
  Changelog.new(url)
69
70
  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
- change_log_urls.push(find_release_url).compact
12
+ directories.flat_map(&:change_log_urls).push(find_release_url).compact
21
13
  end
22
14
 
23
15
  private
24
16
 
25
- def change_log_urls
26
- Github.client.contents(@repository, ref: @ref).
27
- select(&:file?).
28
- select do |content|
29
- name = content.name.downcase.delete('_')
30
- CHANGE_LOG_CANDIDATES.any? { |candidate| name.start_with? candidate }
31
- end&.map(&: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.5.0"
2
+ VERSION = "0.9.0"
3
3
  end
data/lock_diff.gemspec CHANGED
@@ -31,5 +31,6 @@ Gem::Specification.new do |spec|
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.5.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vividmuimui
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-04 00:00:00.000000000 Z
11
+ date: 2021-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -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
@@ -159,6 +174,7 @@ files:
159
174
  - lib/lock_diff/github/changelog_url_finder.rb
160
175
  - lib/lock_diff/github/client.rb
161
176
  - lib/lock_diff/github/content.rb
177
+ - lib/lock_diff/github/directory.rb
162
178
  - lib/lock_diff/github/pull_request.rb
163
179
  - lib/lock_diff/github/repository_name_detector.rb
164
180
  - lib/lock_diff/github/tag_finder.rb
@@ -186,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
202
  - !ruby/object:Gem::Version
187
203
  version: '0'
188
204
  requirements: []
189
- rubygems_version: 3.0.3
205
+ rubygems_version: 3.0.3.1
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,11 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4
4
- - 2.5
5
- - 2.6
6
- - 2.7
7
- script:
8
- - bundle exec rspec
9
- notifications:
10
- slack:
11
- secure: DKSdr5uEtNXGpAARGV+Q694eNv9IGi30RjSIjk8lRZrmLxE0WJbk/17FkmjgVF2w1onO/knFWgCiPBoIncihy4hh6nfAJZDaRI8AwXqYGGi10KeUBu4309r/7SL60KnFUFsQ9o47tar09TY6HS55IesNjN2/mKIEJlpw2c7McPz58rIzlFizTW5OPShsfWQnuLAz9iUYjknZfrntirav+mwkqVKqDZoMM7MRzedk1KjlkRbun/EVrgMEYPqsbpmhfYV0DZkcymorhH6d/FBsrWeqB7QMT6KwROMBHDZGeGzYgaN3KgjZV35gw6pK2VlsETm7E/Fk9Imrjalq87Q28aqX5nq/MR6Llo9yfE4J7PkGOTxcvZlXqp/W+2xT/8Ne6Dy29gb/7TeJY9K4nmkbkrmkanKBBmvIjbhwT46BOPjn1Sz4kbceoZNgihI2hMMPypH61+U6v0eUcGLuxRyDaUsyrgRnBEDHFZHMpfZ1eE7uXnCO9IvqGm5Tn4goP0s67H98CFhP+j3cIM2HKdns6ZyGsAHVakw7bnB90mKc9bIaaPSKEyZZD4MpkJxnMxR453OlSwJZIXesIkbBJMZA4wdOAsPQSBaSCY2w566LsUs4izRVLpdeILa/NOaxb+l1OvmejGyiihUjSUfH7fiIhoD5E0+SgOsDIdd0TV17rb4=