Skip to content
Browse files

update 002 migration to work properly with Rails 2.3 when running in …

…daemon mode. vendor/rails/activesupport/lib/active_support/core_ext/process/daemon.rb forks and changes to root dir, so relative paths no longer work in migration.
  • Loading branch information...
1 parent 88c3847 commit 8fc77f8408006f8c1a77592a068f66e948a5a059 @thewoolleyman thewoolleyman committed Aug 18, 2009
Showing with 11 additions and 10 deletions.
  1. +11 −10 db/migrate/002_move_custom_files_to_directory_in_user_home.rb
View
21 db/migrate/002_move_custom_files_to_directory_in_user_home.rb
@@ -2,28 +2,29 @@
include FileUtils
DATA_ROOT = ARGV[0]
-RAILS_ROOT = File.expand_path(".")
+RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../..')
+puts "RAILS_ROOT = #{RAILS_ROOT}"
-if File.directory? 'projects'
- mv 'projects', DATA_ROOT + '/projects'
+if File.directory? RAILS_ROOT + '/projects'
+ mv RAILS_ROOT + '/projects', DATA_ROOT + '/projects'
else
mkdir_p DATA_ROOT + '/projects'
end
-if File.exists? 'config/site_config.rb'
- mv 'config/site_config.rb', DATA_ROOT + '/site_config.rb'
+if File.exists? RAILS_ROOT + '/config/site_config.rb'
+ mv RAILS_ROOT + '/config/site_config.rb', DATA_ROOT + '/site_config.rb'
elsif !File.exists? DATA_ROOT + '/site_config.rb'
- cp 'config/site_config.rb_example', DATA_ROOT + '/site_config.rb'
+ cp RAILS_ROOT + '/config/site_config.rb_example', DATA_ROOT + '/site_config.rb'
end
-if File.exists? 'public/stylesheets/site.css'
- mv 'public/stylesheets/site.css', DATA_ROOT + '/site.css'
+if File.exists? RAILS_ROOT + '/public/stylesheets/site.css'
+ mv RAILS_ROOT + '/public/stylesheets/site.css', DATA_ROOT + '/site.css'
elsif !File.exists? DATA_ROOT + '/site.css'
- cp 'public/stylesheets/site.css_example', DATA_ROOT + '/site.css'
+ cp RAILS_ROOT + '/public/stylesheets/site.css_example', DATA_ROOT + '/site.css'
end
mkdir_p DATA_ROOT + '/builder_plugins'
-plugins = Dir['builder_plugins/**.rb']
+plugins = Dir[RAILS_ROOT + '/builder_plugins/**.rb']
unless plugins.empty?
raise "We just created a data directory at #{DATA_ROOT}. Any builder plugins in addition to the ones in
#{RAILS_ROOT}/lib/builder_plugins need to be moved from

0 comments on commit 8fc77f8

Please sign in to comment.
Something went wrong with that request. Please try again.