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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0b8550fa90dd68322c89d876f691ee017a650cc7e12436153222576a6a135d3
4
- data.tar.gz: 1a4beda06f52a5a43caf52a6358c63768bf39cf6d2051f37f5d270a005b15512
3
+ metadata.gz: a32df9f4865c407e9611121848c39fe79fad2f036c80458a92416fdc3a2b5628
4
+ data.tar.gz: 1cf7f2209b95e8df7e16edbbcbd18adaab1870b0513d41cc8af78efa3072f85d
5
5
  SHA512:
6
- metadata.gz: 9a9a264de11f1030e5fadcdc9525e9091f6381abd16a68d45e48e21f9db4e19b44bc282f4a53c293ed1d8267b678987c2dec9b78f756975227d006fd5c249d41
7
- data.tar.gz: 4bd112e8eca41f5b9f4ba13f8d96b741bb7923ac7e8907d61887b3f067fa1a183c84247cc5fcef2ffda0fdcd592655b303dc68228e0fc161185725c57cf59969
6
+ metadata.gz: 40ca3a1cf09f874e7310169ee5c6ffa70aa8c1c8ced81dff888a201a980fde4404c717f9e329c1ed641e1959c358e5537eaa445c17e839d3c244dbd0d498c06c
7
+ data.tar.gz: d001ff0b7ae7bccf1cb1bf38272938502d5c348e035defecaa66beb1cd34eeb14b06aafac5174b40970d84445d3478ebc2c7a70021cd7ad778f58c7a91035891
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Diff::PackageManager
2
2
 
3
+ [![Build Status](https://travis-ci.org/kimromi/diff-package_manager.svg?branch=master)](https://travis-ci.org/kimromi/diff-package_manager)
4
+
3
5
  Package manager updating diff tool
4
6
 
5
7
  ## Installation
@@ -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.add_development_dependency 'activesupport'
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'
@@ -18,7 +18,7 @@ module Diff
18
18
  @s.exists?
19
19
  end
20
20
 
21
- def output(format = :hash)
21
+ def output(format = :markdown)
22
22
  @s.output(format)
23
23
  end
24
24
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Diff
4
4
  class PackageManager
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -33,19 +33,22 @@ module Diff
33
33
 
34
34
  def output(format)
35
35
  case format
36
- when :text
36
+ when :markdown
37
37
  to_hash.map do |name, versions|
38
- "#{name} #{versions[:old]} => #{versions[:updated]}"
38
+ to_markdown(name, versions[:old], versions[:updated])
39
39
  end.join("\n")
40
- when :markdown
40
+ when :text
41
41
  to_hash.map do |name, versions|
42
- "- `#{name}` #{versions[:old]} => #{versions[:updated]}"
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.1.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: :development
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: