Sha256: ea08724426aa903c929cc30fc06ac6f60b65560553e5caf6938559a288559102

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

module Flashtastic
  module Generators
    class InstallGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)

      def copy_flashtastic_initializer
        say_status("copying", "flashtastic_initializer.js.coffee file to your assets directory", :green)
        copy_file "flashtastic_initializer.js.coffee", "app/assets/javascripts/flashtastic_initializer.js.coffee"
      end

      def include_flashtastic_module_in_application_controller
        say_status("inserting", "Flashtastic module in your ApplicationController ", :green)
        inject_into_class "app/controllers/application_controller.rb", ApplicationController, "  include Flashtastic\n"
      end

      def include_messenger_js_references
        say_status("inserting", "messenger js references in your application.js ", :green)
        insert_into_file "app/assets/javascripts/application.js", :after => "//= require jquery\n" do
          <<-JS
//= require messenger
//= require messenger-theme-flat
//= require flashtastic_initializer
          JS
        end
      end

      def include_messenger_css_references
        say_status("inserting", "messenger css references in your application.css ", :green)
        insert_into_file "app/assets/stylesheets/application.css", :after => "*= require_self\n" do
          <<-CSS
 *= require messenger
 *= require messenger-spinner
 *= require messenger-theme-flat
          CSS
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flashtastic-0.0.1 lib/generators/flashtastic/install/install_generator.rb