Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
dc26bbdd36
11
db/migrate/20091021024908_modify_text_types.rb
Normal file
11
db/migrate/20091021024908_modify_text_types.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class ModifyTextTypes < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
change_column :revisions, :content, :text, :limit => 16777215
|
||||||
|
change_column :pages, :name, :string, :limit => 255
|
||||||
|
change_column :webs, :additional_style, :text
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
|
end
|
Binary file not shown.
|
@ -1,17 +1,34 @@
|
||||||
task :upgrade_instiki => :environment do
|
require 'rake'
|
||||||
RAILS_ENV = 'production' unless ENV['RAILS_ENV']
|
|
||||||
puts "Upgrading Instiki in #{RAILS_ENV} environment."
|
|
||||||
|
|
||||||
Web.all.each do |web|
|
desc "This task will perform necessary upgrades to your Instiki installation"
|
||||||
public_path = Rails.root.join("public", web.address)
|
task :upgrade_instiki => :environment do
|
||||||
if public_path.exist?
|
ENV['RAILS_ENV'] ||= 'production'
|
||||||
webs_path = Rails.root.join("webs", web.address)
|
puts "Upgrading Instiki in #{ENV['RAILS_ENV']} environment."
|
||||||
if webs_path.exist?
|
|
||||||
puts "Warning! The directory #{webs_path} already exists. Skipping."
|
InstikiUpgrade.migrate_db
|
||||||
else
|
InstikiUpgrade.move_uploaded_files
|
||||||
public_path.rename(webs_path)
|
end
|
||||||
puts "Moved #{public_path} to #{webs_path}"
|
|
||||||
|
class InstikiUpgrade
|
||||||
|
|
||||||
|
def self.migrate_db
|
||||||
|
ActiveRecord::Base.establish_connection ENV['RAILS_ENV']
|
||||||
|
Rake::Task["db:migrate"].invoke
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.move_uploaded_files
|
||||||
|
Web.all.each do |web|
|
||||||
|
public_path = Rails.root.join("public", web.address)
|
||||||
|
if public_path.exist?
|
||||||
|
webs_path = Rails.root.join("webs", web.address)
|
||||||
|
if webs_path.exist?
|
||||||
|
puts "Warning! The directory #{webs_path} already exists. Skipping."
|
||||||
|
else
|
||||||
|
public_path.rename(webs_path)
|
||||||
|
puts "Moved #{public_path} to #{webs_path}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in a new issue