Sha256: 9b3767b29c33ac4a2c0c0fe27858de74353ebf7cb67b4b8f6695b3bd6d3897cb

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

module Bootsy
  module Generators
    class InstallGenerator < Rails::Generators::Base
      source_root __FILE__

      def add_routes
        route "mount Bootsy::Engine => '/bootsy', as: 'bootsy'"
      end

      def copy_locale
        copy_file "../../../../config/locales/en.yml", "config/locales/bootsy.en.yml"
      end

      def add_assets

        [{original: 'app/assets/javascripts/application.js',
          skip_if: 'require bootsy',
          content: "\n//= require bootsy",
          position: {after: '//= require jquery_ujs'}},
         {original: 'app/assets/stylesheets/application.css',
          skip_if: 'require bootsy',
          content: "\n *= require bootsy",
          position: {after: '*= require_self'}}]. each do |params|

          if File.binread(params[:original]).include?(params[:skip_if])
            say_status 'skipped', "insert into #{params[:original]}", :yellow
          else
            insert_into_file params[:original], params[:content], params[:position]
          end
        end

      end

      def copy_config
        template '../templates/bootsy.rb', 'config/initializers/bootsy.rb'
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bootsy-2.0.5 lib/generators/bootsy/install_generator.rb
bootsy-2.0.4 lib/generators/bootsy/install_generator.rb
bootsy-2.0.3 lib/generators/bootsy/install_generator.rb
bootsy-2.0.2 lib/generators/bootsy/install_generator.rb
bootsy-2.0.1 lib/generators/bootsy/install_generator.rb
bootsy-2.0.0 lib/generators/bootsy/install_generator.rb
bootsy-1.2.0 lib/generators/bootsy/install_generator.rb
bootsy-1.1.0 lib/generators/bootsy/install_generator.rb
bootsy-1.0.0 lib/generators/bootsy/install_generator.rb