Browse files

added play:setup:setup_ivy to apply custom ivy configuration

  • Loading branch information...
1 parent cddfaf0 commit 0b93c29158c1f76946b3c8cf264a1be2dc805097 Yamashita Yuu committed Feb 3, 2012
Showing with 19 additions and 0 deletions.
  1. +17 −0 conf/play-recipes.rb
  2. +2 −0 conf/templates/ivysettings.erb
View
17 conf/play-recipes.rb
@@ -67,6 +67,7 @@
desc "install play if needed"
task :default, :except => { :no_release => true } do
transaction {
+ setup_ivy
install_play
install_modules
}
@@ -75,6 +76,22 @@
}
end
+ _cset :play_setup_ivy, false # true if you want to setup custom ivy configuration for play
+ _cset :play_ivy_settings do
+ File.join(capture('echo $HOME').chomp, '.ivy2', 'ivysettings.xml')
+ end
+ _cset :play_ivy_settings_template, File.join(File.dirname(__FILE__), 'templates', 'ivysettings.erb')
+ task :setup_ivy, :roles => :app, :except => { :no_release => true } do
+ if play_setup_ivy
+ template = File.read(play_ivy_settings_template)
+ result = ERB.new(template).result(binding)
+ tempfile = File.join('/tmp', File.basename(play_ivy_settings))
+ run "test -d #{File.dirname(play_ivy_settings)} || mkdir -p #{File.dirname(play_ivy_settings)}"
+ put result, tempfile
+ run "diff #{tempfile} #{play_ivy_settings} || mv -f #{tempfile} #{play_ivy_settings}"
+ end
+ end
+
task :install_play, :roles => :app, :except => { :no_release => true } do
on_rollback {
files = [ play_path ]
View
2 conf/templates/ivysettings.erb
@@ -0,0 +1,2 @@
+<ivy-settings>
+</ivy-settings>

0 comments on commit 0b93c29

Please sign in to comment.