appraisal 2.3.0 → 2.4.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/README.md +40 -0
- data/lib/appraisal/appraisal.rb +4 -0
- data/lib/appraisal/bundler_dsl.rb +4 -0
- data/lib/appraisal/dependency_list.rb +10 -1
- data/lib/appraisal/version.rb +1 -1
- data/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +4 -1
- data/spec/appraisal/dependency_list_spec.rb +19 -0
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0fe7f7616c7aef0aaa5544853800eb05b08f3bb619b4fc292b8e89bbd2e9ea4d
         | 
| 4 | 
            +
              data.tar.gz: 43ef79f1e190735adc4fec2413b84b614938d2a94cae68760972ffe37ca3dff4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 45cb2de8908bd80ab3331a8c452d5f77e0d573670c48e92441cf359c6ae615e7297d5a22e3c157197d659358cd8d9d776aea5c4b55782c3c94fb14c56f356acc
         | 
| 7 | 
            +
              data.tar.gz: e6f88c11dbd4e09849c2318bc14174a482a9e738790fe7ccbcee376856c06d964888d54663c81a2901ef448a7e8de22d64de098ec3dfe2c527ae68ff7ce6415f
         | 
    
        data/README.md
    CHANGED
    
    | @@ -115,6 +115,46 @@ When you prefix a command with `appraisal`, the command is run with the | |
| 115 115 | 
             
            appropriate Gemfile for that appraisal, ensuring the correct dependencies
         | 
| 116 116 | 
             
            are used.
         | 
| 117 117 |  | 
| 118 | 
            +
            Removing Gems using Appraisal
         | 
| 119 | 
            +
            -------
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            It is common while managing multiple Gemfiles for dependencies to become deprecated and no
         | 
| 122 | 
            +
            longer necessary, meaning they need to be removed from the Gemfile for a specific `appraisal`.
         | 
| 123 | 
            +
            To do this, use the `remove_gem` declaration within the necessary `appraise` block in your
         | 
| 124 | 
            +
            `Appraisals` file.
         | 
| 125 | 
            +
             | 
| 126 | 
            +
            ### Example Usage
         | 
| 127 | 
            +
             | 
| 128 | 
            +
            **Gemfile**
         | 
| 129 | 
            +
            ```ruby
         | 
| 130 | 
            +
            gem 'rails', '~> 4.2'
         | 
| 131 | 
            +
             | 
| 132 | 
            +
            group :test do
         | 
| 133 | 
            +
              gem 'rspec', '~> 4.0'
         | 
| 134 | 
            +
              gem 'test_after_commit'
         | 
| 135 | 
            +
            end
         | 
| 136 | 
            +
            ```
         | 
| 137 | 
            +
             | 
| 138 | 
            +
            **Appraisals**
         | 
| 139 | 
            +
            ```ruby
         | 
| 140 | 
            +
            appraise 'rails-5' do
         | 
| 141 | 
            +
              gem 'rails', '~> 5.2'
         | 
| 142 | 
            +
             | 
| 143 | 
            +
              group :test do
         | 
| 144 | 
            +
                remove_gem :test_after_commit
         | 
| 145 | 
            +
              end
         | 
| 146 | 
            +
            end
         | 
| 147 | 
            +
            ```
         | 
| 148 | 
            +
             | 
| 149 | 
            +
            Using the `Appraisals` file defined above, this is what the resulting `Gemfile` will look like:
         | 
| 150 | 
            +
            ```ruby
         | 
| 151 | 
            +
            gem 'rails', '~> 5.2'
         | 
| 152 | 
            +
             | 
| 153 | 
            +
            group :test do
         | 
| 154 | 
            +
              gem 'rspec', '~> 4.0'
         | 
| 155 | 
            +
            end
         | 
| 156 | 
            +
            ```
         | 
| 157 | 
            +
             | 
| 118 158 | 
             
            Version Control
         | 
| 119 159 | 
             
            ---------------
         | 
| 120 160 |  | 
    
        data/lib/appraisal/appraisal.rb
    CHANGED
    
    
| @@ -28,6 +28,10 @@ module Appraisal | |
| 28 28 | 
             
                  @dependencies.add(name, substitute_git_source(requirements))
         | 
| 29 29 | 
             
                end
         | 
| 30 30 |  | 
| 31 | 
            +
                def remove_gem(name)
         | 
| 32 | 
            +
                  @dependencies.remove(name)
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 31 35 | 
             
                def group(*names, &block)
         | 
| 32 36 | 
             
                  @groups[names] ||=
         | 
| 33 37 | 
             
                    Group.new(names).tap { |g| g.git_sources = @git_sources.dup }
         | 
| @@ -4,10 +4,19 @@ module Appraisal | |
| 4 4 | 
             
              class DependencyList
         | 
| 5 5 | 
             
                def initialize
         | 
| 6 6 | 
             
                  @dependencies = Hash.new
         | 
| 7 | 
            +
                  @removed_dependencies = Set.new
         | 
| 7 8 | 
             
                end
         | 
| 8 9 |  | 
| 9 10 | 
             
                def add(name, requirements)
         | 
| 10 | 
            -
                  @ | 
| 11 | 
            +
                  unless @removed_dependencies.include?(name)
         | 
| 12 | 
            +
                    @dependencies[name] = Dependency.new(name, requirements)
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                def remove(name)
         | 
| 17 | 
            +
                  if @removed_dependencies.add?(name)
         | 
| 18 | 
            +
                    @dependencies.delete(name)
         | 
| 19 | 
            +
                  end
         | 
| 11 20 | 
             
                end
         | 
| 12 21 |  | 
| 13 22 | 
             
                def to_s
         | 
    
        data/lib/appraisal/version.rb
    CHANGED
    
    
| @@ -2,7 +2,8 @@ require 'spec_helper' | |
| 2 2 |  | 
| 3 3 | 
             
            describe 'Appraisals file Bundler DSL compatibility' do
         | 
| 4 4 | 
             
              it 'supports all Bundler DSL in Appraisals file' do
         | 
| 5 | 
            -
                build_gems %w(bagel orange_juice milk waffle coffee ham | 
| 5 | 
            +
                build_gems %w(bagel orange_juice milk waffle coffee ham
         | 
| 6 | 
            +
                              sausage pancake rotten_egg)
         | 
| 6 7 | 
             
                build_git_gems %w(egg croissant pain_au_chocolat omelette)
         | 
| 7 8 |  | 
| 8 9 | 
             
                build_gemfile <<-Gemfile
         | 
| @@ -24,6 +25,7 @@ describe 'Appraisals file Bundler DSL compatibility' do | |
| 24 25 | 
             
                  group :breakfast do
         | 
| 25 26 | 
             
                    gem 'orange_juice'
         | 
| 26 27 | 
             
                    gem "omelette", :custom_git_source => "omelette"
         | 
| 28 | 
            +
                    gem 'rotten_egg'
         | 
| 27 29 | 
             
                  end
         | 
| 28 30 |  | 
| 29 31 | 
             
                  platforms :ruby, :jruby do
         | 
| @@ -58,6 +60,7 @@ describe 'Appraisals file Bundler DSL compatibility' do | |
| 58 60 | 
             
                    end
         | 
| 59 61 |  | 
| 60 62 | 
             
                    group :breakfast do
         | 
| 63 | 
            +
                      remove_gem 'rotten_egg'
         | 
| 61 64 | 
             
                      gem 'bacon'
         | 
| 62 65 |  | 
| 63 66 | 
             
                      platforms :rbx do
         | 
| @@ -28,4 +28,23 @@ describe Appraisal::DependencyList do | |
| 28 28 | 
             
                  expect(dependency_list.to_s).to eq %(gem "rails", "4.1.4")
         | 
| 29 29 | 
             
                end
         | 
| 30 30 | 
             
              end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
              describe "#remove" do
         | 
| 33 | 
            +
                let(:dependency_list) { Appraisal::DependencyList.new }
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                before do
         | 
| 36 | 
            +
                  dependency_list.add("rails", ["4.1.4"])
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                it "removes the dependency from the list" do
         | 
| 40 | 
            +
                  dependency_list.remove("rails")
         | 
| 41 | 
            +
                  expect(dependency_list.to_s).to eq("")
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                it "respects the removal over an addition" do
         | 
| 45 | 
            +
                  dependency_list.remove("rails")
         | 
| 46 | 
            +
                  dependency_list.add("rails", ["4.1.0"])
         | 
| 47 | 
            +
                  expect(dependency_list.to_s).to eq("")
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
              end
         | 
| 31 50 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: appraisal
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.4.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Joe Ferris
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire:
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2021-02-24 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rake
         | 
| @@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 164 164 | 
             
                - !ruby/object:Gem::Version
         | 
| 165 165 | 
             
                  version: '0'
         | 
| 166 166 | 
             
            requirements: []
         | 
| 167 | 
            -
            rubygems_version: 3.1. | 
| 167 | 
            +
            rubygems_version: 3.1.4
         | 
| 168 168 | 
             
            signing_key:
         | 
| 169 169 | 
             
            specification_version: 4
         | 
| 170 170 | 
             
            summary: Find out what your Ruby gems are worth
         |