Class: Alchemy::Generators::DemoKitGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/rails/generators/alchemy/demo_kit_generator.rb

Instance Method Summary collapse

Instance Method Details

#alchemy_scafffoldObject



9
10
11
# File 'lib/rails/generators/alchemy/demo_kit_generator.rb', line 9

def alchemy_scafffold
  invoke "alchemy:scaffold"
end

#copy_filesObject



13
14
15
16
17
18
19
# File 'lib/rails/generators/alchemy/demo_kit_generator.rb', line 13

def copy_files
  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/application.html.erb", "#{Rails.root}/app/views/layouts/application.html.erb"
  directory "alchemy/elements", "#{Rails.root}/app/views/alchemy/elements/"
  directory "alchemy/page_layouts", "#{Rails.root}/app/views/alchemy/page_layouts/"
end

#inject_css_into_envObject



21
22
23
24
# File 'lib/rails/generators/alchemy/demo_kit_generator.rb', line 21

def inject_css_into_env
  sentinel = /::Application\.configure do\s*$/
  inject_into_file "#{Rails.root}/config/environments/production.rb", "\n  config.assets.precompile += %w( alchemy/demo_kit.css )\n", { :after => sentinel, :verbose => true }
end