dgutov / robe

Code navigation, documentation lookup and completion for Ruby
584 stars 37 forks source link

Searching for program: No such file or directory, bundle #110

Closed tjbrn closed 7 years ago

tjbrn commented 7 years ago

Hello, I don't know if this behavior is considered normal, but if a open emacs, then open a ruby project and try to robe-start, i get this error: screenshot_20171107_121825

But if I start emacs from terminal, inside of the project folder(emacs ~/some-project) robe just works normally.

There is a bundle directory inside the project .bundle db .git app.rb bot.rb config.ru environment.rb Gemfile Gemfile.lock .gitingore Rakefile

and pry gem is installed

this continues to happen even with a minimal config

...
(use-package robe
  :ensure t
  :defer t
  :init
  (add-hook 'ruby-mode-hook 'robe-mode))

(apparently the problem isn't my config, this happens even in spacemacs)

Do I have to open emacs in the project directory from terminal every time I need to userobe-start?

dgutov commented 7 years ago

That would depend on which tools you're using for Ruby project management. In general, you have to configure your Emacs to work with it before trying Robe.

See also these reports: https://github.com/dgutov/robe/issues?utf8=✓&q=is%3Aissue%20No%20such%20file%20or%20directory%2C%20bundle%20is%3Aclosed%20

I always use GUI Emacs, and my rbenv configuration resides in ~/.profile. That's all that is required for Robe to work on my system (and other tools as well, like rspec-mode).

tjbrn commented 7 years ago

Currently I'm not using rbenv nor rvm, my unique ruby configuration is

# bashrc
# this config let me "gem install" without sudo
if which ruby &>/dev/null && which gem &>/dev/null; then
  export GEM_HOME="/home/username/.gem/ruby/2.4.0"
  export GEM_PATH=$GEM_HOME
  if [[ ! "$PATH" == *$GEM_HOME/bin* ]]; then
    export PATH="$PATH:$GEM_HOME/bin"
  fi
fi

I did a test again, and confirmed that if I open Emacs from desktop(I'm using KDE/openbox) this error occurs, but openning Emacs from terminal(GUI or without window, now no matters what is the initial directory) robe just works

I'm using robe mainly because the integration with company

Could it be because applications initialized from desktop can't know about my bash config?

dgutov commented 7 years ago

Could it be because applications initialized from desktop can't know about my bash config

Pretty much, yes. When it's not launched from Bash.

But you can try putting this piece of code into ~/.profile. Relogin (or restart) afterwards.

tjbrn commented 7 years ago

Putting the configuration into ~/.bash_profile solved the problem! (trying the same thing with ~/.profile didn't work, maybe because bash zoo)

So, for someone, as me, that doesn't uses rvm/rbenv, just put this code into your ~/.bash_profile and things should just works!

# "gem install" without sudo
if which ruby &>/dev/null && which gem &>/dev/null; then
  export GEM_HOME="$(ruby -rubygems -e 'puts Gem.user_dir')"
  if [[ ! "$PATH" == *$GEM_HOME/bin* ]]; then
    export PATH="$PATH:$GEM_HOME/bin"
  fi
fi

dont forget do add gem: --user-install --no-document to ~/.gemrc

thanks!

dgutov commented 7 years ago

Putting the configuration into ~/.bash_profile solved the problem! (trying the same thing with ~/.profile didn't work, maybe because bash zoo)

Yeah, IIRC it depends on the distro which file is actually used for the login shell.