Skip to content

Commit

Permalink
List options for rails new --webpack=WEBPACK
Browse files Browse the repository at this point in the history
When you type `rails new -h`, the `--database=DATABASE` options display
this useful message:

> Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)

However, the `--webpack=WEBPACK` option only displays this:

> Preconfigure for app-like JavaScript with Webpack

so it's hard to know *which* values are valid for `WEBPACK`.

This commit improves the help message to display:

> Preconfigure for app-like JavaScript with Webpack (options: react/vue/angular)

The implication of this commit is that the list needs to be manually updated
whenever rails/webpacker adds support for a new framework.

However, I don't imagine this list to change very frequently, and I think that
the benefit of display the list to the users is greater than the hustle of
updating the list when needed.
  • Loading branch information
claudiob committed Mar 22, 2017
1 parent 12b6849 commit 1c6d394
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion railties/lib/rails/generators/app_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class AppBase < Base # :nodoc:
DATABASES = %w( mysql postgresql sqlite3 oracle frontbase ibm_db sqlserver )
JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc )
DATABASES.concat(JDBC_DATABASES)
WEBPACKS = %w( react vue angular )

attr_accessor :rails_template
add_shebang_option!
Expand All @@ -34,7 +35,7 @@ def self.add_shared_options_for(name)
desc: "Preconfigure for selected JavaScript library"

class_option :webpack, type: :string, default: nil,
desc: "Preconfigure for app-like JavaScript with Webpack"
desc: "Preconfigure for app-like JavaScript with Webpack (options: #{WEBPACKS.join('/')})"

class_option :skip_yarn, type: :boolean, default: false,
desc: "Don't use Yarn for managing JavaScript dependencies"
Expand Down

0 comments on commit 1c6d394

Please sign in to comment.