Skip to content

Commit

Permalink
Add rails_upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
jm committed Apr 8, 2010
1 parent d262fe0 commit 356a6d9
Show file tree
Hide file tree
Showing 17 changed files with 1,561 additions and 0 deletions.
20 changes: 20 additions & 0 deletions vendor/plugins/rails_upgrade/MIT-LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2010 Jeremy McAnally

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 20 additions & 0 deletions vendor/plugins/rails_upgrade/README
@@ -0,0 +1,20 @@
= rails-upgrade

A simple battery of scripts for upgrading Rails app/checking them for required updates. This application should work on Rails 2.x and 3.0, with a focus on upgrading to 3.0.

== Usage

# Check your app for required upgrades
rake rails:upgrade:check

# Backup your likely modified files that might be overwritten by the generator
rake rails:upgrade:backup

# Generate a new route file
rake rails:upgrade:routes

# Generate a Gemfile from your config.gem directives
rake rails:upgrade:gems

# Generate code for a new config/application.rb from your environment.rb
rake rails:upgrade:configuration
22 changes: 22 additions & 0 deletions vendor/plugins/rails_upgrade/Rakefile
@@ -0,0 +1,22 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

desc 'Default: run unit tests.'
task :default => :test

Rake::TestTask.new do |t|
t.libs << 'lib'
t.libs << 'test'
t.test_files = FileList['test/*_test.rb']
t.verbose = true
end

desc 'Generate documentation for the rails_upgrade plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Rails-upgrade'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
2 changes: 2 additions & 0 deletions vendor/plugins/rails_upgrade/init.rb
@@ -0,0 +1,2 @@
# Get long stack traces for easier debugging; you'll thank me later.
Rails.backtrace_cleaner.remove_silencers!
38 changes: 38 additions & 0 deletions vendor/plugins/rails_upgrade/install.rb
@@ -0,0 +1,38 @@
puts "Thanks for installing the Rails upgrade plugin. This is a set of generators and analysis tools to help you upgrade your application to Rails 3. It consists of three tasks...
To get a feel for what you'll need to change to get your app running, run the application analysis:
rake rails:upgrade:check
This should give you an idea of the manual changes that need to be done, but you'll probably want to upgrade some of those automatically. The fastest way to do this is to run 'rails .', which will simply generate a new app on top of your existing code. But this generation also has the effect of replacing some existing files, some of which you might not want to replace. To back those up, first run:
rake rails:upgrade:backup
That will backup files you've probably edited that will be replaced in the upgrade; if you finish the upgrade and find that you don't need the old copies, just delete them. Otherwise, copy their contents back into the new files or run one of the following upgraders...
Routes upgrader
===============
To generate a new routes file from your existing routes file, simply run the following Rake task:
rake rails:upgrade:routes
This will output a new routes file that you can copy and paste or pipe into a new, Rails 3 compatible config/routes.rb.
Gemfile generator
=================
Creating a new Gemfile is as simple as running:
rake rails:upgrade:gems
This task will extract your config.gem calls and generate code you can put into a bundler compatible Gemfile.
Configuration generator
=======================
Much of the configuration information that lived in environment.rb now belongs in a new file named config/application.rb; use the following task to generate code you can put into config/application.rb from your existing config/environment.rb:
rake rails:upgrade:configuration
"

0 comments on commit 356a6d9

Please sign in to comment.