spring 1.1.1 → 1.1.2
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/.travis.yml +3 -1
- data/CHANGELOG.md +12 -0
- data/README.md +1 -0
- data/bin/spring +16 -0
- data/lib/spring/application.rb +17 -5
- data/lib/spring/application_manager.rb +2 -0
- data/lib/spring/client/rails.rb +1 -0
- data/lib/spring/version.rb +1 -1
- data/test/acceptance/app_test.rb +4 -4
- data/test/acceptance/helper.rb +23 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4095a71b95759b8a4ed6a71b5ddcb5048aad506
|
4
|
+
data.tar.gz: 360837121b6655c0abc8fb88f28ce6b62f46a88e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 255ec2bc4edd38b0c1d609e16b8cc6d7d9f8bccdddff14e482f98202260e1dae3f7d766a56b47cb846973c443e45b67bac0ae1c8c3c830c9c9c0ed64486c6025
|
7
|
+
data.tar.gz: 3181e4b656a12b4094742647f6b7fe260d6f3f5acb0642bc39bfbfb83389a174a7434fa6ab355723a169cb2a2441793f02f46aa618a9ec87d7f9eccb9611ee71
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 1.1.2
|
2
|
+
|
3
|
+
* Detect old binstubs generated with Spring 1.0 and exit with an error.
|
4
|
+
This prevents a situation where you can get stuck in an infinite loop
|
5
|
+
of spring invocations.
|
6
|
+
* Avoid `warning: already initialized constant APP_PATH` when running
|
7
|
+
rails commands that do not use spring (e.g. `bin/rails server` would
|
8
|
+
emit this when you ^C to exit)
|
9
|
+
* Fix `reload!` in rails console
|
10
|
+
* Don't connect/disconnect the database if there are no connections
|
11
|
+
configured. Issue #256.
|
12
|
+
|
1
13
|
## 1.1.1
|
2
14
|
|
3
15
|
* Fix `$0` so that it is no longer prefixed with "spring ", as doing
|
data/README.md
CHANGED
@@ -209,6 +209,7 @@ to pick up the changes):
|
|
209
209
|
|
210
210
|
* [spring-commands-rspec](https://github.com/jonleighton/spring-commands-rspec)
|
211
211
|
* [spring-commands-cucumber](https://github.com/jonleighton/spring-commands-cucumber)
|
212
|
+
* [spring-commands-spinach](https://github.com/jvanbaarsen/spring-commands-spinach)
|
212
213
|
* [spring-commands-testunit](https://github.com/jonleighton/spring-commands-testunit) - useful for
|
213
214
|
running `Test::Unit` tests on Rails 3, since only Rails 4 allows you
|
214
215
|
to use `rake test path/to/test` to run a particular test/directory.
|
data/bin/spring
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
if defined?(Spring)
|
4
|
+
$stderr.puts "You've tried to invoke Spring when it's already loaded (i.e. the Spring " \
|
5
|
+
"constant is defined)."
|
6
|
+
$stderr.puts
|
7
|
+
$stderr.puts "This is probably because you generated binstubs with " \
|
8
|
+
"Spring 1.0, and you now have a Spring version > 1.0 on your system. To solve " \
|
9
|
+
"this, upgrade your bundle to the latest Spring version and then run " \
|
10
|
+
"`bundle exec spring binstub --all` to regenerate your binstubs. This is a one-time " \
|
11
|
+
"step necessary to upgrade from 1.0 to 1.1."
|
12
|
+
$stderr.puts
|
13
|
+
$stderr.puts "Here's the backtrace:"
|
14
|
+
$stderr.puts
|
15
|
+
$stderr.puts caller
|
16
|
+
exit 1
|
17
|
+
end
|
18
|
+
|
3
19
|
if defined?(Gem)
|
4
20
|
if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.1.0")
|
5
21
|
warn "Warning: You're using Rubygems #{Gem::VERSION} with Spring. " \
|
data/lib/spring/application.rb
CHANGED
@@ -91,7 +91,9 @@ module Spring
|
|
91
91
|
|
92
92
|
require Spring.application_root_path.join("config", "environment")
|
93
93
|
|
94
|
+
@original_cache_classes = Rails.application.config.cache_classes
|
94
95
|
Rails.application.config.cache_classes = false
|
96
|
+
|
95
97
|
disconnect_database
|
96
98
|
|
97
99
|
@preloaded = :success
|
@@ -161,9 +163,13 @@ module Spring
|
|
161
163
|
# Load in the current env vars, except those which *were* changed when spring started
|
162
164
|
env.each { |k, v| ENV[k] ||= v }
|
163
165
|
|
164
|
-
# requiring is faster,
|
165
|
-
|
166
|
-
|
166
|
+
# requiring is faster, so if config.cache_classes was true in
|
167
|
+
# the environment's config file, then we can respect that from
|
168
|
+
# here on as we no longer need constant reloading.
|
169
|
+
if @original_cache_classes
|
170
|
+
ActiveSupport::Dependencies.mechanism = :require
|
171
|
+
Rails.application.config.cache_classes = true
|
172
|
+
end
|
167
173
|
|
168
174
|
connect_database
|
169
175
|
srand
|
@@ -246,11 +252,11 @@ module Spring
|
|
246
252
|
end
|
247
253
|
|
248
254
|
def disconnect_database
|
249
|
-
ActiveRecord::Base.remove_connection if
|
255
|
+
ActiveRecord::Base.remove_connection if active_record_configured?
|
250
256
|
end
|
251
257
|
|
252
258
|
def connect_database
|
253
|
-
ActiveRecord::Base.establish_connection if
|
259
|
+
ActiveRecord::Base.establish_connection if active_record_configured?
|
254
260
|
end
|
255
261
|
|
256
262
|
# This feels very naughty
|
@@ -289,5 +295,11 @@ module Spring
|
|
289
295
|
[STDOUT, STDERR].each { |stream| stream.reopen(spring_env.log_file) }
|
290
296
|
STDIN.reopen("/dev/null")
|
291
297
|
end
|
298
|
+
|
299
|
+
private
|
300
|
+
|
301
|
+
def active_record_configured?
|
302
|
+
defined?(ActiveRecord::Base) && ActiveRecord::Base.configurations.any?
|
303
|
+
end
|
292
304
|
end
|
293
305
|
end
|
data/lib/spring/client/rails.rb
CHANGED
data/lib/spring/version.rb
CHANGED
data/test/acceptance/app_test.rb
CHANGED
@@ -263,13 +263,13 @@ CODE
|
|
263
263
|
end
|
264
264
|
|
265
265
|
test "runner command sets Rails environment from command-line options" do
|
266
|
-
assert_success "bin/rails runner -e
|
267
|
-
assert_success "bin/rails runner --environment=
|
266
|
+
assert_success "bin/rails runner -e test 'puts Rails.env'", stdout: "test"
|
267
|
+
assert_success "bin/rails runner --environment=test 'puts Rails.env'", stdout: "test"
|
268
268
|
end
|
269
269
|
|
270
270
|
test "forcing rails env via environment variable" do
|
271
|
-
app.env['RAILS_ENV'] = '
|
272
|
-
assert_success "bin/rake -p 'Rails.env'", stdout: "
|
271
|
+
app.env['RAILS_ENV'] = 'test'
|
272
|
+
assert_success "bin/rake -p 'Rails.env'", stdout: "test"
|
273
273
|
end
|
274
274
|
|
275
275
|
test "setting env vars with rake" do
|
data/test/acceptance/helper.rb
CHANGED
@@ -23,7 +23,7 @@ module Spring
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def bundles_spring?
|
26
|
-
version
|
26
|
+
version.segments.take(2) == [4, 1] || version > Gem::Version.new("4.1")
|
27
27
|
end
|
28
28
|
|
29
29
|
def major
|
@@ -33,6 +33,10 @@ module Spring
|
|
33
33
|
def minor
|
34
34
|
version.segments[1]
|
35
35
|
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
version.to_s
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
class Application
|
@@ -216,17 +220,25 @@ module Spring
|
|
216
220
|
end
|
217
221
|
end
|
218
222
|
|
219
|
-
def run!(
|
220
|
-
|
221
|
-
|
223
|
+
def run!(command, options = {})
|
224
|
+
attempts = (options.delete(:retry) || 0) + 1
|
225
|
+
artifacts = nil
|
226
|
+
|
227
|
+
until attempts == 0 || artifacts && artifacts[:status].success?
|
228
|
+
artifacts = run(command, options)
|
229
|
+
attempts -= 1
|
230
|
+
end
|
231
|
+
|
232
|
+
if artifacts[:status].success?
|
233
|
+
artifacts
|
234
|
+
else
|
222
235
|
raise "command failed\n\n#{debug(artifacts)}"
|
223
236
|
end
|
224
|
-
artifacts
|
225
237
|
end
|
226
238
|
|
227
239
|
def bundle
|
228
|
-
run! "(gem list bundler | grep bundler) || gem install bundler", timeout: nil
|
229
|
-
run! "bundle update", timeout: nil
|
240
|
+
run! "(gem list bundler | grep bundler) || gem install bundler", timeout: nil, retry: 2
|
241
|
+
run! "bundle update --retry=2", timeout: nil
|
230
242
|
end
|
231
243
|
|
232
244
|
private
|
@@ -270,10 +282,13 @@ module Spring
|
|
270
282
|
system("gem list rails --installed --version '#{version_constraint}' || " \
|
271
283
|
"gem install rails --clear-sources --source http://rubygems.org --version '#{version_constraint}'")
|
272
284
|
|
285
|
+
@version = RailsVersion.new(`ruby -e 'puts Gem::Specification.find_by_name("rails", "#{version_constraint}").version'`.chomp)
|
286
|
+
|
273
287
|
skips = %w(--skip-bundle --skip-javascript --skip-sprockets)
|
274
288
|
skips << "--skip-spring" if version.bundles_spring?
|
275
289
|
|
276
|
-
system("rails
|
290
|
+
system("rails _#{version}_ new #{application.root} #{skips.join(' ')}")
|
291
|
+
raise "application generation failed" unless application.exists?
|
277
292
|
|
278
293
|
FileUtils.mkdir_p(application.gem_home)
|
279
294
|
FileUtils.mkdir_p(application.user_home)
|
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.2
|
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-02-
|
11
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|