Tag: gem

在osx上安装pg gem时出错

我在osx 10.6.7尝试在新的rails 3.0.7应用程序上运行bundle install,并且在尝试构建pg gem时它仍然失败。 它一直告诉我,我需要开发人员工具。 但据我所知,我已经安装了开发人员工具。 这是xcodebuild -version的输出 Xcode 3.2.6 Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0 BuildVersion: 10M2518 这是失败的pg gem构建的输出 /Users/bm/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb –with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config Using config values from /Library/PostgreSQL/8.4/bin/pg_config checking for libpq-fe.h… *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more […]

Bundler将我的gem放在我的项目目录中

我在Ruby 1.9.2上有一个Rails 3rc应用程序工作正常,但Bundler在我的项目目录中不断创建一个名为“bandsintown”的文件夹(bandsintown是我使用的gem)。 据我所知,该文件夹中包含了我的所有gem。 我很确定这从未发生过。 这是正常的行为吗? 我认为这可能会干扰运行测试。 我得到一个“命令失败,状态(1)”错误,然后它几次提到“bandsintown”文件夹。 我觉得奇怪的是Bundler将文件夹命名为“bandsintown”,即使我在gemfile中注释掉了这个gem。 在那个文件夹中有一个“ruby”文件夹,在“ruby”文件夹中有一个“1.9.1”文件夹。 当我使用1.9.2时,我不明白为什么它会说1.9.1。 1.9.1文件夹里面有bin,bundler,cache,doc,gems和specification文件夹。 我用所有相同的gem制作了一个testapp并进行了捆绑安装。 它不会创建一个包含所有gem的新文件夹。 无论如何,我的应用程序工作正常,但我很感激,如果有人可以帮助我在这里。 如果我遗漏了任何需要知道的信息,请告诉我。 谢谢。

为什么RSpec的方法,“获取”,“发布”,“放置”,“删除”不在gem(或Rails外部)的控制器规范中工作?

我不是Rails或Rspec的新手,但我是制作gem的新手。 当我测试我的控制器时,REST方法“get”,“post”,“put”,“delete”给我一个未定义的方法错误。 您可以在下方找到代码,但如果您希望在贴图中看到它, 请单击此处 。 谢谢! 这是我的spec_helper: $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), ‘..’, ‘lib’)) require ‘rubygems’ require ‘active_support’ unless defined? ActiveSupport # Need this so that mattr_accessor will work in Subscriber module require ‘active_record/acts/subscribable’ require ‘active_record/acts/subscriber’ require ‘action_view’ require ‘action_controller’ # Since we’ll be testing subscriptions controller #require ‘action_controller/test_process’ require ‘spec’ require ‘spec/autorun’ # Need active_support to user […]

在OS X 10.5下,Ruby的常规GEM路径是什么?

我的机器上的ruby存在性能问题,我认为我已经将其隔离到加载库(当调用#require时),所以我想弄清楚ruby是否为库搜索太多文件夹。 当我跑 $ gem environment RubyGems Environment: – RUBYGEMS VERSION: 1.3.0 – RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] – INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8 – RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby – EXECUTABLE DIRECTORY: /usr/bin – RUBYGEMS PLATFORMS: – ruby – universal-darwin-9 – GEM PATHS: – /Library/Ruby/Gems/1.8 – /Users/matt/.gem/ruby/1.8 – /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 – GEM CONFIGURATION: – :update_sources => true – […]

使用sudo进行gem install cocoapods

当我跑 $ gem install cocoapods 我明白了 Fetching: i18n-0.7.0.gem (100%) ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /Library/Ruby/Gems/2.0.0 directory. 我已经阅读了这篇文章cocoaPods pod安装权限被拒绝但是答案没有说明是否在你的gem install上运行sudo是正确的(尽管在问题中被问到 – 即sudo安装cocoaPods的方法是错误的还是正常的?)。

Ruby错误UTF-8到ASCII

我在Centos 5.5上安装了Ruby 1.9.2。 每次我安装一个gem,我都会收到错误 ERROR: While generating documentation for (gem) … MESSAGE: U+2018 from UTF-8 to US-ASCII … RDOC args: lib History.txt README.txt gem仍然安装好,但有些事我不能做。 比如使用SproutCore。 我得到了这个小gem(双关语)。 sc-init xxxx ~ Created directory at xxxx FATAL ~ invalid byte sequence in US-ASCII 任何人都知道发生了什么,以及如何解决它? 谷歌对此没什么帮助。

无法在Mac OS X上安装mysql gem

我使用http://dev.mysql.com/downloads/mysql中的安装程序安装了MySQL服务器。 然后,正如几个指南中所解释的那样,我想用以下命令安装mysql gem。 sudo gem install mysql 这不起作用,并给出以下输出。 Building native extensions. This could take a while… ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /Users/luzi/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb –with-mysql-dir=/usr/local/mysql/ checking for mysql_ssl_set()… *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log […]

无法在任何存储库中找到有效的gem“rails”(> = 0)

我是一个新鲜的Mac,刚刚使用rvm安装了ruby 1.9.3。 现在我正在尝试安装rails并在这篇文章的标题上得到错误。 我将在命令行下面发布所有信息,看看是否有人可以帮助我! Leonardos-MacBook-Air:~ leo$ gem install rails WARNING: Error fetching data: SocketError: getaddrinfo: nodename nor servname provided, or not known (http://rubygems.org/latest_specs.4.8.gz) ERROR: Could not find a valid gem ‘rails’ (>= 0) in any repository ERROR: Possible alternatives: rails Leonardos-MacBook-Air:~ leo$ ping rubygems.org PING rubygems.org (204.232.149.25): 56 data bytes 64 bytes from 204.232.149.25: icmp_seq=0 […]

如何从gem内部引用文件

从gem中找到文件的绝对路径的正确方法是什么? 换句话说,假设我在gem_install_path/mygem/lib/mygem.rb ,我想要通往gem_install_path/mygem/foo/的路径。 得到这个的正确方法是什么?

bundler / setup(LoadError)

我克隆了一个存储库并尝试运行rails s 。 但是,我收到以下错误: /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: cannot load such file — bundler/setup (LoadError) from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’ from /Users/me/workspace/bindo/config/boot.rb:7:in `’ from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’ from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’ from bin/rails:9:in `’ 我的ruby版本是: ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-darwin13.3.0] 我的gem env命令从这个项目目录运行: RubyGems Environment: – RUBYGEMS VERSION: 1.8.23.2 – RUBY VERSION: 1.9.3 (2014-05-14 patchlevel 547) [x86_64-darwin13.3.0] – INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.0.0 […]