Sha256: 60d2861ed3a08a1e30e047e3078b6c388204461d2652b93b00dce22ae358bf4a

Contents?: true

Size: 1.56 KB

Versions: 20

Compression:

Stored size: 1.56 KB

Contents

module Rails
  module Generators
    class ActiveScaffoldSetupGenerator < Rails::Generators::Base #metagenerator
      argument :js_lib, :type => :string, :default => 'jquery', :desc => 'js_lib for activescaffold (prototype|jquery)'
      
      def self.source_root
         @source_root ||= File.join(File.dirname(__FILE__), 'templates')
      end

      def install_plugins
      end
      
      def configure_active_scaffold
        unless defined?(ACTIVE_SCAFFOLD_GEM)
          if js_lib == 'jquery'
            gsub_file 'vendor/plugins/active_scaffold/lib/active_scaffold_env.rb', /#ActiveScaffold.js_framework = :jquery/, 'ActiveScaffold.js_framework = :jquery'
          end
        else
          if js_lib == 'jquery'
            create_file "config/initializers/active_scaffold.rb", "ActiveScaffold.js_framework = :jquery"
          end
        end
      end
      
      def configure_application_layout
        if js_lib == 'prototype'
        elsif js_lib == 'jquery'
          inject_into_file "app/assets/javascripts/application.js",
"//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require active_scaffold\n",
                   :before => "//= require_tree"
          inject_into_file "app/assets/stylesheets/application.js",
" *= require active_scaffold\n",
                   :before => " *= require_self"
           
          inject_into_file "config/locales/en.yml",
"  time:
    formats:
      default: \"%a, %d %b %Y %H:%M:%S\"",                  
                   :after => "hello: \"Hello world\"\n"
        end
      end     
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
active_scaffold_vho-4.0.0 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.14 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.13 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.12 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.11 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.10 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.9 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.8 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.7 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.6 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.5 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.4 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.3 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.2 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.1 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.2.0 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.1.8 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.1.6 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.1.5 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb
active_scaffold_vho-3.1.4 lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb