Skip to content

Commit

Permalink
Added build flags option to gem installer
Browse files Browse the repository at this point in the history
  • Loading branch information
plusplus authored and crafterm committed Dec 21, 2008
1 parent a3c0a6a commit 52b9547
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/sprinkle/installers/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def install_commands #:nodoc:
cmd << " --source #{source}" if source
cmd << " --install-dir #{repository}" if option?(:repository)
cmd << " --no-rdoc --no-ri" unless option?(:build_docs)
cmd << " -- #{build_flags}" if option?(:build_flags)
cmd
end

Expand Down
18 changes: 17 additions & 1 deletion spec/sprinkle/installers/gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
before do
@gem = 'rails'
@version = '2.0.2'
@options = { :source => 'http://gems.github.com/', :repository => '/tmp/gems' }
@options = { :source => 'http://gems.github.com/', :repository => '/tmp/gems', :build_flags => '--build_flag=foo' }
end

def create_gem(gem, version = nil, options = {}, &block)
Expand Down Expand Up @@ -34,6 +34,10 @@ def create_gem(gem, version = nil, options = {}, &block)
it 'should optionally store the repository location where gems are to be installed' do
@installer.repository.should == @options[:repository]
end

it 'should optionally store the build flags' do
@installer.build_flags.should == @options[:build_flags]
end

end

Expand Down Expand Up @@ -70,6 +74,18 @@ def create_gem(gem, version = nil, options = {}, &block)

end

describe 'with build flags' do

before do
@installer = create_gem @gem, nil, :build_flags => '--option=foo'
end

it 'should install with defined build flags' do
@installer.send(:install_commands).should == "gem install #{@gem} --no-rdoc --no-ri -- --option=foo"
end

end

end

end

0 comments on commit 52b9547

Please sign in to comment.