Sha256: 3ee3e5cdb11d4b41f28d048b01f6ec76c556acaebb164bb0ddb32c2daeac2049

Contents?: true

Size: 1.31 KB

Versions: 20

Compression:

Stored size: 1.31 KB

Contents

module SpreePurchaseOrder
  module Generators
    class InstallGenerator < Rails::Generators::Base

      def add_javascripts
        append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/spree_purchase_order\n"
        append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/spree_purchase_order\n"
      end

      def add_stylesheets
        inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/spree_purchase_order\n", before: /\*\//, verbose: true
        inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/spree_purchase_order\n", before: /\*\//, verbose: true
      end

      def add_source_attributes
        append_file 'config/initializers/spree.rb', "Spree::PermittedAttributes.source_attributes.push :po_number, :organization_name"
      end

      def add_migrations
        run 'bundle exec rake railties:install:migrations FROM=spree_purchase_order'
      end

      def run_migrations
         res = ask 'Would you like to run the migrations now? [Y/n]'
         if res == '' || res.downcase == 'y'
           run 'bundle exec rake db:migrate'
         else
           puts "Skiping rake db:migrate, don't forget to run it!"
         end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
spree_purchase_order-3.7.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.6.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.5.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.5.0.rc1 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.4.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.3.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.2.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-2.2.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-2.3.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-2.4.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.1.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.0.0 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.2.0.rc1 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.2.0.beta lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.1.0.beta lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-3.0.0.beta lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-2.4.0.beta lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-2.3.0.beta lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-2.2.0.beta2 lib/generators/spree_purchase_order/install/install_generator.rb
spree_purchase_order-2.2.0.beta lib/generators/spree_purchase_order/install/install_generator.rb