@@ -62,7 +62,11 @@ def log_file_path
62
62
end
63
63
64
64
def log_file
65
- @log_file ||= log_file_path . open ( "w+" )
65
+ @log_file ||= begin
66
+ tmp = path ( "tmp" )
67
+ tmp . mkdir unless tmp . exist?
68
+ tmp . join ( "spring.log" ) . open ( "w+" )
69
+ end
66
70
end
67
71
68
72
def env
@@ -72,7 +76,7 @@ def env
72
76
"HOME" => user_home . to_s ,
73
77
"RAILS_ENV" => nil ,
74
78
"RACK_ENV" => nil ,
75
- "SPRING_LOG" => log_file_path . to_s
79
+ "SPRING_LOG" => log_file . path
76
80
}
77
81
end
78
82
@@ -295,7 +299,8 @@ def generate
295
299
end
296
300
end
297
301
298
- bundle
302
+ install_spring
303
+
299
304
application . run! "bundle exec rails g scaffold post title:string"
300
305
application . run! "bundle exec rake db:migrate db:test:clone"
301
306
end
@@ -305,23 +310,21 @@ def generate_if_missing
305
310
end
306
311
307
312
def install_spring
308
- unless @installed
309
- # Need to do this here too because the app may have been generated with
310
- # a different ruby
311
- bundle
313
+ return if @installed
312
314
313
- system ( "gem build spring.gemspec 2>/dev/null" )
314
- application . run! "gem install ../../../spring-#{ Spring ::VERSION } .gem" , timeout : nil
315
+ system ( "gem build spring.gemspec 2>/dev/null" )
316
+ application . run! "gem install ../../../spring-#{ Spring ::VERSION } .gem" , timeout : nil
315
317
316
- FileUtils . rm_rf application . path ( "bin" )
318
+ bundle
317
319
318
- if application . path ( "bin_original" ) . exist?
319
- FileUtils . cp_r application . path ( "bin_original" ) , application . path ( "bin" )
320
- end
320
+ FileUtils . rm_rf application . path ( "bin" )
321
321
322
- application . run! " #{ application . spring } binstub --all"
323
- @installed = true
322
+ if application . path ( "bin_original" ) . exist?
323
+ FileUtils . cp_r application . path ( "bin_original" ) , application . path ( "bin" )
324
324
end
325
+
326
+ application . run! "#{ application . spring } binstub --all"
327
+ @installed = true
325
328
end
326
329
327
330
def copy_to ( path )
0 commit comments