gem-compare 0.0.3 → 0.0.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: c0bf945c951c897beae61add41492c92c95248fa
4
- data.tar.gz: 1113168bb3eeb4cc7af658f2b8a7bd2665c771a4
3
+ metadata.gz: 2f7e261523b147248e2f35ab4b15e6f03a12a73b
4
+ data.tar.gz: 3f698da159dd70d2946b94f53dae8f90dd697cd7
5
5
  SHA512:
6
- metadata.gz: c4da75c477e6784574cc96651df72e4aaa3621fac232170ace9634dce53192b88997cf42115285bad9a047fb69a0f217823f20e5a4da095ab85213f707ff0232
7
- data.tar.gz: 0c0b71c3002837de7e87b096cd6c98189708baa56e9a478135974a35d7853c88620bdb145bf12321b11950bf9e92c3d3a962c032e1068cb4f904e7ea52dec24d
6
+ metadata.gz: 760fa57013b4c92894ef4ec4a993249c19370affa9f4c4c1f18f0ed1f36172bcfcbdd1c23614c24096b1bdc97f919fce7efc097dbd74042e60ae7a677164ec2b
7
+ data.tar.gz: b3ef20d96057c89b906fcaaff3e2585ca442cf2bc6fdf62cded6b990eee5f7e874e3ed2b2ff5780e07c74bd32f1e7f6bb42cd3e0afeaaf1514e1606817ae284c
data/Rakefile CHANGED
@@ -1,10 +1,11 @@
1
1
  require 'rubygems/package_task'
2
2
  require 'rake/testtask'
3
3
  require 'rdoc/task'
4
+ require_relative 'lib/rubygems/comparator'
4
5
 
5
6
  gemspec = Gem::Specification.new do |s|
6
7
  s.name = 'gem-compare'
7
- s.version = '0.0.3'
8
+ s.version = Gem::Comparator::VERSION
8
9
  s.platform = Gem::Platform::RUBY
9
10
  s.summary = 'RubyGems plugin for comparing gem versions'
10
11
  s.description = <<-EOF
@@ -20,7 +21,7 @@ gemspec = Gem::Specification.new do |s|
20
21
  s.required_ruby_version = '>= 2.0.0'
21
22
  s.required_rubygems_version = '>= 2.0.0'
22
23
  s.add_runtime_dependency 'json'
23
- s.add_runtime_dependency 'curl'
24
+ s.add_runtime_dependency 'curb'
24
25
  s.add_runtime_dependency 'diffy'
25
26
  s.add_runtime_dependency 'rainbow'
26
27
  s.add_runtime_dependency 'gemnasium-parser'
@@ -22,7 +22,7 @@ class Gem::Comparator
22
22
  include Gem::Comparator::Utils
23
23
  attr_accessor :options, :report
24
24
 
25
- VERSION = '0.0.2'
25
+ VERSION = '0.0.4'
26
26
 
27
27
  ##
28
28
  # Set the working dir and process options
@@ -36,7 +36,7 @@ class Gem::Comparator
36
36
  ver = "#{specs[index-1].version}->#{specs[index].version}"
37
37
 
38
38
  report[param][ver].section do
39
- set_header "#{Rainbow(specs[index-1].version).blue}->#{Rainbow(s.version).blue}:"
39
+ set_header "#{Rainbow(specs[index-1].version).cyan}->#{Rainbow(s.version).cyan}:"
40
40
 
41
41
  nest('deleted').section do
42
42
  set_header '* Deleted:'
@@ -1,51 +1,53 @@
1
1
  require 'pathname'
2
2
 
3
- module DirUtils
4
- SHEBANG_REGEX = /\A#!.*/
3
+ class Gem::Comparator
4
+ module DirUtils
5
+ SHEBANG_REGEX = /\A#!.*/
5
6
 
6
- attr_accessor :files_first_line
7
+ attr_accessor :files_first_line
7
8
 
8
- def self.file_first_line(file)
9
- File.open(file){ |f| f.readline }.gsub(/(.*)\n/, '\1')
10
- rescue
11
- end
9
+ def self.file_first_line(file)
10
+ File.open(file){ |f| f.readline }.gsub(/(.*)\n/, '\1')
11
+ rescue
12
+ end
12
13
 
13
- def self.file_has_shebang?(file)
14
- file_first_line(file) =~ SHEBANG_REGEX
15
- end
14
+ def self.file_has_shebang?(file)
15
+ file_first_line(file) =~ SHEBANG_REGEX
16
+ end
16
17
 
17
- def self.files_same_first_line?(file1, file2)
18
- file_first_line(file1) == file_first_line(file2)
19
- end
18
+ def self.files_same_first_line?(file1, file2)
19
+ file_first_line(file1) == file_first_line(file2)
20
+ end
20
21
 
21
- def self.file_permissions(file)
22
- sprintf("%o", File.stat(file).mode)
23
- end
22
+ def self.file_permissions(file)
23
+ sprintf("%o", File.stat(file).mode)
24
+ end
24
25
 
25
- def self.gem_bin_file?(file)
26
- file =~ /(\A|.*\/)bin\/.*/
27
- end
26
+ def self.gem_bin_file?(file)
27
+ file =~ /(\A|.*\/)bin\/.*/
28
+ end
28
29
 
29
- ##
30
- # Returns a unique list of directories and top level files
31
- # out of an array of files
32
-
33
- def self.dirs_of_files(file_list)
34
- dirs_of_files = []
35
- file_list.each do |file|
36
- unless Pathname.new(file).dirname.to_s == '.'
37
- dirs_of_files << "#{Pathname.new(file).dirname.to_s}/"
38
- else
39
- dirs_of_files << file
30
+ ##
31
+ # Returns a unique list of directories and top level files
32
+ # out of an array of files
33
+
34
+ def self.dirs_of_files(file_list)
35
+ dirs_of_files = []
36
+ file_list.each do |file|
37
+ unless Pathname.new(file).dirname.to_s == '.'
38
+ dirs_of_files << "#{Pathname.new(file).dirname.to_s}/"
39
+ else
40
+ dirs_of_files << file
41
+ end
40
42
  end
43
+ dirs_of_files.uniq
41
44
  end
42
- dirs_of_files.uniq
43
- end
44
45
 
45
- def self.remove_subdirs(dirs)
46
- dirs.dup.sort_by(&:length).reverse.each do |dir|
47
- dirs.delete_if{ |d| d =~ /#{dir}\/.+/ }
46
+ def self.remove_subdirs(dirs)
47
+ dirs.dup.sort_by(&:length).reverse.each do |dir|
48
+ dirs.delete_if{ |d| d =~ /#{dir}\/.+/ }
49
+ end
50
+ dirs
48
51
  end
49
- dirs
50
52
  end
51
- end
53
+ end
@@ -64,8 +64,8 @@ class Gem::Comparator
64
64
  report[param].set_header "#{different} #{param}:"
65
65
 
66
66
  report[param][vers].section do
67
- set_header "#{Rainbow(packages[index-1].spec.version).blue}->" +
68
- "#{Rainbow(packages[index].spec.version).blue}:"
67
+ set_header "#{Rainbow(packages[index-1].spec.version).cyan}->" +
68
+ "#{Rainbow(packages[index].spec.version).cyan}:"
69
69
  nest('deleted').section do
70
70
  set_header '* Deleted:'
71
71
  puts deleted unless deleted.empty?
@@ -85,8 +85,8 @@ class Gem::Comparator
85
85
  all_same = false unless same_files
86
86
 
87
87
  if previous == current && same_files && !all_same
88
- report[param][vers] << "#{Rainbow(packages[index-1].spec.version).blue}->" + \
89
- "#{Rainbow(packages[index].spec.version).blue}: No change"
88
+ report[param][vers] << "#{Rainbow(packages[index-1].spec.version).cyan}->" + \
89
+ "#{Rainbow(packages[index].spec.version).cyan}: No change"
90
90
  end
91
91
 
92
92
  end
@@ -37,8 +37,8 @@ class Gem::Comparator
37
37
  curr_gemfile = File.join(unpacked_gem_dirs[@packages[index].spec.version], 'Gemfile')
38
38
 
39
39
  vers = "#{@packages[index-1].spec.version}->#{@packages[index].spec.version}"
40
- report['gemfiles'][vers].set_header "#{Rainbow(packages[index-1].spec.version).blue}->" +
41
- "#{Rainbow(packages[index].spec.version).blue}:"
40
+ report['gemfiles'][vers].set_header "#{Rainbow(packages[index-1].spec.version).cyan}->" +
41
+ "#{Rainbow(packages[index].spec.version).cyan}:"
42
42
 
43
43
  added, deleted, updated = compare_gemfiles(prev_gemfile, curr_gemfile)
44
44
 
@@ -43,11 +43,10 @@ class Gem::Comparator
43
43
 
44
44
  if file_permissions != '100644'
45
45
  unless (DirUtils.gem_bin_file?(file) && file_permissions == '100755')
46
- " (!) Unexpected permissions: #{file_permissions}"
46
+ return " (!) Unexpected permissions: #{file_permissions}"
47
47
  end
48
- else
49
- ''
50
48
  end
49
+ ''
51
50
  end
52
51
 
53
52
  def self.files_executability_changes(prev_file, curr_file)
@@ -29,7 +29,7 @@ class Gem::Comparator
29
29
  report[param].set_header "#{different} #{param}:"
30
30
  values.each_with_index do |value, index|
31
31
  report[param] << \
32
- "#{Rainbow(specs[index].version).blue}: #{value}"
32
+ "#{Rainbow(specs[index].version).cyan}: #{value}"
33
33
  end
34
34
  end
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-compare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Stribny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-05 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: curl
28
+ name: curb
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '>='