Tag: gem

使用明确版本的ruby以root身份安装没有rvm的Gems

我已经决定摆脱rvm,而我在使用新版本的ruby 1.9.2编译gem时遇到了麻烦。 gem需要1.9.2,我有它,但说不能没有安装,所以错误信息没有意义。 如何明确告诉gem使用所述版本的ruby进行编译? Gem::InstallError: linecache19 requires Ruby version >= 1.9.2. An error occured while installing linecache19 (0.5.12), and Bundler cannot continue. Make sure that `gem install linecache19 -v ‘0.5.12’` succeeds before bundling. apps2 ~/projects/sms/apps2/apps2_admin $ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0] apps2 ~/projects/sms/apps2/apps2_admin $ which ruby /usr/local/bin/ruby

启用turbolinks重新渲染特定的js文件

我正在使用Rails 4并希望使用内置的Turbolink gem。 我很满意它所做的一切,除了我希望它在每个页面请求时重新加载一个js文件。 换句话说,我想要一个特定的js文件来忽略turbolinks,我该怎么做呢?

无法安装mysql2 gem OS X Mountain Lion

我是RoR的新手,我正在尝试安装Mysql2 -v’0.3.11’。 我有OS X Mountain Lion,rails 3.2.6,ruby 1.9.3。 以下是我得到的错误。 我到处看,没找到任何东西。 $gem install mysql2 -v ‘0.3.11’ Building native extensions. This could take a while… ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /Users/curiosity/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb checking for rb_thread_blocking_region()… yes checking for rb_wait_for_single_fd()… yes checking for mysql.h… yes checking for errmsg.h… yes checking for mysqld_error.h… […]

如何在gem中扩展ApplicationController?

我想我会想出一个灵活的方法来扩展Rails 3.x gem中的ApplicationController。 在我的gem的lib/my_namespace/my_controller.rb ,我有: class MyNamespace::MyController < ApplicationController before_filter :some_method after_filter :another_method def initialize # getting classname of the subclass to use for lookup of the associated model, etc. # and storing the model_class in an instance variable # … end # define :some_method, :another_method, etc. # … private attr_accessor :subclass_defined_during_initialize # etc. # […]

Passenger说Bundler:GemNotFound错误,而捆绑安装说它就在那里

我在共享主机上遇到Passenger错误 Could not find i18n-0.6.0 in any of the sources (Bundler::GemNotFound) 但如果我运行“捆绑安装”它说一切都好:( 并且Gemfile的内容是: source ‘http://rubygems.org’ gem ‘rake’, ‘0.8.7’ gem ‘tzinfo’, ‘0.3.27’ gem ‘mail’, ‘2.2.16’ gem ‘arel’, ‘2.0.9’ gem ‘rack’, ‘1.2.2’ gem ‘i18n’, ‘0.6.0’ gem ‘rails’, ‘3.0.5’ gem ‘mysql2’ gem ‘paperclip’ gem ‘devise’ gem ‘jquery-rails’ gem ‘acts-as-taggable-on’ gem “will_paginate”, “~> 3.0.pre2” gem ‘tiny_mce’ gem “oa-oauth”, :require […]

有没有办法改变gem的gcc编译选项?

我正在努力安装RedCloth gem。 当我打字 gem install RedCloth 我明白了: […] ragel/redcloth_attributes.c.rl: In function ‘redcloth_attribute_parser’: ragel/redcloth_attributes.c.rl:26:11: error: variable ‘act’ set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors make: *** [redcloth_attributes.o] Error 1 […] 原因是-Rerror编译选项传递给RedCloth gem的extconf.rb中的gcc: require ‘mkmf’ CONFIG[‘warnflags’].gsub!(/-Wshorten-64-to-32/, ”) if CONFIG[‘warnflags’] $CFLAGS << ' -O0 -Wall -Werror' if CONFIG['CC'] =~ /gcc/ […] 问题是,当我从文件中删除-Werror选项时,它会在下次启动“gem install”命令时自动重新出现。 […]

什么是捆绑安装 – 部署和捆绑包之间的区别

我知道他们都把gem放在你的应用程序的不同位置,但似乎捆绑安装 – 部署做得更彻底。 我可以将它创建的供应商/包目录添加到版本控制并完成吗?

Mountain Lion上的pg gem’0.14.0’失败了

我刚从OS X Lion升级到OS X Mountain Lion。 我的铁路环境大部分都保持着机智。 我必须做的唯一步骤才能让事情恢复到良好状态: – 安装XCode 4.4 – 安装XCode 4.4命令行工具 – 安装gcc-4.2 一切顺利。 这是问题,当我运行bundle install时几乎所有的gem都安装正确,除了我需要的最重要的一个 – postgresql gem’pg’。 它特别适用于0.12.2以上的版本。 我正在使用ruby 1.9.3p125。 我可以成功地获取0.12.2 pg gem以及下面的版本,但是它们给了我分段错误(我猜是因为我正在使用的ruby版本)。 因此,这让我相信它特定于pg gem,而不是我的整体环境看到其他gem安装正常。 我也尝试重新安装Postgresql以确保我的postgres环境没问题,并且在这方面似乎很好。 有没有人能够安装’pg’gem版0.13.0或更高版本(更优选0.14.X)? 这是我的堆栈跟踪: Building native extensions. This could take a while… ERROR: Error installing pg: ERROR: Failed to build gem native extension. /Users/caseyli/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb checking […]

脱机gem依赖项

不幸的是,当我在工作时,我正在开发一个绝不能连接到互联网的网络。 所以我一直在从rubygems.org下载我需要的每个gem,然后通过flashdisk将它们复制到内部网络。 这工作正常,除非我需要一个具有其他gem依赖关系的gem我必须单独下载这些并且它是缓慢而乏味的。 有没有办法下载一个gem及其所有依赖的gem进行离线安装? 我在互联网上有一台计算机,我可以安装gem,我希望我可以下载我需要的gem,它会自动安装依赖项,然后我可以复制到内部网络。 但是gem install似乎并没有在gem install留下.gem文件。

在Rails项目中找不到文件’jquery’

我正在使用Rails版本3.2.13和Ruby 2.0.0编写Agile Web Development书籍,但在尝试访问localhost:3000时我一直收到以下错误: Sprockets::FileNotFound in Store#index couldn’t find file ‘jquery’ (in /Users/…/app/assets/javascripts/application.js:13) 我的application.js文件: // This is a manifest file that’ll be compiled into application.js, which will include all the files // listed below. // // … // //= require jquery //= require jquery-ui //= require jquery_ujs //= require_tree . 在我的Gemfile ,我有gem ‘jquery-rails’, ‘~> 2.3.0’并尝试了许多我在互联网上找到的不同解决方案无济于事。