Installing a public ruby gem prompts: Enter PEM pass phrase - ruby-on-rails

I am trying to install this gem: https://github.com/mongodb/mongo-ruby-driver (on the master branch).
When I run bundle install I get:
Enter PEM pass phrase:
(to which I don't have a key as this is a public repo, so I press enter)
OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key: nested asn1 error
I tried downloading the zip and bundling from source and get the exact same problem.
Update My Local Environment Variables
rvm_bin_path=/Users/Clay/.rvm/bin
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/Users/Clay/.rvm/gems/ruby-2.0.0-p451
TERM=xterm-256color
SHELL=/bin/bash
IRBRC=/Users/Clay/.rvm/rubies/ruby-2.0.0-p451/.irbrc
TMPDIR=/var/folders/yl/7nzdd2wx2tzbrwr4bm8t25qr0000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-8mCJ2I/Render
TERM_PROGRAM_VERSION=326
OLDPWD=/Users/Clay/Developer
MY_RUBY_HOME=/Users/Clay/.rvm/rubies/ruby-2.0.0-p451
TERM_SESSION_ID=63791880-F18D-4CD5-932D-109041B81415
USER=Clay
_system_type=Darwin
rvm_path=/Users/Clay/.rvm
SSH_AUTH_SOCK=/tmp/launch-8O5pHu/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
rvm_prefix=/Users/Clay
__CHECKFIX1436934=1
PATH=/Users/Clay/.rvm/gems/ruby-2.0.0-p451/bin:/Users/Clay/.rvm/gems/ruby-2.0.0-p451#global/bin:/Users/Clay/.rvm/rubies/ruby-2.0.0-p451/bin:/Users/Clay/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/mysql/bin:/Users/Clay/Developer/mongodb-osx-x86_64-2.4.6/bin:/usr/local/mysql/support-files/:/Applications/Sublime Text.app/Contents/SharedSupport/bin/:/Users/Clay/Developer/AWS-ElasticBeanstalk-CLI-2.6.3/eb/macosx/python2.7/
PWD=/Users/Clay/Developer/mongo-ruby-driver
LANG=en_US.UTF-8
_system_arch=x86_64
_system_version=10.9
rvm_version=1.24.7 (stable)
HOME=/Users/Clay
SHLVL=1
RAILS_ENV=development
LOGNAME=Clay
GEM_PATH=/Users/Clay/.rvm/gems/ruby-2.0.0-p451:/Users/Clay/.rvm/gems/ruby-2.0.0-p451#global
DISPLAY=/tmp/launch-Pm5rac/org.macosforge.xquartz:0
RUBY_VERSION=ruby-2.0.0-p451
SECURITYSESSIONID=186f1
_system_name=OSX
_=/usr/bin/env

I suggest you first get it working using the stable version and without using bundle. If that works, then try the master branch and bundle.
First, try this and tell us if it succeeds:
gem install mongo
(If it fails then please copy/paste the exact results as an edit to your question.)
Second, try building the current stable version in a fresh directory:
rm -rf mongo-ruby-driver
git clone https://github.com/mongodb/mongo-ruby-driver.git
cd mongo-ruby-driver
git checkout 1.11.1
gem build mongo.gemspec
(If it fails then please copy/paste the exact results as an edit to your question.)
What you expect to see is:
Warning: No private key present, creating unsigned gem.
Successfully built RubyGem
Name: mongo
Version: 1.11.1
File: mongo-1.11.1.gem
(If you see anything different then please copy/paste the exact results as an edit to your question.)
If you still getting the PEM error when you try to build 1.11.1, then try editing mongo.gemspec. Comment out these lines that may be causing the PEM prompt:
# s.signing_key = 'gem-private_key.pem'
# s.cert_chain = ['gem-public_cert.pem']
Then retry the build:
gem build mongo.gemspec
(If the build fails, then I suggest looking at your gem environment to see if it's all as you expect. Run gem env and copy/paste the results into your question. Also, search your various gem env directories for a file called gem-private_key.pem. This file may be causing your issue; temporarily rename it and try again.)
If the build succeeds, then install as usual:
gem install mongo-1.11.1
If that all works, then you're in good shape.
If you're positive that you want the master branch:
git checkout master
gem build mongo.gemspec

Related

How can I add git to the ruby command line?

I am looking to access git commands from the Ruby command line in Windows 10 however when I attempt to run a git command I get a "git is not recognized" error. I can call git commands from the standard command line without any problems. I have updated my paths to include C:\Program Files\Git\cmd\ and C:\Program Files\Git\bin\ however this has not resolved the error. Any other suggestions of how to solve this?
Make sure you've set your PATH to git correctly. By default, git should already be configured to PATH automatically. Go to this link and download the correct version for your system and then install it. Afterwards, open the windows terminal and everything should work.
This may help you out: How to run Ruby and GIT commands in one place on Windows

Snowflake on Heroku Via ODBC

Update - I got it working by using Sequel and Ruby-ODBC gems and a different build pack for Heroku (https://elements.heroku.com/buildpacks/daasity/heroku-buildpack-snowflake-odbc)
Had to amend the AptFile line
https://sfc-repo.snowflakecomputing.com/odbc/linux/2.18.3/snowflake-odbc-2.18.3.x86_64.deb
to
https://sfc-repo.snowflakecomputing.com/odbc/linux/latest/snowflake-odbc-2.21.0.x86_64.deb
I am looking for some advice to help resolve an issue I am having trying connect a Rails 5.1 app to a Snowflake database via ODBC on Heroku.
I have tried various methods but keep hitting different issues.
Steps taken so far:
Added heroku-community/apt buildpack
Created AptFile with the below packages:
unixodbc
unixodbc-dev
https://raw.githubusercontent.com/carwow/heroku-buildpack-snowflake-odbc/master/snowflake-odbc.deb
Added odbc_adapter gem (https://github.com/localytics/odbc_adapter)
Modified my database.yml file to include :snowflake connection details.
Created a new class to mirror a table held in Snowflake, added a line to establish_connection to snowflake and a method to test the connection.
When I run this locally, everything works perfectly. When I deploy to Heroku and try to run the same method I get this error:
ODBC::Error: S1000 (-1) [unixODBC][DSI] The error message SFRestRequestFailed could not be found in the en-US locale. Check that /app/.apt/usr/lib/snowflake/odbc/lib/SFMessages_en-US.xml exists.
When I check the file structure on Heroku, I can see that SFMessages_en_US.xml is in a different path.
I tried using isql -v to see if I could get more details but that returns an error:
[28000][unixODBC][DSI] The error message DSIReqSettingNotFound could not be found in the en-US locale. Check that /app/.apt/usr/lib/snowflake/odbc/lib/ODBCMessages_en-US.xml exists.
I've been trying to get this to work but without being able to see the underlying error I am stuck.
Try adding the following (copied from Dockerfile, so you need to change that to match Heroku) before installing SNFLK ODBC drivers:
ENV LANGUAGE=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
RUN apt-get install locales && locale-gen

Anyone else get this error "Error: invalid option: --with-passenger"

Can not get NGINX to install with passenger
Following the steps you are supposed to...
brew install passenger
Then you run the following command...
brew install nginx --with-passenger
But I get:
Error: invalid option: --with-passenger
Could not find any resources about this online, so asking here.
$ brew install nginx --with-passenger
Usage: brew install [options] formula
Install formula.
formula is usually the name of the formula to install, but it can be specified
in several different ways.
-d, --debug If brewing fails, open an interactive
debugging session with access to IRB or a
shell inside the temporary build directory
--env If std is passed, use the standard build
environment instead of superenv.If super
is passed, use superenv even if the formula
specifies the standard build environment.
--ignore-dependencies Skip installing any dependencies of any
kind. If they are not already present, the
formula will probably fail to install.
--only-dependencies Install the dependencies with specified
options but do not install the specified
formula.
--cc Attempt to compile using provided
compiler. compiler should be the name
of the compiler's executable, for instance
gcc-7 for GCC 7. In order to use LLVM's
clang, use llvm_clang. To specify the
Apple-provided clang, use clang. This
parameter will only accept compilers that
are provided by Homebrew or bundled with
macOS. Please do not file issues if you
encounter errors while using this flag.
-s, --build-from-source Compile the specified formula from source
even if a bottle is provided. Dependencies
will still be installed from bottles if
they are available.
--force-bottle Install from a bottle if it exists for the
current or newest version of macOS, even if
it would not normally be used for
installation.
--include-test Install testing dependencies required to
run brew test.
--devel If formula defines it, install the
development version.
--HEAD If formula defines it, install the HEAD
version, aka. master, trunk, unstable.
--fetch-HEAD Fetch the upstream repository to detect if
the HEAD installation of the formula is
outdated. Otherwise, the repository's HEAD
will be checked for updates when a new
stable or development version has been
released.
--keep-tmp Don't delete the temporary files created
during installation.
--build-bottle Prepare the formula for eventual bottling
during installation.
-f, --force Install without checking for previously
installed keg-only or non-migrated
versions.
-v, --verbose Print the verification and postinstall
steps.
--display-times Print install times for each formula at the
end of the run.
-i, --interactive Download and patch formula, then open a
shell. This allows the user to run
./configure --help and otherwise
determine how to turn the software package
into a Homebrew package.
-g, --git Create a Git repository, useful for
creating patches to the software.
-h, --help Show this message.
Error: invalid option: --with-passenger
This is supposed to work... so yeah.
A late answer. Obviously the documentation on the passenger site is outdated at time of this writing.
According to phusion's github site
https://github.com/phusion/passenger/issues/2187#issue-416881033
the config option --nginx-with-passenger is not valid anymore.
Instead do:
brew install nginx passenger
Addendum:
When using google search for results currently the old page comes up at the top of the list. Here's the currently maintained page with the accurate information:
https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/nginx/install/oss/osx.html

Pronto-Rubocop on Gitlab is not working, wrong URL being called

I'm using:
Gitlab 7.11.2
Rails 3.2
Pronto 0.4.2
pronto-rubocop 0.4.4
And I'm having trouble setting up the script to run Rubocop on git commits. I want to use Pronto so only the changes are checked. I am not using GitLab to host so I am not sure how to proceed when I reach this point of the Pronto setup, https://github.com/mmozuras/pronto:
Set the GITLAB_API_ENDPOINT environment variable to your API endpoint URL. If you are using Gitlab.com's hosted service your endpoint will be https://gitlab.com/api/v3. Set the GITLAB_API_PRIVATE_TOKEN environment variable to your Gitlab private token which you can find in your account settings.
Then just run it:
GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
Where do I run the last command?:
GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
I created a .gitlab-ci.yml file and it has:
before_script:
- ruby -v
- gem install bundler --no-ri --no-rdoc
- bundle --without postgres
rubocop:
script: bundle exec pronto run --index
But I can't tell if this is running.
I also did not set up GitlabFormatter as it is mentioned on the Pronto page, when I tried looking up information about it was vague and unhelpful to me.
Can someone point me in the right direction?
Thanks!
**UPDATE
So I gave up on using .gitlab-ci.yml file route for now because the job on gitlab-ci worked. I figured out the endpoint and installed all the necessary requirements on the server and everything bundles correctly.
At the very end of the process, I run:
GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
But the URL it generates is incorrect and I cannot add comments to the commit:
https://gitlab.com/api/v3/projects/10022%2Fname%2Fapp-name/repository/commits/ad87234..asdf87923/comments
I'm getting an
(Gitlab::Error::NotFound)
and I looks like it is coming from this part of code:
../10022%2Fname%2Fapp-name/..
because I can see the JSON when I change it to
../name/app-name/..
Any idea on how to call the correct URL?
Finally got this working. I am hosting gitlab on my own server, the API endpoint will look up the correct project as long as you have "api/v3" at the end. It's when you specify projects that things can go wrong, you'll know this if you see errors similar to these:
"Project not found" --> don't specify the project
"Unauthorized" --> are you using the correct user token?
Finally, even after pronto is run and it tells you how many errors were found or how many comments left, it might not always show up on the commit BUT if you submit a merge request the rubocop comments will show up.
To have the gitlab build fail if there are style guide violations run pronto with the option:
--exit-code

Capistrano isn't applying path environment to second command

My Capistrano deployments are hanging on the second command in a composite command.
https://github.com/capistrano/capistrano/blob/5986983915163e6681f2546bf6fad599d58cd024/lib/capistrano/dsl.rb#L59
At the point that SSHKit tries to run the following command:
cd /home/lawfm/deployments/staging/repo && git rev-parse
I get a
bash: git: command not found error.
I believe the issue is documented here:
https://github.com/capistrano/capistrano/issues/675
My deploy was working in 3.0.1, but an upgrade to 3.1 introduced the error. At first, I read that pty was now on by default, so I set:
set :pty, false
Unfortunately, it seems neither .bash_profile nor .profile are being loaded, so any attempt to augment the PATH there have been fruitless.
I can't seem to figure out a way to set the path or even map the git command directly since it's the second command.
I can't figure out a way to fix the path not being applied to the second command, but I did place the PATH definition in my .bashrc file instead of .bash_profile and it now works.

Resources