Sha256: 563937e4caa7ed0d4d70654f68b4ffedfd683957912c4138f47ec33c735f3ce4

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

#
# Copies all the javascripts in place and updates them if necessary
#

class RightRailsGenerator < Rails::Generator::Base
  
  mandatory_options :source => "#{File.dirname(__FILE__)}/../../javascripts"
    
  def manifest
    record do |m|
      # creating the javascript directories
      m.directory 'public/javascripts/right'
      m.directory 'public/javascripts/right/i18n'
      
      # copying the javascript files
      Dir.open(options[:source]).each do |file|
        unless ['.', '..'].include?(file)
          destination = if ['right.js', 'right-src.js', 'right-olds.js', 'right-olds-src.js'].include?(file)
            file
          elsif file.include?('ui-i18n')
            file.gsub('right-', 'right/').gsub('ui-i18n-', 'i18n/')
          else
            file.gsub('right-', 'right/')
          end
          
          m.file file, "public/javascripts/#{destination}", :chmod => 0644
        end
      end
      
      # creating the iframed uploads layout
      m.directory "app/views/layouts"
      m.file "/../generators/right_rails/templates/iframed.html.erb", "app/views/layouts/iframed.html.erb"
      
      # copying the images in place
      m.directory "public/images/rightjs-ui"
      Dir.open("#{File.dirname(__FILE__)}/../../images").each do |filename|
        unless ['.', '..'].include?(filename)
          m.file "/../images/#{filename}", "public/images/rightjs-ui/#{filename}"
        end
      end
    end
  end
  
  
  def banner
    "Usage: #{$0} right_rails"
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
right-rails-0.6.0 generators/right_rails/right_rails_generator.rb