Class: SpreeSlider::InstallAnythingGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/spree_slider/install_anything_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
25
26
27
# File 'lib/generators/spree_slider/install_anything_generator.rb', line 4

def install
  #copy slider partial
  copy_file "anything_slider.html.erb", "app/views/spree/shared/_slider.html.erb"      
  
  #add javascripts
  append_file "app/assets/javascripts/store/all.js", "//= require js/jquery.anythingslider\n" 
  append_file "app/assets/javascripts/store/all.js", "//= require js/jquery.anythingslider.fx\n" 
  append_file "app/assets/javascripts/store/all.js", "//= require js/jquery.anythingslider.video\n" 

  #add stylesheets
  inject_into_file "app/assets/stylesheets/store/all.css", " *= require css/anythingslider\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