Closed merongivian closed 8 years ago
@merongivian Did you include the dependencies from the README in your Gemfile? Rack is a dependency of sprockets and Opal depends on sprockets, so you should have rackup.
@wied03 i have this inside the gemspec file:
spec.add_dependency 'opal-browser'
spec.add_dependency 'opal-audio'
spec.add_runtime_dependency "opal", ">= 0.7.0", "<= 0.9.0"
spec.add_development_dependency "bundler", "~> 1.9"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "opal-rspec", "~> 0.5.0"
Can you run Karma outside of Travis? In your Travis before_install
section, have you tried adding bundle exec rackup --version
to the before_script
section and checking the output?
@wied03 i fixed the spec-json
missing package, so now it works locally, im getting this for before_script
still:
0.32s$ bundle exec rackup --version
bundler: command not found: rackup
Install missing gem executables with `bundle install`
The command "bundle exec rackup --version" failed and exited with 127 during .
Your build has been stopped.
@merongivian - A couple things:
bundle install
for you because it assumes you are not doing anything Ruby related. You need to add bundle install
as a before_install
or before_script
command. You may need to consult the Travis documentation about ensuring a Ruby is available via RVM to run that.If you look at this project's Travis config, you'll see that we have a Ruby config that we add a (newer version of) nodejs on top of. You're coming at it from the opposite direction, which is fine.
@wied03 yea indeed you were right, i had to add ruby in the travis conf.... I run into other problem though, Karma won't load other gems paths i have as dependencies, this gems are opal gems, one is opal-browser
and the other os opal-audio
, this is my config.ru
which works when i run the tests locally on firefox:
require 'opal/rspec'
require 'opal-browser'
require 'opal-audio'
sprockets_env = Opal::RSpec::SprocketsEnvironment.new
run Opal::Server.new(sprockets: sprockets_env) { |s|
s.main = 'opal/rspec/sprockets_runner'
s.append_path 'opal'
sprockets_env.add_spec_paths_to_sprockets
s.debug = false
}
i got this error when i run karma locally, which can't find the browser
file from opal-browser
:
[2016-01-27 12:18:05] INFO WEBrick 1.3.1
[2016-01-27 12:18:05] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
[2016-01-27 12:18:05] INFO WEBrick::HTTPServer#start: pid=48150 port=9292
Sprockets::FileNotFound: couldn't find file 'browser' with type 'application/javascript'
Im aware this is a diferent issue :), let me know if a should open a new one
It looks like you're hitting a case I hadn't planned for. In my case the only time I've used other opal GEMs is with Rails, in which case this Karma project boots up the rails environment and the asset paths get appended to. I opened a separate issue (#16) for that.
@merongivian - try out a development version and see if that fixes your problem. If it does, let me know and I'll create another release. The feature is documented at https://github.com/wied03/karma-opal-rspec/blob/enhancement/16/README.md under 'Additional Requires'
To use this from github, in your package.json dependencies:
{"karma-opal-rspec": "wied03/karma-opal-rspec#enhancement/16"}
@wied03 it worked :+1: thanks, yea let me know when u realize this, im planning to use this in other opal gems i have
I will say this. If you have your assets in your Gemfile, Bundler will require them automatically unless you use require: false
. This wouldn't be necessary in that case. I can understand though that, being a runtime dependency, you wouldn't want to duplicate those deps in the Gemfile.
@merongivian - 1.0.10 is released. That said, I think you should be able to remove the mriRequires stuff from your Karma config because I tackled the bigger picture problem of Bundler.require
When running travis with karma i get the following
then it gets stucked on bundle install, here is my package.json :
and my karma config: