Sha256: efa424c173612e7be874eac43404a6d65e697f2803ffdc6170587f415bb5c8ed

Contents?: true

Size: 922 Bytes

Versions: 7

Compression:

Stored size: 922 Bytes

Contents

require 'rails/generators/named_base'

module Joosy
  module Generators
    class PreloaderGenerator < ::Rails::Generators::NamedBase
      class_option :template_engine, :type => :string,
        :desc => "Generate templates for specified engine."

      source_root File.join(File.dirname(__FILE__), 'templates')

      def create_preloader_files
        unless class_path.empty?
          puts <<HELP
Usage: rails generate joosy:preloader joosy_app_name
HELP
          exit 1
        end

        template "app_preloader.js.coffee.erb", "app/assets/javascripts/#{file_name}_preloader.js.coffee.erb"

        template "app_controller.rb", "app/controllers/#{file_name}_controller.rb"

        template "preload.html.#{options[:template_engine]}",
                 "app/views/layouts/#{file_name}.html.#{options[:template_engine]}"

        route "match '#{file_name}' => '#{file_name}#index'"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
joosy-1.1.0.alpha.3 lib/rails/generators/joosy/preloader_generator.rb
joosy-1.1.0.alpha.2 lib/rails/generators/joosy/preloader_generator.rb
joosy-1.1.0.alpha.1 lib/rails/generators/joosy/preloader_generator.rb
joosy-1.0.0.RC7 lib/rails/generators/joosy/preloader_generator.rb
joosy-1.0.0.RC6 lib/rails/generators/joosy/preloader_generator.rb
joosy-1.0.0.RC5 lib/rails/generators/joosy/preloader_generator.rb
joosy-1.0.0.RC4 lib/rails/generators/joosy/preloader_generator.rb