Sha256: bd5eabf8fd0cdf6dea30d6b632ef4df59cf69593e013030259b8d1a32944c00e

Contents?: true

Size: 931 Bytes

Versions: 3

Compression:

Stored size: 931 Bytes

Contents

module SpreeEssentials
  module Generators
    class InstallGenerator < Rails::Generators::Base
      
      desc "Installs required migrations for spree_essentials"
      
      class_option :add_stylesheets, :type => :boolean, :default => true, :banner => 'Append spree_essentials to admin/all.css'
      class_option :add_javascripts, :type => :boolean, :default => true, :banner => 'Append spree_essentials to admin/all.js'
      
      def copy_migrations
        rake "spree_essentials:install:migrations"
      end
      
      def append_stylesheets
        return unless options[:add_stylesheets]
        gsub_file "app/assets/stylesheets/admin/all.css", "*/", "*= require admin/spree_essentials\n*/"  
      end
      
      def append_javascripts
        return unless options[:add_javascripts]
        append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_essentials"
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_essentials-0.5.0.rc1 lib/generators/spree_essentials/install_generator.rb
spree_essentials-0.4.0 lib/generators/spree_essentials/install_generator.rb
spree_essentials-0.4.0.rc3 lib/generators/spree_essentials/install_generator.rb