Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make git_source work in nested groups #160

Merged
merged 1 commit into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/appraisal/bundler_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ def gem(name, *requirements)
end

def group(*names, &block)
@groups[names] ||= Group.new(names)
@groups[names] ||=
Group.new(names).tap { |g| g.git_sources = @git_sources.dup }
@groups[names].run(&block)
end

def platforms(*names, &block)
@platforms[names] ||= Platform.new(names)
@platforms[names] ||=
Platform.new(names).tap { |g| g.git_sources = @git_sources.dup }
@platforms[names].run(&block)
end

alias_method :platform, :platforms

def source(source, &block)
if block_given?
@source_blocks[source] ||= Source.new(source)
@source_blocks[source] ||=
Source.new(source).tap { |g| g.git_sources = @git_sources.dup }
@source_blocks[source].run(&block)
else
@sources << source
Expand All @@ -54,12 +57,14 @@ def ruby(ruby_version)
end

def git(source, options = {}, &block)
@gits[source] ||= Git.new(source, options)
@gits[source] ||=
Git.new(source, options).tap { |g| g.git_sources = @git_sources.dup }
@gits[source].run(&block)
end

def path(source, options = {}, &block)
@paths[source] ||= Path.new(source, options)
@paths[source] ||=
Path.new(source, options).tap { |g| g.git_sources = @git_sources.dup }
@paths[source].run(&block)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'Appraisals file Bundler DSL compatibility' do
it 'supports all Bundler DSL in Appraisals file' do
build_gems %w(bagel orange_juice milk waffle coffee ham sausage pancake)
build_git_gems %w(egg croissant pain_au_chocolat)
build_git_gems %w(egg croissant pain_au_chocolat omelette)

build_gemfile <<-Gemfile
source 'https://rubygems.org'
Expand All @@ -23,6 +23,7 @@

group :breakfast do
gem 'orange_juice'
gem "omelette", :custom_git_source => "omelette"
end

platforms :ruby, :jruby do
Expand Down Expand Up @@ -106,6 +107,7 @@

group :breakfast do
gem "orange_juice"
gem "omelette", :git => "../../gems/omelette"
gem "bacon"

platforms :rbx do
Expand Down