Ruby-on-rails – SPORK is automatically restarted

I use spork as my DRB and auto-test as my observer to speed up testing in my Rails application. Currently, when the files in the directory structure change, autotest will restart the test.

Is there a way to restart spork after adding a new model? That is, restart spork when the directory structure changes.

check Guard guard-spork

p>

https://github.com/guard/guard

https://github.com/guard/guard-spork

Guard is basically a An extended listener that allows you to view various files to make changes.
Recently there is a Railscasts episode (264-guard) on this topic.

Additional for each reply:

Guard-spork sets the watch statement to:

guard'spork' do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.*\.rb$})
watch(%r{^config/initializers/.*\. rb$))
watch('spec/spec_helper.rb')
end

To restart spork when the directory structure is changed, try fine-tuning the regular expression watch statement. In the case of restarting spork after adding a new model (why need it, if you don’t mind my problem?) trying the following will capture any activity on the .rb file,

watch (%r{^app/models/.*\.rb$})

Otherwise, please try the following to capture any content that is changed to the directory in bulk:

watch(%r{^config/initializers/.*})

I use spork as my DRB and automatic test as my observer, To speed up the testing in my Rails application. Currently, autotest restarts the test when the files in the directory structure change.

Is there a way to restart spork after adding a new model ? That is, restart spork when the directory structure changes.

Check Guard guard-spork

https://github.com /guard/guard

https://github.com/guard/guard-spork

Guard is basically a listener with many extensions that allows you to view various files To make changes.
Recently there is a Railscasts episode (264-guard) on this topic.

Additional for each reply:

Guard-spork sets the watch statement to :

guard'spork' do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.*\.rb$})
watch(%r{^config/initializers/.*\.rb$})
watch('spec /spec_helper.rb')
end

To restart spork when the directory structure is changed, try fine-tuning the regular expression watch statement. In the case of restarting spork after adding a new model (why Need, if you don’t mind my question?) Trying the following will capture any activity on the .rb file,

watch(%r{^app/models/.*\ .rb$})

Otherwise, please try the following to capture any content that is changed in batches to the directory:

watch(%r{^config /initializers/.*})

Leave a Comment

Your email address will not be published.