Bundler: is bundle viz the only way to show the dependencies? - bundler

I don't have Graphviz on this machine and don't wish to install it, so an alternative, the terminal being preferred, would be good.
Bundler v1.1.5

Gemfile.lock shows dependencies:
view Gemfile.lock
e.g.
GEM
remote: http://rubygems.org/
specs:
ZenTest (4.5.0)
aaronh-chronic (0.3.9)
abstract (1.0.0)
actionmailer (3.0.19)
actionpack (= 3.0.19)
mail (~> 2.2.19)
actionpack (3.0.19)
activemodel (= 3.0.19)
activesupport (= 3.0.19)
...

Related

ActiveRecord requires ruby version >= 2.2.2

I need activerecord for rake, but when i try to install it it says:
activesupport-5.0.0.1 requires ruby version >= 2.2.2,
which is incompatible with the current version, ruby 1.9.3p484
I tried changing ruby with rbenv to 2.2.2
rbenv versions
outputs
system
* 2.2.2 (set by /home/user/.rbenv/version)
2.3.1
But when i go ruby -v it says
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
Also tried removing it but when i install rake
sudo apt-get install rake
and I get this output
The following extra packages will be installed:
libruby1.9.1 ruby ruby1.9.1
But, I need ruby version 2.2.2 or later to be active (ruby -v) to install active record so i can do the rake command.
You are messing things up.
sudo apt-get install rake
is a system wide debian package, that knows nothing about rbenv. Remove it as well as you have system ruby removed.
Afterwards, do:
rbenv global 2.2.2
gem install rake # ⇐ THIS
I had help with this one and resolved it. In my case i changed gemfile.lock from
GEM
remote: http://rubygems.org/
specs:
activemodel (5.0.0.1)
activesupport (= 5.0.0.1)
activerecord (5.0.0.1)
activemodel (= 5.0.0.1)
activesupport (= 5.0.0.1)
arel (~> 7.0)
activesupport (5.0.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (7.1.4)
concurrent-ruby (1.0.2)
i18n (0.7.0)
minitest (5.9.1)
mysql2 (0.4.5)
rake (11.3.0)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
PLATFORMS
ruby
DEPENDENCIES
activerecord
mysql2
rake
BUNDLED WITH
1.13.6
to this one (most important is activerecord version):
GEM
remote: http://rubygems.org/
specs:
activemodel (3.1.3)
activesupport (= 3.1.3)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activesupport (3.1.3)
multi_json (~> 1.0)
arel (2.2.1)
builder (3.0.0)
i18n (0.6.0)
multi_json (1.0.4)
mysql2 (0.3.11)
rake (0.9.2.2)
tzinfo (0.3.31)
PLATFORMS
ruby
DEPENDENCIES
activerecord
mysql2
rake
BUNDLED WITH
1.13.6
And then installed activerecord and all other that i needed
gem install activerecord -v 3.1.3
sudo apt-get install libmysqlclient-dev
sudo apt-get install ruby1.9.1-dev
gem install activerecord-mysql2-adapter
gem uninstall mysql2
gem install mysql -v 0.3.11
And the rake worked.
rake db:migrate[]
Hope this will help someone! :)

Fail to push to heroku

Likely not the best way to migrate a rails 3 app to a rails 4 one, but I just deleted all the files (except for hidden .git files) and re-built a static webapp with no database or unit tests (rails new testapp -O --skip-bundle -T). Everything works fine on my localhost. I deleted then ran bundle install to re-create my Gemfile.lock.
I've also tested adding config.serve_static_assets = true; in config/application.rb but continue to see warning that "Detected Rails is not set to serve static_assets."
Here are the contents of my Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.2'
group :development do
#gem 'sqlite3', '1.3.8'
end
group :production do
gem 'rails_12factor' # for heroku
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
And here is the output I get when trying to push to Heroku:
me-mbp:testapp me$ git push heroku master
Fetching repository, done.
Counting objects: 275, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (197/197), done.
Writing objects: 100% (211/211), 56.08 KiB | 0 bytes/s, done.
Total 211 (delta 117), reused 3 (delta 0)
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
/tmp/build_25e2c7af-af3f-4901-8e75-4d3e12337bf8/Gemfile:2:in `evaluate': undefined method `ruby' for #<Bundler::Dsl:0x000000025d3c78> (NoMethodError)
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/dsl.rb:7:in `instance_eval'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/dsl.rb:7:in `evaluate'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/definition.rb:17:in `build'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler.rb:128:in `definition'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/bin/bundle:13:in `<top (required)>'
from /usr/ruby1.9.2/bin/bundle:19:in `load'
from /usr/ruby1.9.2/bin/bundle:19:in `<main>'
FAILED: http://devcenter.heroku.com/articles/bundler
! Push failed: failed to install gems via Bundler
! If the problem persists, see http://help.heroku.com and provide Request ID 25e2c7af-af3f-4901-8e75-4d3e12337bf8.
My full Gemfile.lock file shows a higher versioned bundler and rails:
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.2)
actionpack (= 4.0.2)
mail (~> 2.5.4)
actionpack (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
erubis (~> 2.7.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
activerecord (4.0.2)
activemodel (= 4.0.2)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.2)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.1)
atomic (1.1.14)
builder (3.1.4)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
erubis (2.7.0)
execjs (2.0.2)
hike (1.2.3)
i18n (0.6.9)
jbuilder (1.0.2)
activesupport (>= 3.0.0)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
minitest (4.7.5)
multi_json (1.8.2)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.2)
actionmailer (= 4.0.2)
actionpack (= 4.0.2)
activerecord (= 4.0.2)
activesupport (= 4.0.2)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
sprockets-rails (~> 2.0.0)
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.2)
rails_stdout_logging (0.0.3)
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.1.1)
rdoc (3.12.2)
json (~> 1.4)
sass (3.2.13)
sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10)
sprockets-rails (~> 2.0.0)
sdoc (0.3.20)
json (>= 1.1.3)
rdoc (~> 3.10)
sprockets (2.10.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (1.1.1)
coffee-rails
tzinfo (0.3.38)
uglifier (2.1.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
PLATFORMS
ruby
DEPENDENCIES
coffee-rails (= 4.0.1)
jbuilder (= 1.0.2)
jquery-rails (= 3.0.4)
rails (= 4.0.2)
rails_12factor
sass-rails (= 4.0.1)
sdoc (= 0.3.20)
turbolinks (= 1.1.1)
uglifier (= 2.1.1)
That error happens when using an old version of Bundler that doesn't support the ruby method inside the Gemfile.
This is confirmed by the deploy output
-----> Gemfile detected, running Bundler version 1.0.7
Because the Cedar stack is updated, I assume you are using the Bamboo stack. You should upgrade to Cedar.

where are my gems installed with rbenv?

I use rbenv and bundler, I want open the installed rails gem and insert some debug codes. So I run 'bundle show rails' in a rails project, I get '~/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rails-3.2.11', but there is nothing in this directory.
Rails is just a meta-gem, as-in it doesn't contain any actual code, it just lists dependencies that make up Rails. This is why the gem's directory is empty.
If you want to edit part of the Rails code you should edit the relevant dependency. In a Gemfile.lock the direct dependecies of Rails 3.2.11 are listed as follows:
rails (3.2.11)
actionmailer (= 3.2.11)
actionpack (= 3.2.11)
activerecord (= 3.2.11)
activeresource (= 3.2.11)
activesupport (= 3.2.11)
bundler (~> 1.0)
railties (= 3.2.11)

Resque with Redis To Go can't work as expectation

I need to use Resque to enqueue my jobs on Heroku.
As it's my first time to use it, I follow the instruction on this site:Resque with Redis To Go.
When I run the command:
$ rake resque:work QUEUE=*
the terminal shows:
rake aborted!
Please install the yajl-ruby or json gem
(See full trace by running task with --trace)
I had installed both yajl-ruby and json gem after I got the error; however, it didn't work.
If I ignore the problem and enter "rails s" to start the server.
It shows:
/Library/Ruby/Gems/1.8/gems/resque-1.19.0/lib/resque/helpers.rb:6: Please install the yajl-ruby or json gem (RuntimeError)
from /Library/Ruby/Gems/1.8/gems/resque-1.19.0/lib/resque.rb:10:in `require'
from /Library/Ruby/Gems/1.8/gems/resque-1.19.0/lib/resque.rb:10
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
from /Users/Brian/Documents/cookie-monster/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6
I guess it's a problem of my environment, but I don't know how to solve it.
Please help me, thanks!!
mikhailov ask me to paste my Gemfile and Gemfile.lock.
Here it is:
Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'redis'
gem 'SystemTimer'
Gemfile.lock:
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.5)
actionpack (= 3.0.5)
mail (~> 2.2.15)
actionpack (3.0.5)
activemodel (= 3.0.5)
activesupport (= 3.0.5)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.5)
activesupport (= 3.0.5)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.5)
activemodel (= 3.0.5)
activesupport (= 3.0.5)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.5)
activemodel (= 3.0.5)
activesupport (= 3.0.5)
activesupport (3.0.5)
arel (2.0.9)
builder (2.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
i18n (0.5.0)
mail (2.2.15)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.5)
actionmailer (= 3.0.5)
actionpack (= 3.0.5)
activerecord (= 3.0.5)
activeresource (= 3.0.5)
activesupport (= 3.0.5)
bundler (~> 1.0)
railties (= 3.0.5)
railties (3.0.5)
actionpack (= 3.0.5)
activesupport (= 3.0.5)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.9.2)
redis (2.2.2)
sqlite3-ruby (1.2.4)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.25)
PLATFORMS
ruby
DEPENDENCIES
rails (= 3.0.5)
redis
sqlite3-ruby
You still should use/try:
bundle exec rake resque:work QUEUE=*
Resque has dependence on 'json' gem, so just add it into Gemfile:
gem 'json'
then Bundler pick the appropriate version to resolve dependencies

heroku, thin rack 1.1.0, gemfile requires rack 1.0.1

My ror app runs on rails 2.3.5(which requires rack 1.0.1),
thin on heroku activates rack 1.1.0 by default
and throws error:
" You have already activated rack 1.1.0, but your Gemfile requires rack 1.0.1. Consider using bundle exec."
my Gemfile:
source 'http://rubygems.org'
group :test, :development do
gem "rack","1.0.1"
end
gem "rails","2.3.5"
gem "mysql"
gem "rake", "0.8.3"
gem "declarative_authorization", "0.5.2"
gem "searchlogic"
gem "prawn", "0.6.3"
gem "thin","1.2.11"
group :test, :development do
gem "rack","1.0.1"
end
group :development do
# bundler requires these gems in development
# gem "rails-footnotes"
end
group :test do
# bundler requires these gems while running tests
# gem "rspec"
# gem "faker"
end
----------------------
I installed bundler and developed Gemfile.lock :
GEM
remote: http://rubygems.org/
specs:
actionmailer (2.3.5)
actionpack (= 2.3.5)
actionpack (2.3.5)
activesupport (= 2.3.5)
rack (~> 1.0.0)
activerecord (2.3.5)
activesupport (= 2.3.5)
activeresource (2.3.5)
activesupport (= 2.3.5)
activesupport (2.3.5)
daemons (1.1.4)
declarative_authorization (0.5.2)
eventmachine (0.12.10)
mysql (2.8.1)
prawn (0.6.3)
prawn-core (>= 0.6.3, < 0.7)
prawn-format (>= 0.2.3, < 0.3)
prawn-layout (>= 0.3.2, < 0.4)
prawn-security (>= 0.1.1, < 0.2)
prawn-core (0.6.3)
prawn-format (0.2.3)
prawn-core
prawn-layout (0.3.2)
prawn-security (0.1.1)
rack (1.0.1)
rails (2.3.5)
actionmailer (= 2.3.5)
actionpack (= 2.3.5)
activerecord (= 2.3.5)
activeresource (= 2.3.5)
activesupport (= 2.3.5)
rake (>= 0.8.3)
rake (0.8.3)
searchlogic (2.4.28)
activerecord (>= 2.0.0)
thin (1.2.11)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
PLATFORMS
ruby
DEPENDENCIES
declarative_authorization (= 0.5.2)
mysql
prawn (= 0.6.3)
rack (= 1.0.1)
rails (= 2.3.5)
rake (= 0.8.3)
searchlogic
thin (= 1.2.11)
---------------------------
Please help me deploy it on heroku........
Solved it...
my app uses rack 1.0.1 , rails 2.3.5
and heroku activates rake 1.1.0 by default..
so i switched my rails app version to 2.3.11 which uses rack 1.1.2 in environment.rb and created a Gem file,
installed bundler
tested on my laptop...
generated lock file and pushed it to heroku...
finally worked....
took a week to get my app working...
:)

Resources