NameError in Repository.fetch_changesets

Added by Jochen Knochen about 5 years ago

Hi,
the command
ruby /usr/share/redmine/script/rails runner "Repository.fetch_changesets" -e production

gives me the following error message
/usr/lib/ruby/vendor_ruby/rails/commands/runner.rb:54: (eval):1: uninitialized constant Repository (NameError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `eval'
from /usr/lib/ruby/vendor_ruby/rails/commands/runner.rb:54
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/vendor_ruby/rails/commands.rb:64
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /usr/share/redmine/script/rails:6

Don't know what that means. Do I have to replace 'Repository' with my actual project name?
Can't remember what I changed, but a month ago it did work.
Maybe some apt-get upgrade ? :-(
My Environment (Ubuntu 12.04):

sh: 1: darcs: not found
sh: 1: hg: not found
sh: 1: cvs: not found
sh: 1: bzr: not found
Environment:
Redmine version 2.4.2.stable
Ruby version 1.8.7-p352 (2011-06-30) [i686-linux]
Rails version 3.2.16
Environment production
Database adapter MySQL
SCM:
Subversion 1.6.17
Git 1.7.9.5
Filesystem
Redmine plugins:
no plugin installed

Replies (10)

RE: NameError in Repository.fetch_changesets - Added by Jochen Knochen about 5 years ago

To be honest,
to fix the fastercsv not found error I also changed the line
in one correspondent ruby script from 'fastercsv' to 'csv'.
So I got redmine running in general.
Hope that has nothing to do with this ;-)

RE: NameError in Repository.fetch_changesets - Added by Jochen Knochen about 5 years ago

Anyone?

more version info:
gem: 1.8.18
rake: 10.1.1

RE: NameError in Repository.fetch_changesets - Added by Martin Denizet (redmine.org team member) about 5 years ago

Hello Jochenm,

Try this:

cd /usr/share/redmine/
./script/rails runner "Repository.fetch_changesets" -e production

If it's not working, you may try to do the same with the console:

cd /usr/share/redmine/
./script/rails console production

Inside the console:
Repository.fetch_changesets
exit

Cheers

RE: NameError in Repository.fetch_changesets - Added by Jochen Knochen about 5 years ago

Hi Martin,
./script/rails runner "Repository.fetch_changesets" -e production
works! :-)
As I have no knowledge of ruby whatsoever, what does that mean?
If I try this from home directory/cron job the errors are as above.
Did I miss to set an environment variable?
Thanks anyway.

RE: NameError in Repository.fetch_changesets - Added by Martin Denizet (redmine.org team member) about 5 years ago

Hi Jochen,
Glad to hear your problem is solved!
./script/rails is itself an executable, you don't need to call ruby, just run that executable.
In your cron, I suggest you try:

/usr/share/redmine/script/rails runner "Repository.fetch_changesets" -e production

Cheers

RE: NameError in Repository.fetch_changesets - Added by Jochen Knochen about 5 years ago

No,
this is not working.
Just only if I'm inside /usr/share/redmine as you suggested previously.
I think I can do a cd inside cron job, but there has to be something wrong with my installation?
Greets,
Jochen

RE: NameError in Repository.fetch_changesets - Added by Martin Denizet (redmine.org team member) about 5 years ago

Then you can try to cd first in the cron:

cd /usr/share/redmine/ && ./script/rails runner "Repository.fetch_changesets" -e production

Cheers

RE: NameError in Repository.fetch_changesets - Added by Jochen Knochen about 5 years ago

that works in crontab:
cd /usr/share/redmine/ && ./script/rails runner "Repository.fetch_changesets" -e production > /dev/null 2>&1

RE: NameError in Repository.fetch_changesets - Added by Jochen Knochen about 5 years ago

ok, I can live with that
the next step will be to upgrade to ruby 1.9.3
and that will be hard enough anyway
Thanks!

RE: NameError in Repository.fetch_changesets - Added by Martin Denizet (redmine.org team member) about 5 years ago

Jochen Knochen wrote:

ok, I can live with that
the next step will be to upgrade to ruby 1.9.3
and that will be hard enough anyway
Thanks!

Use packages or RVM to upgrade Ruby.
You're welcome!

(1-10/10)