diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2018-07-07 09:33:11 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2018-07-07 09:33:11 +0200 |
commit | b773318f5acbb41c549724ba0a9f5e32cd05aff8 (patch) | |
tree | 098be69bb533dbdf8c350a4cea11a87b15c4d34e /railties/lib/rails | |
parent | a0061d2389a178b093f0d3f64f58236ffbe088e0 (diff) | |
download | rails-b773318f5acbb41c549724ba0a9f5e32cd05aff8.tar.gz rails-b773318f5acbb41c549724ba0a9f5e32cd05aff8.tar.bz2 rails-b773318f5acbb41c549724ba0a9f5e32cd05aff8.zip |
Use only snake cased symbols in commands.
Mixing strings and symbols seems aesthetically less than ideal.
We can also use underscores just fine. Thor converts them to dashes
for the CLI and it makes access in Ruby code nicer.
Here's the `server --help` output after this change:
```
Usage:
rails server [thin/puma/webrick] [options]
Options:
-p, [--port=port] # Runs Rails on the specified port - defaults to 3000.
-b, [--binding=IP] # Binds Rails to the specified IP - defaults to 'localhost' in development and '0.0.0.0' in other environments'.
-c, [--config=file] # Uses a custom rackup configuration.
# Default: config.ru
-d, [--daemon], [--no-daemon] # Runs server as a Daemon.
-e, [--environment=name] # Specifies the environment to run this server under (development/test/production).
-u, [--using=name] # Specifies the Rack server used to run the application (thin/puma/webrick).
-P, [--pid=PID] # Specifies the PID file.
# Default: tmp/pids/server.pid
-C, [--dev-caching], [--no-dev-caching] # Specifies whether to perform caching in development.
[--early-hints], [--no-early-hints] # Enables HTTP/2 early hints.
```
See? Quite dashing ✨
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/commands/server/server_command.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb index cf17f0ef12..4fcb10d53f 100644 --- a/railties/lib/rails/commands/server/server_command.rb +++ b/railties/lib/rails/commands/server/server_command.rb @@ -132,10 +132,10 @@ module Rails desc: "Specifies the Rack server used to run the application (thin/puma/webrick).", banner: :name class_option :pid, aliases: "-P", type: :string, default: DEFAULT_PID_PATH, desc: "Specifies the PID file." - class_option "dev-caching", aliases: "-C", type: :boolean, default: nil, + class_option :dev_caching, aliases: "-C", type: :boolean, default: nil, desc: "Specifies whether to perform caching in development." - class_option "restart", type: :boolean, default: nil, hide: true - class_option "early_hints", type: :boolean, default: nil, desc: "Enables HTTP/2 early hints." + class_option :restart, type: :boolean, default: nil, hide: true + class_option :early_hints, type: :boolean, default: nil, desc: "Enables HTTP/2 early hints." def initialize(args = [], local_options = {}, config = {}) @original_options = local_options @@ -177,7 +177,7 @@ module Rails environment: environment, daemonize: options[:daemon], pid: pid, - caching: options["dev-caching"], + caching: options[:dev_caching], restart_cmd: restart_command, early_hints: early_hints } @@ -210,7 +210,7 @@ module Rails name = :Port when :binding name = :Host - when :"dev-caching" + when :dev_caching name = :caching when :daemonize name = :daemon |