rubygems

How to control the version of Chef that Vagrant uses to provision VMs?

一笑奈何 提交于 2019-12-17 17:28:22
问题 A current Chef recipe isn't running because of a bug in version 0.10.10. How can I upgrade the version of Chef that Vagrant uses, to 0.10.12? I don't want to just update it for the current instance of the VM - I keep destroying and rebuilding those. Do I need to change something in the Vagrant base box, or something in my (physical) system's installation? 回答1: Using the Vagrant plugin vagrant-omnibus worked great for me: vagrant plugin install vagrant-omnibus You can then simply configure

Update just one gem with bundler

故事扮演 提交于 2019-12-17 17:23:39
问题 I use bundler to manage dependencies in my rails app, and I have a gem hosted in a git repository included as followed: gem 'gem-name', :git => 'path/to/my/gem.git' To update this gem, I execute bundle update but it also updates all the gem mentioned in Gemfile. So what is the command to update just one specific gem? 回答1: Here you can find a good explanation on the difference between Update both gem and dependencies: bundle update gem-name or Update exclusively the gem: bundle update --source

Cannot install Puma gem on Ruby on Rails

给你一囗甜甜゛ 提交于 2019-12-17 16:14:50
问题 I'm trying to install the puma gem, but when I run gem install puma I get this error message: Temporarily enhancing PATH to include DevKit Building native extensions. This could take a while... ERROR: Error installing puma: ERROR: Failed to build gem native extension. C:/Ruby193/bin/ruby.exe extconf.rb creating Makefile make generating puma_http11-i386-mingw32.def compiling http11_parser.c ext/http11/http11_parser.rl: In function 'puma_parser_execute': ext/http11/http11_parser.rl:111:3:

Rails Devise: after_confirmation

给你一囗甜甜゛ 提交于 2019-12-17 15:53:33
问题 Is there a way to create a after_confirmation :do_something ? The goal is to send an e-mail after the user confirms using Devise :confirmable . 回答1: For new versions of devise 3.x : See a different answer http://stackoverflow.com/a/20630036/2832282 For old versions of devise 2.x : (Original answer) but you should be able to put a before_save callback on the user (extra credit for using an observer) and check if confirmed_at was just set by devise. You can do something like: send_the_email if

How do I read the content of an Excel spreadsheet using Ruby?

微笑、不失礼 提交于 2019-12-17 15:34:54
问题 I am trying to read an Excel spreadsheet file with Ruby, but it is not reading the content of the file. This is my script book = Spreadsheet.open 'myexcel.xls'; sheet1 = book.worksheet 0 sheet1.each do |row| puts row.inspect ; puts row.format 2; puts row[1]; exit; end It is giving me the following: [DEPRECATED] By requiring 'parseexcel', 'parseexcel/parseexcel' and/or 'parseexcel/parser' you are loading a Compatibility layer which provides a drop-in replacement for the ParseExcel library.

What's the difference between GEM_HOME and GEM_PATH?

為{幸葍}努か 提交于 2019-12-17 15:29:15
问题 RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them. It is analogous to EasyInstall for the Python programming language. RubyGems is now part of the standard library from Ruby version 1.9. That said, what's the difference between GEM_HOME and GEM_PATH? 回答1: GEM_PATH

`gem install therubyracer` fails on Mac OS X Lion

核能气质少年 提交于 2019-12-17 15:19:20
问题 I would appreciate some help in getting gem install therubyracer to work. Here is the error: $ gem install therubyracer Building native extensions. This could take a while... ERROR: Error installing therubyracer: ERROR: Failed to build gem native extension. /Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb checking for main() in -lobjc... yes *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf

Ignoring GEM because its extensions are not built

最后都变了- 提交于 2019-12-17 15:08:16
问题 On both my work and home computers, I recently upgraded Ruby to 2.3.1, using ruby-install . I use chruby as my Ruby switcher. I started seeing this warning in my terminal: Ignoring bcrypt-3.1.11 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.11 Ignoring bcrypt-3.1.10 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.10 Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0

How do RVM and rbenv actually work?

二次信任 提交于 2019-12-17 14:59:16
问题 I am interested in how RVM and rbenv actually work. Obviously they swap between different versions of Ruby and gemsets, but how is this achieved? I had assumed they were simply updating symlinks, but having delved into the code (and I must admit my knowledge of Bash is superficial) they appear to be doing more than this. 回答1: Short explanation: rbenv works by hooking into your environment's PATH . The concept is simple, but the devil is in the details; full scoop below. First, rbenv creates

Could not find rails (>= 0) amongst [] (Gem::LoadError)

╄→尐↘猪︶ㄣ 提交于 2019-12-17 10:23:49
问题 After installing rvm, updating .gmrc file, updating rubygems and running gem install rails -v ">=3.1.0rc" , I now seem to have a complete mess: $ rails -v /usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [] (Gem::LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec' from /usr/local/lib/site_ruby/1.8/rubygems.rb:1182:in `gem' from /var/lib/gems/1.8/bin/rails:18 myhome@myhome-mini:~$ gem env RubyGems