Class: RightRailsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RightRailsGenerator
- Defined in:
- lib/generators/right_rails/right_rails_generator.rb
Overview
Copies all the javascripts in place and updates them if necessary
Kudos to Jose Fernández (github.com/magec)
Instance Method Summary collapse
Instance Method Details
#banner ⇒ Object
32 33 34 |
# File 'lib/generators/right_rails/right_rails_generator.rb', line 32 def "Usage: #{$0} right_rails" end |
#manifest ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/right_rails/right_rails_generator.rb', line 8 def manifest source_path = File.dirname(__FILE__) images_path = "#{source_path}/../../../vendor/assets/images/rightjs-ui" javascripts_path = "#{source_path}/../../../vendor/assets/javascripts" # copying the javascript javascript files directory javascripts_path , "public/javascripts" # copying the images in place directory images_path, "public/images/rightjs-ui" # patching up the JS files to use images from 'pubic/images' Dir['public/javascripts/right/*.js'].each do |filename| old_content = File.read(filename) new_content = old_content.gsub("url(/assets/rightjs-ui/", "url(/images/rightjs-ui/") if old_content != new_content File.open(filename, "w") do |f| f.write new_content end end end end |