Add carrierwave migration.
This commit is contained in:
parent
5b0f05ba59
commit
c99f1b9176
|
@ -300,6 +300,21 @@ if bundle_update_flag
|
||||||
c = YAML.dump(r).sub("---\n",'')
|
c = YAML.dump(r).sub("---\n",'')
|
||||||
open("#{env_pwd}/config/mongoid.yml",'w+'){|f| f.write(c)}
|
open("#{env_pwd}/config/mongoid.yml",'w+'){|f| f.write(c)}
|
||||||
end
|
end
|
||||||
|
if !File.exist?("#{env_pwd}/.carrierwave_upgraded")
|
||||||
|
upgrading = File.exist?("#{env_pwd}/.carrierwave_upgrading")
|
||||||
|
File.open("#{env_pwd}/.carrierwave_upgrading", "w") {}
|
||||||
|
uploaders = Dir.chdir(env_pwd){ Dir.glob("app/uploaders/*") }
|
||||||
|
uploaders.each do |uploader|
|
||||||
|
if upgrading
|
||||||
|
bundler_with_clean_env{%x[cd #{env_pwd} && git checkout -- #{uploader}]}
|
||||||
|
end
|
||||||
|
uploader_contents = File.read("#{env_pwd}/#{uploader}")
|
||||||
|
uploader_contents.gsub!(/^[ \t]*require[ \t]+['"]carrierwave\/processing\/mime_types['"][ \t]*$/, '')
|
||||||
|
uploader_contents.gsub!(/^[ \t]*include[ \t]+CarrierWave::MimeTypes[ \t]*$/, '')
|
||||||
|
File.open("#{env_pwd}/#{uploader}", "w"){|f| f.write(uploader_contents)}
|
||||||
|
end
|
||||||
|
File.open("#{env_pwd}/.carrierwave_upgraded", "w") {}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
# Describe your gem and declare its dependencies:
|
# Describe your gem and declare its dependencies:
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
|
|
Loading…
Reference in New Issue