Class: SpreeSlider::InstallSimpleCarouselGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/spree_slider/install_simple_carousel_generator.rb

Instance Method Summary collapse

Instance Method Details

#installObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/spree_slider/install_simple_carousel_generator.rb', line 4

def install
  #copy slider partial
  copy_file "simple_carousel_slider.html.erb", "app/views/spree/shared/_slider.html.erb"      
  
  #add javascripts
  append_file "app/assets/javascripts/store/all.js", "//= require simple.carousel\n" 
  append_file "app/assets/javascripts/store/all.js", "//= require simple.carousel.slider\n" 
  
  
  #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