Sha256: 00df723fbc71abaf123a3dd0714842de7094dfae9bf257abadd7c313f280e0ec

Contents?: true

Size: 1.79 KB

Versions: 11

Compression:

Stored size: 1.79 KB

Contents

require 'rails'

module Formize

  class InstallGenerator < ::Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
    # class_option :no_ui, :type => :boolean, :default => false, :desc => "Do not include special jQuery-UI JavaScripts"
    class_option :no_locales, :type => :boolean, :default => false, :desc => "Do not include locales for jQuery-UI date picker"
    class_option :no_stylesheet, :type => :boolean, :default => false, :desc => "Do not include stylesheet of jQuery-UI"

    unless ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR >= 1
      def copy_assets
        copy_file '../../../../assets/javascripts/formize.js',  'public/javascripts/formize.js'

        # unless options[:no_ui]
        copy_file '../../../../assets/javascripts/jquery.ui.formize.js',  'public/javascripts/jquery.ui.formize.js'
        # end

        unless options[:no_locales]
          for locale in Dir.glob(File.expand_path('../../../../assets/javascripts/locales/*datepicker*.js', __FILE__))
            file = locale.split(/[\\\/]+/)[-1]
            copy_file "../../../../assets/javascripts/locales/#{file}",  "public/javascripts/locales/#{file}"
          end
        end

        copy_file '../../../../assets/stylesheets/formize.css', 'public/stylesheets/formize.css'

        unless options[:no_stylesheet]
          copy_file '../../../../assets/stylesheets/jquery-ui.css', 'public/stylesheets/jquery-ui.css'
          for image in Dir.glob(File.expand_path('../../../../assets/images/*.png', __FILE__))
            file = image.split(/[\\\/]+/)[-1]
            copy_file "../../../../assets/images/#{file}",  "public/images/#{file}"
          end
        end

      end
    end

    def copy_initializer_file
      template "initializer.rb", "config/initializers/formize.rb"
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
formize-0.0.27 lib/generators/formize/install/install_generator.rb
formize-0.0.26 lib/generators/formize/install/install_generator.rb
formize-0.0.25 lib/generators/formize/install/install_generator.rb
formize-0.0.24 lib/generators/formize/install/install_generator.rb
formize-0.0.23 lib/generators/formize/install/install_generator.rb
formize-0.0.22 lib/generators/formize/install/install_generator.rb
formize-0.0.21 lib/generators/formize/install/install_generator.rb
formize-0.0.20 lib/generators/formize/install/install_generator.rb
formize-0.0.19 lib/generators/formize/install/install_generator.rb
formize-0.0.18 lib/generators/formize/install/install_generator.rb
formize-0.0.17 lib/generators/formize/install/install_generator.rb