Skip to content

Commit

Permalink
Merge pull request #149 from jkutner/master
Browse files Browse the repository at this point in the history
fixing ci
  • Loading branch information
jkutner committed Apr 5, 2013
2 parents 0fe9b9b + 6c7d38c commit e4de829
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions spec/warbler/bundler_spec.rb
Expand Up @@ -20,6 +20,15 @@ def use_config(&block)
@extra_config = block @extra_config = block
end end


def hide_shallow_git_clone
git_shallow_marker = File.join(Warbler::WARBLER_HOME, ".git/shallow")
tmp_marker = File.join(Warbler::WARBLER_HOME, ".git/shallow.tmp")
File.rename(git_shallow_marker, tmp_marker) if File.exists?(git_shallow_marker)
yield
ensure
File.rename(tmp_marker, git_shallow_marker) if File.exist?(tmp_marker)
end

let(:config) { drbclient.config(@extra_config) } let(:config) { drbclient.config(@extra_config) }
let(:jar) { drbclient.jar } let(:jar) { drbclient.jar }


Expand Down Expand Up @@ -61,19 +70,23 @@ def use_config(&block)
end end


it "works with :git entries in Gemfiles" do it "works with :git entries in Gemfiles" do
File.open("Gemfile", "w") {|f| f << "gem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\n"} hide_shallow_git_clone do
`#{RUBY_EXE} -S bundle install --local` File.open("Gemfile", "w") {|f| f << "gem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\n"}
jar.apply(config) `#{RUBY_EXE} -S bundle install --local`
file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should_not be_empty jar.apply(config)
file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should_not be_empty
file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty
end
end end


it "bundles only the gemspec for :git entries that are excluded" do it "bundles only the gemspec for :git entries that are excluded" do
File.open("Gemfile", "w") {|f| f << "gem 'rake'\ngroup :test do\ngem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\nend\n"} hide_shallow_git_clone do
`#{RUBY_EXE} -S bundle install --local` File.open("Gemfile", "w") {|f| f << "gem 'rake'\ngroup :test do\ngem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\nend\n"}
jar.apply(config) `#{RUBY_EXE} -S bundle install --local`
file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should be_empty jar.apply(config)
file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should be_empty
file_list(%r{WEB-INF/gems/bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty
end
end end


it "does not work with :path entries in Gemfiles" do it "does not work with :path entries in Gemfiles" do
Expand Down Expand Up @@ -117,14 +130,16 @@ def use_config(&block)
cleanup_temp_files cleanup_temp_files


it "works with :git entries in Gemfiles" do it "works with :git entries in Gemfiles" do
File.open("Gemfile", "w") {|f| f << "gem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\n"} hide_shallow_git_clone do
`#{RUBY_EXE} -S bundle install --local` File.open("Gemfile", "w") {|f| f << "gem 'warbler', :git => '#{Warbler::WARBLER_HOME}'\n"}
jar.apply(config) `#{RUBY_EXE} -S bundle install --local`
file_list(%r{^bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should_not be_empty jar.apply(config)
file_list(%r{^bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty file_list(%r{^bundler/gems/warbler[^/]*/lib/warbler/version\.rb}).should_not be_empty
jar.add_init_file(config) file_list(%r{^bundler/gems/warbler[^/]*/warbler.gemspec}).should_not be_empty
contents = jar.contents('META-INF/init.rb') jar.add_init_file(config)
contents.should =~ /ENV\['BUNDLE_GEMFILE'\] = File.expand_path(.*, __FILE__)/ contents = jar.contents('META-INF/init.rb')
contents.should =~ /ENV\['BUNDLE_GEMFILE'\] = File.expand_path(.*, __FILE__)/
end
end end


it "adds BUNDLE_GEMFILE to init.rb" do it "adds BUNDLE_GEMFILE to init.rb" do
Expand Down

0 comments on commit e4de829

Please sign in to comment.