Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@saturnflyer
Created December 30, 2011 17:50
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saturnflyer/1540782 to your computer and use it in GitHub Desktop.
Save saturnflyer/1540782 to your computer and use it in GitHub Desktop.
Upgrading from Radiant 0.9.1 to a 1.0 version
  1. Edit config/boot.rb to add this after the RAILS_ROOT definition:

     require 'thread'
     require 'rubygems'
     require 'bundler'
    
     begin
       # Set up load paths for all bundled gems
       ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
       Bundler.setup
     rescue Bundler::GemNotFound
       raise RuntimeError, "Bundler couldn't find some gems." +
         "Did you run `bundle install`?"
     end
    
  2. Open config/environment.rb and add the following:

    config.after_initialize do # ... existing stuff...

     require 'will_paginate'
    

    end

  3. run "gem install bundler"

  4. run "bundle init"

  5. Copy dependencies from your environment.rb file to the Gemfile. For example:

     # A sample Gemfile
     source "http://rubygems.org"
    
     gem 'will_paginate', '2.3.14'
    
     # If you make any changes in this file, please run `bundle install`.
     # If new versions of your installed gems are available, run `bundle update`
    
     gem "radiant", "~> 0.9.1"
    
     # alternatively, in development
     # gem "radiant", :path => "/path/to/radiant/root"
    
     # SQLite is the default database connection but only suitable for local use
     # gem "sqlite3", "~> 1.3.4"
    
     # To use MySQL
     # gem "mysql", "~> 2.8.1"
    
     # Postgres
     # postgresql' %>gem "pg", "~> 0.11.0"
    
     # IBM DB2
     # gem "db2", "~> 2.6.2"
    
     # SQL Server
     # gem "tiny_tds"
     # gem "activerecord-sqlserver-adapter", "~> 3.1.0"
    
     # Language packs
     # gem "radiant-dutch_language_pack-extension",    "~> 1.0.0"
     # gem "radiant-french_language_pack-extension",   "~> 1.0.0"
     # gem "radiant-german_language_pack-extension",   "~> 1.0.0"
     # gem "radiant-italian_language_pack-extension",  "~> 1.0.0"
     # gem "radiant-japanese_language_pack-extension", "~> 1.0.0"
     # gem "radiant-russian_language_pack-extension",  "~> 1.0.0"
    
     # A standard gem extension
     # gem "radiant-example-extension", :version => "~> 1.0.0"
    
     # Your own forked extension
     # gem "radiant-modified-extension", :git => "git://github.com/your/fork.git"
    
     # A local extension in development
     # gem "radiant-new-extension", :path => "/path/to/extension/root"
    
     # Gems you would like to have in your development environment
     # group :development do
     #   gem "wirble"
     # end
    
     # If you're running tests or specs
     # group :test do
     #   gem "cucumber-rails",   "~> 0.3.2"
     #   gem "database_cleaner", "~> 0.6.5"
     #   gem "webrat",           "~> 0.7.3"
     #   gem "rspec-rails",      "~> 1.3.3"
     #   gem "sqlite3",          "~> 1.3.4"
     #   gem "ZenTest",          "4.6.0"
     # end
    
  6. Run "bundle install"

  7. Run "bundle exec script/server"

Now you should be running Radiant 0.9.1 with bundler.

  1. Edit your Gemfile to specify a newer Radiant version

     gem "radiant", "1.0.0.rc4"
    
  2. run "bundle install"

  3. run "bundle exec rake radiant:update"

  4. Make any alterations to your Gemfile and run "bundle install"

  5. Run "bundle exec rake db:migrate"

  6. Update your asset management

    • If you have page_attachments extension
      • Move vendor/extensions/page_attachments to vendor/disabled/page_attachments (or remove it entirely)
      • Run "bundle exec rake radiant:extensions:clipped:migrate_from_page_attachments"
    • If you have the assets extension
      • Move vendor/extensions/assets to vendor/disabled/assets (or remove it entirely)
      • Run "bundle exec rake radiant:extensions:clipped:migrate_from_assets"
    • If you want to keep your existing asset manager
      • Add to config/environment.rb config.ignore_extensions [:clipped]
  7. Update your JS and CSS management

    • If you have the sns extension
      • Move vendor/extension/sns to vendor/disabled/sns (or remove it entirely)
      • Run "bundle exec rake radiant:extensions:sheets:import:sns"
    • If you want to keep sns
      • Add to config/environment.rb config.ignore_extensions [:sheets]
  8. Run "bundle exec script/server"

You should now be running on the latest version of Radiant

@cayblood
Copy link

cayblood commented Feb 2, 2012

Does radiant work with ruby 1.9.x?

@saturnflyer
Copy link
Author

@cayblood. yes, it should. we have 1 bug to work out, but we're testing on travis for 1.9 http://travis-ci.org/#!/radiant/radiant/jobs/607842

@jayroh
Copy link

jayroh commented Jun 22, 2012

This works fine with 1.9.2 (haven't tried 1.9.3) but needed script/server updated where:

require File.dirname(__FILE__) + '/../config/boot'

should be changed to

require File.expand_path('../../config/boot', __FILE__)

Other than that I think this was pretty much spot on.

@saturnflyer
Copy link
Author

Thanks @jayroh!

@bosborne
Copy link

bosborne commented Mar 2, 2014

Struggling to upgrade an older Web site, this looks very useful. But I'm getting an error after "bundle exec rake radiant:update", I see: "cannot load such file -- rake/gempackagetask"

Do I need to downgrade rake? It's currently 10.0.2. Thanks again.

@bosborne
Copy link

bosborne commented Mar 2, 2014

Answering my own question here, yes, downgrading fixed that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment