lock_diff 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +3 -3
- data/exe/lock_diff +1 -1
- data/lib/lock_diff/gem/gem.rb +6 -14
- data/lib/lock_diff/gem/pr_lockfile.rb +3 -6
- data/lib/lock_diff/gem/ruby_gem.rb +1 -2
- data/lib/lock_diff/github/client.rb +1 -2
- data/lib/lock_diff/version.rb +1 -1
- data/lib/lock_diff.rb +1 -3
- data/lock_diff.gemspec +2 -2
- metadata +4 -5
- data/lib/lock_diff/core_ext/memoize.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 350868a953714a43814533531c9ffe6bcac986b6
|
4
|
+
data.tar.gz: 0b4e8f25a0cc2501a91b8be9964e8d7e1766d449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b10659add1b0534294ac1f64fb495d0368048fee0ab86346d7257d8043ccadc549722ff167c66887720f2fa91b5150dfea9dd5c602d7ab1f2623c9b38f483a0
|
7
|
+
data.tar.gz: cb0ad1c60fca7a06ceb238194189480c141bc72ae87b0186f973e241b3dc07c6b673f5627b65d0848b1b26f2e25e2dfd3df9aa575df50bb67f4871c0a2e37fe0
|
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
[](https://circleci.com/gh/vividmuimui/lock_diff)
|
4
4
|
|
5
|
-
This Gem is
|
5
|
+
This Gem is generates `changelog url`, `github compare link` by lock file of Github pull request. And comment to pull request.
|
6
6
|
|
7
|
-
Like
|
7
|
+
Like this.
|
8
8
|
|
9
9
|
> https://github.com/vividmuimui/rails_tutorial/pull/26#issuecomment-312491272
|
10
10
|
> 
|
@@ -38,7 +38,7 @@ Require `GITHUB_ACCESS_TOKEN` environment.
|
|
38
38
|
```sh
|
39
39
|
$ lock_diff
|
40
40
|
Usage: lock_diff [options]
|
41
|
-
-r, --repository=REPOSITORY required. Like as
|
41
|
+
-r, --repository=REPOSITORY required. Like as "user/repository"
|
42
42
|
-n, --number=PULL_REQUEST_NUMBER required
|
43
43
|
--post-comment=true or false dafault=false
|
44
44
|
```
|
data/exe/lock_diff
CHANGED
@@ -8,7 +8,7 @@ options = {
|
|
8
8
|
}
|
9
9
|
opt = OptionParser.new
|
10
10
|
|
11
|
-
opt.on('-r', '--repository=REPOSITORY', 'required. Like as
|
11
|
+
opt.on('-r', '--repository=REPOSITORY', 'required. Like as "user/repository"') { |v| options[:repository] = v }
|
12
12
|
opt.on('-n', '--number=PULL_REQUEST_NUMBER', 'required') { |v| options[:number] = v }
|
13
13
|
opt.on('--post-comment=true or false', 'dafault=false') { |v| options[:post_comment] = v }
|
14
14
|
opt.parse!
|
data/lib/lock_diff/gem/gem.rb
CHANGED
@@ -4,36 +4,28 @@ module LockDiff
|
|
4
4
|
extend Forwardable
|
5
5
|
|
6
6
|
attr_reader :name
|
7
|
-
def_delegator
|
7
|
+
def_delegator :@ruby_gem, :github_url
|
8
8
|
|
9
9
|
def initialize(name)
|
10
10
|
@name = name
|
11
|
+
@ruby_gem = RubyGem.new(name)
|
11
12
|
end
|
12
13
|
|
13
14
|
def url
|
14
|
-
ruby_gem.github_url || ruby_gem.homepage_url
|
15
|
+
@ruby_gem.github_url || @ruby_gem.homepage_url
|
15
16
|
end
|
16
17
|
|
17
18
|
def change_log_url
|
18
|
-
Github::ChangeLogUrlFinder.new(repository: repository, github_url: ruby_gem.github_url).call
|
19
|
+
@change_log_url ||= Github::ChangeLogUrlFinder.new(repository: repository, github_url: @ruby_gem.github_url).call
|
19
20
|
end
|
20
|
-
memoize :change_log_url
|
21
21
|
|
22
22
|
def repository
|
23
|
-
Github::RepositoryNameDetector.new(ruby_gem.github_url).call
|
23
|
+
Github::RepositoryNameDetector.new(@ruby_gem.github_url).call
|
24
24
|
end
|
25
25
|
|
26
26
|
def tag_names
|
27
|
-
LockDiff.client.tag_names(repository)
|
27
|
+
@tag_names ||= LockDiff.client.tag_names(repository)
|
28
28
|
end
|
29
|
-
memoize :tag_names
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def ruby_gem
|
34
|
-
RubyGem.new(name)
|
35
|
-
end
|
36
|
-
memoize :ruby_gem
|
37
29
|
|
38
30
|
end
|
39
31
|
end
|
@@ -10,19 +10,16 @@ module LockDiff
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def path
|
13
|
-
@pr.find_content_path("Gemfile.lock")
|
13
|
+
@path ||= @pr.find_content_path("Gemfile.lock")
|
14
14
|
end
|
15
|
-
memoize :path
|
16
15
|
|
17
16
|
def base_file
|
18
|
-
LockDiff.client.file(@pr.repository, path: path, ref: @pr.base_sha)
|
17
|
+
@base_file ||= LockDiff.client.file(@pr.repository, path: path, ref: @pr.base_sha)
|
19
18
|
end
|
20
|
-
memoize :base_file
|
21
19
|
|
22
20
|
def head_file
|
23
|
-
LockDiff.client.file(@pr.repository, path: path, ref: @pr.head_sha)
|
21
|
+
@head_file ||= LockDiff.client.file(@pr.repository, path: path, ref: @pr.head_sha)
|
24
22
|
end
|
25
|
-
memoize :head_file
|
26
23
|
|
27
24
|
end
|
28
25
|
end
|
data/lib/lock_diff/version.rb
CHANGED
data/lib/lock_diff.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require "logger"
|
2
2
|
require "forwardable"
|
3
3
|
|
4
|
-
require "lock_diff/core_ext/memoize"
|
5
4
|
require "lock_diff/formatter/github_markdown"
|
6
5
|
require "lock_diff/gem"
|
7
6
|
require "lock_diff/github"
|
@@ -10,7 +9,7 @@ require "lock_diff/version"
|
|
10
9
|
|
11
10
|
module LockDiff
|
12
11
|
class << self
|
13
|
-
attr_accessor :client_class, :formatter, :strategy, :
|
12
|
+
attr_accessor :client_class, :formatter, :strategy, :logger
|
14
13
|
|
15
14
|
def client
|
16
15
|
client_class.client
|
@@ -32,6 +31,5 @@ module LockDiff
|
|
32
31
|
self.client_class = Github
|
33
32
|
self.formatter = Formatter::GithubMarkdown
|
34
33
|
self.strategy = Gem
|
35
|
-
self.memoize_response = true
|
36
34
|
self.logger = Logger.new(nil)
|
37
35
|
end
|
data/lock_diff.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["vividmuimui"]
|
10
10
|
spec.email = ["vivid.muimui@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{Generate links
|
13
|
-
spec.description = %q{Generate links
|
12
|
+
spec.summary = %q{Generate links by Gemfile.lock of Github PR, and post comment to it.}
|
13
|
+
spec.description = %q{Generate links by Gemfile.lock of Github PR, and post comment to it.}
|
14
14
|
# spec.homepage = "https://github.com/vividmuimui/lock_diff"
|
15
15
|
spec.homepage = ""
|
16
16
|
spec.license = "MIT"
|
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vividmuimui
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description: Generate links
|
111
|
+
description: Generate links by Gemfile.lock of Github PR, and post comment to it.
|
112
112
|
email:
|
113
113
|
- vivid.muimui@gmail.com
|
114
114
|
executables:
|
@@ -128,7 +128,6 @@ files:
|
|
128
128
|
- bin/setup
|
129
129
|
- exe/lock_diff
|
130
130
|
- lib/lock_diff.rb
|
131
|
-
- lib/lock_diff/core_ext/memoize.rb
|
132
131
|
- lib/lock_diff/formatter/github_markdown.rb
|
133
132
|
- lib/lock_diff/gem.rb
|
134
133
|
- lib/lock_diff/gem/diff_info.rb
|
@@ -172,5 +171,5 @@ rubyforge_project:
|
|
172
171
|
rubygems_version: 2.6.11
|
173
172
|
signing_key:
|
174
173
|
specification_version: 4
|
175
|
-
summary: Generate links
|
174
|
+
summary: Generate links by Gemfile.lock of Github PR, and post comment to it.
|
176
175
|
test_files: []
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module LockDiff
|
2
|
-
module CorExt
|
3
|
-
module Memoize
|
4
|
-
def self.included(base)
|
5
|
-
base.extend(ClassMethods)
|
6
|
-
end
|
7
|
-
|
8
|
-
def has_memoized?(key)
|
9
|
-
memoized_table.key?(key)
|
10
|
-
end
|
11
|
-
|
12
|
-
def memoize(key, value)
|
13
|
-
memoized_table[key] = value
|
14
|
-
end
|
15
|
-
|
16
|
-
def memoized(key)
|
17
|
-
memoized_table[key]
|
18
|
-
end
|
19
|
-
|
20
|
-
def memoized_table
|
21
|
-
@memoized_table ||= {}
|
22
|
-
end
|
23
|
-
|
24
|
-
module ClassMethods
|
25
|
-
def memoize(method_name)
|
26
|
-
original_visibility =
|
27
|
-
case
|
28
|
-
when protected_instance_methods.include?(method_name)
|
29
|
-
:protected
|
30
|
-
when private_instance_methods.include?(method_name)
|
31
|
-
:private
|
32
|
-
else
|
33
|
-
:public
|
34
|
-
end
|
35
|
-
|
36
|
-
define_method("#{method_name}_with_memoize") do |*args, &block|
|
37
|
-
if LockDiff.memoize_response
|
38
|
-
if has_memoized?(method_name)
|
39
|
-
memoized(method_name)
|
40
|
-
else
|
41
|
-
memoize(method_name, send("#{method_name}_without_memoize", *args, &block))
|
42
|
-
end
|
43
|
-
else
|
44
|
-
send("#{method_name}_without_memoize", *args, &block)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
send(original_visibility, "#{method_name}_with_memoize")
|
48
|
-
|
49
|
-
alias_method "#{method_name}_without_memoize", method_name
|
50
|
-
alias_method method_name, "#{method_name}_with_memoize"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
Object.send(:include, LockDiff::CorExt::Memoize)
|