Emacs inf-ruby certificate verify failed - ruby

I tried to execute an HTTPS request, and it fail in Emacs inf-ruby mode. But it works in bash command line.
irb(main):001:0> load ('./get-email-request.rb')
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
from /usr/lib/ruby/1.9.1/net/http.rb:800:in `connect'
from /usr/lib/ruby/1.9.1/net/http.rb:800:in `block in connect'
from /usr/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
from /usr/lib/ruby/1.9.1/net/http.rb:800:in `connect'
from /usr/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
from /usr/lib/ruby/1.9.1/net/http.rb:745:in `start'
from /usr/lib/ruby/1.9.1/net/http.rb:1285:in `request'
from /home/jyuan/projects/opensources/eloqua-ruby-request/eloqua-ruby-request.rb:52:in `request'
from /home/jyuan/projects/opensources/eloqua-ruby-request/eloqua-ruby-request.rb:31:in `get'
from /home/jyuan/projects/opensources/eloqua-ruby-request/examples/get-email-request.rb:10:in `<top (required)>'
from (irb):9:in `load'
from (irb):9
from /usr/bin/irb:12:in `<main>'
The ruby configuration is https://github.com/bbatsov/prelude/blob/master/modules/prelude-ruby.el.
Anyone encountered this before?

It works well after adding This code. https://github.com/senny/rvm.el

Related

I have an error in my Ruby code -- socket error

I am running into an error when I try and run my code, it's a kind of error message I've never seen before when coding.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:878:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:877:in `connect'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:851:in `start'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:582:in `start'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:477:in `get_response'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:454:in `get'
Not sure what it means, or where I should look to fix the error

error uploading theme using shopify_theme gem on Windows

I'm getting the following error when trying to upload theme files to shopify using the gem:
C:\Users\will\workspace\theme\Timber>theme upload
[14:00:45] Uploading: assets/ajax-cart.js.liquidC:/Ruby21/lib/ruby/2.1.0/net/http.rb:923:in
`connect': SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (Ope
nSSL::SSL::SSLError)
from C:/Ruby21/lib/ruby/2.1.0/net/http.rb:923:in `block in connect'
from C:/Ruby21/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
from C:/Ruby21/lib/ruby/2.1.0/net/http.rb:923:in `connect'
from C:/Ruby21/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
from C:/Ruby21/lib/ruby/2.1.0/net/http.rb:852:in `start'
from C:/Ruby21/lib/ruby/2.1.0/net/http.rb:1375:in `request'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/httparty-0.13.5/lib/httparty/request.rb:101:in `perform'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/httparty-0.13.5/lib/httparty.rb:522:in `perform_request'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/httparty-0.13.5/lib/httparty.rb:486:in `put'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.22/lib/shopify_theme.rb:71:in `send_asset'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.22/lib/shopify_theme/cli.rb:234:in `block in send_asset'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.22/lib/shopify_theme/cli.rb:297:in `show_during'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.22/lib/shopify_theme/cli.rb:233:in `send_asset'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.22/lib/shopify_theme/cli.rb:106:in `block in upload'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.22/lib/shopify_theme/cli.rb:105:in `each'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.22/lib/shopify_theme/cli.rb:105:in `upload'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/shopify_theme-0.0.22/bin/theme:25:in `<top (required)>'
from C:/Ruby21/bin/theme:23:in `load'
from C:/Ruby21/bin/theme:23:in `<main>'
It seems to be an SSL error but I installed the SSL certificate and made the environment variable as per the instructions at http://shopify.github.io/shopify_theme/.

OpenSSL::SSL::SSLError in Ruby 1.9 and 2.0 using Mechanize

I met the problem but don't know how to fix it ?
1.9.3
.rvm/gems/ruby-1.9.3-p484/gems/pry-0.9.12.6/lib/pry/pry_class.rb:258: warning: Insecure world writable dir .rvm/gems in PATH, mode 040777
.rvm/gems/ruby-1.9.3-p484/gems/net-http-persistent-2.9.4/lib/net/http/persistent/ssl_reuse.rb:70:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from .rvm/gems/ruby-1.9.3-p484/gems/net-http-persistent-2.9.4/lib/net/http/persistent/ssl_reuse.rb:70:in `block in connect'
from .rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
from .rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
2.0
.rvm/gems/ruby-2.0.0-p353/gems/pry-0.9.12.3/lib/pry/pry_class.rb:259: warning: Insecure world writable dir .rvm/gems/ruby-2.0.0-p353/bin in PATH, mode 040777
.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:918:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from .rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
from .rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from .rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:918:in `connect'
from .rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from .rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:857:in `start'
from .rvm/gems/ruby-2.0.0-p353/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:700:in `start'
from .rvm/gems/ruby-2.0.0-p353/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:631:in `connection_for'
from .rvm/gems/ruby-2.0.0-p353/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:994:in `request'
from .rvm/gems/ruby-2.0.0-p353/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:259:in `fetch'
from .rvm/gems/ruby-2.0.0-p353/gems/mechanize-2.7.3/lib/mechanize.rb:440:in `get'
from course_3.rb:76:in `<main>'
I workaroud it by a = Mechanize.new{|a| a.ssl_version, a.verify_mode = 'SSLv3', OpenSSL::SSL::VERIFY_NONE}
because I need to access https URL with Mechanize

Permission denied when trying to forward ports in openshift

I am kinda new to openshift and I am trying to give it a try.
While following this tutorial when running the rhc port-forward -a command. I am getting an Permission Denied error. Any ideas what I am doing wrong?
The problem is not the password. If you enter a wrong password you get a different error message
Thank
C:\development\infra\appServer\apache-tomcat-7.0.27\bin>rhc port-forward -a <My WebApp>
Password: *****
Checking available ports...
Forwarding ports
C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.3/lib/net/ssh/service/forward.rb:68:in `initialize': Permission denied - bind(2) (Errno::EAC
CES)
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.3/lib/net/ssh/service/forward.rb:68:in `new'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.3/lib/net/ssh/service/forward.rb:68:in `local'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/lib/rhc/commands/port-forward.rb:133:in `block (3 levels) in run'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/lib/rhc/commands/port-forward.rb:127:in `each'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/lib/rhc/commands/port-forward.rb:127:in `block (2 levels) in run'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.3/lib/net/ssh.rb:193:in `start'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/lib/rhc/commands/port-forward.rb:125:in `block in run'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/net-ssh-2.6.3/lib/net/ssh.rb:193:in `start'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/lib/rhc/commands/port-forward.rb:88:in `run'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/lib/rhc/commands.rb:138:in `block (3 levels) in to_commander'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:180:in `call'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:180:in `call'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/command.rb:155:in `run'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/runner.rb:402:in `run_active_command'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/lib/rhc/command_runner.rb:54:in `run!'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/commander-4.1.3/lib/commander/delegates.rb:11:in `run!'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/lib/rhc/cli.rb:40:in `start'
from C:/development/infra/buildtools/RubyInstaller193/lib/ruby/gems/1.9.1/gems/rhc-1.2.7/bin/rhc:21:in `<top (required)>'
from C:/development/infra/buildtools/RubyInstaller193/bin/rhc:23:in `load'
from C:/development/infra/buildtools/RubyInstaller193/bin/rhc:23:in `<main>'
Looks like you're running an older version of the rhc client tools (1.2.7). Please try it again after updating your client tools (gem update rhc).
The error indicates that your host can't bind a particular local port possibly cause it's in use. The latest rhc client responds by binding to the next open port. Let us know if you're still having issues after updating.

watir webdriver error resolving host

Just have a simple script to automate a firefox browser:
Just have a simple script to automate a firefox browser:
require 'rubygems'
require 'watir-webdriver'
# Initialize watir firefox browser
$browser = Watir::Browser.new :ff , :profile => 'default'
Leads to the following error which I havent been able to figure out. Is there a TCP port that is blocked or something?.I am using my office pc btw , the code works fine on my home pc.
C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `initialize': getaddrinfo: No such
host is known. (SocketError)
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `open'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/http/default.rb:76:in `response_for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/http/default.rb:38:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/bridge.rb:598:in `raw_execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/bridge.rb:92:in `create_session'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/firefox/bridge.rb:28:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/common/driver.rb:31:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver/common/driver.rb:31:in `for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.22.2/lib/s
elenium/webdriver.rb:65:in `for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir
-webdriver/browser.rb:35:in `initialize'
from sic_class.rb:8:in `new'
from sic_class.rb:8:in `<main>'
There is no proxy, I am using windows 7, watir webdriver 0.6.1 and firefox 13.01
if you want to install gems then the http_proxy environment variable must be set in ur PATH. But this causes the above problem with watir-webdriver, it worked for me after removing the http_proxy variable. It then uses the proxy settings in browser.

Resources