gem_version_check 0.4.1 → 0.5.0
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/Rakefile +2 -2
 - data/lib/gem_version_check/cli.rb +25 -23
 - data/lib/gem_version_check/configuration.rb +6 -5
 - data/lib/gem_version_check/lockfile_fetcher.rb +3 -0
 - data/lib/gem_version_check/version.rb +1 -1
 - data/spec/configuration_spec.rb +4 -3
 - data/spec/spec_helper.rb +3 -5
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e340631acf7ee16e0e4c5a18cc43c1724b29d503
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 136168c6704c77ab20ee30ba0dd14d3d9a3b6cde
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7a9e0cd9afa58f70acacf347901c234151d352ee88e013718c0e7d567530001911ccef293413fdc2ec943f30fd99ef92b0bbf0dd9b20d1430ed90b50bc216c97
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: dd8e7bd1031d9ae1a20fff3891fd8980734e028785321a15396e2b6f5ee09c4686ea92afa40f049491e6bc0a02f12c4e34e6cb07b77ef703d4718734e8207323
         
     | 
    
        data/Rakefile
    CHANGED
    
    
| 
         @@ -1,4 +1,6 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'optparse'
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
5 
     | 
    
         
             
            module GemVersionCheck
         
     | 
| 
       4 
6 
     | 
    
         
             
              module Cli
         
     | 
| 
         @@ -6,10 +8,10 @@ module GemVersionCheck 
     | 
|
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
                def run(params)
         
     | 
| 
       8 
10 
     | 
    
         
             
                  project_names, options = parse(params)
         
     | 
| 
       9 
     | 
    
         
            -
                  if project_names. 
     | 
| 
      
 11 
     | 
    
         
            +
                  if !project_names.empty?
         
     | 
| 
       10 
12 
     | 
    
         
             
                    generate_report(project_names, options)
         
     | 
| 
       11 
13 
     | 
    
         
             
                  else
         
     | 
| 
       12 
     | 
    
         
            -
                    puts  
     | 
| 
      
 14 
     | 
    
         
            +
                    puts 'Missing params: gem_version_check my-gh-name/my-project gem1 gem2 gem3'
         
     | 
| 
       13 
15 
     | 
    
         
             
                    exit(1)
         
     | 
| 
       14 
16 
     | 
    
         
             
                  end
         
     | 
| 
       15 
17 
     | 
    
         
             
                end
         
     | 
| 
         @@ -20,49 +22,49 @@ module GemVersionCheck 
     | 
|
| 
       20 
22 
     | 
    
         
             
                  options = {}
         
     | 
| 
       21 
23 
     | 
    
         
             
                  option_parser = nil
         
     | 
| 
       22 
24 
     | 
    
         
             
                  project_names = OptionParser.new do |opts|
         
     | 
| 
       23 
     | 
    
         
            -
                    opts.banner =  
     | 
| 
      
 25 
     | 
    
         
            +
                    opts.banner = 'Usage: gem_version_check project [options]'
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                    opts.separator  
     | 
| 
       26 
     | 
    
         
            -
                    opts.separator  
     | 
| 
      
 27 
     | 
    
         
            +
                    opts.separator ''
         
     | 
| 
      
 28 
     | 
    
         
            +
                    opts.separator 'Specific options:'
         
     | 
| 
       27 
29 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                    opts.on( 
     | 
| 
      
 30 
     | 
    
         
            +
                    opts.on('--only gem1,gem2,gem3', Array, 'List of ruby gems') do |list|
         
     | 
| 
       29 
31 
     | 
    
         
             
                      options[:only] = list
         
     | 
| 
       30 
32 
     | 
    
         
             
                    end
         
     | 
| 
       31 
33 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                    opts.on( 
     | 
| 
      
 34 
     | 
    
         
            +
                    opts.on('--except gem1,gem2,gem3', Array, 'List of ruby gems') do |list|
         
     | 
| 
       33 
35 
     | 
    
         
             
                      options[:except] = list
         
     | 
| 
       34 
36 
     | 
    
         
             
                    end
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                    opts.on( 
     | 
| 
      
 38 
     | 
    
         
            +
                    opts.on('--host github.com', String, 'Github host name') do |host|
         
     | 
| 
       37 
39 
     | 
    
         
             
                      options[:host] = host
         
     | 
| 
       38 
40 
     | 
    
         
             
                    end
         
     | 
| 
       39 
41 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                    opts.on( 
     | 
| 
      
 42 
     | 
    
         
            +
                    opts.on('--sources my.gems.org,rubygems.org', String, 'Sources to check for new gems versions') do |sources|
         
     | 
| 
       41 
43 
     | 
    
         
             
                      options[:sources] = sources
         
     | 
| 
       42 
44 
     | 
    
         
             
                    end
         
     | 
| 
       43 
45 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                    opts.on( 
     | 
| 
      
 46 
     | 
    
         
            +
                    opts.on('--disable-progress-bar', 'Disable progress bar') do |disable_progress_bar|
         
     | 
| 
       45 
47 
     | 
    
         
             
                      options[:disable_progress_bar] = disable_progress_bar
         
     | 
| 
       46 
48 
     | 
    
         
             
                    end
         
     | 
| 
       47 
49 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                    opts.on( 
     | 
| 
      
 50 
     | 
    
         
            +
                    opts.on('--ignore-major-version-change', 'Ignore changes of the major version') do |ignore_major_version_change|
         
     | 
| 
       49 
51 
     | 
    
         
             
                      options[:ignore_major_version_change] = ignore_major_version_change
         
     | 
| 
       50 
52 
     | 
    
         
             
                    end
         
     | 
| 
       51 
53 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                    opts.on( 
     | 
| 
      
 54 
     | 
    
         
            +
                    opts.on('--allow-prerelease-dependencies', 'Allow dependencies to be prereleases') do |allow_prerelease_dependencies|
         
     | 
| 
       53 
55 
     | 
    
         
             
                      options[:allow_prerelease_dependencies] = allow_prerelease_dependencies
         
     | 
| 
       54 
56 
     | 
    
         
             
                    end
         
     | 
| 
       55 
57 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                    opts.on( 
     | 
| 
      
 58 
     | 
    
         
            +
                    opts.on('--output-format FORMAT', %w[json pretty], 'Output format') do |output_format|
         
     | 
| 
       57 
59 
     | 
    
         
             
                      options[:output_format] = output_format
         
     | 
| 
       58 
60 
     | 
    
         
             
                    end
         
     | 
| 
       59 
61 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
                    opts.on_tail( 
     | 
| 
      
 62 
     | 
    
         
            +
                    opts.on_tail('--version', 'Show version') do
         
     | 
| 
       61 
63 
     | 
    
         
             
                      puts GemVersionCheck::VERSION
         
     | 
| 
       62 
64 
     | 
    
         
             
                      exit
         
     | 
| 
       63 
65 
     | 
    
         
             
                    end
         
     | 
| 
       64 
66 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
                    opts.on_tail( 
     | 
| 
      
 67 
     | 
    
         
            +
                    opts.on_tail('-h', '--help', 'Show this message') do
         
     | 
| 
       66 
68 
     | 
    
         
             
                      puts opts
         
     | 
| 
       67 
69 
     | 
    
         
             
                      exit
         
     | 
| 
       68 
70 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -71,11 +73,12 @@ module GemVersionCheck 
     | 
|
| 
       71 
73 
     | 
    
         
             
                  end.parse!(params)
         
     | 
| 
       72 
74 
     | 
    
         | 
| 
       73 
75 
     | 
    
         
             
                  GemVersionCheck.configuration = {
         
     | 
| 
       74 
     | 
    
         
            -
                    : 
     | 
| 
       75 
     | 
    
         
            -
                    : 
     | 
| 
       76 
     | 
    
         
            -
                    : 
     | 
| 
       77 
     | 
    
         
            -
                    : 
     | 
| 
       78 
     | 
    
         
            -
                    : 
     | 
| 
      
 76 
     | 
    
         
            +
                    github_host:                   options[:host],
         
     | 
| 
      
 77 
     | 
    
         
            +
                    sources:                       options[:sources],
         
     | 
| 
      
 78 
     | 
    
         
            +
                    show_progress_bar:             !options[:disable_progress_bar],
         
     | 
| 
      
 79 
     | 
    
         
            +
                    ignore_major_version_change:   options[:ignore_major_version_change],
         
     | 
| 
      
 80 
     | 
    
         
            +
                    allow_prerelease_dependencies: options[:allow_prerelease_dependencies],
         
     | 
| 
      
 81 
     | 
    
         
            +
                    token:                         options[:token]
         
     | 
| 
       79 
82 
     | 
    
         
             
                  }
         
     | 
| 
       80 
83 
     | 
    
         | 
| 
       81 
84 
     | 
    
         
             
                  [Array(project_names), options]
         
     | 
| 
         @@ -89,7 +92,7 @@ module GemVersionCheck 
     | 
|
| 
       89 
92 
     | 
    
         
             
                  report = Report.new(project_names, options)
         
     | 
| 
       90 
93 
     | 
    
         | 
| 
       91 
94 
     | 
    
         
             
                  case options[:output_format]
         
     | 
| 
       92 
     | 
    
         
            -
                  when  
     | 
| 
      
 95 
     | 
    
         
            +
                  when 'json'
         
     | 
| 
       93 
96 
     | 
    
         
             
                    puts Formatter::JSON.new(report.generate).format
         
     | 
| 
       94 
97 
     | 
    
         
             
                  else
         
     | 
| 
       95 
98 
     | 
    
         
             
                    puts Formatter::PrettyPrint.new(report.generate).format
         
     | 
| 
         @@ -100,6 +103,5 @@ module GemVersionCheck 
     | 
|
| 
       100 
103 
     | 
    
         
             
                  puts "Can't find Gemfile.lock for #{e}"
         
     | 
| 
       101 
104 
     | 
    
         
             
                  exit(1)
         
     | 
| 
       102 
105 
     | 
    
         
             
                end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
106 
     | 
    
         
             
              end
         
     | 
| 
       105 
107 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,13 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module GemVersionCheck
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Configuration
         
     | 
| 
       3 
     | 
    
         
            -
                attr_reader :github_host, :sources, :show_progress_bar, :ignore_major_version_change, :allow_prerelease_dependencies
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_reader :github_host, :sources, :show_progress_bar, :ignore_major_version_change, :allow_prerelease_dependencies, :token
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
                def initialize(settings = {})
         
     | 
| 
       6 
     | 
    
         
            -
                  @github_host 
     | 
| 
       7 
     | 
    
         
            -
                  @sources 
     | 
| 
       8 
     | 
    
         
            -
                  @show_progress_bar 
     | 
| 
       9 
     | 
    
         
            -
                  @ignore_major_version_change 
     | 
| 
      
 6 
     | 
    
         
            +
                  @github_host                   = settings[:github_host]     || "github.com"
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @sources                       = settings[:sources]
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @show_progress_bar             = settings[:show_progress_bar] || false
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @ignore_major_version_change   = settings[:ignore_major_version_change] || false
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @allow_prerelease_dependencies = settings[:allow_prerelease_dependencies] || false
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @token                         = settings[:token]
         
     | 
| 
       11 
12 
     | 
    
         
             
                end
         
     | 
| 
       12 
13 
     | 
    
         
             
              end
         
     | 
| 
       13 
14 
     | 
    
         
             
            end
         
     | 
| 
         @@ -28,8 +28,11 @@ module GemVersionCheck 
     | 
|
| 
       28 
28 
     | 
    
         
             
                # github enterprise does not redirect
         
     | 
| 
       29 
29 
     | 
    
         
             
                # TODO: change if github enterprise redirects too
         
     | 
| 
       30 
30 
     | 
    
         
             
                def gemfile_lock_url
         
     | 
| 
      
 31 
     | 
    
         
            +
                  token = GemVersionCheck.configuration.token
         
     | 
| 
       31 
32 
     | 
    
         
             
                  if GemVersionCheck.configuration.github_host == "github.com"
         
     | 
| 
       32 
33 
     | 
    
         
             
                    "https://raw.#{GemVersionCheck.configuration.github_host}/#{@project}/master/Gemfile.lock"
         
     | 
| 
      
 34 
     | 
    
         
            +
                  elsif token
         
     | 
| 
      
 35 
     | 
    
         
            +
                    "https://#{GemVersionCheck.configuration.github_host}/raw/#{@project}/master/Gemfile.lock?token=#{token}"
         
     | 
| 
       33 
36 
     | 
    
         
             
                  else
         
     | 
| 
       34 
37 
     | 
    
         
             
                    "https://#{GemVersionCheck.configuration.github_host}/raw/#{@project}/master/Gemfile.lock"
         
     | 
| 
       35 
38 
     | 
    
         
             
                  end
         
     | 
    
        data/spec/configuration_spec.rb
    CHANGED
    
    | 
         @@ -5,14 +5,15 @@ module GemVersionCheck 
     | 
|
| 
       5 
5 
     | 
    
         
             
              describe Configuration do
         
     | 
| 
       6 
6 
     | 
    
         
             
                after do
         
     | 
| 
       7 
7 
     | 
    
         
             
                end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       9 
9 
     | 
    
         
             
                it "returns github.com as default github_host" do
         
     | 
| 
       10 
10 
     | 
    
         
             
                  GemVersionCheck.configuration.github_host.should == "github.com"
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                it "returns specified value if set" do
         
     | 
| 
       14 
     | 
    
         
            -
                  GemVersionCheck.configuration = { :github_host => "test" }
         
     | 
| 
      
 14 
     | 
    
         
            +
                  GemVersionCheck.configuration = { :github_host => "test", token: 'teeest' }
         
     | 
| 
       15 
15 
     | 
    
         
             
                  GemVersionCheck.configuration.github_host.should == "test"
         
     | 
| 
      
 16 
     | 
    
         
            +
                  GemVersionCheck.configuration.token.should == 'teeest'
         
     | 
| 
       16 
17 
     | 
    
         
             
                end
         
     | 
| 
       17 
18 
     | 
    
         
             
              end
         
     | 
| 
       18 
     | 
    
         
            -
            end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -1,7 +1,5 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require "gem_version_check"
         
     | 
| 
       4 
     | 
    
         
            -
            require "mocha/api"
         
     | 
| 
      
 1 
     | 
    
         
            +
            require 'gem_version_check'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'mocha/api'
         
     | 
| 
       5 
3 
     | 
    
         | 
| 
       6 
4 
     | 
    
         
             
            def lock_file_content(filename)
         
     | 
| 
       7 
5 
     | 
    
         
             
              IO.read(File.expand_path("../stubs/#{filename}", __FILE__))
         
     | 
| 
         @@ -10,6 +8,6 @@ end 
     | 
|
| 
       10 
8 
     | 
    
         
             
            RSpec.configure do |config|
         
     | 
| 
       11 
9 
     | 
    
         
             
              config.mock_framework = :mocha
         
     | 
| 
       12 
10 
     | 
    
         
             
              config.before do
         
     | 
| 
       13 
     | 
    
         
            -
                GemVersionCheck.configuration = { : 
     | 
| 
      
 11 
     | 
    
         
            +
                GemVersionCheck.configuration = { github_host: 'github.com', token: 'testtoken' }
         
     | 
| 
       14 
12 
     | 
    
         
             
              end
         
     | 
| 
       15 
13 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: gem_version_check
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Frederik Dietz
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-12-12 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rake
         
     | 
| 
         @@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       136 
136 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       137 
137 
     | 
    
         
             
            requirements: []
         
     | 
| 
       138 
138 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       139 
     | 
    
         
            -
            rubygems_version: 2.6. 
     | 
| 
      
 139 
     | 
    
         
            +
            rubygems_version: 2.6.14
         
     | 
| 
       140 
140 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       141 
141 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       142 
142 
     | 
    
         
             
            summary: Check your gem dependencies
         
     |