Closed recurser closed 10 years ago
Hey @recurser, this behavior is symptomatic of your jasmine tasks being defined multiple times. I was able to create a new rails 4 project, added the bleeding edge master jasmine-gem to my Gemfile
and saw that rake jasmine:ci
still worked.
Taking a look at your project, it seems like your Rakefile
is the problem
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
JasmineTest::Application.load_tasks
require 'jasmine'
# <<<<<this line causes the tasks to be defined again>>>>>
load 'jasmine/tasks/jasmine.rake'
Aha, I used 'jasmine init' rather than the generator, and it must have added that line. No 'address in use' problem when that line is removed.
Thanks!
Sounds like there is a real bug here then. Running jasmine init
from inside a rails project is supposed to raise an exception.
https://github.com/pivotal/jasmine-gem/blob/master/lib/jasmine/command_line_tool.rb#L93
The bug is that this code assumes its current working directory is Rails.root
, which is not guaranteed to be true. Unless you ran jasmine init --force
, in which case it doesn't check at all.
@tjarratt sorry, it did raise an exception - I ran jasmine init --force
. I tried running the rails generator but it complained that the generator didn't exist (which may be a bug?) so I used jasmine init
instead.
The generator won't necessarily be found if you only install jasmine under the Gemfile test group (which many people do). You want it in test & development. If that was the case and you still didn't see the generator, sounds like we have a railtie bug.
@ragaskar yes jasmine was included under both test and development - see this example Gemfile.
The generator doesn't appear to be available for this test app:
> rails g jasmine:init
Could not find generator jasmine:init.
@recurser It's currently set up to be rails g jasmine:install
for rails projects and jasmine init
otherwise. rails g jasmine:install
seems to work correctly in your sample project.
Maybe the change that should be made is to make both of them consistent. Although I could see how the two different commands highlight that they do different things and are for different types of projects.
@sheelc thanks, jasmine:install
works as expected. It was the output of jasmine init
that was confusing me:
jasmine init
You're attempting to run jasmine init in a Rails project. You probably want to use the Rails generator like so:
rails g jasmine:init
If you're not actually in a Rails application, just run this command again with --force
jasmine init --force
I've added a pull request to update the help message.
Ah yes, that is pretty confusing. Thanks for the pull; I'll merge it in after Travis is finished with the build.
Thanks @sheelc
Running
rake jasmine:ci
on master seems to fail every time with anAddress already in use
error, no matter what port I specify. I've tried a variety of ports, and checked that nothing is running on the port usinglsof -wni | grep <PORT NUMBER>
.There's a bare-bones rails install that exhibits the problem locally here: https://github.com/recurser/jasmine-2.0.0-address-already-in-use
rake jasmine
works as expected.