appraisal 2.3.0 → 2.4.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: 0e5becde2c97891ac7e0d0cb0e8943653ec7b43ca3dcad2f60a8aa7becd9a977
4
- data.tar.gz: bac9e06f7948cc07025d06572f373f444e8159422ac9c62aa5e29ae6e32f6fdb
3
+ metadata.gz: 0fe7f7616c7aef0aaa5544853800eb05b08f3bb619b4fc292b8e89bbd2e9ea4d
4
+ data.tar.gz: 43ef79f1e190735adc4fec2413b84b614938d2a94cae68760972ffe37ca3dff4
5
5
  SHA512:
6
- metadata.gz: d9b23d137f23b270822cf4e49248cc2f2a3bd229668d96f44feaf3a7d804b7daddca6429ebe2dba8f5782ee5b4f9860da0e0976e9b25e5baf419180e463bb85e
7
- data.tar.gz: de06629b275c669997f73c5e840458f6de44ca435a4e8a543ff49b8e4d7a6c98d44006dc780df173d37958a4b6e8286184571a135b19d9529465206f7f548d8d
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
 
@@ -20,6 +20,10 @@ module Appraisal
20
20
  gemfile.gem(*args)
21
21
  end
22
22
 
23
+ def remove_gem(*args)
24
+ gemfile.remove_gem(*args)
25
+ end
26
+
23
27
  def source(*args, &block)
24
28
  gemfile.source(*args, &block)
25
29
  end
@@ -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
- @dependencies[name] = Dependency.new(name, requirements)
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
@@ -1,3 +1,3 @@
1
1
  module Appraisal
2
- VERSION = "2.3.0".freeze
2
+ VERSION = "2.4.0".freeze
3
3
  end
@@ -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 sausage pancake)
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.3.0
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: 2020-06-05 00:00:00.000000000 Z
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.2
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