spring 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +32 -0
- data/README.md +2 -0
- data/lib/spring/application.rb +21 -5
- data/lib/spring/application/boot.rb +4 -2
- data/lib/spring/command_wrapper.rb +1 -1
- data/lib/spring/version.rb +1 -1
- data/test/acceptance/helper.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e8e020e7dc1eb3f27faa79634ad8c9ff4e9c1ddb
|
|
4
|
+
data.tar.gz: 5bd55b0c1e659701f4cd61afaba2b854070bc482
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ebecedcb2e4a616615dc33a752e54a380f685e9d43227f67a5c3a0f29ae8c500df20ab75705778e13f2efa5c52d51f4ed682472eda7b12006e3720a762232dd9
|
|
7
|
+
data.tar.gz: 349a6b90ba96409a80e90a14e5bc39d7057970d3a6a81eb8fe7e6c6b7cd48aebc7465d687ffd08b704a3977cc0c3405a72cc93521b022fd54ef7a13a154ba3e8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 1.1.1
|
|
2
|
+
|
|
3
|
+
* Fix `$0` so that it is no longer prefixed with "spring ", as doing
|
|
4
|
+
this cause issues with rspec when running just `rspec` with no
|
|
5
|
+
arguments.
|
|
6
|
+
* Ensure we're always connected to a tty when preloading the
|
|
7
|
+
application in the background, in order to avoid loading issues
|
|
8
|
+
with readline + libedit which affected pry-rails.
|
|
9
|
+
|
|
1
10
|
## 1.1.0
|
|
2
11
|
|
|
3
12
|
* A `bin/spring` binstub is now generated. This allows us to load spring
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Contributing guide
|
|
2
|
+
|
|
3
|
+
## Getting set up
|
|
4
|
+
|
|
5
|
+
Check out the code and run `bundle install` as usual.
|
|
6
|
+
|
|
7
|
+
## Running tests
|
|
8
|
+
|
|
9
|
+
Running `rake` will run all tests. There are both unit tests and
|
|
10
|
+
acceptance tests. You can run them individually with `rake test:unit` or
|
|
11
|
+
`rake test:acceptance`.
|
|
12
|
+
|
|
13
|
+
If one doesn't already exist, the acceptance tests will generate a dummy
|
|
14
|
+
Rails app in `test/apps/`. On each test run, the dummy app is copied to
|
|
15
|
+
`test/apps/tmp/` so that any changes won't affect the pre-generated app
|
|
16
|
+
(this saves us having to regenerate the app on each run).
|
|
17
|
+
|
|
18
|
+
If tests are failing and you don't know why, it might be that the
|
|
19
|
+
pre-generated app has become inconsistent in some way. In that case the
|
|
20
|
+
best solution is to purge it with `rm -rf test/apps/*` and then run the
|
|
21
|
+
acceptance tests again, which will generate a new app.
|
|
22
|
+
|
|
23
|
+
## Testing different Rails versions
|
|
24
|
+
|
|
25
|
+
You can set the `RAILS_VERSION` environment variable:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
$ RAILS_VERSION="~> 3.2.0" rake test:acceptance
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The apps in `test/apps` will be named based on the rails version and the
|
|
32
|
+
spring version.
|
data/README.md
CHANGED
|
@@ -7,6 +7,8 @@ Spring is a Rails application preloader. It speeds up development by
|
|
|
7
7
|
keeping your application running in the background so you don't need to
|
|
8
8
|
boot it every time you run a test, rake task or migration.
|
|
9
9
|
|
|
10
|
+
**Upgrading to 1.1? It's recommended to run `bundle exec spring binstub --all` to regenerate your binstubs.**
|
|
11
|
+
|
|
10
12
|
## Features
|
|
11
13
|
|
|
12
14
|
* Totally automatic; no need to explicitly start and stop the background process
|
data/lib/spring/application.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "spring/boot"
|
|
2
2
|
require "set"
|
|
3
|
+
require "pty"
|
|
3
4
|
|
|
4
5
|
module Spring
|
|
5
6
|
class Application
|
|
@@ -102,12 +103,16 @@ module Spring
|
|
|
102
103
|
watcher.add loaded_application_features
|
|
103
104
|
watcher.add Spring.gemfile, "#{Spring.gemfile}.lock"
|
|
104
105
|
|
|
105
|
-
if defined?(Rails)
|
|
106
|
+
if defined?(Rails) && Rails.application
|
|
106
107
|
watcher.add Rails.application.paths["config/initializers"]
|
|
107
108
|
watcher.add Rails.application.paths["config/database"]
|
|
108
109
|
end
|
|
109
110
|
end
|
|
110
111
|
|
|
112
|
+
def eager_preload
|
|
113
|
+
with_pty { preload }
|
|
114
|
+
end
|
|
115
|
+
|
|
111
116
|
def run
|
|
112
117
|
state :running
|
|
113
118
|
manager.puts
|
|
@@ -128,7 +133,7 @@ module Spring
|
|
|
128
133
|
manager.puts
|
|
129
134
|
|
|
130
135
|
stdout, stderr, stdin = streams = 3.times.map { client.recv_io }
|
|
131
|
-
[STDOUT, STDERR].zip(
|
|
136
|
+
[STDOUT, STDERR, STDIN].zip(streams).each { |a, b| a.reopen(b) }
|
|
132
137
|
|
|
133
138
|
preload unless preloaded?
|
|
134
139
|
|
|
@@ -144,8 +149,6 @@ module Spring
|
|
|
144
149
|
end
|
|
145
150
|
|
|
146
151
|
pid = fork {
|
|
147
|
-
Process.setsid
|
|
148
|
-
STDIN.reopen(stdin)
|
|
149
152
|
IGNORE_SIGNALS.each { |sig| trap(sig, "DEFAULT") }
|
|
150
153
|
trap("TERM", "DEFAULT")
|
|
151
154
|
|
|
@@ -172,7 +175,7 @@ module Spring
|
|
|
172
175
|
}
|
|
173
176
|
|
|
174
177
|
disconnect_database
|
|
175
|
-
|
|
178
|
+
reset_streams
|
|
176
179
|
|
|
177
180
|
log "forked #{pid}"
|
|
178
181
|
manager.puts pid
|
|
@@ -273,5 +276,18 @@ module Spring
|
|
|
273
276
|
stream.puts("#{first}: #{error} (#{error.class})")
|
|
274
277
|
rest.each { |line| stream.puts("\tfrom #{line}") }
|
|
275
278
|
end
|
|
279
|
+
|
|
280
|
+
def with_pty
|
|
281
|
+
PTY.open do |master, slave|
|
|
282
|
+
[STDOUT, STDERR, STDIN].each { |s| s.reopen slave }
|
|
283
|
+
yield
|
|
284
|
+
reset_streams
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
def reset_streams
|
|
289
|
+
[STDOUT, STDERR].each { |stream| stream.reopen(spring_env.log_file) }
|
|
290
|
+
STDIN.reopen("/dev/null")
|
|
291
|
+
end
|
|
276
292
|
end
|
|
277
293
|
end
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# This is necessary for the terminal to work correctly when we reopen stdin.
|
|
2
|
+
Process.setsid
|
|
3
|
+
|
|
1
4
|
require "spring/application"
|
|
2
5
|
|
|
3
6
|
app = Spring::Application.new(
|
|
@@ -6,11 +9,10 @@ app = Spring::Application.new(
|
|
|
6
9
|
)
|
|
7
10
|
|
|
8
11
|
Signal.trap("TERM") { app.terminate }
|
|
9
|
-
Signal.trap("TTOU", "IGNORE")
|
|
10
12
|
|
|
11
13
|
Spring::ProcessTitleUpdater.run { |distance|
|
|
12
14
|
"spring app | #{app.app_name} | started #{distance} ago | #{app.app_env} mode"
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
app.
|
|
17
|
+
app.eager_preload if ENV.delete("SPRING_PRELOAD") == "1"
|
|
16
18
|
app.run
|
data/lib/spring/version.rb
CHANGED
data/test/acceptance/helper.rb
CHANGED
|
@@ -267,8 +267,8 @@ module Spring
|
|
|
267
267
|
# Sporadic SSL errors keep causing test failures so there are anti-SSL workarounds here
|
|
268
268
|
def generate
|
|
269
269
|
Bundler.with_clean_env do
|
|
270
|
-
system("
|
|
271
|
-
|
|
270
|
+
system("gem list rails --installed --version '#{version_constraint}' || " \
|
|
271
|
+
"gem install rails --clear-sources --source http://rubygems.org --version '#{version_constraint}'")
|
|
272
272
|
|
|
273
273
|
skips = %w(--skip-bundle --skip-javascript --skip-sprockets)
|
|
274
274
|
skips << "--skip-spring" if version.bundles_spring?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spring
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon Leighton
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-02-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -49,6 +49,7 @@ files:
|
|
|
49
49
|
- .gitignore
|
|
50
50
|
- .travis.yml
|
|
51
51
|
- CHANGELOG.md
|
|
52
|
+
- CONTRIBUTING.md
|
|
52
53
|
- Gemfile
|
|
53
54
|
- LICENSE.txt
|
|
54
55
|
- README.md
|