Class: Farbtastic::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/farbtastic/install/install_generator.rb,
lib/generators/farbtastic/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_imagesObject



25
26
27
28
# File 'lib/generators/farbtastic/install/install_generator.rb', line 25

def copy_images
  say_status("copying", "Farbtastic Images", :green)
  directory "images/farbtastic", "public/images/farbtastic"
end

#copy_javascriptObject



12
13
14
15
# File 'lib/generators/farbtastic/install/install_generator.rb', line 12

def copy_javascript
  say_status("copying", "Farbtastic JS", :green)
  copy_file "javascripts/farbtastic.js", "public/javascripts/farbtastic.js"
end

#copy_stylesheetObject



17
18
19
20
21
22
23
# File 'lib/generators/farbtastic/install/install_generator.rb', line 17

def copy_stylesheet
  say_status("copying", "Farbtastic CSS", :green)
  copy_file "stylesheets/farbtastic.css.scss", "public/stylesheets/farbtastic.css"

  say_status("updating", "CSS Image Paths", :green)
  gsub_file "public/stylesheets/farbtastic.css", "image-url(\"farbtastic/", "url(\"/images/farbtastic/"
end

#do_nothingObject



39
40
41
42
43
44
45
46
# File 'lib/generators/farbtastic/install/install_generator.rb', line 39

def do_nothing
  say_status("deprecated", "You are using Rails 3.1 with the asset pipeline enabled, so this generator is not needed.")
  say_status("", "The necessary files are already in your asset pipeline.")
  say_status("", "Just add `//= require farbtastic` to your app/assets/javascripts/application.js and add `*= require farbtastic` to your app/assets/stylesheets/application.css")
  say_status("", "If you upgraded your app from Rails 3.0 and still have farbtastic.js, farbtastic.css or images/farbtastic in your public assets folders, be sure to remove them.")
  say_status("", "If you do not want the asset pipeline enabled, you may turn it off in application.rb and re-run this generator.")
  # ok, nothing
end