Skip to content

Commit

Permalink
Refer to Spring as a proper noun, with a capital "S" (rails#559)
Browse files Browse the repository at this point in the history
This updates the docs and code - particularly the comments
and code that generate help, e.g. when you run `spring --help` -
to refer to "Spring" with a capital "S", since it's a name (i.e.
a proper noun).

The only places where I've left "spring" with a lower-case "s"
is where we're referring to the name of the gem (e.g. in a
`Gemfile`) or for code examples (e.g. running `bin/spring`).
  • Loading branch information
Tim Rogers authored and jeremy committed May 21, 2018
1 parent 468faec commit 0c711ff
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $ RAILS_VERSION="~> 3.2.0" rake test:acceptance
```

The apps in `test/apps` will be named based on the rails version and the
spring version.
Spring version.

## Testing with your app

Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ provide a speed up on platforms which don't support forking (Windows, JRuby).

### Setup

Add spring to your Gemfile:
Add Spring to your Gemfile:

``` ruby
gem "spring", group: :development
```

(Note: using `gem "spring", git: "..."` *won't* work and is not a
supported way of using spring.)
supported way of using Spring.)

It's recommended to 'springify' the executables in your `bin/`
directory:
Expand All @@ -54,8 +54,8 @@ rescue LoadError
end
```

On platforms where spring is installed and supported, this snippet
hooks spring into the execution of commands. In other cases, the snippet
On platforms where Spring is installed and supported, this snippet
hooks Spring into the execution of commands. In other cases, the snippet
will just be silently ignored and the lines after it will be executed as
normal.

Expand Down Expand Up @@ -90,7 +90,7 @@ user 0m0.281s
sys 0m0.066s
```

That wasn't particularly fast because it was the first run, so spring
That wasn't particularly fast because it was the first run, so Spring
had to boot the application. It's now running:

```
Expand Down Expand Up @@ -167,7 +167,7 @@ Spring is running:
26707 spring app | spring-demo-app | started 2 secs ago | development mode
```

There's no need to "shut down" spring. This will happen automatically
There's no need to "shut down" Spring. This will happen automatically
when you close your terminal. However if you do want to do a manual shut
down, use the `stop` command:

Expand All @@ -180,7 +180,7 @@ From within your code, you can check whether Spring is active with `if defined?(

### Removal

To remove spring:
To remove Spring:

* 'Unspring' your bin/ executables: `bin/spring binstub --remove --all`
* Remove spring from your Gemfile
Expand Down Expand Up @@ -218,7 +218,7 @@ Spring::Commands::Rake.environment_matchers[:default] = "development"
### `rails console`, `rails generate`, `rails runner`

These execute the rails command you already know and love. If you run
a different sub command (e.g. `rails server`) then spring will automatically
a different sub command (e.g. `rails server`) then Spring will automatically
pass it through to the underlying `rails` executable (without the
speed-up).

Expand All @@ -240,12 +240,12 @@ You can add these to your Gemfile for additional commands:

## Use without adding to bundle

If you don't want spring-related code checked into your source
repository, it's possible to use spring without adding to your Gemfile.
However, using spring binstubs without adding spring to the Gemfile is not
If you don't want Spring-related code checked into your source
repository, it's possible to use Spring without adding to your Gemfile.
However, using Spring binstubs without adding Spring to the Gemfile is not
supported.

To use spring like this, do a `gem install spring` and then prefix
To use Spring like this, do a `gem install spring` and then prefix
commands with `spring`. For example, rather than running `bin/rake -T`,
you'd run `spring rake -T`.

Expand Down Expand Up @@ -401,14 +401,14 @@ The following environment variables are used by Spring:
the long-running Spring server process. By default this is related to
the socket path; if the socket path is `/foo/bar/spring.sock` the
pidfile will be `/foo/bar/spring.pid`.
* `SPRING_SERVER_COMMAND` - The command to run to start up the spring
* `SPRING_SERVER_COMMAND` - The command to run to start up the Spring
server when it is not already running. Defaults to `spring _[version]_
server --background`.

## Troubleshooting

If you want to get more information about what spring is doing, you can
run spring explicitly in a separate terminal:
If you want to get more information about what Spring is doing, you can
run Spring explicitly in a separate terminal:

```
$ spring server
Expand Down
4 changes: 2 additions & 2 deletions lib/spring/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ def serve(client)
ARGV.replace(args)
$0 = command.exec_name

# Delete all env vars which are unchanged from before spring started
# Delete all env vars which are unchanged from before Spring started
original_env.each { |k, v| ENV.delete k if ENV[k] == v }

# Load in the current env vars, except those which *were* changed when spring started
# Load in the current env vars, except those which *were* changed when Spring started
env.each { |k, v| ENV[k] ||= v }

# requiring is faster, so if config.cache_classes was true in
Expand Down
18 changes: 9 additions & 9 deletions lib/spring/client/binstub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module Client
class Binstub < Command
SHEBANG = /\#\!.*\n(\#.*\n)*/

# If loading the bin/spring file works, it'll run spring which will
# If loading the bin/spring file works, it'll run Spring which will
# eventually call Kernel.exit. This means that in the client process
# we will never execute the lines after this block. But if the spring
# we will never execute the lines after this block. But if the Spring
# client is not invoked for whatever reason, then the Kernel.exit won't
# happen, and so we'll fall back to the lines after this block, which
# should cause the "unsprung" version of the command to run.
Expand All @@ -26,7 +26,7 @@ class Binstub < Command
SPRING = <<'CODE'
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast.
# This file loads Spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
Expand Down Expand Up @@ -78,7 +78,7 @@ def add
generate(fallback)
status "upgraded"
elsif existing.include?(LOADER)
status "spring already present"
status "Spring already present"
elsif existing =~ BINSTUB_VARIATIONS
upgraded = existing.sub(BINSTUB_VARIATIONS, LOADER)
File.write(command.binstub, upgraded)
Expand All @@ -93,15 +93,15 @@ def add
end

File.write(command.binstub, "#{head}#{shebang}#{LOADER}#{tail}")
status "spring inserted"
status "Spring inserted"
else
status "doesn't appear to be ruby, so cannot use spring", $stderr
status "doesn't appear to be ruby, so cannot use Spring", $stderr
exit 1
end
end
else
generate
status "generated with spring"
status "generated with Spring"
end
end

Expand All @@ -118,15 +118,15 @@ def generate(fallback = nil)
def remove
if existing
File.write(command.binstub, existing.sub(BINSTUB_VARIATIONS, ""))
status "spring removed"
status "Spring removed"
end
end
end

attr_reader :bindir, :items

def self.description
"Generate spring based binstubs. Use --all to generate a binstub for all known commands. Use --remove to revert."
"Generate Spring based binstubs. Use --all to generate a binstub for all known commands. Use --remove to revert."
end

def self.rails_command
Expand Down
2 changes: 1 addition & 1 deletion lib/spring/client/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def call
def formatted_help
["Version: #{env.version}\n",
"Usage: spring COMMAND [ARGS]\n",
*command_help("spring itself", spring_commands),
*command_help("Spring itself", spring_commands),
'',
*command_help("your application", application_commands)].join("\n")
end
Expand Down
2 changes: 1 addition & 1 deletion lib/spring/client/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Rails < Command
}

def self.description
"Run a rails command. The following sub commands will use spring: #{COMMANDS.to_a.join ', '}."
"Run a rails command. The following sub commands will use Spring: #{COMMANDS.to_a.join ', '}."
end

def call
Expand Down
4 changes: 2 additions & 2 deletions lib/spring/client/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def warm_run
require "spring/commands"

if Spring.command?(args.first)
# Command installed since spring started
# Command installed since Spring started
stop_server
cold_run
else
Expand Down Expand Up @@ -116,7 +116,7 @@ def stop_server
def verify_server_version
server_version = server.gets.chomp
if server_version != env.version
$stderr.puts "There is a version mismatch between the spring client " \
$stderr.puts "There is a version mismatch between the Spring client " \
"(#{env.version}) and the server (#{server_version})."

if server_booted?
Expand Down
2 changes: 1 addition & 1 deletion lib/spring/client/stop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Spring
module Client
class Stop < Command
def self.description
"Stop all spring processes for this project."
"Stop all Spring processes for this project."
end

def call
Expand Down
2 changes: 1 addition & 1 deletion lib/spring/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def self.command(name)
# then we need to be under bundler.
require "bundler/setup"

# Auto-require any spring extensions which are in the Gemfile
# Auto-require any Spring extensions which are in the Gemfile
Gem::Specification.map(&:name).grep(/^spring-/).each do |command|
begin
require command
Expand Down
2 changes: 1 addition & 1 deletion lib/spring/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(project_root)

def message
"Spring was unable to find your config/application.rb file. " \
"Your project root was detected at #{project_root}, so spring " \
"Your project root was detected at #{project_root}, so Spring " \
"looked for #{project_root}/config/application.rb but it doesn't exist. You can " \
"configure the root of your application by setting Spring.application_root in " \
"config/spring.rb."
Expand Down
2 changes: 1 addition & 1 deletion lib/spring/process_title_updater.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Spring
# Yes, I know this reimplements a bunch of stuff in Active Support, but
# I don't want the spring client to depend on AS, in order to keep its
# I don't want the Spring client to depend on AS, in order to keep its
# load time down.
class ProcessTitleUpdater
SECOND = 1
Expand Down
16 changes: 8 additions & 8 deletions lib/spring/test/acceptance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ def without_gem(name)
refute spring_env.server_running?
end

test "tells the user that spring is being used when used automatically via binstubs" do
test "tells the user that Spring is being used when used automatically via binstubs" do
assert_success "bin/rails runner ''", stderr: "Running via Spring preloader in process"
assert_success app.spring_test_command, stderr: "Running via Spring preloader in process"
end

test "does not tell the user that spring is being used when used automatically via binstubs but quiet is enabled" do
test "does not tell the user that Spring is being used when used automatically via binstubs but quiet is enabled" do
File.write("#{app.user_home}/.spring.rb", "Spring.quiet = true")
assert_success "bin/rails runner ''"
refute_output_includes "bin/rails runner ''", stderr: 'Running via Spring preloader in process'
Expand Down Expand Up @@ -232,13 +232,13 @@ def exec_name
test "binstub" do
assert_success "bin/rails server --help", stdout: /Usage:\s+rails server/ # rails command fallback

assert_success "#{app.spring} binstub rake", stdout: "bin/rake: spring already present"
assert_success "#{app.spring} binstub rake", stdout: "bin/rake: Spring already present"

assert_success "#{app.spring} binstub --remove rake", stdout: "bin/rake: spring removed"
assert_success "#{app.spring} binstub --remove rake", stdout: "bin/rake: Spring removed"
assert !app.path("bin/rake").read.include?(Spring::Client::Binstub::LOADER)
assert_success "bin/rake -T", stdout: "rake db:migrate"

assert_success "#{app.spring} binstub rake", stdout: "bin/rake: spring inserted"
assert_success "#{app.spring} binstub rake", stdout: "bin/rake: Spring inserted"
assert app.path("bin/rake").read.include?(Spring::Client::Binstub::LOADER)
end

Expand Down Expand Up @@ -409,8 +409,8 @@ def exec_name
require 'rails/commands'
RUBY

assert_success "bin/spring binstub --remove rake", stdout: "bin/rake: spring removed"
assert_success "bin/spring binstub --remove rails", stdout: "bin/rails: spring removed"
assert_success "bin/spring binstub --remove rake", stdout: "bin/rake: Spring removed"
assert_success "bin/spring binstub --remove rails", stdout: "bin/rails: Spring removed"

expected = <<-RUBY.strip_heredoc
#!/usr/bin/env ruby
Expand Down Expand Up @@ -503,7 +503,7 @@ def exec_name
assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
end

test "changing the Gemfile works when spring calls into itself" do
test "changing the Gemfile works when Spring calls into itself" do
File.write(app.path("script.rb"), <<-RUBY.strip_heredoc)
gemfile = Rails.root.join("Gemfile")
File.write(gemfile, "\#{gemfile.read}gem 'text'\\n")
Expand Down
2 changes: 1 addition & 1 deletion test/unit/client/help_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def setup
Usage: spring COMMAND [ARGS]
Commands for spring itself:
Commands for Spring itself:
command Random Spring Command
Expand Down

0 comments on commit 0c711ff

Please sign in to comment.