Class: Edge::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Edge::Generators::InstallGenerator
- Defined in:
- lib/edge/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_assets ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/edge/install_generator.rb', line 9 def add_assets # rails_ujs breaks, need to incorporate rails-behavior plugin for this to work seamlessly # gsub_file "app/assets/javascripts/application#{detect_js_format[0]}", /\/\/= require jquery\n/, "" settings_file = File.join(File.dirname(__FILE__), "..", "..", "template", "base", "assets", "sass", "_setting.scss") create_file "app/assets/stylesheets/_setting.scss", File.read(settings_file) framework_file = File.join(File.dirname(__FILE__), "..", "..", "template", "base", "assets", "sass", "framework.scss") create_file "app/assets/stylesheets/framework.scss", File.read(framework_file) style_file = File.join(File.dirname(__FILE__), "..", "..", "template", "base", "assets", "sass", "app.scss") create_file "app/assets/stylesheets/app.scss", File.read(style_file) script_file = File.join(File.dirname(__FILE__), "..", "..", "template", "rails", "app.js") create_file "app/assets/javascripts/app.js", File.read(script_file) insert_into_file "app/assets/stylesheets/application#{detect_css_format[0]}", "#{detect_css_format[1]} require framework\n", after: "require_self\n" end |
#create_layout ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/edge/install_generator.rb', line 42 def create_layout if .haml?||(defined?(Haml) && .haml?) template "application.html.haml", "app/views/layouts/#{file_name}.html.haml" elsif .slim?||(defined?(Slim) && .slim?) template "application.html.slim", "app/views/layouts/#{file_name}.html.slim" else template "application.html.erb", "app/views/layouts/#{file_name}.html.erb" end end |
#detect_css_format ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/edge/install_generator.rb', line 34 def detect_css_format return [".css", " *="] if File.exist?("app/assets/stylesheets/application.css") return [".css.sass", " //="] if File.exist?("app/assets/stylesheets/application.css.sass") return [".sass", " //="] if File.exist?("app/assets/stylesheets/application.sass") return [".css.scss", " //="] if File.exist?("app/assets/stylesheets/application.css.scss") return [".scss", " //="] if File.exist?("app/assets/stylesheets/application.scss") end |
#detect_js_format ⇒ Object
28 29 30 31 32 |
# File 'lib/edge/install_generator.rb', line 28 def detect_js_format return [".coffee", "#="] if File.exist?("app/assets/javascripts/application.coffee") return [".js.coffee", "#="] if File.exist?("app/assets/javascripts/application.js.coffee") return [".js", "//="] if File.exist?("app/assets/javascripts/application.js") end |