Permalink
Browse files

Do not allow to use plugin_new generator directly, you should use Usage:

  rails new APP_PATH [options]

Options:
  -G, [--skip-git]            # Skip Git ignores and keeps
  -r, [--ruby=PATH]           # Path to the Ruby binary of your choice
                              # Default: /Users/drogus/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
  -b, [--builder=BUILDER]     # Path to an application builder (can be a filesystem path or URL)
      [--edge]                # Setup the application with Gemfile pointing to Rails repository
      [--dev]                 # Setup the application with Gemfile pointing to your Rails checkout
      [--skip-gemfile]        # Don't create a Gemfile
  -d, [--database=DATABASE]   # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
                              # Default: sqlite3
  -O, [--skip-active-record]  # Skip Active Record files
  -m, [--template=TEMPLATE]   # Path to an application template (can be a filesystem path or URL)
  -J, [--skip-prototype]      # Skip Prototype files
  -T, [--skip-test-unit]      # Skip Test::Unit files

Runtime options:
  -s, [--skip]     # Skip files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -f, [--force]    # Overwrite files that already exist
  -q, [--quiet]    # Supress status output

Rails options:
  -v, [--version]  # Show Rails version number and quit
  -h, [--help]     # Show this help message and quit

Description:
    The 'rails new' command creates a new Rails application with a default
    directory structure and configuration at the path you specify.

Example:
    rails new ~/Code/Ruby/weblog

    This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
    See the README in the newly created application to get going. command
  • Loading branch information...
1 parent b066534 commit bf176e9c7a1aa46b021384b91f4f9ec9a1132c0f @drogus drogus committed with josevalim Nov 15, 2010
Showing with 9 additions and 0 deletions.
  1. +3 −0 railties/lib/rails/commands.rb
  2. +6 −0 railties/test/application/generators_test.rb
@@ -14,6 +14,9 @@
when 'generate', 'destroy', 'plugin'
if command == "plugin" && ARGV.first == "new"
require "rails/commands/plugin_new"
+ elsif command == 'generate' && ARGV.first == "plugin_new"
+ puts "This generator should not be used directly as a generator. You should use `rails plugin new` command instead"
+ exit(1)
else
require APP_PATH
Rails.application.require_environment!
@@ -31,6 +31,12 @@ def with_bare_config
assert File.exist?(File.join(rails_root, "vendor/plugins/bukkits/test/dummy/config/application.rb"))
end
+ test "don't allow running plugin_new generator as a generator" do
+ FileUtils.cd rails_root
+ output = `./script/rails g plugin_new vendor/plugins/bukkits`
+ assert_match /This generator should not be used directly as a generator. You should use `rails plugin new` command instead/, output
+ end
+
test "generators default values" do
with_bare_config do |c|
assert_equal(true, c.generators.colorize_logging)

4 comments on commit bf176e9

@drogus
Member
drogus commented on bf176e9 Nov 16, 2010

Damn :D

This is what happens with commit message when you try to do:

git commit -a -m "bla bla rails plugin new bla bla" ;-)

@mephux
mephux commented on bf176e9 Nov 16, 2010

lol, nice

@drnic
Contributor
drnic commented on bf176e9 Nov 16, 2010

Haha

@cfcosta
Contributor

Good one, champs!

Please sign in to comment.