Code Monkey home page Code Monkey logo

spring's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring's Issues

Avoid creating new server process if another one is already running

Currently, each spring server is strictly attached to the current terminal session, without caring about potential existing servers in the same project.

This means that if we open 3-4 terminal sessions in the same project and run a spring test command in each one of them, 8 processes will be created (4 spring servers + 4 spring apps loading the test environment).

Could this be optimized?

I think that if only a server process were allowed to exist it would solve this problem. So each time a server is about to be created, it will first check if there's already a running and if not, only then create a new server, else use the existing one.

Or maybe another solution would be to check the pid files in tmp/ and use the already existing ones if there are any.

Figure out integration for 3rd-party commands

Ideally if somebody wants an rspec command, it should be in another gem, rather than in spring (either rspec or rspec-spring or something).

Therefore, they should be able to add something like:

require "rspec/spring"

To their config/spring.rb

However, this require activating the gem, which we don't want to do when running the spring client (because it's slow).

So we either need to stop loading config/spring.rb when running the spring client, or figure out some other integration method.

command to stop everything

While debugging it's pretty annoying to stop everything and get a clean slate to try again. I think it would help if we have some kind of "reset" command to shut everything down and get the project into a clean state.

can't seem to get it to work - file descriptor was not passed

Once I'm past the error described in #2 I'm stuck with:

/Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application.rb:98:in `recv_io': file descriptor was not passed (msg_controllen=0 smaller than sizeof(struct cmsghdr)=12) (SocketError)
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application.rb:98:in `redirect_output'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application.rb:64:in `serve'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application.rb:53:in `block in run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application.rb:47:in `loop'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application.rb:47:in `run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application.rb:43:in `start'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application_manager.rb:60:in `block in start_child'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application_manager.rb:55:in `fork'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application_manager.rb:55:in `start_child'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application_manager.rb:17:in `start'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application_manager.rb:36:in `block in run'
    from <internal:prelude>:10:in `synchronize'
    from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/application_manager.rb:35:in `run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/server.rb:28:in `block in boot'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/server.rb:28:in `loop'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/server.rb:28:in `boot'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/server.rb:9:in `boot'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/server.rb:59:in `<main>'

I'm running spring inside one of our production rails apps (3.2.9) with the following command:
spring rspec spec/functional

fiddle library missing

When I tried to run the tests under spec/lib it didn't work complaining about not finding 'fiddle'. I'd create a pull-request to add the 'fiddle' dependency if that was the only problem.

But that doesn't help because fiddle seems to depend on inherited_resources although it also doesn't declare this dependency in its gemspecs...

Maybe fiddle should be fixed before fixing this gem...

OS X issues (bad environment variable, file descriptor was not passed)

/Users/jack/.rvm/gems/ruby-1.9.3-p327@app-gemset/gems/spring-0.0.2/lib/spring/application_manager.rb:58:in `[]=': bad environment variable value (ArgumentError)

Originally had it in :development group, now trying at top level in gemfile. Neither seems to work. Have you come across this yourself?

"No such file or directory" error

Example:

/home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_watcher.rb:33:in `mtime': No such file or directory - /home/turnip/Code/loco2/journeyplanner/lib/core_ext/time.rb (Errno::ENOENT)
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_watcher.rb:33:in `block in compute_mtime'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_watcher.rb:33:in `map'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_watcher.rb:33:in `compute_mtime'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_watcher.rb:27:in `stale?'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application.rb:57:in `watch_application'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application.rb:50:in `block in run'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application.rb:49:in `loop'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application.rb:49:in `run'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application.rb:45:in `start'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_manager.rb:67:in `block in start_child'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_manager.rb:63:in `fork'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_manager.rb:63:in `start_child'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_manager.rb:17:in `start'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_manager.rb:46:in `block in run'
    from <internal:prelude>:10:in `synchronize'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/application_manager.rb:36:in `run'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:36:in `serve'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:29:in `block in boot'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:29:in `loop'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:29:in `boot'
    from /home/turnip/.rbenv/versions/1.9.3-p194-falcon/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:9:in `boot'
    from -e:1:in `<main>'

ApplicationWatcher should just tolerate ENOENT rather than exploding.

Consider renaming the `spring test` command

Bash has a built-in test command, which means things can get a bit confusing:

$ spring binstub test
$ export PATH=./bin:$PATH
$ which test
./bin/test
$ test test/unit/user_test.rb # runs the bash test built-in, no output
$ bin/test test/unit/user_test.rb # runs the spring binstub

Perhaps spring testunit would be more appropriate?

FactoryGirl seems not to like Spring

Because zeus seems to have a problem with rspec-guard I looked into spring today tried it with

spring rspec spec

and of 550 rspec tests 55 failed... running them standalone with just plain rspec works without errors.

All the error messages look like this:

  26) api/v1/images/show with image should return the image preview url for download
     Failure/Error: let(:image) { FactoryGirl.build_stubbed(:image_without_file) }
     ActiveRecord::AssociationTypeMismatch:
       Client(#70184004674200) expected, got Client(#70184002607880)
     # ./spec/views/api/v1/images/show_spec.rb:4:in `block (2 levels) in <top (required)>'
     # ./spec/views/api/v1/images/show_spec.rb:8:in `block (2 levels) in <top (required)>'
     # <internal:prelude>:10:in `synchronize'
     # -e:1:in `<main>'

After a little searching I came across this stackoverflow articles which describes an issue which sounds very similar....

Has anybody tested the combination of spring & rspec and factorygirl?
By the way I am using Ruby 1.9.3, Rails 3.2.9 and latest rspec and factory girl...

Cheers,

Govinda

Add after fork callback

Certain users might need to run some arbitrary code after forking. (For example to reload something, or whatever.) So we should support doing this.

Spring ignores exit status

When I run rspec spec/failing_spec.rb ; echo $? the exit status is 1.

But spring always reports 0, regardless of whether the command succeeded or failed.

When I run spring rspec spec/failing_spec.rb ; echo $? the exit status is 0.

Reporting the wrong exit status breaks my test-runner shell, and might impact guard etc.

Console doesn't display prompt in OS X

Running bin/console loads the console but it's not displayed properly as you can see in the image below. Also I can't tell if it's a pry console:

Screen Shot 2013-02-22 at 11 37 27 AM

A proper console would look something like this (this is what I get by rails console):

Screen Shot 2013-02-22 at 2 14 11 PM

I'm on OS X Mountain Lion and I have pry-rails in my Gemfile.

Integrate with `rails` command

We should have a seamless integration such that bin/rails console uses spring but bin/rails server executes as normal (without spring).

Pry and ruby-debug19 causes spring to hang

When I use this gems in a project, spring won't start (no error, just hangs).
Removing them from Gemfile and spring works normally.
Any ideas on what's going on?

Thanks!

Better error message when fiddle cannot be required

We should explain that ruby needs to be compiled with the fiddle stdlib enabled, which required libffi to be installed on the system.

Actually I'd like to figure out if there's a way to avoid depending on fiddle, but I don't know if there is.

jruby support

I wanted to try this out on jruby (where the startup issues are even more prominent than mri) but saw that fork was used.

tmp/spring directory needs to be configurable

When running in an environment like Vagrant, the project folder is shared into the VM. This means it's not possible to create a socket file under this directory:

/var/lib/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:28:in `initialize': Operation not permitted - /vagrant/tmp/spring/2249 (Errno::EPERM)
    from /var/lib/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:28:in `open'
    from /var/lib/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:28:in `boot'
    from /var/lib/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:9:in `boot'
    from -e:1:in `<main>'

Using /tmp/spring instead seems to work fine.

Ensure client and server versions match

The spring command is designed to be run outside of bundler, to keep it fast. This introduces the issue that the spring server may be at a different version to the spring client. So the first thing a server should do when a client connects is send its version. If the don't match, the client should exit with an error.

Should use rb-inotify

Currently, running top shows a spring app process consuming 10% of CPU. This is obviously unacceptable if you're going to work from a laptop.

Please, implement inotify support.

Integrating with Guard

I'm having a hard time figuring out how to integrate this with guard. I would love to see this work with my current guard setup and would be even willing to write some code if someone gives me helpful pointers on what to do...

cannot load such file -- fiddle (LoadError) (0.0.6, Rails 3.2.12)

I just installed your gem (0.0.6) by adding it in the Gemfile, then running bundle update.

Then, I tried...

$ spring console

...but got:

/home/tom/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- fiddle (LoadError)
    from /home/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

Any ideas?

Consider renaming?

I'm sure you're aware that that's a very popular Java framework, used frequently for web apps, called Spring. In case this was an oversight, you may want to consider renaming. Certainly name clashes happen across communities all the time, but given the domain overlap, the SEO for this is likely to be really wonky.

Don't watch any files outside the app root

This seemed like a nice idea at the time but it means we're watching lots more files than just those under the app root, so using more CPU and I think it's simpler to just say "spring will only notice changes under your app root". If you change e.g. a gem which resides on the filesystem then you'll need to stop spring to notice the changes.

ctrl+c do not stop the process

Hi,

Hitting ctrl+c during a rspec command don't kill the process.

I'm back to the bash but the command is still running and outputting (like when we call ctrl+z and bg on bash).

REQ: aliases for Rails commands

Would like to do spring g migration AddFooToBar

Currently throws a couple errors:

/Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/commands.rb:13:in `fetch': key not found: "g" (KeyError)
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/commands.rb:13:in `command'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring.rb:97:in `rails_env_for'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring.rb:60:in `run'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring.rb:21:in `run'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/bin/spring:5:in `<top (required)>'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/bin/spring:23:in `load'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/bin/spring:23:in `<main>'
/Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:34:in `serve': undefined method `chomp' for nil:NilClass (NoMethodError)
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:29:in `block in boot'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:29:in `loop'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:29:in `boot'
    from /Users/turadg/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/spring-0.0.4/lib/spring/server.rb:9:in `boot'
    from -e:1:in `<main>'

cannot load such file -- spring/server

The latest published version is not working:

λ spring rspec spec/integrations/models/fiscal_shift_spec.rb 
-e:in `require': cannot load such file -- spring/server (LoadError)

λ spring console
-e:in `require': cannot load such file -- spring/server (LoadError)

Using bundler:

λ bundle exec spring console
/Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application.rb:98:in `recv_io': file descriptor was not passed (msg_controllen=0 smaller than sizeof(struct cmsghdr)=12) (SocketError)
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application.rb:98:in `redirect_output'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application.rb:64:in `serve'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application.rb:53:in `block in run'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application.rb:47:in `loop'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application.rb:47:in `run'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application.rb:43:in `start'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application_manager.rb:59:in `block in start_child'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application_manager.rb:55:in `fork'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application_manager.rb:55:in `start_child'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application_manager.rb:17:in `start'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application_manager.rb:36:in `block in run'
        from <internal:prelude>:10:in `synchronize'
        from /Users/sobrinho/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/application_manager.rb:35:in `run'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/server.rb:28:in `block in boot'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/server.rb:28:in `loop'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/server.rb:28:in `boot'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/server.rb:9:in `boot'
        from /Users/sobrinho/Developer/.../vendor/bundle/ruby/1.9.1/gems/spring-0.0.2/lib/spring/server.rb:59:in `<main>'

I don't care about bundler, makes more sense to use spring without it.

Let's focus on require issue :)

JRuby Support

I have been playing with the idea of JRuby support for a few days now, and figured that I would see if you would be interested before I put too much work into it.

I have been using drip under JRuby for a little while to help speedup the general process launch case, but I would love to get something working directly with spring.

The only real issue with the current code base (that I can see) under JRuby is the usage of Kernel.fork and Process.spawn. Obviously, running under the JVM fork isn't available.

The easiest (still not simple) solution that I can see is to use the api provided by childprocess and refactor the code where fork and spawn are called to allow them to be called directly from the command line.

It would still use fork under *nix, but under JRuby it would use java.lang.ProcessBuilder to build up a process. Alternatively, we could set childprocess to use posix_spawn mode so that both are on equal footing.

Issues with readline on OS X

When I run spring console I don't see the characters I type. I can still execute the entered command and it will print the response but I don't see anything while typing.

`rails s` ?

Am I missing something, or is there currently no way to replace rails s with spring ___ ?

Confused about binstubs

I'm confused by the suggested use of binstubs.

We use bundle install --binstubs on all of our projects, which creates stubs such as bin/rails, bin/rspec, etc.

But the instructions imply that I should also run spin binstub rspec in order to overwrite the bin/rspec stub with one that uses spin. This feels like a world of pain as bundler and spin continually overwrite each other's binstubs. It's also not clear if spin will precede rspec with bundle exec, since bundler's bin/rspec stub is no longer there.

So how are we supposed to use both bunder and spin binstubs?

Rspec time spent overestimated when using Timecop

When I use Spring to run a spec that calls Timecop, Rspec's time estimate is way high.

$ time spring rspec spec/models/quiz_spec.rb 
.........................................

Finished in 48 minutes 10.14 seconds
41 examples, 0 failures


real    0m11.434s
user    0m0.266s
sys 0m0.054s

That spec has these lines:

      time_now = Time.now()
      time_future = time_now + 16*60 #moving 16 minutes forward (in seconds)
      Timecop.travel(time_future)

Note that Timecop.travel() doesn't execute a block. So it advances time 16 minutes and that must happen three times to account for the 48 minutes. I thought maybe I was using it wrong, but running this spec without Spring works fine:

$ time rspec spec/models/quiz_spec.rb 
Rack::File headers parameter replaces cache_control after Rack 1.5.
.........................................

Finished in 8.88 seconds
41 examples, 0 failures


real    0m15.876s
user    0m11.543s
sys 0m1.708s

Is this a bug or by design?

does not work inside engines

Engines have a different directory structure than rails apps. Spring wants to load config/application.rb to boot up the application. Inside an engine we need to load the dummy application. Otherwise we get:

/Users/senny/Projects/spring/lib/spring/application.rb:30:in `require': cannot load such file -- ./config/application (LoadError)
    from /Users/senny/Projects/spring/lib/spring/application.rb:30:in `start'
    from /Users/senny/Projects/spring/lib/spring/application_manager.rb:67:in `block in start_child'
    from /Users/senny/Projects/spring/lib/spring/application_manager.rb:63:in `fork'
    from /Users/senny/Projects/spring/lib/spring/application_manager.rb:63:in `start_child'
    from /Users/senny/Projects/spring/lib/spring/application_manager.rb:17:in `start'
    from /Users/senny/Projects/spring/lib/spring/application_manager.rb:46:in `block in run'
    from <internal:prelude>:10:in `synchronize'
    from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
    from /Users/senny/Projects/spring/lib/spring/application_manager.rb:36:in `run'
    from /Users/senny/Projects/spring/lib/spring/server.rb:37:in `serve'
    from /Users/senny/Projects/spring/lib/spring/server.rb:29:in `block in boot'
    from /Users/senny/Projects/spring/lib/spring/server.rb:29:in `loop'
    from /Users/senny/Projects/spring/lib/spring/server.rb:29:in `boot'
    from /Users/senny/Projects/spring/lib/spring/server.rb:9:in `boot'
    from -e:1:in `<main>'
/Users/senny/Projects/spring/lib/spring/application_manager.rb:51:in `run': undefined method `chomp' for nil:NilClass (NoMethodError)
    from /Users/senny/Projects/spring/lib/spring/server.rb:37:in `serve'
    from /Users/senny/Projects/spring/lib/spring/server.rb:29:in `block in boot'
    from /Users/senny/Projects/spring/lib/spring/server.rb:29:in `loop'
    from /Users/senny/Projects/spring/lib/spring/server.rb:29:in `boot'
    from /Users/senny/Projects/spring/lib/spring/server.rb:9:in `boot'
    from -e:1:in `<main>'
/Users/senny/Projects/spring/lib/spring.rb:102:in `run_command': undefined method `chomp' for nil:NilClass (NoMethodError)
    from /Users/senny/Projects/spring/lib/spring.rb:56:in `run'
    from /Users/senny/Projects/spring/lib/spring.rb:22:in `run'
    from /Users/senny/Projects/spring/bin/spring:5:in `<top (required)>'
    from bin/spring:16:in `load'
    from bin/spring:16:in `<main>'

stale pid file makes spring unusable

If a process crashes and does not clean up the associated PID file spring won't work until the PID file is removed. The error I get is:

/Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:66:in `ensure in run': undefined method `close' for nil:NilClass (NoMethodError)
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:66:in `run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:19:in `run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/bin/spring:5:in `<top (required)>'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/bin/spring:19:in `load'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/bin/spring:19:in `<main>'

Would it be reasonable to unlink the PID file if the returned socket is nil and re-run the process? Let me know and I'll submit a PR.

crashes when no command is given

When no command is supplied spring crashes with:

/Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/commands.rb:13:in `fetch': key not found: nil (KeyError)
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring/commands.rb:13:in `command'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:72:in `rails_env_for'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:44:in `run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:19:in `run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/bin/spring:5:in `<top (required)>'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/bin/spring:19:in `load'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/bin/spring:19:in `<main>'

I know this is mostly a proof of concept and not refined. I just think I'll log every exception in an issue so you can decide which ones have priority.

cucumber

Any examples of support for cucumber?

Thx

executing spring outside RAILS_ROOT results in NoMethodError

When calling spring outside the RAILS_ROOT directory I get the following error:

/Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:66:in `ensure in run': undefined method `close' for nil:NilClass (NoMethodError)
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:66:in `run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/lib/spring.rb:19:in `run'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/gems/spring-0.0.2/bin/spring:5:in `<top (required)>'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/bin/spring:19:in `load'
    from /Users/senny/.rvm/gems/ruby-1.9.3-p194@equis/bin/spring:19:in `<main>'

This happens for subdirectories of your rails application as well as directories outside a rails app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.