rubygems

gem install: Failed to build gem native extension (can't find header files)

天大地大妈咪最大 提交于 2019-12-17 02:52:39
问题 I am using Fedora 14 and I have MySQL and MySQL server 5.1.42 installed and running. Now I tried to do this as root user: gem install mysql But I get this error: Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /usr

How to install gem from GitHub source?

十年热恋 提交于 2019-12-17 01:22:01
问题 I would like to install gem from the latest GitHub source. How do I do this? 回答1: In case you are using bundler, you need to add something like this to your Gemfile: gem 'redcarpet', :git => 'git://github.com/tanoku/redcarpet.git' And in case there is .gemspec file, it should be able to fetch and install the gem when running bundle install . 回答2: well, that depends on the project in question. Some projects have a *.gemspec file in their root directory. In that case, it would be gem build

How to install gem from GitHub source?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 01:21:48
问题 I would like to install gem from the latest GitHub source. How do I do this? 回答1: In case you are using bundler, you need to add something like this to your Gemfile: gem 'redcarpet', :git => 'git://github.com/tanoku/redcarpet.git' And in case there is .gemspec file, it should be able to fetch and install the gem when running bundle install . 回答2: well, that depends on the project in question. Some projects have a *.gemspec file in their root directory. In that case, it would be gem build

How to make --no-ri --no-rdoc the default for gem install?

二次信任 提交于 2019-12-17 01:19:01
问题 I don't use the RI or RDoc output from the gems I install in my machine or in the servers I handle (I use other means of documentation). Every gem I install installs RI and RDoc documentation by default, because I forget to set --no-ri --no-rdoc . Is there a way to make those two flags the default? 回答1: You just add following line to your local ~/.gemrc file (it is in your home folder) gem: --no-document or you can add this line to the global gemrc config file. Here is how to find it (in

Return single :key from nested hash in ruby

Deadly 提交于 2019-12-16 18:06:13
问题 From psd.rb gem by LayerVault, I get a hash that contains all the layers and groups of the psd in nested hashes. Here is a gist of the hash. I want to retrieve a certain key from that hash. Is there a way to do this and store those keys values in an array? 回答1: def values(hsh, key) return [] if !hsh.kind_of? Hash v = hsh[key] ? [hsh[key]] : [] hsh.values.select{|i| i.kind_of? Hash or i.kind_of? Array}.each do |val| if val.kind_of? Hash v+= values(val, key) else val.each {|i| v+= values(i, key

How to use pry-byebug in an example script for a gem?

自作多情 提交于 2019-12-14 04:18:22
问题 I'm working on making my first gem, which is not a Rails app, is a tic-tac-toe library with some AI in it, so I can play a computer opponent that will never lose and force a win if possible. Right now I am trying to debug the attack strategy in the AI, but I can't seem to figure out how to get pry-byebug working in my test script, specfically, have the debugging commands like step , next , etc. work upon hitting a binding.pry . The gem, named smart-tac-toe, has the following directory

Jekyll Serve not working

点点圈 提交于 2019-12-14 01:57:50
问题 I have downloaded zip of this github repo - https://github.com/mmistakes/minimal-mistakes I have installed bundler and I did bundle install , it worked perfectly. Now when I try to run jekyll serve -w , WARN: Unresolved specs during Gem::Specification.reset: jekyll-watch (~> 1.1) WARN: Clearing out unresolved specs. Please report a bug if this causes problems. Configuration file: /home/kenden/Desktop/minimal-mistakes-master/_config.yml Dependency Error: Yikes! It looks like you don't have

consuming gems from jruby-complete

牧云@^-^@ 提交于 2019-12-14 00:58:27
问题 I can make my jruby-complete consume gems from a jar passed to it. But I'd like to use a central gem repo. This is what I can do now: $ java -jar jruby-complete-1.6.5.jar -S gem list *** LOCAL GEMS *** rake (0.8.7) sources (0.0.1) $ java -jar jruby-complete-1.6.5.jar -rjar_of_gems.jar -S gem list *** LOCAL GEMS *** erubis (2.7.0) mizuno (0.4.1) rack (1.4.0) rack-protection (1.2.0) rake (0.8.7) rna (0.0.101) sinatra (1.3.2) sources (0.0.1) tilt (1.3.3) Having to change the jar file everytime I

How do I get a Ruby CGI program that requires a gem to run properly?

倾然丶 夕夏残阳落幕 提交于 2019-12-13 19:43:14
问题 I have configured my Apache installation to run Ruby CGI scripts. I am now trying to run a simple Ruby CGI script that requires a gem. When I run this script from the command line, it outputs correctly. But when I call it as an Apache CGI script, it generates an Apache Internal Server Error . The script looks like this: #!/Ruby/bin/ruby require 'RedCloth' # <-- This is the gem puts "Content-type: text/html" puts puts puts "<html>" puts "<head>" puts "</head>" puts "<body>" puts "I want to

Ruby tool to browse through installed gems code

喜你入骨 提交于 2019-12-13 17:26:40
问题 I am using a gem and I have trouble figuring out how to use a specific method. Currently to understand how it works, I have to go to github, search the gem realise the code is from a dependency, search the code repo for the other gem, realise it's another gem, locate it, find the class, and from there go from one class to another with a lot of browsers tabs open. I am on Linux using sublime text. Is there some tool that would allow me to directly access the code from a gem ? 回答1: You could