Sha256: 2f4fd5b6228fe9dd6f6c4103cfe640ed72b1e633e8b02170fa10c75f247a1170

Contents?: true

Size: 1.51 KB

Versions: 11

Compression:

Stored size: 1.51 KB

Contents

require 'rails'

module Alchemy
  module Generators
    class ScaffoldGenerator < ::Rails::Generators::Base
      desc "This generator generates the Alchemy scaffold. Pass --with-standard-set to copy Alchemys standard set into your app."
      class_option 'with-standard-set', :type => :boolean, :desc => "Copy standard set files."
      source_root File.expand_path('templates', File.dirname(__FILE__))
      
      def create_config_dir
        empty_directory "#{Rails.root}/config/alchemy"
      end
      
      def copy_config
        @config_path = File.expand_path('../../../../../config/alchemy', File.dirname(__FILE__)) 
        copy_file "#{@config_path}/config.yml", "#{Rails.root}/config/alchemy/config.yml"
      end
      
      def copy_yamls
        if options['with-standard-set']
          layouts_path = File.expand_path('../../../../../app/views/layouts', File.dirname(__FILE__)) 
          copy_file "#{@config_path}/elements.yml", "#{Rails.root}/config/alchemy/elements.yml"
          copy_file "#{@config_path}/page_layouts.yml", "#{Rails.root}/config/alchemy/page_layouts.yml"
          copy_file "#{layouts_path}/pages.html.erb", "#{Rails.root}/app/views/layouts/pages.html.erb"
          Rails::Generators.invoke("alchemy:elements")
          Rails::Generators.invoke("alchemy:page_layouts")
        else
          template "elements.yml", "#{Rails.root}/config/alchemy/elements.yml"
          template "page_layouts.yml", "#{Rails.root}/config/alchemy/page_layouts.yml"
        end
      end
      
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
alchemy_cms-2.0.1 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.rc6 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.rc5 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.rc4 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.rc3 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.rc2 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.rc1 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.pre5 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.pre4 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
alchemy_cms-2.0.pre3 lib/rails/generators/alchemy/scaffold/scaffold_generator.rb