Sha256: 0125e2021bf1402921d554561ab5a7c44c442d1c6fe1e72157db2dbf9e918019

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

module SpreeSlider
  class InstallNivoGenerator < Rails::Generators::Base
    source_root File.expand_path("../templates", __FILE__)    
    def install
      #copy slider partial
      copy_file "nivo_slider.html.erb", "app/views/spree/shared/_slider.html.erb"      
      
      #add javascripts
      append_file "app/assets/javascripts/store/all.js", "//= require jquery.nivo.slider.pack.js\n" 

      #add stylesheets
      inject_into_file "app/assets/stylesheets/store/all.css", " *= require themes/default/default\n", :before => /\*\//, :verbose => true
      inject_into_file "app/assets/stylesheets/store/all.css", " *= require themes/pascal/pascal\n", :before => /\*\//, :verbose => true
      inject_into_file "app/assets/stylesheets/store/all.css", " *= require themes/orman/orman\n", :before => /\*\//, :verbose => true
      inject_into_file "app/assets/stylesheets/store/all.css", " *= require nivo-slider\n", :before => /\*\//, :verbose => true

      #copy migrations
      run 'bundle exec rake railties:install:migrations FROM=spree_slider' 

      #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




Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_slider-1.2.0 lib/generators/spree_slider/install_nivo_generator.rb
spree_slider-1.1.0 lib/generators/spree_slider/install_nivo_generator.rb
spree_slider-1.0.1 lib/generators/spree_slider/install_nivo_generator.rb