jruby, glassfish gem and bundler - glassfish

I wonder if anybody has the following issue:
in a jruby environment, I can do:
gem install glassfish
no problem
But if I add
gem 'glassfish'
to my Gemfile and do
bundle install
it always complain glass fish gem cannot be found.
Any solution to this? Thanks

Do you have source "http://rubygems.org" in your Gemfile? I just tested
source "http://rubygems.org"
gem 'glassfish'
and it was fine:
$ cat > Gemfile
source 'http://rubygems.org'
gem "glassfish"
$ jruby -S bundle install
Fetching source index for http://rubygems.org/
Using rack (1.3.5)
Installing glassfish (1.0.3)
Using bundler (1.0.21)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Having said that, please keep in mind that glassfish gem is not maintained at this time. For the alternatives, please check this blog post: http://www.engineyard.com/blog/2011/taking-stock-jruby-web-servers/

It turned out to be something wrong with the Gemfile.lock. deleted the file and reinstall fixed the issue.

Related

Rails can't install gem sqlite

Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.4.0' succeeds before bundling.
I tried to install earlier version on sqlite, not working.
Tried one of the solutions from stackoverflow :
gem 'sqlite3', '~> 1.3.6'
getting this error
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command sqlite3,
Please help i'm new in Rails , this is my first project in rails.
Add gem 'sqlite3' to Gemfile in the root directory of your rails project. Then run bundle install and it should install sqlite and make it available to use in your rails project.
Specify git and branch for the gem sqlite3 in your Gemfile should fix the problem.
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
For more info
https://medium.com/#declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b
cannot load such file — sqlite3/sqlite3_native (LoadError) Ruby on Rails
Replace gem 'sqlite3' with gem 'sqlite3', '~> 1.3.11' which is in Gemfile in the root directory of your rails project. Then run bundle install.

how can I resolve this gemfile conflict

I'm getting this error after bundle install. How can I fix it?
Bundler could not find compatible versions for gem "excon":
In Gemfile:
locomotive-heroku (~> 0.0.2) ruby depends on
excon (~> 0.9.4) ruby
excon (0.20.0)
Uninstall the latest version of the gem: gem uninstall excon -v=0.20.0. Then bundle install again to see if it resolved the problem.
i fixed it by putting the locations for the current repos for locomotive/engine and locomotive/heroku. I.e gem 'locomotive-heroku', git: 'repolocation', require: 'locomotive/heroku' This is also what eventually got me a working installation of locomotivecms on heroku. I did need to set it to compile assets in the production environment.

ruby_threadptr_data_type error

I'm starting up a new rails app with the latest version of rails (3.1.3). Rails crashes when I try to start up the server. First I fixed this bug, and now I'm getting this one
ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_threadptr_data_type
There's a discussion about this going on here, but I can't make enough sense of it to get things to work.
UPDATE
I updated the version of ruby-debug
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
and have now moved on to this error
linecache19-0.5.12/lib/trace_nums19.so: undefined symbol: ruby_current_thread
Ok, it turns out that both ruby-debug and linecache needed to be manually updated to the latest versions. These lines in my gemfile did the trick
gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
gem 'ruby-debug19'
To run specs, you need to run bundle exec rspec -d spec
At last I found the problem. The debugger in RubyMine starts without bundle exec, so it doesn't use linecache19 from git. You need to install it manually.
Resolution of the problem found here: http://youtrack.jetbrains.com/issue/RUBY-9418?projectKey=RUBY
gem uninstall linecache19
gem uninstall ruby-debug-base19x
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
gem install linecache19-0.5.13.gem
gem install ruby-debug-base19x –-pre
Make sure to uninstall all linecache19 and ruby-debug-base19x!
The following lines worked for me:
gem 'linecache19'
gem 'ruby-debug-base19x'
gem 'ruby-debug19', :require => 'ruby-debug'
(Hat tip to declan. His comment didn't work for me, but it gave me the idea to add linecache19.)
after trying all advise on stackoverflow, the following combination worked for me
gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
gem 'ruby-debug19'
I'm running Rails 3.1.3 on Ruby 1.9.3-p0 with RVM
when I set :require => 'ruby-debug' the server would not start.
It's repost from this
I also ran into this, and found the solution in Ruby 1.9.3 and ruby-debug. You need to install not-yet-officially-released versions of ruby-debug-base19 and linecache19. The currently released versions indeed cause the exception you had.
Use this gist.
#To install ruby-debug on Ubuntu ruby-1.9.3 you need to download from http://rubyforge.org/frs/?group_id=8883
linecache19-0.5.13.gem
ruby_core_source-0.1.5.gem
ruby-debug19-0.11.6.gem
ruby-debug-base19-0.11.26.gem
#Then in your console
export RVM_SRC=/your/path/to/ruby-1.9.3
# Note, your source path should be something like /home/user/.rvm/src/ruby-1.9.3-p0
gem install archive-tar-minitar
gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=/$RVM_SRC
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug19-0.11.6.gem -- --with-ruby-include=/$RVM_SRC
I tried it and it's work!
This is solve of our problems.

Bundler could not find compatible versions for gem

I've added a gem 'koala' to my Gemfile and seems to have thrown gem versions out of whack when I run the 'bundle install' command:
Bundler could not find compatible versions for gem "faraday":
In snapshot (Gemfile.lock):
faraday (0.6.1)
In Gemfile:
koala (~> 1.2.0beta1) depends on
faraday (~> 0.7.4)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
How can I resolve this conflict?
Delete the contents of Gemfile.lock, and run bundle install again. That's been working for me.
Did you run bundle update as the error message points out? bundle install handles changes to the Gemfile and bundle update upgrades gems that are already managed by Bundler. The Gemfile.lock file locks in version numbers, bundle update will update any of those that aren't directly specified in your Gemfile (like gem 'rails', '3.0.9').
Deleting the Gemfile.lock will work, but running bundle update is better.
You can't simply delete you Gemfile.lock if that is a solution then why Gemfile.lock is exist in the first place, you code depend on the versions locked in this file, try to only update the Gem which cause the conflict by using bundle update gem_name and you have to check the ReadMe if any changes needed to work with the new version otherwise you are breaking your code or others code.
I found that by removing the specified version of rails solved the problem for me ....
instead of:
gem rails, '4.0.4'
I did
gem rails
followed by deleting the Gemfile.lock and re-running bundle install
If deleting Gemfile.lock doesn't work there is another possibility:
It may be possible a gem you are depending on has inadvertently included its own Gemfile.lock in its .gem file. The solution is to update the offending gems to not include a Gemfile.lock, rebuild and reinstall.
An alternative is to go to your Gemfile.lock and delete all references to the offending gem (in this case the faraday gem).
Then run bundle install and it'll update the Gemfile.lock to have compatible versions of the gem where it needs.
If you want to be extra safe you can go to the Gemfile and specify the versions of the gems you want before doing this.
This was the only way I was able to get bundle install running for one of the systems that I'm maintaining.
This system has a lot of old gems in its dependencies (58 gems at the time of writing) and so bundler has a hard time coping with it.
If I delete the Gemfile.lock and run bundle install it'll blow up with multiple Bundler could not find compatible versions for gem xxxxxx errors.
If I run bundle update it would also blow up with multiple Bundler could not find compatible versions for gem xxxxxx errors.
Note: Removing Gemfile.lock will have new entried to different gems. This might not be acceptable in your project. Your team or lead will not allow this.
If you are working on legacy codebase, for example Rails 3.2 or similar
In case you hit this kind of errors,
see the last line of Gemfile.lock which seems like
whenever (~> 0.9.4)
wicked_pdf (= 1.1.0)
will_paginate (= 3.1.8)
wkhtmltopdf-binary-edge (~> 0.12.4.0)
BUNDLED WITH
1.16.6
now install the version of bundler mentioned in the file. In my case its1.16.6.
gem install bundler -v 1.16.6
now remove the older version. How?
$ gem uninstall bundler
Select gem to uninstall:
1. bundler-1.16.6
2. bundler-2.1.4
3. All versions
> 2
Successfully uninstalled bundler-2.1.4
$ bundle -v
Bundler version 1.16.6
Now it will install successfully

Heroku error when launch rails3.1 app missing postgres gem

I am trying to deploy to heroku.
Rails 3.1.0.rc4,
I get the following error from Heroku logs:
Starting process with command: `thin -p 48902 -e production -R /home/heroku_rack/heroku.ru start`
2011-06-20T11:25:44+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (RuntimeError)
I tried to install the activerecord-postgresql-adapter but then I get this error:
Could not find gem 'activerecord-postgresql-adapter (>= 0)' in any of the gem sources listed in your Gemfile.
So I tried to add this to my gem file
gem 'pg'
which produced this error:
Installing pg (0.11.0) with native extensions /Users/imac/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
any ideas?
You don't have to install Postgres locally. In your Gemfile, put 'pg' in group :production, as johnny-grass suggests, and then when you run bundle, just specify --without production, like this:
bundle --without production
Unfortunately, you have to remember this argument when you run bundler, but at least you don't have to install and maintain postgres locally.
Please note that Heroku "strongly recommends against" using sqlite, saying that "Your production and development environment should be as close to identical as possible" http://devcenter.heroku.com/articles/rails3
Do you have PostgreSQL installed on your computer? If you don't then install it first, then install the pg gem.
# gemfile
group :production do
gem 'therubyracer-heroku', '0.8.1.pre3' # you will need this too
gem 'pg'
end
I found a solution in this Heroku article.
As Jared said, they suggest to create a different group for postgresql.