Class: SpreeShowcase::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- SpreeShowcase::Generators::InstallGenerator
- Defined in:
- lib/generators/spree_showcase/install/install_generator.rb
Instance Method Summary collapse
- #add_javascripts ⇒ Object
- #add_migrations ⇒ Object
- #add_partials ⇒ Object
- #add_stylesheets ⇒ Object
- #complete ⇒ Object
- #run_migrations ⇒ Object
Instance Method Details
#add_javascripts ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/spree_showcase/install/install_generator.rb', line 6 def add_javascripts append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_showcase\n" if copy_file "javascripts/store/showcase.js", "app/assets/javascripts/store/showcase.js" puts "Copied showcase.js into app/assets/javascripts/store/showcase.js\n" else puts "[Failed] File copying showcase.js => app/assets/javascripts/store/showcase.js\n" end if copy_file "javascripts/store/jquery.flexslider.js", "app/assets/javascripts/store/jquery.flexslider.js" puts "Copied jquery.flexslider.js into app/assets/javascripts/store/jquery.flexslider.js\n" else puts "[Failed] File copying jquery.flexslider.js => app/assets/javascripts/store/jquery.flexslider.js\n" end puts "Copying JS assets into your app's javascripts/store directory. The file showcase.js is required by the extension and is used to activate slideshow.\n" end |
#add_migrations ⇒ Object
47 48 49 |
# File 'lib/generators/spree_showcase/install/install_generator.rb', line 47 def add_migrations run 'bundle exec rake railties:install:migrations FROM=spree_showcase' end |
#add_partials ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/generators/spree_showcase/install/install_generator.rb', line 38 def add_partials puts %q{This partial is the template structure for displaying the slideshow.} if copy_file "partials/_showcase.html.erb", "app/views/spree/slides/_showcase.html.erb" puts "Copied Partial _showcase.html.erb into app/views/spree/slides/_showcase.html.erb\n" else puts "[Failed] File copying _showcase.html.erb => app/views/spree/slides/_showcase.html.erb\n" end end |
#add_stylesheets ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/spree_showcase/install/install_generator.rb', line 21 def add_stylesheets inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_showcase\n", :before => /\*\//, :verbose => true if copy_file "stylesheets/store/showcase.css.scss", "app/assets/stylesheets/store/showcase.css.scss" puts "Copied showcase.css.scss into app/assets/stylesheets/store/showcase.css.scss\n" else puts "[Failed] File copying showcase.css.scss => app/assets/stylesheets/store/showcase.css.scss\n" end if copy_file "stylesheets/store/flexslider.css", "app/assets/stylesheets/store/flexslider.css" puts "Copied flexslider into app/assets/stylesheets/store/flexslider.css. This is used for the default flexslider slider.\n" else puts "[Failed] File copying flexslider.css => app/assets/stylesheets/store/flexslider.css\n" end puts "showcase.css styles are required by the extension and can be changed in anyway to fit your own _showcase.html.erb\n" end |
#complete ⇒ Object
60 61 62 |
# File 'lib/generators/spree_showcase/install/install_generator.rb', line 60 def complete puts "\nEverything is done! To summarize, _showcase.html.erb => HTML template, showcase.css.scss & showcase.js => assets. Edit these 3 files to fit run the slideshow." end |
#run_migrations ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/generators/spree_showcase/install/install_generator.rb', line 51 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 |