appraisal 2.0.2 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e62486edd88ce962fe2bfa9385aaee5f7a18a3d
4
- data.tar.gz: 87e7f4913a92cef3083029622223544ea4de2701
3
+ metadata.gz: 3b0fc3ea3d75b4caacecc601a02f5cc3dbe9aad9
4
+ data.tar.gz: 12d540aa5afe3fe1a12813e21dbccbf65e3c2b9f
5
5
  SHA512:
6
- metadata.gz: 39c0aefe135188fb147aef623f10ff609e478daca8836855767c1260dc18576fc364c83dea9ee76aee39c84fc9afce5802a3c26b5a666c97e32b67b63a25a733
7
- data.tar.gz: c80f38736122daa41bfc7f7c1773b2cc49e6b931707157d9c3dbca01ab4c35d30291ee858b29251a72f1506744d1fde3321f16447d4f370afbc097b3c0a93db7
6
+ metadata.gz: bb0850ae7207e6f668668dcfdd0debb6c06b38989ca7bf557530a0e40ecb71aca98404d9d469106b60f2f5469833a40a49743acb96690fb31a492df51f1115b5
7
+ data.tar.gz: 6ec513b116b30e95f775df2e5f88d06a5eafad736e922cbd5db3c0f6b2703b655750e9417f700d73cc34f95e30a3c9bd04e55cfd9b9dfe2579fcccd3c73f864a
@@ -18,8 +18,8 @@ module Appraisal
18
18
  gemfile.gem(*args)
19
19
  end
20
20
 
21
- def source(*args)
22
- gemfile.source(*args)
21
+ def source(*args, &block)
22
+ gemfile.source(*args, &block)
23
23
  end
24
24
 
25
25
  def ruby(*args)
@@ -6,7 +6,7 @@ module Appraisal
6
6
  attr_reader :dependencies
7
7
 
8
8
  PARTS = %w(source ruby_version git_sources path_sources dependencies groups
9
- platforms gemspec)
9
+ platforms source_blocks gemspec)
10
10
 
11
11
  def initialize
12
12
  @sources = []
@@ -17,6 +17,7 @@ module Appraisal
17
17
  @platforms = OrderedHash.new
18
18
  @git_sources = OrderedHash.new
19
19
  @path_sources = OrderedHash.new
20
+ @source_blocks = OrderedHash.new
20
21
  end
21
22
 
22
23
  def run(&block)
@@ -39,8 +40,13 @@ module Appraisal
39
40
 
40
41
  alias_method :platform, :platforms
41
42
 
42
- def source(source)
43
- @sources << source
43
+ def source(source, &block)
44
+ if block_given?
45
+ @source_blocks[source] ||= Source.new(source)
46
+ @source_blocks[source].run(&block)
47
+ else
48
+ @sources << source
49
+ end
44
50
  end
45
51
 
46
52
  def ruby(ruby_version)
@@ -103,7 +109,8 @@ module Appraisal
103
109
  METHODS
104
110
  end
105
111
 
106
- [:git_sources, :path_sources, :platforms, :groups].each do |method_name|
112
+ [:git_sources, :path_sources, :platforms, :groups, :source_blocks].
113
+ each do |method_name|
107
114
  class_eval <<-METHODS, __FILE__, __LINE__
108
115
  private
109
116
 
@@ -3,9 +3,10 @@ require "appraisal/bundler_dsl"
3
3
  module Appraisal
4
4
  autoload :Gemspec, "appraisal/gemspec"
5
5
  autoload :GitSource, "appraisal/git_source"
6
- autoload :PathSource, "appraisal/path_source"
7
6
  autoload :Group, "appraisal/group"
7
+ autoload :PathSource, "appraisal/path_source"
8
8
  autoload :Platform, "appraisal/platform"
9
+ autoload :Source, "appraisal/source"
9
10
 
10
11
  # Load bundler Gemfiles and merge dependencies
11
12
  class Gemfile < BundlerDSL
@@ -0,0 +1,30 @@
1
+ require "appraisal/bundler_dsl"
2
+ require "appraisal/utils"
3
+
4
+ module Appraisal
5
+ class Source < BundlerDSL
6
+ def initialize(source)
7
+ super()
8
+ @source = source
9
+ end
10
+
11
+ def to_s
12
+ formatted_output indent(super)
13
+ end
14
+
15
+ # :nodoc:
16
+ def for_dup
17
+ formatted_output indent(super)
18
+ end
19
+
20
+ private
21
+
22
+ def formatted_output(output_dependencies)
23
+ <<-OUTPUT.strip
24
+ source #{@source.inspect} do
25
+ #{output_dependencies}
26
+ end
27
+ OUTPUT
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Appraisal
2
- VERSION = "2.0.2".freeze
2
+ VERSION = "2.1.0".freeze
3
3
  end
@@ -2,7 +2,7 @@ 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 sausage pancake)
6
6
  build_git_gem 'egg'
7
7
 
8
8
  build_gemfile <<-Gemfile
@@ -31,6 +31,10 @@ describe 'Appraisals file Bundler DSL compatibility' do
31
31
  end
32
32
  end
33
33
 
34
+ source "https://other-rubygems.org" do
35
+ gem "sausage"
36
+ end
37
+
34
38
  gem 'appraisal', :path => #{PROJECT_ROOT.inspect}
35
39
  Gemfile
36
40
 
@@ -61,6 +65,10 @@ describe 'Appraisals file Bundler DSL compatibility' do
61
65
  gem 'yoghurt'
62
66
  end
63
67
 
68
+ source "https://other-rubygems.org" do
69
+ gem "pancake"
70
+ end
71
+
64
72
  gemspec
65
73
  end
66
74
  Appraisals
@@ -108,6 +116,11 @@ describe 'Appraisals file Bundler DSL compatibility' do
108
116
  end
109
117
  end
110
118
 
119
+ source "https://other-rubygems.org" do
120
+ gem "sausage"
121
+ gem "pancake"
122
+ end
123
+
111
124
  gemspec :path => "../"
112
125
  Gemfile
113
126
  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.0.2
4
+ version: 2.1.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: 2015-06-26 00:00:00.000000000 Z
12
+ date: 2015-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -117,6 +117,7 @@ files:
117
117
  - lib/appraisal/ordered_hash.rb
118
118
  - lib/appraisal/path_source.rb
119
119
  - lib/appraisal/platform.rb
120
+ - lib/appraisal/source.rb
120
121
  - lib/appraisal/task.rb
121
122
  - lib/appraisal/travis_ci_helper.rb
122
123
  - lib/appraisal/utils.rb