how to use app from github - ruby-on-rails

I want to use app from github , i cloned it ,
but when i try bundle install , it requires a gem file .
I copied my gem file from other Local app , 'bundle install ' is successfull , but when i try 'rake db:migrate' i see it:
rusik#rusik-K50AF:~/work/ruby/episode-119/blog$ rake db:migrate
rake aborted!
no such file to load -- initializer
(See full trace by running task with --trace)
rusik#rusik-K50AF:~/work/ruby/episode-119/blog$ rake db:migrate --trace
rake aborted!
no such file to load -- initializer
/home/rusik/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/home/rusik/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/home/rusik/work/ruby/episode-119/blog/config/boot.rb:54:in `load_initializer'
/home/rusik/work/ruby/episode-119/blog/config/boot.rb:38:in `run'
/home/rusik/work/ruby/episode-119/blog/config/boot.rb:11:in `boot!'
/home/rusik/work/ruby/episode-119/blog/config/boot.rb:109:in `<top (required)>'
/home/rusik/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/rusik/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/rusik/work/ruby/episode-119/blog/Rakefile:4:in `<top (required)>'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/ home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
,
I tried to copy my db test.sqlite3 from my LOCAL app, but it doesn't work, the same problem.
So ,of'course, i tried rails server, but it doesn't work.
So , how to setup app from github?

It's rails 2 app, so there is no bundler at all. If you want to run it you should read README:
To setup the app, just run rake setup.

Related

Cannot migrate on Heroku

I'd like to migrate database to production environment on Heroku.
I typed the following code, however I got error. I have no idea what to do. I'm looking forward to your advice. Thank you for your kindness.
$ heroku run rake db:migrate
Running `rake db:migrate --trace` attached to terminal... up, run.2338
rake aborted!
LoadError: libruby.so.2.2: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/2.2.0/gems/pg-0.18.2/lib/pg_ext.so
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/pg-0.18.2/lib/pg.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
/app/config/application.rb:7:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load_rakefile'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:689:in `raw_load_rakefile'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:94:in `block in load_rakefile'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:93:in `load_rakefile'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:77:in `block in run'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/app/bin/rake:8:in `<main>'
Have you tried running migration directly from the bash inside the heroku server? If not, try the following...
heroku run bash --app your_app_name_goes_here
bundle exec rake db:migrate
First line of code opens the bash command terminal and the second one migrates the db as usual.
This would not be the suggested solution. But, in case you DO NOT care about losing data in the database, you can try and reset the database first and try again. Again, don't do this unless you are willing to lose existing data!
heroku pg:reset DATABASE
heroku run rake db:migrate
However you can perform this via bash as before.
Hope this helps you out.
You can run a dyno in the background using heroku run:detached. Unlike heroku run, these dynos will send their output to your logs instead of your console window. You can use heroku logs to view the output from these commands:$ heroku run:detached rake db:migrate
Running rake db:migrate... up, run.2
Use 'heroku logs -p run.2' to view the log output.

Heroku Rake and Heroku Push Not Working - Rails

If i try running: heroku rake db:migrate, this is the error i get:
rake aborted!
undefined local variable or method `config' for main:Object
/app/config/application.rb:4:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>
Running: git push heroku master i get this:
Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
I have tried adding: config.assets.initialize_on_precompile = false to application.rb but it did not help :(.
This app i'm trying to push used to be on heroku, but i accidentally deleted my herokuapp. Please help!
The problem was with Rolify, new version has problems so I had to step down back to 3.2.0.

bundle exec rake db:create:all, errors caused by 2 different versions of rake gem, not sure where to go from here

I'm trying to bundle exec rake db:create:all
I found that I have two versions of the rake gem:
rake (10.1.0, 0.9.6)
Author: Jim Weirich
Homepage: http://rake.rubyforge.org
License: MIT
Installed at (10.1.0): /Users/david/.rvm/gems/ruby-2.0.0-p247#global
(0.9.6, default): /Users/david/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0
I think there may be an issue with the two different locations of the gems; 10.1 is at #global, and 0.9.6 is not. I think the solution may lay here because...
The trace first looks at the directories in 0.9.6 and then the last two lines look in 10.1:
dn0a158988:portfolio davidngo$ bundle exec rake db:create:all --trace
rake aborted!
cannot load such file -- /Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/boot
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/application.rb:1:in `require'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/application.rb:1:in `<top (required)>'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/Rakefile:5:in `require'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/Rakefile:5:in `<top (required)>'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:604:in `raw_load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:89:in `block in load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:88:in `load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:72:in `block in run'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:70:in `run'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-0.9.6/bin/rake:37:in `<top (required)>'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247#global/bin/rake:23:in `load'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247#global/bin/rake:23:in `<main>'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
I specified in my Gemfile `gem 'rake', '0.9.6'
I ran bundle update to update the Gemlock file
Thank you in advance -- any help would be appreciated!
Thought: I'm going to try to uninstall the 10.1 version of rake and see if it'll work.
I don't think it's the multiple versions of rake. The bundle exec bit should do the right thing. Are you missing the /config/boot.rb file referred to at /config/application.rb:1?

Rake aborted, cannot load file ./bundler/setup, ruby require errors in RubyOnRails application

I've been working on a Ruby on Rails project for class and have run into some problems. When I run bundle install, all of my gems install appropriately. When I run rake db:setup, I get the following error.
tuggernuts2#tn-Extensa5620:~/Workspace/Class/baseball-manager$ rake db:setup
rake aborted!
cannot load such file -- ./bundler/setup
/home/tuggernuts2/Workspace/Class/baseball-manager/config/boot.rb:6:in `<top (required)>'
/home/tuggernuts2/Workspace/Class/baseball-manager/config/application.rb:1:in `<top (required)>'
/home/tuggernuts2/Workspace/Class/baseball-manager/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
I am also get this error when I try to run any of my unit tests:
tuggernuts2#tn-Extensa5620:~/Workspace/Class/baseball-manager$ ruby test/unit/user_test.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require': cannot load such file -- ./bundler/setup (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/tuggernuts2/Workspace/Class/baseball-manager/config/boot.rb:6:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/tuggernuts2/Workspace/Class/baseball-manager/config/application.rb:1:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/tuggernuts2/Workspace/Class/baseball-manager/config/environment.rb:2:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/tuggernuts2/Workspace/Class/baseball-manager/test/test_helper.rb:2:in `<top (required)>'
from test/unit/user_test.rb:2:in `require_relative'
from test/unit/user_test.rb:2:in `<main>'
I'm working on this project with a group of 4 others, and no one else is getting these errors so I infer that the problem is with my setup and not with the code.
I'm running ruby version "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]"
I'm running ruby gems version 1.8.23
I'm running rails version 3.2.5
but when I run rails -v I get the same require error, and the same ./bundler/setup error as above. I've been googling these problems for awhile and non of the solutions I've found so far have helped.
I've tried re-installing gems, I've tried running gem update -system, but that just gives me:
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian, because it will overwrite the content of the rubygems Debian package, and might break your Debian system in subtle ways. The Debian-supported way to update rubygems is through apt-get, using Debian official repositories.
If you really know what you are doing, you can still update rubygems by setting the REALLY_GEM_UPDATE_SYSTEM environment variable, but please remember that this is completely unsupported by Debian.
The rake errors are new as of yesterday, the ruby require errors have been there pretty much since the beginning. Life has been a struggle.
I've tried a bunch of combinations of require, require "./...", require_relative, and nothing seems to fix the require errors.
Any and all help is appreciated. Thanks in advance.
Edit: Output from: bundle exec rake db:setup --trace
tuggernuts2#tn-Extensa5620:~/Workspace/Class/baseball-manager$ bundle exec rake db:setup --trace
rake aborted!
cannot load such file -- ./bundler/setup
/home/tuggernuts2/Workspace/Class/baseball-manager/config/boot.rb:7:in `require'
/home/tuggernuts2/Workspace/Class/baseball-manager/config/boot.rb:7:in `<top (required)>'
/home/tuggernuts2/Workspace/Class/baseball-manager/config/application.rb:1:in `require'
/home/tuggernuts2/Workspace/Class/baseball-manager/config/application.rb:1:in `<top (required)>'
/home/tuggernuts2/Workspace/Class/baseball-manager/Rakefile:5:in `require'
/home/tuggernuts2/Workspace/Class/baseball-manager/Rakefile:5:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:583:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/var/lib/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'

rake db:migrate postgreSQL

I finally got the gem pg to install. Now when I go to migrate the database I get the following:
$ rake db:migrate
(in c:/rubyDev/bsbaslic)
rake aborted!
no such file to load -- 1.9/pg_ext
c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.10.0/lib/pg.rb:10:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.10.0/lib/pg.rb:10:in `<top (required)>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `block (2 levels) in require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `block in require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler.rb:112:in `require'
c:/rubyDev/bsbaslic/config/application.rb:7:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
c:/rubyDev/bsbaslic/Rakefile:4:in `<top (required)>'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
c:/Ruby192/bin/rake:31:in `<main>'
Does anybody have any ideas as to what it is looking for? I have a pg_ext.so file in the same directory as pg.rb.
Windows programs cannot load .so files - they load .dll files instead. You need a build of pg compiled for Windows, or you need to be running Ruby from within a Linuxy environment such as msys or cygwin.
The problem is in your version of pg gem. There is a special version for windows pg 0.9.0.
In order to have it workingon windows:
uninstall the current pg 0.10.0
install pg as follows: gem install pg --version=0.9.0 -- --with-pg-config=/short/path/to/postresql/bin
(To get short path you can simply change directory to PostgrSQL bin and then type command in cmd, it will automaticaly change path to a short verison)
Then edit your project Gemfile in order to use correct pg gem version (0.9.0)
And that's it.
Good Luck

Resources