Ruby. Errors. DataMapper - ruby

Try to use DataMapper on my macbook and got such error:
/Users/roger/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems
/specification.rb:2288:in `raise_if_conflicts':
Unable to activate dm-serializer-1.2.2, because json-2.1.0 conflicts
with json (~> 1.6) (Gem::ConflictError)
I try to uninstall JSON and install new. But if before ruby complain about JSON 1.6 now it complain about 2.10.
What to do I don't know..
Same script on my Ubuntu server work with DataMapper without problem but got Selenium error:
/usr/lib/ruby/2.3.0/net/protocol.rb:158:in `rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
from /usr/lib/ruby/2.3.0/net/protocol.rb:136:in `readuntil'
from /usr/lib/ruby/2.3.0/net/protocol.rb:146:in `readline'
from /usr/lib/ruby/2.3.0/net/http/response.rb:40:in `read_status_line'
from /usr/lib/ruby/2.3.0/net/http/response.rb:29:in `read_new'
from /usr/lib/ruby/2.3.0/net/http.rb:1437:in `block in transport_request'
from /usr/lib/ruby/2.3.0/net/http.rb:1434:in `catch'
from /usr/lib/ruby/2.3.0/net/http.rb:1434:in `transport_request'
from /usr/lib/ruby/2.3.0/net/http.rb:1407:in `request'
from /usr/lib/ruby/2.3.0/net/http.rb:1400:in `block in request'
from /usr/lib/ruby/2.3.0/net/http.rb:853:in `start'
from /usr/lib/ruby/2.3.0/net/http.rb:1398:in `request'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/remote/http/default.rb:124:in `response_for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/remote/http/default.rb:78:in `request'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/remote/http/common.rb:61:in `call'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/remote/bridge.rb:170:in `execute'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/remote/bridge.rb:103:in `create_session'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/firefox/marionette/driver.rb:56:in `initialize'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/firefox/driver.rb:33:in `new'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/firefox/driver.rb:33:in `new'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver/common/driver.rb:54:in `for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.4.3/lib/selenium/webdriver.rb:86:in `for'
from selen_serv.rb:19:in `<main>'
Script header:
require 'nokogiri'
require 'selenium-webdriver'
require 'rspec/expectations'
require 'headless'
require 'pp'
require 'json'
require 'rubygems'
require 'data_mapper'
require 'dm-core'
require 'dm-validations'
require 'dm-timestamps'
TEST_DIR = File.expand_path(File.dirname(__FILE__))
TEST_FILES = File.join(TEST_DIR, "test_files")
TEST_OUTPUT = File.join(TEST_DIR, "test_output")
CHROMEDRIVER_FN = File.join(File.absolute_path('..', TEST_DIR), "/usr/local/bin", "chromedriver")
#browser = Selenium::WebDriver.for :firefox
bash-3.2$ bundler
Resolving dependencies...
Bundler could not find compatible versions for gem "json_pure":
In Gemfile:
data_mapper was resolved to 1.2.0, which depends on
dm-serializer (~> 1.2.0) was resolved to 1.2.2, which depends on
json_pure (~> 1.6)
Could not find gem 'json_pure (~> 1.6)', which is required by gem 'dm-serializer (~> 1.2.0)', in any of the sources.

Related

ruby on rails upgrade asset precompilation failure

I have a rails 4.2 application I am in the process of upgrading from 3.2. Something is going wrong with asset precomiplation but I'm not sure what I am missing.
#Gemfile
gem 'rails', '~> 4.2.7.1'
ruby "2.3.3"
gem 'jquery-rails', '2.1.4'
gem 'jquery-ui-rails', '4.2.1'
gem 'activeadmin'
gem 'sprockets-rails', '2.3.3
Here is the active_admin.js
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require select2
//= require active_admin/base
//= require best_in_place
//= require best_in_place.jquery-ui
//= require activeadmin-sortable
The asset precompilation fails here
$ bundle exec rake assets:precompile
I, [2018-02-28T10:58:20.467128 #6312] INFO -- : Writing /home/nellis/src/circle2/public/assets/style-6150d2089bcada194fcfda8d38d0046cadfe7a754b6b477226d1b701cda7e197.css.gz
rake aborted!
Sprockets::FileNotFound: couldn't find file 'jquery_ujs' with type 'application/javascript'
Checked in these paths:
/home/nellis/src/circle2/app/assets/fonts
/home/nellis/src/circle2/app/assets/images
/home/nellis/src/circle2/app/assets/javascripts
/home/nellis/src/circle2/app/assets/stylesheets
/home/nellis/src/circle2/vendor/assets/javascripts
/home/nellis/src/circle2/vendor/assets/stylesheets
/home/nellis/src/circle2/public/vendor
/home/nellis/src/circle2/app/assets/javascripts/active_admin.js:2
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/resolve.rb:65:in `resolve!'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:399:in `resolve'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:207:in `process_require_directive'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:180:in `block in process_directives'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:178:in `each'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:178:in `process_directives'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:83:in `_call'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb:68:in `call'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:23:in `block in call'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/utils.rb:200:in `dfs'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:24:in `call'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:134:in `block in find'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:133:in `each'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:133:in `find'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
/home/nellis/.rvm/gems/ruby-2.3.3/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/home/nellis/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `eval'
/home/nellis/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
zlib(finalizer): Zlib::GzipWriter object must be closed explicitly.
zlib(finalizer): the stream was freed prematurely.
All the questions I read just say run bundle install and make sure the gems are in your Gemfile which they are.
Hard to say what's going on without knowing more about your configuration, but it might be a loading issue. jquery-rails puts the actual .js files in vendor/assets/javascripts, which might not be in your load path for whatever reason. You might try two things:
First try running the generator that comes with the gem to see if it fixes the paths in the manifest file:
rails generate jquery:install #--ui to enable jQuery UI
If that doesn't work, and don't want to upgrade jquery-rails, you might have to do something like this
//= require vendor/assets/javascripts/jquery.js
//= require vendor/assets/javascripts/jquery_ujs.js
//= require vendor/assets/javascripts/jquery-ui.js
If I were you I would upgrade

rake aborted! uninitialized constant Logging::Logger::INFO - Namespace collision with WinRM and Albacore

Ruby/Rake NOOB and have inherited set of C# projects that use ruby & rake for build/deploy.
The build quit working last week because of an old gem. In the process of updating all gems to recent versions, I've run into this uninitialized constant problem.
There were no code changes involved and I tried adding "require 'logging'" to setup.rb.
I've been working under the assumption that the problem is in our rake files, but after pounding on this for hours I'm not so sure. I haven't found anyplace in our code that uses the constant.
Any suggestions or help appreciated.
Windows Server 2008 with Ruby 2.0.0.
gem list output:
*** LOCAL GEMS ***
akami (1.2.1)
albacore (0.3.6)
aws-sdk (1.38.0)
bigdecimal (1.2.0)
builder (3.2.2)
bundler (1.6.0)
ffi (1.9.3 x86-mingw32)
gssapi (1.0.3)
gyoku (1.1.1)
httpclient (2.3.4.1)
httpi (0.9.7)
io-console (0.4.2)
json (1.8.1, 1.7.7)
little-plugger (1.1.3)
logging (1.8.2)
mini_portile (0.5.3)
minitest (4.3.2)
multi_json (1.9.2)
nokogiri (1.6.1 x86-mingw32)
nori (1.1.5)
psych (2.0.0)
rack (1.5.2)
rake (0.9.6)
rdoc (4.0.0)
rubyntlm (0.1.1)
rubyzip (0.9.9)
savon (0.9.5)
test-unit (2.0.0.0)
uuidtools (2.1.4)
wasabi (1.0.0)
win32-service (0.8.4)
winrm (1.1.3)
and the rake output:
rake aborted!
uninitialized constant Logging::Logger::INFO
C:/Ruby200/lib/ruby/2.0.0/rake/ext/module.rb:36:in `const_missing'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/albacore-0.3.6/lib/albacore/support/logging.rb:7:in `initialize'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/albacore-0.3.6/lib/albacore/support/failure.rb:7:in `initialize'
C:/Ruby200/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:13:in `initialize'
C:/Ruby200/lib/ruby/2.0.0/psych/nodes/node.rb:35:in `new'
C:/Ruby200/lib/ruby/2.0.0/psych/nodes/node.rb:35:in `to_ruby'
C:/Ruby200/lib/ruby/2.0.0/psych.rb:130:in `load'
C:/build-dir/MV-MB-JOB1/deploy/setup.rb:5:in `block in <top (required)>'
C:/build-dir/MV-MB-JOB1/deploy/setup.rb:5:in `open'
C:/build-dir/MV-MB-JOB1/deploy/setup.rb:5:in `<top (required)>'
C:/build-dir/MV-MB-JOB1/deploy/rakefile.rb:15:in `require_relative'
C:/build-dir/MV-MB-JOB1/deploy/rakefile.rb:15:in `<top (required)>'
C:/Ruby200/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load'
C:/Ruby200/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load_rakefile'
C:/Ruby200/lib/ruby/2.0.0/rake/application.rb:604:in `raw_load_rakefile'
C:/Ruby200/lib/ruby/2.0.0/rake/application.rb:89:in `block in load_rakefile'
C:/Ruby200/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
C:/Ruby200/lib/ruby/2.0.0/rake/application.rb:88:in `load_rakefile'
C:/Ruby200/lib/ruby/2.0.0/rake/application.rb:72:in `block in run'
C:/Ruby200/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
C:/Ruby200/lib/ruby/2.0.0/rake/application.rb:70:in `run'
C:/Ruby200/bin/rake:37:in `<main>'
setup.rb:
require "yaml"
#environment = ENV["environment"] || "development"
#version = ENV["version"] || "none"
#configuration = File.open(File.join("environment", #environment, "global_config.yml"), "rb") {|f| YAML::load(f)}
#configuration.merge!({:environment => #environment,
:version => #version,
:repository_path => ENV["repository_path"]})
There seems to be a namespace collision between the WinRM and Albacore gems AND WinRM uses the 'logging' gem, Albacore uses 'logger'. Both define Logger.
Using the following command:
rake -f myTest.rb --trace
This works:
require "winrm"`
require "albacore"
task :default do
end
This does not:
require "albacore"
require "winrm"
task :default do
end
Albacore implements lib\albacore\support\logging.rb:
require 'logger'
module Logging
attr_accessor :logger, :current_log_device
def initialize
create_logger(STDOUT, Logger::INFO)
super()
end
def log_device=(logdev)
level = #logger.level
create_logger(logdev, level)
end
.
.
.
end
WinRm does the following in winrm.rb:
require 'date'
require 'kconv' if(RUBY_VERSION.start_with? '1.9') # bug in rubyntlm with ruby 1.9.x
require 'logging'
module WinRM
Logging.logger.root.level = :info
Logging.logger.root.appenders = Logging.appenders.stdout
end
require 'winrm/helpers/iso8601_duration'
require 'winrm/soap_provider'
Not suggesting this as an appropriate fix, but wrapping the Albacore Logging module in another module, and updating Albacore references to Logging (Albacore::Logging), solves the problem.
Altered lib\albacore\support\logging.rb:
module Albacore
module Logging
.
.
.
end
end
Update:
I opened an Albacore issue. 2.0.0.rc.10, released today, includes a fix for the name collision issue. However, migrating from pre-2.0 Albacore to 2.0.0 is not pain-free because some of the task types have been generalized. Albacore nunit has been replaced by task_runner. Albacore msbuild is now simply 'build'.
The conflict can also be solved by moving the require down in to the task that needs it, as such:
require "albacore"
task :default do
...
end
task :some_winrm_task do
require "winrm"
...
end

Can't start Mongoid with Sinatra

I'm trying to get started with Mongoid in a Sinatra app, but it looks like I'm running into dependency issues. If it helps, I'm on a Macbook Pro using RVM and running Ruby 1.9.3.
Here are the errors I'm getting after running $ ruby config.ru:
/Users/duncanmalashock/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate mongoid-3.0.23, because activemodel-4.0.0 conflicts with activemodel (~> 3.1) (Gem::LoadError)
from /Users/duncanmalashock/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems/specification.rb:746:in `activate'
from /Users/duncanmalashock/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate'
from /Users/duncanmalashock/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems.rb:209:in `try_activate'
from /Users/duncanmalashock/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /Users/duncanmalashock/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/duncanmalashock/Penumbra/penumbra.rb:4:in `<top (required)>'
from /Users/duncanmalashock/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/duncanmalashock/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from config.ru:2:in `<main>'
Can anyone help?
Here are the files involved:
mongoid.yml:
development:
sessions:
default:
database: mongoid
hosts:
- localhost:27017
config.ru:
require 'sinatra'
require './penumbra'
run Sinatra::Application
Gemfile:
source :rubygems
source :rubyforge
# Thin Server
gem 'thin'
# Sinatra
gem 'sinatra'
gem 'sinatra-contrib', :require => 'sinatra/multi_route'
gem 'sinatra-partial', :require => 'sinatra/partial'
gem 'sinatra-reloader'
# MongoDB
gem "mongoid"
# Shopify
gem 'shopify_api'
penumbra.rb:
require 'sinatra'
require 'shopify_api'
require 'mongo'
require 'mongoid'
require 'json'
require "sinatra/reloader" if development?
Mongoid.load!("./mongoid.yml", :production)
def isactivepage(link_name)
if (link_name == #page_name)
return ' activelink'
else return ''
end
end
get '/' do
#page_name = "Home"
erb :"pages/index"
end
get '/about' do
#page_name = "About"
erb :"pages/about"
end
After running $ bundle exec rackup:
/Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/mongoid-1.0.6/lib/mongoid.rb:68:in `method_missing': undefined method `load!' for #<Mongoid::Config:0x007fc0838cb1d0> (NoMethodError)
from /Users/duncanmalashock/Penumbra/penumbra.rb:9:in `<top (required)>'
from /Users/duncanmalashock/Penumbra/config.ru:2:in `require'
from /Users/duncanmalashock/Penumbra/config.ru:2:in `block in <main>'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/duncanmalashock/Penumbra/config.ru:in `new'
from /Users/duncanmalashock/Penumbra/config.ru:in `<main>'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:250:in `start'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:141:in `start'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/bin/rackup:4:in `<top (required)>'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/bin/rackup:23:in `load'
from /Users/duncanmalashock/.rvm/gems/ruby-1.9.3-p448/bin/rackup:23:in `<main>'
You have a Gemfile, but you’re not starting your app using Bundler, and that’s why you have the conflict.
The current version of shopify_api (3.0.3) has a dependency on activemodel via activeresource with the version requirements set to >=3.0.0. On your system you have Rails 4 installed, so activemodel 4.0 is loaded.
The current version of mongoid also has a dependency on activemodel, but this time the version requirement is ~> 3.2.
These two version requirements are not compatible, so you get the error activemodel-4.0.0 conflicts with activemodel (~> 3.1).
To fix it, simply use Bundler to start your app. You say you are running with $ ruby config.ru but this isn’t the correct way to use a config.ru (you would get errors later even if you fixed your dependency issues). You should use rackup. In this case you should run:
$ bundle exec rackup

What is wrong with my installation of Ruby Watir::WebDriver?

I'm trying to run Watir for Ruby on Ubuntu 10.04. I've installed Chrome and ChromeDriver on my (displayless) server, and installed the selenium-webdriver Gem. But when I try to create a browser in Watir, I get:
$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'watir-webdriver'
=> true
irb(main):003:0> browser = Watir::Browser.new :chrome
NoMethodError: undefined method `closed?' for nil:NilClass
from /usr/lib/ruby/1.8/net/http.rb:1060:in `request'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/bridge.rb:92:in `create_session'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/chrome/bridge.rb:29:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver.rb:65:in `for'
from /usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.5.5/lib/watir-webdriver/browser.rb:35:in `initialize'
from (irb):3:in `new'
from (irb):3
from :0
irb(main):004:0>
Long pause after the "Watir::Browser.new" call, I'm assuming some sort of timeout? Maybe trying to talk with Chromedriver? I'm running these versions of the relevant Gems:
$ gem list
*** LOCAL GEMS ***
addressable (2.3.2)
childprocess (0.3.6)
fastercsv (1.5.5)
ffi (1.2.0, 1.0.11)
libwebsocket (0.1.3)
multi_json (1.3.7, 1.0.4)
rubygems-update (1.8.24)
rubyzip (0.9.9)
selenium-webdriver (2.26.0, 2.18.0)
watir-webdriver (0.5.5)
websocket (1.0.3)
yajl-ruby (1.1.0)
I'm trying to run Chrome headless, and I didn't have an X server running. Xvfb did the trick, and I'm working now:
http://en.wikipedia.org/wiki/Xvfb
http://blog.kagesenshi.org/2007/06/running-x-applications-headless-using.html

HTTP Path Empty Error when using JRuby Watir

I have installed JRuby 1.6.7.2 (64bit), and the JDK 1.7.x (64-bit) on my Windows 7 machine. Right now I'm just trying to launch a browser (Firefox 13.0) using Watir but I keep getting an HTTP error that seems to be coming internally from JRuby + gems. I have installed the gems using the following commands:
jgem install watir-webdriver
jgem install rspec
jgem install capybara
jgem install page-object
jgem install bundler
jgem install jruby-jars
Here is the stacktrace error I get when I try to open a browser using Watir:
C:\Windows\System32>jirb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'watir-webdriver'
=> true
irb(main):003:0> b = Watir::Browser.start("http://www.google.com", :firefox)
[WARNING] MultiJson is using the default adapter (ok_json). We recommend loading
a different JSON library to improve performance.
ArgumentError: HTTP request path is empty
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/net/http.rb:1476:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/net/http.rb:1594:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/http/default.rb:64:in `new_request_for'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/http/default.rb:34:in `request'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/http/default.rb:57:in `request'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/bridge.rb:92:in `create_session'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/firefox/bridge.rb:28:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver/common/driver.rb:31:in `for'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/selenium-webdriver-2.2
2.2/lib/selenium/webdriver.rb:65:in `for'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/
lib/watir-webdriver/browser.rb:35:in `initialize'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/
lib/watir-webdriver/browser.rb:18:in `start'
from (irb):3:in `evaluate'
from org/jruby/RubyKernel.java:1083:in `eval'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:158:in `eval_input'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:271:in `signal_status'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1183:in `catch'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:154:in `eval_input'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1183:in `catch'
from C:/Ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:70:in `start'
from C:\Ruby\jruby-1.6.7.2\bin\jirb:13:in `(root)'irb(main):004:0>
I have the selenium webdrivers ie & chrome added to my classpath. When I execute this command with ie or chrome I get a similar HTTP error. Is this a fix I have to do manually to the gem files?
I had the same error with the watir-webdriver gem.
The problem were the http proxy settings and the solution was to add the no_proxy env before the code.
ENV['no_proxy'] = "127.0.0.1"
I hope that can help you!

Resources