lock_diff 0.3.3 → 0.3.4

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
  SHA1:
3
- metadata.gz: 40bb372ad385170936087d91ee3530cc75afb6c6
4
- data.tar.gz: ce08c865a51232770c210585ff789e98e95e843f
3
+ metadata.gz: be2e92ea138be9c068f1c4a90a4a62d0684643de
4
+ data.tar.gz: f1717a0ec899c42cbc9d33697e065c9ee63d23a7
5
5
  SHA512:
6
- metadata.gz: 89509ad3d40bc26f45206f999d323ccf20dc76ebbc4dbfdc46a865beb572c8c6c9426f6c954a06fb90e1a60f7ea8e174ca8d960d596f9e3768bb170347eb4098
7
- data.tar.gz: 416e18c67a7cf82ea5ea59fae3c3f393461b1fbe0ff3fd3920bb7e9bcffacfaa3aafff3a01819b64ad7d77d19d52e532a6e2e68891483261e31382c7829943bd
6
+ metadata.gz: b91f6b0a99c4382817b63de18d26a446ba644204b6994b5df522336f12581197bf3c5ed47f3941624845c62da56d67b4bc69e7627ba8dd89025a705cbe5de3e2
7
+ data.tar.gz: 58b34be40b17940180f05e3930255a00047c32830622581f51885f2a1788380ca7e8acc4c287bbbaf78f822b83719cd3de15c6cb412b73d208c448dafb31b4f6
data/.travis.yml CHANGED
@@ -1,6 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.4
4
- - 2.4.1
3
+ - 2.3.4
4
+ - 2.4.1
5
5
  script:
6
- - bundle exec rspec
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=
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/lock_diff.svg)](https://badge.fury.io/rb/lock_diff)
4
4
  [![GitHub tag](https://img.shields.io/github/tag/vividmuimui/lock_diff.svg)](https://github.com/vividmuimui/lock_diff/tags)
5
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)
6
7
  [![Dependency Status](https://gemnasium.com/badges/github.com/vividmuimui/lock_diff.svg)](https://gemnasium.com/github.com/vividmuimui/lock_diff)
7
8
  [![Code Climate](https://codeclimate.com/github/vividmuimui/lock_diff/badges/gpa.svg)](https://codeclimate.com/github/vividmuimui/lock_diff)
8
9
  [![Issue Count](https://codeclimate.com/github/vividmuimui/lock_diff/badges/issue_count.svg)](https://codeclimate.com/github/vividmuimui/lock_diff)
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
File without changes
@@ -37,7 +37,7 @@ module LockDiff
37
37
  end
38
38
  opt.parse!(args)
39
39
 
40
- if @require_flags.all? { |flag| options.has_key?(flag) }
40
+ if @require_flags.all? { |flag| options.key?(flag) }
41
41
  options
42
42
  else
43
43
  $stdout.puts opt.help
@@ -23,7 +23,7 @@ module LockDiff
23
23
  def status
24
24
  case
25
25
  when @old_package.version && @new_package.version
26
- if @old_package.version < @new_package.version
26
+ if @old_package.version <= @new_package.version
27
27
  UPGRADE
28
28
  else
29
29
  DOWNGRADE
@@ -83,7 +83,7 @@ module LockDiff
83
83
  return unless package.repository_url
84
84
  old_ref = @old_package.ref
85
85
  new_ref = @new_package.ref
86
- commits_url =
86
+ compare_path =
87
87
  case status
88
88
  when UPGRADE
89
89
  "compare/#{old_ref}...#{new_ref}" if old_ref && new_ref
@@ -95,7 +95,7 @@ module LockDiff
95
95
  "commits/#{new_ref}" if new_ref
96
96
  end
97
97
 
98
- "#{package.repository_url}/#{commits_url}" if commits_url
98
+ "#{package.repository_url}/#{compare_path}" if compare_path
99
99
  end
100
100
 
101
101
  def commits_url_text
@@ -9,7 +9,6 @@ module LockDiff
9
9
  @diff_infos = diff_infos
10
10
  end
11
11
 
12
-
13
12
  def call
14
13
  (headers + body).join("\n")
15
14
  end
@@ -7,8 +7,8 @@ module LockDiff
7
7
  end
8
8
 
9
9
  def call
10
- old_specs_by_name = Spec.new(@old_lockfile).map { |spec| [spec.name, spec] }.to_h
11
- new_specs_by_name = Spec.new(@new_lockfile).map { |spec| [spec.name, spec] }.to_h
10
+ old_specs_by_name = Spec.parse(@old_lockfile).map { |spec| [spec.name, spec] }.to_h
11
+ new_specs_by_name = Spec.parse(@new_lockfile).map { |spec| [spec.name, spec] }.to_h
12
12
  names = (old_specs_by_name.keys + new_specs_by_name.keys).uniq
13
13
 
14
14
  names.map { |name|
@@ -19,7 +19,7 @@ module LockDiff
19
19
  end
20
20
 
21
21
  def different?(other)
22
- revision != other.revision || version != other.version
22
+ name != other.name || revision != other.revision || version != other.version
23
23
  end
24
24
 
25
25
  def repository
@@ -13,11 +13,7 @@ module LockDiff
13
13
  end
14
14
 
15
15
  def repository_url
16
- @repository_url ||= Github::UrlDetector.new([source_code_url, homepage_url]).call
17
- end
18
-
19
- def homepage_url
20
- @ruby_gem.homepage_uri
16
+ @repository_url ||= Github::UrlDetector.new([source_code_url, @ruby_gem.homepage_uri]).call
21
17
  end
22
18
 
23
19
  def url
@@ -4,8 +4,8 @@ module LockDiff
4
4
  module Spec
5
5
  class UnSupportSource < StandardError; end
6
6
 
7
- def self.new(lockfile)
8
- Bundler::LockfileParser.new(lockfile).specs.map do |lazy_specification|
7
+ class << self
8
+ def new(lazy_specification)
9
9
  case lazy_specification.source
10
10
  when Bundler::Source::Rubygems
11
11
  RubyGemSpec.new(lazy_specification)
@@ -17,6 +17,13 @@ module LockDiff
17
17
  raise UnSupportSource, "#{lazy_specification.source.class} source by #{lazy_specification.name} is not supported"
18
18
  end
19
19
  end
20
+
21
+ def parse(lockfile)
22
+ Bundler::LockfileParser.new(lockfile).specs.map do |lazy_specification|
23
+ new(lazy_specification)
24
+ end
25
+ end
26
+
20
27
  end
21
28
 
22
29
  class Base
@@ -37,12 +44,11 @@ module LockDiff
37
44
  end
38
45
 
39
46
  def repository_url; end
40
- def homepage_url; end
41
47
  def ruby_gem_url; end
42
48
  end
43
49
 
44
50
  class RubyGemSpec < Base
45
- def_delegators :ruby_gem, :repository_url, :homepage_url
51
+ def_delegators :ruby_gem, :repository_url
46
52
  def_delegator :ruby_gem, :url, :ruby_gem_url
47
53
 
48
54
  private
@@ -77,7 +83,6 @@ module LockDiff
77
83
  end
78
84
 
79
85
  def repository_url; end
80
- def homepage_url; end
81
86
  def ruby_gem_url; end
82
87
 
83
88
  def to_package
@@ -9,9 +9,9 @@ module LockDiff
9
9
 
10
10
  def call
11
11
  return unless @url
12
- @url.match(REGEXP).to_a.last.
13
- split("/").first(2).
14
- join("/")
12
+ path = @url.match(REGEXP).to_a.last
13
+ return unless path
14
+ path.split("/").first(2).join("/")
15
15
  end
16
16
 
17
17
  end
@@ -40,7 +40,7 @@ module LockDiff
40
40
  def find(repo_name, options = {})
41
41
  key = "#{repo_name}-#{options[:page]}"
42
42
  ruby_gem = repository[key]
43
- return ruby_gem if repository.has_key?(key)
43
+ return ruby_gem if repository.key?(key)
44
44
  repository[key] = fetch(repo_name, options)
45
45
  end
46
46
 
@@ -11,7 +11,7 @@ module LockDiff
11
11
  end
12
12
 
13
13
  def call
14
- url = @urls.find { |url| url.include?("github.com") }
14
+ url = @urls.find { |_url| _url.include?("github") }
15
15
  return unless url
16
16
 
17
17
  begin
@@ -3,7 +3,7 @@ module LockDiff
3
3
  class << self
4
4
  def compare_by(pull_request)
5
5
  file_path = pull_request.find_content_path(lockfile_name)
6
- raise NotChangedLockfile unless !!file_path
6
+ raise NotChangedLockfile if file_path.nil?
7
7
 
8
8
  LockDiff.config.strategy.lockfile_comparator.new(
9
9
  old_lockfile: pull_request.base_file(file_path),
@@ -1,3 +1,3 @@
1
1
  module LockDiff
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/lock_diff.gemspec CHANGED
@@ -31,4 +31,5 @@ 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
35
  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.3.3
4
+ version: 0.3.4
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-23 00:00:00.000000000 Z
11
+ date: 2017-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: codacy-coverage
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'
111
125
  description: This gem detects changes to your package manager (e.g. Gemfile) and generates
112
126
  a Markdown-formatted diff.
113
127
  email: