Alchemy CMS

Gem Version Build Status Code Climate Coverage Status

About

Alchemy is the most powerful, userfriendly and flexible Rails CMS.

Read more on the website and in the guidelines.

This master branch is a development branch that can contain bugs. For productive environments you should use the current Ruby gem version, or the latest stable branch (3.0-stable).

Features

Rails Version

This version of Alchemy CMS runs with Rails 4 (including 4.1)

If you are looking for a Rails 3.2 compatible version check the 2.8-stable branch.

If you are looking for a Rails 3.1 compatible version check the 2.1-stable branch.

If you are looking for a Rails 3.0 compatible version check the 2.0-stable branch.

If you are looking for a Rails 2.3 compatible version check the 1.6-stable branch.

Ruby Version

Alchemy runs with Ruby >= 1.9.3 (including Ruby 2.0 and 2.1).

For a Ruby 1.8.7 compatible version use the 2.3-stable branch.

Installation

As a standalone project

1. Use the installer:

gem install alchemy_cms --pre
alchemy new my_magicpage
cd my_magicpage

Run

bundle install

to finish installation process.

2. Start the local server:

bin/rails server

3. Switch to your browser:

Open http://localhost:3000 and follow the on screen instructions.

Into an existing Rails project

1. Add the Alchemy gem:

In your App's Gemfile:

gem 'alchemy_cms', github: 'magiclabs/alchemy_cms', branch: 'master'

2. Install Alchemy into your app:

Run in terminal:

bundle install
bin/rake alchemy:install

Authentication User Model

With Version 3.0 we extracted the Alchemy user model into its own gem.

In order to get the former Alchemy user model back, add the following gem into your Gemfile:

gem 'alchemy-devise', '~> 2.0'

Run in terminal:

bundle install
bin/rake alchemy_devise:install:migrations db:migrate

In order to use your own user model, you can add e.g.

# config/initializers/alchemy.rb
Alchemy.user_class_name = 'YourUserClass'
Alchemy. = '/your/login/path'
Alchemy.logout_path = '/your/logout/path'

The only thing Alchemy needs to know from your user model is the alchemy_roles method.

This method has to return an Array or ActiveRecord::Relation with at least one of the following roles:

Example:

def alchemy_roles
  self.admin?
    %w(admin)
  end
end

Optionally you can add a alchemy_display_name method that returns a name representing the currently logged in user. This is used in the admin views.

Example:

def alchemy_display_name
  "#{first_name} #{last_name}".strip
end

Testing

Before running tests (which refer to Alchemy), please make sure to run the rake task

bundle exec rake alchemy:spec:prepare

to set up the database for testing.

Now you can run your tests, e. g. with RSpec:

bundle exec rspec spec/...

Alternatively you can just run:

bundle exec rake

This default task executes the database preparations and runs all defined test cases.

Deployment

Alchemy ships with a generator that creates a Capistrano config/deploy.rb file, which takes care of everything you need to deploy an Alchemy site.

So, if you don't have your own deploy file, we encourage you to use this generator:

$ bin/rails g alchemy:deploy_script

If you have your own Capistrano receipts, you should require the Alchemy tasks in your app's config/deploy.rb file:

# deploy.rb
require 'alchemy/capistrano'

If you don't use Capistrano you have to make sure that the uploads, tmp/cache/assets, public/assets and public/pictures cache folders get shared between deployments, otherwise you will loose data.

Please take a look into the lib/alchemy/capistrano.rb file, to see how to achieve this.

Upgrading

After updating the Alchemy gem in your App, you should run the upgrader.

Run in terminal:

bin/rake alchemy:upgrade

Tips

Getting Help

Resources

Authors

License