Weblog
Sunday, June 14, 2009 |
|
Radiant 0.8.0 “Asterism” features a brand new and more compliant caching
mechanism based on Rack::Cache, and numerous bugfixes and small enhancements.
Also included are:
- An extensive integration suite using Cucumber and Webrat
- Rails 2.3.2 (previously 2.1.2)
- Highline 1.5.1
- Haml 2.0.9
Many thanks to our contributors and committers for their contributions.
Installation
To install use the gem command (with ‘sudo’ as necessary):
$ gem install radiant
Upgrading an existing project/site
1. Change the RADIANT_GEM_VERSION constant in config/environment.rb to “0.8.0” or remove it altogether.
2. Update the Radiant assets in your project:
rake radiant:update
3. Copy your customizations back into config/environment.rb, if necessary.
4. Migrate the database:
rake production db:migrate
5. Restart the server
Creating a new project/site
1. Invoke the radiant command with your desired database driver:
$ radiant -d sqlite3 my_project
2. Bootstrap the database:
$ cd my_project
$ rake db:bootstrap
3. Startup the server and try it out!
$ script/server
Monday, June 08, 2009 |
|
If you’re looking to test out your site on edge to prepare for the next release but aren’t ready to take the plunge, you can alter your environments to selectively set up ResponseCache
if defined? ResponseCache == 'constant'
ResponseCache.defaults[:perform_caching] = true
end
You may also set the cache_timeout for SiteController which will stand in the place of ResponseCache.defaults[:expire_time]
config.after_initialize do
...
if defined? ResponseCache == 'constant'
ResponseCache.defaults[:expire_time] = 12.hours
else
SiteController.cache_timeout = 12.hours
end
...
end
That should get you going as you kick the tires on 0.8.
If you’re looking for more control, take a look at the source and know that Radiant::Cache is now implemented in Rack::Cache and of course, keep your eye on the wiki page for developer upgrades
Tuesday, May 12, 2009 |
|
ATTENTION EXTENSION DEVELOPERS! When working to upgrade your extensions to be compatible with the latest Radiant, please refer to and update this new wiki page: Developer Upgrade Notes. I’d like to make this a one-stop-shop for inter-version upgrade questions. Do not put information on individual extensions here, but on upgrade issues in the general sense. Things that will go well in the page:
- Class/method/namespace changes
- Common errors and how to resolve them
- Library/API additions and modifications
- New conventions, deprecated conventions
Start preparing your extensions for Radiant 0.8 as soon as you can!
Hot on the heels of the feature list from this morning is Release Candidate 1 of Radiant 0.8.0.
Download the gem from S3.
The gem will install as radiant-0.8.0.
Missing from the promised feature list in this release candidate are:
- Support for cucumber features in extensions — sorry, you’ll have to rig something up yourself for now.
- Packaged assets in DB templates – Roasters is due for this enhancement.
This release is intended for developers and the brave only! A production-ready release should be available later in the month. Please use this release to test the new features and discover bugs.
The dev team has been working hard at preparing the next version of Radiant, which we believe will be ready later this month. Here’s an overview of the upcoming changes:
- Rails 2.3.2 is bundled – this includes support for Rack, so you can add your own “metal” or “middleware”, making certain tasks much easier and performant.
- The integration specs are now Cucumber stories, and you will be able to write Cucumber stories in your extensions.
- RSpec and friends are only required to run tests and will no longer be install-time gem dependencies. Rake tasks that depend on them are stubbed.
config.extensions will be pre-populated so you can easily turn off installed extensions like so: config.extensions -= [:archive]
ResponseCache, Radiant’s built-in caching, has been replaced by Radiant::Cache, which wraps Rack::Cache with some enhancements for manual expiration and acceleration headers. This makes us more compliant with the HTTP/1.1 spec and removes some of the complexity of that code. Best of all, it’s completely pluggable, so you can use plain Rack::Cache or turn it off altogether in one line.
Admin::AbstractModelController is no more. Use Admin::ResourceController!
Some efforts that are started but will not finish until after 0.8 release:
- Internationalization of the interface has begun in the i18n branch, lead by Keith Bingman.
- The new “blade” interface is nearly complete, John says. Check it out in the prototype
If you are at RailsConf 2009, please consider attending the Radiant BoF Session, which will be moderated by the awesome Keith Bingman, developer of bitchkittyracing and leader of the i18n effort for Radiant. John and Sean might also make an appearance remotely via Skype or IRC, so bring your questions, problems and comments!
Friday, April 17, 2009 |
|
You’re invited to another Radiant Hack Day/Sprint!
- What: Radiant Hack Day
- When: Saturday, April 25th, 10:00AM-? EDT
- Where:
Carrboro Creative Coworking
205 Lloyd St, Suite 101
Carrboro, NC, 27510
carrborocoworking.com
Both John and Sean will be in attendance, leading the design/UI and development pieces respectively. This is an easy way to get started contributing to the project, learn more about Radiant, or to work on your own feature with guidance from the community. We’re going lower ceremony than our big one in October, but still encourage out-of-towners to come. Contact Sean privately via email if you need help making arrangements to attend, or if you’d like to be involved remotely.
Happy hacking!
If you can attend, please RSVP.
Thursday, April 09, 2009 |
|
Thanks to Steven Southard and John Muhl, we have moved the majority of the existing wiki over to Github. We encourage you to start contributing to the wiki there. You will need a Github account to participate.
NOTE: In an attempt to place this notice on the old wiki, Junebug failed for us again. AVLUX attempted to help me with this, but we were unable to resurrect it. If you need access to an old page on the wiki, please refer to the file made available on the mailing list.
Friday, March 27, 2009 |
|
Over at the Heroku blog, Morten has written up some details about using their “instant ruby platform” to get running on Radiant with a tip on how to get around their read-only file system.
Happy content-managing!
Wednesday, March 18, 2009 |
|
Have you ever needed to bootstrap an installation of Radiant on your production server with Capistrano, Vlad, or some other method?
You may have thought that you couldn’t because the rake db:bootstrap task requires some user input (such as username and password for the administrator). If you have, you’ve been wrong.
Take a look at the code:
namespace :db do
desc "Migrate schema to version 0 and back up again. WARNING: Destroys all data in tables!!"
task :remigrate => :environment do
require 'highline/import'
if ENV['OVERWRITE'].to_s.downcase == 'true' or agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [yn] ")
# Migrate downward
ActiveRecord::Migrator.migrate("#{RADIANT_ROOT}/db/migrate/", 0)
# Migrate upward
Rake::Task["db:migrate"].invoke
# Dump the schema
Rake::Task["db:schema:dump"].invoke
else
say "Task cancelled."
exit
end
end
desc "Bootstrap your database for Radiant."
task :bootstrap => :remigrate do
require 'radiant/setup'
Radiant::Setup.bootstrap(
:admin_name => ENV['ADMIN_NAME'],
:admin_username => ENV['ADMIN_USERNAME'],
:admin_password => ENV['ADMIN_PASSWORD'],
:database_template => ENV['DATABASE_TEMPLATE']
)
end
end
If any of those ENV stand out at you, you might realize that you can easily do something like:
rake db:bootstrap ADMIN_NAME='Admin' ADMIN_USERNAME='admin' ...etc...
Personally, however, if I do an automated bootstrap I then remove the task from my deployment recipe so that it can’t happen again and wipe out all my work.
Tuesday, March 10, 2009 |
|
You may have the need to update specs for your extension if you had been using the Scenarios plugin that came with Radiant.
Recent changes to Radiant moved from the Scenarios plugin to the new rewrite as the Dataset plugin. For great information about the thinking behind the move to Datasets, check out John Long’s post.
If you’re working with your extension and your specs no longer run because of an error like:
../../activesupport/lib/active_support/dependencies.rb:279:in `load_missing_constant': uninitialized constant Scenario (NameError)
That means that you’ll either need to add back the Scenarios plugin, or just alter some code to use Datasets.
Your existing spec/spec_helper.rb might have something like
if File.directory?(File.dirname(__FILE__) + "/scenarios")
Scenario.load_paths.unshift File.dirname(__FILE__) + "/scenarios"
end
You’ll need to change that to
Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
And your specs load your scenarios with scenario :users. You’ll just need to change that to dataset :users. Here’s an example from the site_watcher extension
Tuesday, February 24, 2009 |
|
Working on building that great extension to track widgets, doodads and thingamajigs? You’ll probably need a way to keep track of who created and updated what.
Radiant takes care of tracking the creator and updater of pages, snippets, layouts and even users with the UserActionObserver so perhaps there’s a way to use that in your own quest to track whatchamacallits.
The UserActionObserver is loaded in your config/environment.rb with config.active_record.observers = :user_action_observer
You could create your own observer and add that to your environment with config.active_record.observers = :user_action_observer, :gizmo_observer. The UserActionObserver looks like this:
class UserActionObserver < ActiveRecord::Observer
observe User, Page, Layout, Snippet
cattr_accessor :current_user
def before_create(model)
model.created_by = @@current_user
end
def before_update(model)
model.updated_by = @@current_user
end
end
You could go right ahead and make that GizmoObserver that you need, but if you only need to perform the same function as the UserActionObserver why not make your life easier and use what’s already there.
Here’s how Radiant set’s up the relationships in the observed models:
belongs_to :created_by, :class_name => 'User'
belongs_to :updated_by, :class_name => 'User'
That’s simple enough to repeat in your extension. Just add created_by_id and updated_by_id fields to your appropriate table and setup the same relationships.
Once you’ve done that, the last step is simple: just update your whatever_extension.rb
def activate
...
UserActionObserver.instance.send :add_observer!, DooHickey
...
end
There are other extensions out there that already do this, so if you need to see it in action, check out their code.
Tuesday, February 17, 2009 |
|
I thought I’d start writing about interesting bits about developing for Radiant that some of you might not know about.
First off, Radiant::Config:
You can see examples of the standard configuration options that Radiant uses and you’ll find an oft overlooked option page.edit.published_date?.
By setting this to true, you will have the option of changing the published date for each page when creating or editing. There’s even a wiki page about the page published_at date.
Even more interesting about it is that for developers, this is an example of how to return a boolean value from the configuration options, not just a string that is “true” or “false”.
def value
if key.ends_with? "?"
read_attribute(:value) == "true"
else
read_attribute(:value)
end
end
Here’s the source
A popular extension for managing configuration options is the Settings extension. It will prevent users from seeing the values of configuration options containing the phrase “password”. While this is only a way to hide the details from typical users and not a secure way to store important passwords, it may be just enough for you. Here’s the code that does it:
module ConfigProtection
def protected?
key.match(/[p|P]assword/)
end
def protected_value
if protected?
return "********"
else
return value
end
end
end
It’s good enough for something like the Twitter extension (github)
Here are some other tips about altering the configuration options: http://wiki.radiantcms.org/Customizations_II
Sunday, February 15, 2009 |
|
Radiant 0.7.1 Engraving is a bugfix release that corrects two errors
in the user-interface. The contents of page-parts will now maintain
escaped HTML characters across saves, and the tag reference will now
properly display when ’<normal>’ is selected as the page type. The
spec-suite was expanded to cover these regressions. Many thanks to John
Muhl for identifying the escaping issue and a number of other community
members for diagnosing the tag reference issue.
Installation
To install use the gem command (with ‘sudo’ as necessary):
$ gem install radiant
Upgrading an existing project/site from 0.7.x
1. Update the Radiant gem:
% gem update radiant
2. Change the RADIANT_GEM_VERSION constant in config/environment.rb to “0.7.1”.
3. Restart the server
Upgrading an existing project/site from 0.6.5 – 0.6.9
1. Change the RADIANT_GEM_VERSION constant in config/environment.rb to “0.7.1” or remove it altogether.
2. Update the Radiant assets in your project:
rake radiant:update
3. Copy your customizations back into config/environment.rb, if necessary.
4. Migrate the database:
rake production db:migrate
5. Restart the server
Upgrading an existing project/site from 0.5.x – 0.6.4
The upgrade process changed significantly from last release, so listen
up! To upgrade an existing installation, BACKUP YOUR DATABASE, update
the gem, and create a new Radiant project using the instructions above.
Then point Radiant to the right database by editing config/database.yml
and execute the following command in your project directory:
% rake db:migrate
If you have problems during the upgrade, please let us know.
Creating a new project/site
1. Invoke the radiant command with your desired database driver:
$ radiant -d sqlite3 my_project
2. Bootstrap the database:
$ cd my_project
$ rake db:bootstrap
3. Startup the server and try it out!
$ script/server
Saturday, February 07, 2009 |
|
Radiant 0.7.0 “Intaglio” culminates six months of refactoring and bug-
fixing by a dedicated team of contributors. The major milestone crossed
with this release is that the admin controllers have been refactored
toward Rails’ RESTful design. In addition, these changes are of note:
- A beautiful new database template by Paul du Coudray is included.
- Rails 2.1.2 is included.
- Radiant is now compatible with Ruby 1.8.7.
- The extension installer is more helpful, and more friendly with git.
- The caching mechanism supports nginx-style X-Accel-Redirect headers and ETags.
- RSpec and RSpec-Rails are no longer included, but use gem dependencies.
- Extensions can now use timestamped migration numbers.
- Updated gems of RedCloth and BlueCloth (RDiscount) will be preferred over the pre-packaged versions if installed.
There were over 80 changes to this release! A big thank you goes to all
of the sprint weekend attendees and hack night contributors. Well done!
Installation
To install use the gem command (with ‘sudo’ as necessary):
$ gem install radiant
Upgrading an existing project/site
1. Change the RADIANT_GEM_VERSION constant in config/environment.rb to “0.7.0” or remove it altogether.
2. Update the Radiant assets in your project:
rake radiant:update
3. Copy your customizations back into config/environment.rb, if necessary.
4. Migrate the database:
rake production db:migrate
5. Restart the server
Creating a new project/site
1. Invoke the radiant command with your desired database driver:
$ radiant -d sqlite3 my_project
2. Bootstrap the database:
$ cd my_project
$ rake db:bootstrap
3. Startup the server and try it out!
$ script/server