class AnchorUi::InstallGenerator

Public Instance Methods

create_javascript() click to toggle source
# File lib/generators/anchor_ui/install_generator.rb, line 52
def create_javascript
  copy_file "install/core-ui.#{options[:javascript_engine]}", "app/assets/stylesheets/core-ui.#{options[:javascript_engine]}"
end
create_stylesheets() click to toggle source

class_option :layout_name, :default => 'application' class_option :skin, :default => 'blue', desc: 'AdminLTE skin color' class_option :skip_turbolinks, :type => :boolean, :default => false, :desc => “Skip Turbolinks on assets”

def copy_base_scaffold_templates

directory "lib/templates/#{options[:template_engine]}"

end

def copy_images

directory "img/", "public/img"

end

def copy_form_builder

copy_file "form_builder/_form.html.#{options[:template_engine]}", "lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}"

end

def copy_nav_helper

copy_file "helpers/navigation_helper.rb", "app/helpers/nav_helper.rb"

end

def create_layout

template "layouts/dashboard.html.#{options[:template_engine]}", "app/views/layouts/#{options[:layout_name]}.html.#{options[:template_engine]}"
template "layouts/_header.html.#{options[:template_engine]}", "app/views/layouts/_#{options[:layout_name]}_header.html.#{options[:template_engine]}"
template "layouts/_sidebar.html.#{options[:template_engine]}", "app/views/layouts/_#{options[:layout_name]}_sidebar.html.#{options[:template_engine]}"

end

# File lib/generators/anchor_ui/install_generator.rb, line 37
def create_stylesheets
    copy_file "install/_custom-variables.#{options[:stylesheet_engine]}", "app/assets/stylesheets/_custom-variables.#{options[:stylesheet_engine]}"
end
inject_javascript() click to toggle source
# File lib/generators/anchor_ui/install_generator.rb, line 56
def inject_javascript

  application_js_path = "app/assets/javascripts/application.js"

  if ::File.exists?(::File.join(destination_root, application_js_path))
    inject_into_file application_js_path, before: '//= require_tree' do
      # "//= require bootstrap\n"+
      # "//= require jquery-rails\n"
      "//= require coreui-free\n"
    end
  end
end
inject_stylesheets() click to toggle source
# File lib/generators/anchor_ui/install_generator.rb, line 41
def inject_stylesheets
  application_scss_path = "app/assets/stylesheets/application.scss"

  if ::File.exists?(::File.join(destination_root, application_scss_path))
    inject_into_file application_scss_path, before: 'end' do
      "@import 'custom-variables';\n"+
      "@import 'coreui-free';\n"
    end
  end
end