Class: Alchemy::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_configObject



15
16
17
# File 'lib/rails/generators/alchemy/install/install_generator.rb', line 15

def copy_config
  copy_file "#{config_path}/config.yml", "config/alchemy/config.yml"
end

#copy_demo_viewsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rails/generators/alchemy/install/install_generator.rb', line 30

def copy_demo_views
  return if @options[:skip_demo_files]

  copy_file "application.html.erb", "app/views/layouts/application.html.erb"
  copy_file "article.scss", "app/assets/stylesheets/alchemy/elements/article.scss"

  stylesheet_require = " *= require_tree ./alchemy/elements\n"
  if File.exist?("app/assets/stylesheets/application.css")
    insert_into_file "app/assets/stylesheets/application.css", stylesheet_require,
      before: " */"
  else
    create_file "app/assets/stylesheets/application.css", "/*\n#{stylesheet_require} */\n"
  end

  [
    "_article_editor.html.erb",
    "_article_view.html.erb"
  ].each do |file|
    copy_file file, "app/views/alchemy/elements/#{file}"
  end

  copy_file "_standard.html.erb", "app/views/alchemy/page_layouts/_standard.html.erb"

  %w(de en es).each do |locale|
    copy_file "alchemy.#{locale}.yml", "config/locales/alchemy.#{locale}.yml"
  end
end

#copy_yml_filesObject



19
20
21
22
23
# File 'lib/rails/generators/alchemy/install/install_generator.rb', line 19

def copy_yml_files
  %w(elements page_layouts).each do |file|
    template "#{current_path}/templates/#{file}.yml.tt", "config/alchemy/#{file}.yml"
  end
end

#install_assetsObject



25
26
27
28
# File 'lib/rails/generators/alchemy/install/install_generator.rb', line 25

def install_assets
  copy_file "all.js", "vendor/assets/javascripts/alchemy/admin/all.js"
  copy_file "all.css", "vendor/assets/stylesheets/alchemy/admin/all.css"
end