Sha256: 02a6481aa5b5ff68c6dd9bfc09d35893c572145d18b2dd61f2d0a5fecfed180c

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

require 'thor'

class Alchemy::RoutesInjector < Thor
  include Thor::Actions

  def initialize; super; end

  no_tasks do
    def inject
      mountpoint = ask "\nWhere do you want to mount Alchemy CMS? (/)"
      mountpoint = "/" if mountpoint.empty?
      sentinel = /\.routes\.draw do(?:\s*\|map\|)?\s*$/
      inject_into_file "./config/routes.rb", "\n  mount Alchemy::Engine => '#{mountpoint}'\n", { :after => sentinel, :verbose => true }
    end
  end
end

namespace :alchemy do

  desc "Installs Alchemy CMS into your app."
  task :install do
    Rake::Task["alchemy:install:migrations"].invoke
    Rake::Task["alchemy:mount"].invoke
    system("rails g alchemy:scaffold")
    Rake::Task["db:migrate"].invoke
    Rake::Task["alchemy:db:seed"].invoke
    puts <<-EOF

\\o/ Successfully installed Alchemy CMS \\o/

Now:

1. Start your Rails server:

  rails server

2. Open your browser and enter the following URL:

  http://localhost:3000/admin/signup

3. Follow the instructions to complete the installation!

Thank you for using Alchemy CMS!

http://alchemy-cms.com

EOF
  end

  desc "Mounts Alchemy into your routes."
  task :mount do
    Alchemy::RoutesInjector.new.inject
  end

  namespace :db do

    desc "Seeds your database with essential data for Alchemy CMS."
    task :seed => :environment do
      Alchemy::Seeder.seed!
    end

  end

  namespace :standard_set do

    desc "Install Alchemy CMS's standard set."
    task :install do
      system("rails g alchemy:scaffold --with-standard-set")
      puts "\n-> Please do not forget to add Alchemy's standard set to precompiable assets. <-\n"
      puts "\nPut this line in your 'config/environments/production.rb' file:\n"
      puts "  config.assets.precompile += %w( alchemy/standard_set.css )"
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alchemy_cms-2.4.rc2 lib/tasks/install.rake
alchemy_cms-2.4.rc1 lib/tasks/install.rake
alchemy_cms-2.4.beta2 lib/tasks/install.rake