Bundler Starting with full path - issue - ruby

I am trying to run bundle from inside a folder of my RoR app and it works as expected.
However, when I try to run it using the full path (need this for the cron jobs), it just fails with the error "in `require': no such file to load -- bundler (LoadError)" . Any ideas how to fix this?

Just found out that my original issue for the cron was the PATH variable, so I just directly set it up in the cron.

Related

Rubymine (Ruby): Why can't I run rspec from within the IDE?

If I run the following command from the terminal I am able to run the rspec test cases successfully.
bundle exec rspec spec/requests/api/contacts/v3_get_tags_spec.rb
However if I am in the Rubymine IDE and do:
1- Right click on the file
2- Select "Run"
Then i get the following error message.
"in `require': cannot load such file -- spec_helper (LoadError)"
Also i am seeing a lot of errors related to gems not found, i feel link Rubymine is not configured correctly. What am i missing?
Note: Both the terminal and the IDE are running in the same root directory. I am pretty sure there is a problem with the configuration of the IDE. I checked the preference setting and it is using the same version of ruby as the one I am running in the termina.
Any help on the issue would be greatly appreciated.

Issue on installing a own written logstash plugin

I am doing my firts steps on writing my own logstash filter plugins. I followed the instructions of https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html but I do not get it done.
I do this on my windows machine. The following has been ensured
Proper JAVA_HOME is set and its bin folder is added to PATH
JRuby is installed
Proper JRUBY_HOME is set and its bin folder is added to PATH
I did the following
Cloned and did NO source code changes on https://github.com/logstash-plugins/logstash-filter-example.git
Did a successful gem build which created the file logstash-filter-example-3.0.0.gem
Wanted to see if the plugin is working and tried to install it
Got this error message
logstash-plugin.bat install logstash-filter-example-3.0.0.gem
LoadError: no such file to load -- clamp
require at org/jruby/RubyKernel.java:956
require at C:/jruby-9.1.5.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
<main> at D:\hust\playground\logstash_filter_plugin\logstash-2.4.0\logstash-2.4.0\lib\pluginmanager\main.rb:14
I am a newbie to this world. Any suggestions what I am doing wrong here?
BW Hubert

Fixing "custom_require.rb:36:in `require': no such file to load" errors

I understand that after Ruby 1.9.2, '.' is no longer in your path for security reasons. This seems to be a problem when using certain gems (ones not updated to 1.9 I imagine?), a problem that throws errors like
$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 'require': cannot load such file -- rubylog (LoadError)
I've seen and fixed this problem once, by (perhaps naively) changing some requires into require_relatives: https://github.com/mathpunk/MongoDB_Koans/commit/e2f7898347d328450ec121d22f701508f389cc53
Now I'd like to use rubylog, and I'm getting the custom_require error, so I tried the same trick:
https://github.com/mathpunk/rubylog/commit/995e13dccc6a197d280d0783f3fb7fe50deabd02
but this time, I'm just getting the same error. What else can I try?
ETA: All this time, I've been using sudo gem install blah to install gems, and for some reason, for rubylog it's gem install rubylog that does it. (Something to do with RVM?) So now everything works. Thank you.
Your code fails at require 'rubylog' - so it can't find rubylog.rb itself. So just add dir containing rubylog.rb to load path - something like $: << 'rubylog' might help.
Just add the library directory to your LOAD_PATH:
$LOAD_PATH.unshift(File.dirname(__FILE__))
See Understanding Ruby's load paths\
Edit: I assumed you had a rubylog directory wherever your script was running from. If your script can't find rubylog then you need to add that location to your load path:
$LOAD_PATH.unshift('/path/to/rubylog')
Are you sure you have the rubylog libraries? gem install rubylog

Need help with starting RoR: Command "rails server" does not result in "Booting WEBrick"?

I need help to get started with RoR.
I currently follow this guideline:
http://allaboutruby.wordpress.com/2009/07/20/installing-rails-on-windows-3-years-later/#comment-11099
I followed step 1 through 3 w/o problems.
In step 5: I can get the webserver through WEBrick working.
When i put
"rails server"
instead of getting "Booting Webrick", i get "rails new_path option"
thus when i try 127.0.0.1:3000 in the browser... it does work.
Can anyone guide me on this on how to get it up and runnning? (Im a total newb for now...so i need specific explanations! thanks!)
In your tutorial i can't see the command 'bundle install' - it's checking and installing all necessary gems in your system. So why you don't use another great rails tutorial - http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
I'm guessing you are running windows, on which rails can be a little awkward. You'll probably need to run the rails server command by pointing ruby at the server script. On windows, your rails "commmand" is actually just a .bat file that lives in the /bin file of your ruby installation, and that .bat file just passes the arguments to ruby. If you look at the rails gem that is installed on your machine, you'll see the files that correspond to the normal first argument of a rails command (console, generate, server, etc). You might find it helpful to copy these to the /script directory of your application, and when you want to run a rails command you can just run "ruby script\server" from your application's main directory, though there may be more accepted ways of getting the same result.

Rails 3 -- Rspec

in my rails3 app I have installed rspec. But when I run the rspec command in my console it gives the following error.
C:\myapp>rspec spec
'rspec' is not recognized as an internal or external command,
operable program or batch file.
Please Help.
Thanks in Advance.
You can try
bundle exec rspec spec
It doesnt solve the root problem, but is a quick work-around
EDIT: Did a bit of googling for you, have you tried this? http://getsatisfaction.com/railstutorial/topics/rspec_command_not_found#reply_4313182
You need to add the ruby gems directory to your PATH environment variable.
For me this is "C:\Program Files\Ruby192\lib\ruby\gems", but this will vary depending on version and install directory. You can add it to your PATH variable by going to Computer > System Properties > Advanced System Settings > Environment Variable > Path > Edit. Make sure you don't wipe the existing contents. Instead, add a semi-colon and paste the gems path in.
Good luck.
I did this and it worked
C:\OSS\InSpects>PATH=C:\Ruby192\lib\ruby\gems\1.9.1\bin;C:\Ruby192\bin

Resources