FAQ Database Discussion Community

Adding Ruby Gems to my PuPHPet provisioner

I'm new to Vagrant and Puppet so I'm using the excellent tool provided by PuPHPet (https://puphpet.com/). I'm putting together a fairly straight forward LAMP box. Everything is coming along swimmingly except I can't add Ruby Gems. I need to include sass and compass but I have no idea how and...

To generate one for the first time: rails generate symmetric_encryption:config, getting warning, how to fix?

When i starting rails application i'm getting warning like this Symmetric Encryption config not found. To generate one for the first time: rails generate symmetric_encryption:config I don't know, Why its showing if i generate symmetric_encryption:config nothing happened. What is the use of 'symmetric_encryption:config' Where it will use? What it will...

Connecting to a SQL server using watir web driver

I need some help connecting to a SQL database held on a server to compare some values in watir webdriver. Not even sure where to start really. Is there any particular GEM i need to install My database lives on server xxx.xxx.xxx.xxx, with a username and password so I have...

qpid_messaging ruby gem compilation fails (Apache Qpid messaging api)

I have tried many things but, no luck, im on Ubuntu 14.04.2 LTS. So Here it is the problem: http://pastebin.com/eYftQcaP

Formatting issue in ActiveAdmin dashboard

I'm having an issue pulling the correct information into a dashboard column using ActiveAdmin. If anyone could help me wrap my head around this issue it would be greatly appreciated. The issue I'm having is retaining the data from an associated class with the current record I'm displaying (line 6...

OpenBSD unable to install therubyracer gem ERROR: Failed to build gem native extension

I am trying host OpenSourceBilling application built using Ruby on Rails framework to OpenBSD server. When i try to install gems using bundle install command, I get following error on therubyracer gem installation: /usr/local/lib/ruby/gems/2.0/gems/libv8- `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError) and...

Installing optipng with homebrew: command not found (rbenv?)

I've successfully installed optipng: $ brew install optipng ==> Downloading https://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.5/optipng-0.7.5.tar.gz Already downloaded: /Library/Caches/Homebrew/optipng-0.7.5.tar.gz ==> Patching patching file src/optipng/osys.c ==> ./configure --with-system-zlib --prefix=/usr/local/Cellar/optipng/0.7.5 --mandir=/usr/local/Cellar/optipng/0.7.5/share/man ==> make install 🍺 /usr/local/Cellar/optipng/0.7.5: 6 files, 156K, built in 2 seconds but when I use the command it...

How to use gem 'geokit' to validate zipcode with respect to city and state in rails4?

I want to use gem 'geokit' as my requirement is to validate my zipcode on the basis of city and province/state. Please guide me how to use it. I had tried my own validation in my model but it don't work for me. Please help me out. I got stuck...

Rubygems: specify dependency on the latest version of a gem

I'm developing a gem A that depends on another gem B. I need the user of my gem to have the latest version of B whatever it is. So I would like to say in my gemspec something like spec.add_dependency "B", :latest The reason for this is that B contains...

Run “Bundle Install” w/o Installing a Specific Dependency Gem - Rails

I'm trying to run bundle on a Win machine for an existing app. One of the gems is using HiRedis as a dependency. Since it is impossible to install HiRedis on Win: Is there a way to find out which gem is using HiRedis? Is there a way to run...

How to connect development mode rails app with nginx server?

I want to run my rails app in development mode with nginx server as I want to override remotipart. Please guide me how to connect rails app with nginx.

How can I run a custom version of dpl on Travis CI?

Travis-CI uses the dpl deploy tool to deploy your application. I've made a fork of the repo which includes a number of improvements concerning deploying to AWS. In the before deploy step, I clone the repo and build them gem. I've found that using edge: local under the deploy section...

Trouble running RubyGems on Redhat 5.5

Am trying to install Ruby and RubyGems on a RedHat 5.5 machine. I'd got them by running the following two commands: sudo yum install ruby sudo yum install rubygems Got both installed. However when i try to run gem, i got the following error: /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require': undefined methodend_with?' for "no...

Executable gem - Windows

I am trying to create an executable gem on windows machine. But i am not sure how do make the file executable in windows? Is there any way i can create the same on windows? Here is what i did so far: created a file and then right click and...

Corrupted ruby gem system

Somehow, my ruby gems got corrupted, and when I do $ sudo gem update I get: ERROR: While executing gem ... (Gem::Exception) Invalid spec cache file in /home/sawa/.gem/specs/api.rubygems.org%443/specs.4.8 I removed .gem, and reinstalled Ruby, but the problem persists. How can I repair this?...

How can I avoid bundlers warning about multiple sources when I have all gems in my .gemspec?

In my own gem, I have a Gemfile that looks basically like this: source 'https://my.gemserver.com' source 'https://rubygems.org' gemspec My .gemspec has all dependencies listed as add_dependency and add_development_dependency. As of Bundler 1.8, I get the warning: Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a...

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension Linux Mint

While running bundle install i am getting the following error. Running on Linux Mint 17.0 Rails 4.0.2 Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /home/dubzero/.rvm/rubies/ruby-2.0.0-p643/bin/ruby extconf.rb checking for ffi_call() in -lffi... yes checking for ffi_prep_closure()... yes checking for ffi_raw_call()... yes checking for ffi_prep_raw_closure()... yes checking for rb_thread_blocking_region()... yes checking...

How do you protect your API key in your tests when you publish a gem with tests?

I am using rspec in my test and i would like to protect my API key it when i publish my gem on github. What are the best practices to do that? should i use VCR and then remove my key from the git log?

Where to get versions suitability sheet of neat and bourbon?

I want so use libsass for compiling my scss (considering positive testimonials about it's speed against ruby native compiler). The compiling ends with an error, and my searching have driven me here: (my bourbon was 4.x): https://github.com/sass/libsass/issues/365. the current version of libsass cannot compile bourbon 4.x. and the issue is...

Rails doesn't load actionform gem from Gemfile

My Rails 4.2 app fails to load some GitHub hosted gem (installed via bundler v1.8.2). I am using rvm 1.26.10 (master) In my Gemfile, gem 'simple_form', '~> 3.1.0' gem 'actionform', :github => 'rails/actionform' Bundler install them in different location: $ bundle show simple_form /Users/me/.rvm/gems/[email protected]_app/gems/simple_form-3.1.0 $ bundle show actionform /Users/me/.rvm/gems/[email protected]_app/bundler/gems/actionform-4a858fecf4c2 Rails...

How to access the class name inside the gem code

So I'm creating an acts_as kind of gem, and inside the gem I want a reference to the class that is including the gem, to define methods using its name, like for example class MyObject < ActiveRecord::Base acts_as_whatever end I want to define methods from the gem using that class's...

How can i parse a user object to return a screen name and move on to my next step?

I'm on code-cademy and i'm in Step 2 of learning twittr api in rubygem (i think its called)... I did Step 1 easy. This is what the second lesson reads... The response from the verify_credentials.json endpoint contains a JSON-encoded representation of the authenticating user for successful requests. Now you will...

Can't convert html.erb's to haml with the “erb2haml” gem on Windows

Solved. Look at my answer below. My Problem: I just can't convert all my html.erb's to haml. I tried the erb2haml gem with the "rake haml:replace_erbs" command but it doesn't work. Here is the full error:       C:\xampp\htdocs\Ruby>rake haml:replace_erbs --trace ** Invoke haml:replace_erbs (first_time) ** Execute haml:replace_erbs rake...

Installing nginx as a ruby gem vs using apt-get

I'm new to running a Linux server and slowly getting up to speed with things. I have already installed nginx via the apt-get function, although I'm following a tutorial which recommends installing it as a ruby gem instead. Is there any difference in the functionality/limitations to installing it as a...

Failed to build native extension while installing oily_png

I'm having a hard time installing a gem required by my Ruby project (automated tests based on Cucumber and SitePrism but I don't think that's relevant). The output suggests a problem with native extensions but I do have the devkit installed and have previously used it without any trouble. $...

How to install a rubygem from inside a ruby script and require this gem afterwards?

I would like to do something like this: begin require 'progressbar' rescue LoadError => e puts "exception .. installing with gem" h = system 'gem install progressbar' puts "gem installed #{h}" require 'progressbar' end pbar = ProgressBar.new("test", 100) 100.times {sleep(0.1); pbar.inc}; pbar.finish but obviously if you run this snippet, the...

gem: command not found

I have bash file which build gem files and launch my program: cd /src/stackify-api rm *.gem gem build stackify.gemspec gem install stackify-0.1.0.gem cd /src/stackify-classificator rm *.gem gem build stackify-classificator.gemspec gem install stackify-classificator-0.1.1.gem cd /src/bin ruby console-task.rb I use it in the docker container. It works fine if I launch the...

Parsing a JSON string with multiple keys

I am trying to write a simple JSON parser. I am getting my JSON string from odata.org. I tried to access the elements of the parsed JSON string using the technique listed in the second answer in "Parsing a JSON string in ruby". You'll see that there are a bunch...

Can't install Nokogiri 1.4.3 gem

Can't install nokogiri 1.4.3 gem. Nokogiri installs without a problem. Using latest RVM on Ubuntu. [email protected]:~$ gem install nokogiri -v '1.4.3' Fetching: nokogiri-1.4.3.gem (100%) Building native extensions. This could take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. /home/pm/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150519-7580-2yzgsg.rb extconf.rb *** extconf.rb...

Using cron and ruby

OS: Mac OS X 10.10.3; Ruby version: 2.2.0; I have a problem with using cron, that launches ruby script. Problem: cron launches ruby script, but nothing happened. That cron says in its logs (script requires mongo gem) : /Users/username/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- mongo (LoadError) from /Users/username/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'...

Install a gem locally for development

I'm new to ruby (many years of Python experience) and want to install this gem locally to replace the existing one which I installed using gem install swagger-docs. I have tried everything but cannot get rails to pick up my local version.

Unable to Setup Ruby Gems on Windows

When I try to setup ruby gems on Windows 7 using http://rubyinstaller.org/: ruby setup.rb I get the following error C:/rubygems-2.4.5/lib/rubygems.rb:1239:in `<top (required)>': uninitialized constant Gem::Specification (NameError) from setup.rb:32:in `require' from setup.rb:32:in `<main>' How can I resolve this issue? I've tried using Ruby 2.1.5 and 1.9.3-p551. Edit C:\>ruby -version ruby 2.1.5p273...

Destroying UpVotes on acts_as_votable

I have a rails app that is working fine using acts_as_votable. The like button upvotes the post count, and then switches to an un-like button and this down votes the post count. My issue is, that since I started using the Public Activity gem, I can't find a way to...

using devise WITHOUT the gem, can I simply copy the files?

Could I simply copy the devise app and lib (and gem?) folders into my respective project folders and have them work just as if I was using the gem? I'd like to do this so that I can really see all the code, possibly do some customization, and also avoid...

Getting a list of required gems

What is the best way to get the list of gems that are required? The pseudo variable $" (loaded feature) gives a list of all files loaded, some of which are files internally loaded by gems, and others are non-gem files that were loaded. The Gem::Specification.map(&:name) gives all gems that...

Make responders gem a dependency in gemspec?

I have a gem which requires the 'responders' gem. Below I've posted a section of my .gemspec file. Whenever I install my gem I always get the responders/rails-upgrade error message. Why would this be happening when an app is using my gem? Are these dependencies correct? s.add_development_dependency 'bundler', '~> 1.8'...

How to install a ruby gem

I'm trying to write a program with colorized output. I looked at a few, and the gem I found was colorize. I've done some research, but I can't find step-by-step instructions on how to install a gem, require it, and use it. The gem I want is colorize, and I...

Install ruby gem feedjira on codingground online coding platform

I cannot install feddjira on Codingground online coding plataform (http://www.tutorialspoint.com/execute_ruby_online.php) via gem install feedjira It says sh-4.2# gem install feedjira Fetching: sax-machine-1.3.2.gem (100%) Successfully installed sax-machine-1.3.2 Fetching: curb-0.8.8.gem (100%) Building native extensions. This could take a while... Killed Feedjira is not installed bash-4.2# gem list *** LOCAL GEMS *** bigdecimal...

Gems groups in the Gemfile for rails

Is it necessary to divide the gems inside the Gemfile in groups, i.e. production, test, development, even though I want to use the exact gems for all of the environments?

Rails, default.js is empty, and jquery and jquery_ujs not loaded

I am practicing ruby on rails by using rails guides. In the section 5.13 Deleting Articles they are showing how to create the delete (destroy) functionality. I followed the steps correctly, but the delete confirmation dialogue isn't shown and the articles are not getting deleted. When I checked the chrome...

mysql ruby gem not installing on Windows 7

Not a duplicate. This question is mysql gem and the other question is mysql2 gem. They do have the same answer though, but the other question's answer doesn't tell what the solution is explicitly. The answer is hidden in the comments. See yellow text of the answer for this...

Ruby byebug never stops

Ruby byebug never seems to stop in any of my code. It installed properly without errors. I did a bundle update byebug as well as gem pristine byebug. I start the rails server with this command rails s -e development Here's the gem file source 'https://rubygems.org' #ruby '2.0.0' gem 'multi_json',...

Curb v 0.8.5 won't install on Ubuntu 14.04

I'm trying to install curb v 0.8.5 gem but without any success. Below is a stack trace: /usr/local/bin/ruby -r ./siteconf20150211-19572-1mel9g2.rb extconf.rb checking for curl-config... yes checking for curlinfo_appconnect_time... yes checking for curlinfo_redirect_time... yes checking for curlinfo_response_code... yes checking for curlinfo_filetime... yes checking for curlinfo_redirect_count... yes checking for curlinfo_os_errno... yes checking...

Error installing Ruby in Rails in Maverick

I've tried multiple solutions offered on similar question posted here but nothing seems to work. I can't install Rails. Error message is below. Also, Wwen I try to install Xcode by using xcode-select --install, it give me an installation o network cannot download due to network Please advise. I'm very...

how to customize the gem: pace-rails default option startOnPageLoad in rails 4

I choose a gem pace-rails for show a progress bar, but I just want to show it in limited requests, I know it's need to change the default option startOnPageLoad to false. how can i do it in my application.js or anywhere? thank you...

How to add require 'zip/zip' and 'zip' in Gem file

I have two ruby files where one file is using "require 'zip/zip'" with rubyzip version '0.0.9' and other "require 'zip'" with rubyzip version 1.1.7. If use them separately(alone) its working fine.If i combine i am getting error like "no such file to load — zip/zip". How can i solve this?...

how can I install gem from source on local machine? [duplicate]

This question already has an answer here: How to install gem from GitHub source? 9 answers I have downloaded a gem source from a private repository to my local machine, how can I install it from the source?...

Ruby gem install

I started in Ruby recently. And I'm having trouble installing a gem . I use this command : gem install ocra-1.3.4 What am I doing wrong ? The gem file is in the same place the batch....

cap command not found [Cygwin + Capistrano]

I've installed ruby, rubygems and rails through Cygwin setup. Then I've installed a gem: gem install capistrano --verbose No problem here. But when I try to run cap command, Cygwin tells me:cap: command not found When I execute in ./bin/cap it works: $ ./bin/cap Stage not set, please call something...

Bundle update installs gems into ~/.rvm/gems/[email protected]_rails_4_0

I have a rails project located at ~/RailsApp From there I run: bundle update The ensuing gems are then installed into this directory: ~/.rvm/gems/[email protected]_rails_4_0 What is railstutorial_rails_4_0 and where is it coming from? Is this directory configured somewhere? It's an issue because when I try to debug in RubyMine I...

Ruby on Rails 4.2.2 ArgumentError (wrong number of arguments (2 for 1)) [duplicate]

This question already has an answer here: Rails 'parse_query' error on server in brand new app 2 answers I've recently cleaned out all of my gems due to this issue and tried to reinstall via the following: $ gem install rails $ rails new myproject $ cd myproject $...

Twitter Boostrap in Rails

I generated views using this command rails g bootstrap:themed Todo it generated several views for my model. I am using git and reverted the project to its former branch without the boostrap. Now, I am trying to regenerate the views but it always returns this identical app/views/manifests/index.html.erb How do I...

How do I upload a gem to geminabox?

When I upload a gem to geminabox, what exactly am I supposed to be uploading? Apparently not the .gemspec file. When I do that, I get "400Cannot process gem". So what should I be uploading?

Executable “require” can't find it's own library

I am making a ruby gem with an executable and a class library. The executable has require "fpa/chklinks" which is the class library in lib/fpa directory. I get the following error when I run my executable named chklinks.rb: $ bin/chklinks.rb -h /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- fpa/chklinks (LoadError)...