Permalink
Browse files

Preventing overwrite from occurring on config/plugins.rb

  • Loading branch information...
1 parent 41e1c5c commit 078177f3c70a50f8ac083cc9109726573ca178f0 Winton Welsh committed Sep 2, 2008
Showing with 4 additions and 2 deletions.
  1. +2 −1 tasks/app_helpers.rake
  2. +2 −1 tasks/git.rake
@@ -17,11 +17,12 @@ namespace :app_helpers do
desc 'Removes files created by rake app_helpers'
task :remove => [ 'app_helpers:db:remove', 'app_helpers:git:remove', 'app_helpers:views:remove', 'app_helpers:widgets:remove' ]
- def app_helper_resource(type, to, reverse=false)
+ def app_helper_resource(type, to, reverse=false, overwrite=true)
from = "#{File.dirname(__FILE__)}/../resources/#{type}"
from, to = to, from if reverse
puts "=> Removing old #{type}..."
puts to
+ return if File.exists?(to) && !overwrite
if File.directory?(from)
FileUtils.remove_dir(to, true) if File.exists?(to)
FileUtils.mkdir_p to
View
@@ -12,7 +12,7 @@ namespace :app_helpers do
desc 'Copy config/plugins.rb to app'
task :plugins do
- app_helper_resource 'git/plugins.rb', 'config/plugins.rb'
+ app_helper_resource 'git/plugins.rb', 'config/plugins.rb', false, false
end
desc 'Removes files from rake app_helpers:git'
@@ -44,6 +44,7 @@ namespace :app_helpers do
task :update do
eval(File.read('config/plugins.rb')).each do |plugin|
puts plugin[:repo]
+ install_path = plugin[:to] || "vendor/plugins/#{File.basename(plugin[:repo], '.git')}"
Dir.chdir install_path do
`git pull origin #{git_head(plugin)}`
`git checkout #{git_head(plugin)}`

0 comments on commit 078177f

Please sign in to comment.