rubygems

I'm using rbenv, so why are there two Gem paths on my system? (OS X Lion)

筅森魡賤 提交于 2019-12-21 07:24:29
问题 To clarify, I'm using rbenv to manage my ruby versions. I was under the impression that binaries are managed as shims in their respective ruby version directory. Here is what my system shows when I run gem environment (I'm excluding the irrelevant parts): - GEM PATHS: - /Volumes/Data/nathan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1 - /Volumes/Data/nathan/.gem/ruby/1.9.1 Any reason for having two locations? Curious minds want to know. 回答1: I think I figured out the answer to this question

How do I specify heap size configuration in a config file

微笑、不失礼 提交于 2019-12-21 06:16:13
问题 gem install fails with the following error, How do I specify the heap size configuration in a common place so that I don't have to re-define this every time. Error: Your application used more memory than the safety cap of 500m. Specify -J-Xmx####m to increase it (#### = cap size in MB). Specify -w for full OutOfMemoryError stack trace. 回答1: This error and message are actually coming from jruby, not gem. Fortunately, jruby checks for default options in the JRUBY_OPTS environment variable. So,

Snow Leopard / 64-bit ruby gem problem?

本秂侑毒 提交于 2019-12-21 06:05:33
问题 I just upgraded to Snow Leopard, including installing the new XCode, re-compiled Ruby 1.8 and MySQL. My Rails app is running fine in the updated environment, except for some image processing features, which depend on ImageScience/FreeImage. I upgraded MacPorts to 1.8, removed all previously installed ports and reinstalled them in 1.8, which I assume would have installed a 64-bit versions of the ports, including FreeImage. I also re-installed the image_science and RubyInline as 64-bit gems

ERROR: Failed to build gem native extension on Windows

喜夏-厌秋 提交于 2019-12-21 05:11:29
问题 I'm getting the below error while installing ' redcarpet ' gem. It got installed without issue on my friends machine though. (I want to install this to run yard ) Ruby version: 1.9.3 cmd output: D:\Learning\Common_POM_FW\SampleProjects>yard [error]: Missing 'redcarpet' gem for Markdown formatting. Install it with `gem install redcarpet` D:\Learning\Common_POM_FW\SampleProjects>gem install redcarpet Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a

Fresh Ruby gem from Bundler - cannot load my version.rb file?

这一生的挚爱 提交于 2019-12-21 04:55:20
问题 I wanted to make a fresh Ruby app, so I decided to use bundle gem foo to do it. This gave me the whole: lib/ foo/ version.rb foo.rb Gemfile Rakefile foo.gemspec README.md structure. Now when I run ruby foo.rb , I get: `require': cannot load such file -- foo/version (LoadError) foo.rb is just the default: require 'foo/version' module Foo end Can gems not be ran on their own? I hope I don't have to include my gem into a sample app just to test it out? 回答1: You need to run bundle exec ruby foo

How to find unused gems and cleanup gemfile

老子叫甜甜 提交于 2019-12-21 04:15:15
问题 I'm looking for simple, but good way to cleanup gemfile and make rails startup faster. How can I get a list of all required gems vs all loaded gems. 回答1: I think it is impossible. When your APP starts it loads gems from Gemfile.lock but it does not know if they (gems) are needed in your code or not. The APP inform you by raising an exception When something calls a class or method that is undefined if some needed gem is missed (if you remove it from Gemfile), but this can happen at any moment

How to find unused gems and cleanup gemfile

痴心易碎 提交于 2019-12-21 04:15:08
问题 I'm looking for simple, but good way to cleanup gemfile and make rails startup faster. How can I get a list of all required gems vs all loaded gems. 回答1: I think it is impossible. When your APP starts it loads gems from Gemfile.lock but it does not know if they (gems) are needed in your code or not. The APP inform you by raising an exception When something calls a class or method that is undefined if some needed gem is missed (if you remove it from Gemfile), but this can happen at any moment

Setting up configuration settings when writing a gem

筅森魡賤 提交于 2019-12-21 03:35:13
问题 I'm writing a gem which I would like to work with and without the Rails environment. I have a Configuration class to allow configuration of the gem: module NameChecker class Configuration attr_accessor :api_key, :log_level def initialize self.api_key = nil self.log_level = 'info' end end class << self attr_accessor :configuration end def self.configure self.configuration ||= Configuration.new yield(configuration) if block_given? end end This can now be used like so: NameChecker.configure do

Ruby JSON.pretty_generate … is pretty unpretty

▼魔方 西西 提交于 2019-12-21 03:20:13
问题 I can't seem to get JSON.pretty_generate() to actually generate pretty output in Rails. I'm using Rails 2.3.5 and it seems to automatically load the JSON gem. Awesome. While using script/console this does indeed produce JSON: some_data = {'foo' => 1, 'bar' => 20, 'cow' => [1, 2, 3, 4], 'moo' => {'dog' => 'woof', 'cat' => 'meow'}} some_data.to_json => "{\"cow\":[1,2,3,4],\"moo\":{\"cat\":\"meow\",\"dog\":\"woof\"},\"foo\":1,\"bar\":20}" But this doesn't produce pretty output : JSON.pretty

gem and/or Ruby on Rails broke all of a sudden, anyone know what happened?

我的梦境 提交于 2019-12-21 02:59:41
问题 I had a Ruby on Rails app that used to work. I hadn't used it in a month or so, but then tried starting it up today with rails s and got the following error—in fact, I get this error when I try rails -h or rails -v or even gem -h or sudo gem update --system or anything having to do with gem . NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8