Skip to content

Commit

Permalink
Add optional configuration for rake version
Browse files Browse the repository at this point in the history
* applies to deploy:setup and normal deploy
  • Loading branch information
leejones committed May 26, 2011
1 parent 836fa09 commit 764a876
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/moonshine/capistrano_integration.rb
Expand Up @@ -438,7 +438,8 @@ def self.load_into(capistrano_config)
end

task :install_moonshine_deps do
sudo 'gem install rake --no-rdoc --no-ri'
rake_version = fetch(:rake_version, '>= 0')
sudo "gem install rake --no-rdoc --no-ri --version='#{rake_version}'"
sudo 'gem install i18n --no-rdoc --no-ri' # workaround for missing activesupport-3.0.2 dep on i18n
sudo 'gem install shadow_puppet --no-rdoc --no-ri'
if rails_root.join('Gemfile').exist?
Expand Down
3 changes: 2 additions & 1 deletion lib/moonshine/manifest/rails/rails.rb
Expand Up @@ -59,7 +59,8 @@ def rails_logrotate
# This task ensures Rake is installed and that <tt>rake environment</tt>
# executes without error in your <tt>rails_root</tt>.
def rails_rake_environment
package 'rake', :provider => :gem, :ensure => :installed
rake_version = configuration[:rake_version] || :installed
package 'rake', :provider => :gem, :ensure => rake_version
file '/var/log/moonshine_rake.log',
:ensure => :present,
:owner => configuration[:user],
Expand Down
14 changes: 14 additions & 0 deletions spec/moonshine/manifest/rails_spec.rb
Expand Up @@ -534,4 +534,18 @@ def search(gem_pattern, platform_only = false)
end
end

describe "rake" do
it "installs :installed by default" do
@manifest.configure(:rake_version => nil)
@manifest.rails_rake_environment
@manifest.should have_package('rake').version(:installed)
end

it "can be pinned to a specific version" do
@manifest.configure(:rake_version => '1.2.3')
@manifest.rails_rake_environment
@manifest.should have_package('rake').version('1.2.3')
end
end

end

0 comments on commit 764a876

Please sign in to comment.