diff-package_manager 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/diff-package_manager.gemspec +2 -1
- data/lib/diff/package_manager.rb +1 -1
- data/lib/diff/package_manager/version.rb +1 -1
- data/lib/diff/strategy/base.rb +7 -4
- data/lib/diff/strategy/bundler.rb +19 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a32df9f4865c407e9611121848c39fe79fad2f036c80458a92416fdc3a2b5628
|
4
|
+
data.tar.gz: 1cf7f2209b95e8df7e16edbbcbd18adaab1870b0513d41cc8af78efa3072f85d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40ca3a1cf09f874e7310169ee5c6ffa70aa8c1c8ced81dff888a201a980fde4404c717f9e329c1ed641e1959c358e5537eaa445c17e839d3c244dbd0d498c06c
|
7
|
+
data.tar.gz: d001ff0b7ae7bccf1cb1bf38272938502d5c348e035defecaa66beb1cd34eeb14b06aafac5174b40970d84445d3478ebc2c7a70021cd7ad778f58c7a91035891
|
data/README.md
CHANGED
@@ -23,7 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.
|
26
|
+
spec.add_dependency 'activesupport'
|
27
|
+
spec.add_dependency 'gems'
|
27
28
|
|
28
29
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
29
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/lib/diff/package_manager.rb
CHANGED
data/lib/diff/strategy/base.rb
CHANGED
@@ -33,19 +33,22 @@ module Diff
|
|
33
33
|
|
34
34
|
def output(format)
|
35
35
|
case format
|
36
|
-
when :
|
36
|
+
when :markdown
|
37
37
|
to_hash.map do |name, versions|
|
38
|
-
|
38
|
+
to_markdown(name, versions[:old], versions[:updated])
|
39
39
|
end.join("\n")
|
40
|
-
when :
|
40
|
+
when :text
|
41
41
|
to_hash.map do |name, versions|
|
42
|
-
"
|
42
|
+
"#{name} #{versions[:old]} => #{versions[:updated]}"
|
43
43
|
end.join("\n")
|
44
44
|
else
|
45
45
|
to_hash
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def to_markdown(name, old, updated)
|
50
|
+
"- Updated: `#{name}` #{old} => #{updated}"
|
51
|
+
end
|
49
52
|
end
|
50
53
|
end
|
51
54
|
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'rubygems'
|
4
|
+
require 'gems'
|
5
|
+
|
3
6
|
module Diff
|
4
7
|
module Strategy
|
5
8
|
class Bundler < Base
|
@@ -14,6 +17,22 @@ module Diff
|
|
14
17
|
@olds ||= extract(OLDS_LINE)
|
15
18
|
end
|
16
19
|
|
20
|
+
def to_markdown(gem_name, old, updated)
|
21
|
+
gem = Gems.info(gem_name)
|
22
|
+
sleep 0.1 # rate limit
|
23
|
+
if gem.empty?
|
24
|
+
super
|
25
|
+
else
|
26
|
+
source_code_uri = gem["source_code_uri"] || gem["homepage_uri"]
|
27
|
+
compare_uri = "#{source_code_uri}/compare/v#{old}...v#{updated}"
|
28
|
+
[
|
29
|
+
"- Updated:",
|
30
|
+
"[`#{gem_name}`](#{source_code_uri})",
|
31
|
+
"[#{old} => #{updated}](#{compare_uri})"
|
32
|
+
].join(' ')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
17
36
|
private
|
18
37
|
|
19
38
|
def extract(regex)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diff-package_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kimromi
|
@@ -17,7 +17,21 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
type: :
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gems
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|