Spork don't run on Ubuntu 10.04 in RubyMine 4.5.4

When I run "Tools -> Run Spork DRb server (spec)" i got error

/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /usr/bin/spork rspec
-e:1:in `load': /usr/bin/spork:11: syntax error, unexpected tLAMBDA, expecting keyword_do_LAMBDA or tLAMBEG (SyntaxError)
    from -e:1:in `<main>'

Process finished with exit code 1

my /usr/bin/spork:

#!/usr/bin/perl -w

eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell
use strict;
use warnings;
use Spork;
our $VERSION = '0.19';

use lib 'lib';

=head1 NAME

spork - The Spork Command Line Utility

=head1 USAGE

    > mkdir my-slideshow
    > cd my-slideshow
    > spork -new
    > spork -make
    > spork -start


Spork is a Perl module for creating standalone HTML slideshows from Kwiki

=head1 AUTHOR

Brian Ingerson <INGY@cpan.org>


Copyright (c) 2004. Brian Ingerson. All rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html


# vim: set ft=perl:

in project using gem 'spork', '>= 0.9.2'
But when I run in console "bundle exec spork" all run normaly.
Run from IDE cause error.

What I can fix this?

Comment actions Permalink


it looks like the /usr/bin/spork is not a ruby spork script (some other package has installed this scipt here :()
One way to fix the problem is to finde where (in your gems) ruby spork binary is located and edit spork run configuration to
use this script instead.
BTW do you use some specific settings of bundler or just default ones?


Comment actions Permalink

You be right.

$ bundle show spork
$ mv /usr/bin/spork /usr/bin/spork.bak
$ cp /var/lib/gems/1.9.1/gems/spork-0.9.2/bin/spork /usr/bin/spork

and it work!
How is it happenens? I don't know. Just install Ubuntu, Ruby, RubyMine ... any way it's work now! :)


But another problem is here. I am add to /.rspec  line: --drb
When I start Spork in IDE and then run RSpec from IDE I see in spork window:

Running tests with args ["--color", "--profile", "--order", "random", "--tag", "~performance", "--format", "Spec::Runner::Formatter::TeamcityFormatter", "--require", "teamcity/spec/runner/formatter/teamcity/formatter" <skipped>

and in RSpec window:

/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /usr/bin/rake spec --trace
Testing started at 10:50 ...
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:test:load_schema (first_time)
** Invoke db:test:purge
** Execute db:test:load_schema
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load

and all this take 8s same as without Spork.
look like runing spec from "rake" not using spork... because if run "bundle exec rspec --drb spec" all spec running in 2s

any idea?

Comment actions Permalink

Hm, how do you run spork?  I think you should apropriate param to it to support rspec.  Also you need to "bootstrap" your rspec tests
(see http://www.jetbrains.com/ruby/webhelp/using-drb-server.html for more information)

Regards, Oleg.

Comment actions Permalink

Spork already bootstraped. When I run "Tools -> Run Spork DRb Server", select "Rspec" and check "Perform bootstrap"

/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /usr/bin/spork rspec --bootstrap
Using RSpec
Already bootstrapped!

When run without "Perform bootstrap":

/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /usr/bin/spork rspec
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
        SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
        This poses a security threat. It is strongly recommended that you
        provide a secret to prevent exploits that may be possible from crafted
        cookies. This will not be supported in future versions of Rack, and
        future versions will even invalidate your existing user cookies.

        Called from: /var/lib/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.

Rack::File headers parameter replaces cache_control after Rack 1.5.
Spork is ready and listening on 8989!

this "SECURITY WARNING" appear in many other places, don't know what he mean, but maybe this not related to problems with Spec in IDE.


require 'spork'
require 'rubygems'

Spork.prefork do
  ENV["RAILS_ENV"] ||= 'test'
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'

  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

  RSpec.configure do |config|
    config.mock_with :rspec
    config.fixture_path = "#{::Rails.root}/spec/fixtures"
    config.use_transactional_fixtures = true
    config.infer_base_class_for_anonymous_controllers = false

Spork.each_run do
  #Подгружаем каждый раз все файлы из директории app/
  Dir["#{Rails.root}/app/**/*.rb"].each {|file| load file }
  #Подгружаем файл с описанием маршрутизации
  load "#{Rails.root}/config/routes.rb"

Comment actions Permalink

I'm neither rails developer (thus I know nothing about the warnings you see) nor full day ruby developer (thus I can not say from the code you provide if it can cause the problems you see).
But I'd suggest to try run both spork and rspec from command line and check if the problem is RM specific or not.
If it is not then I'd suggest to ask your question on spork/rails forums.  If not I could look at this but w/o test to reproduce it may take some time.

Regards, Oleg.

Comment actions Permalink

Sadly, but I can't describe step to reproduce, for this need reinstall system and install all software. No time for this :(  If it help, I can open remote destkop (TeamViewer).

About command line:
If I run "bundle exec rspec spec" or "rspec --drb spec" all test run using Spork. Because he run faster when Spork server run, and say "No DRb server is running. Running in local process instead ..." in case Spork server off.
In IDE I run: Tool -> Run rake task ... -> spec
and get

/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /usr/bin/rake spec[--drb] --trace

So IDE using rake. When I run in console "rake spec [--drb]" all tests run withoun using Spork server.

This issue ralete to "rake", "application settings", "RSpec gem" or "IDE" ?

Comment actions Permalink


based on your description I'd say that it looks like spec rake command is unable to execute specs in spork.  Thus I'd suggest to discuss this with rspec community.
As a short term solution I'd suggest to use "Run all specs in directory" in RM (right click on directory with specs and select this item)

Regards, Oleg.

Comment actions Permalink

I don't know in what way installed my Ruby, and this fact bother me. So I just reinstall Ubuntu and install Ruby with RVM. And all problem with RubyMine is disappear.
There were problems with the OS and Ruby enviroment, not with IDE.
RubyMine is great.

Comment actions Permalink

I'm happy to hear this :)


Please sign in to leave a comment.