Tag: gem

Rails app:在Twitter Bootstrap中使用gem与包含源代码

我已经浏览了我的应用程序,当我通过gem包含它时,我很难找到Twitter Bootstrap源的确切位置。 例如,如果我想查看Bootstrap .css,我该如何找到它? 根据我的理解,将其作为gem包含在内的替代方案是下载并直接包含源代码,对吗? 一种方法比另一种更好。 最后,如果我想修改Bootstrap css,最好的方法是什么? 如果我在我的应用程序中有源代码,我想我可以去那里修改一些东西。 如果我把它作为gem包括在内怎么样? 关于如何工作的一些澄清将不胜感激。 将源代码放在我的应用程序目录中某个地方是有道理的,我可以指向它相对于.html文件…但是使用Gemfile我觉得事情是在一个小黑盒子里……

执行Nokogiri测试仪时需要“open-url”加载错误

我试图跟随RailsCast使用Nokogiri。 我的测试脚本文件中只有几个非常基本的行: require ‘rubygems’ require ‘nokogiri’ require ‘open-url’ url = “http://www.walmart.com/search/search-ng.do?search_constraint=0&ic=48_0&search_query=Batman&Find.x=0&Find.y=0&Find=Find” doc = Nokogiri::HTML(open(url)) puts doc.at_css(“title”).text 但是当我执行它时,我遇到了一个错误: /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require’: cannot load such file — open-url (LoadError) from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require’ from nokogiri.test.rb:3:in `’ 我按照以下说明安装了open url gem: https : //github.com/openurl/openurl如何修复错误消息?

bundle install / update:libv8(therubyracer)安装失败(带有本机扩展)

我最近想更新我的gem包但是遇到了libv8的安装问题(对therubyracer的要求): 使用本机扩展安装libv8(3.3.10.3)/usr/local/rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:在块中救援在build_extensions’中:错误:失败 构建gem原生扩展。 (gem::安装:: ExtensionBuildError) /usr/local/rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb 检查Python … *** extconf.rb失败*** 由于某些原因,可能无法创建Makefile 必要的库和/或标题。 检查mkmf.log文件以获取更多信息 细节。 您可能需要配置选项。 我在therubyracer github网站上找到了问题报告 ,它建议卸载并重新安装libv8,但这不适用于我的Ubuntu 11.04机器。 任何想法 – 还是我坚持旧版本一段时间?

完全删除RVM,Ruby和gem?

我不得不降级Rails,现在gem,版本和所有东西都完全搞砸了,我觉得我喜欢从窗户跳下来。 我只想破坏与RVM,Ruby和gem相关的所有内容,以确保我完全重新安装100%。 我怎样才能做到这一点?

从gem安装RMagick时出错

尝试安装RMagick gem失败了,因为无法找到ImageMagick库,即使我确定它们已安装。 gem install rmagick的相关输出是: checking for InitializeMagick() in -lMagick… no checking for InitializeMagick() in -lMagickCore… no checking for InitializeMagick() in -lMagick++… no Can’t install RMagick 2.6.0. Can’t find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information. *** extconf.rb failed *** 在mkmf.log中查看显示: have_library: checking for InitializeMagick() […]

厨房/ berkshelf想要旧gem?

我想测试一些食谱的变化,所以我做了我以前做过的事,但结果远非正常: $ ../gem-sucks/bin/kitchen收敛 —–>启动厨房(v1.2.1) !!!!!! 缺少’berkshelf’gem,必须安装或无法正确激活。 如果您使用的是Bundler:`gem’sberkshelf’,请运行`gem install berkshelf`或将以下内容添加到您的Gemfile中。 >>>>>> ——exception——- >>>>>>类:Kitchen :: UserError >>>>>>消息:无法加载或激活Berkshelf(无法激活json-1.8.0,已激活json-1.8.1) >>>>>> ———————- >>>>>>请参阅.kitchen / logs / kitchen.log了解更多详情 >>>>>>还可以尝试运行`kitchen diagnose –all`进行配置 $ gem list | grep berkshelf berkshelf(3.2.1,3.1.4,2.0.10,2.0.9) berkshelf-api-client(1.2.0) $ gem list | grep json json(1.8.1,1.8.0) multi_json(1.10.1,1.7.9) 这台机器正在运行debian Jessie,自从我最后触及这本食谱以来,已经更新了许多软件包(我不知道是否有任何ruby相关)。 如何让厨房再次工作?

运行Rails时出现“未定义的符号:rb_Digest_MD5_Init”

我正在尝试运行Ruby On Rails,但每次启动它时(即使我在没有参数的情况下运行rails ,它应该显示一些帮助)它会产生一个错误: serge1peshcoff@myLaptop:~$ rails /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’: /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/x86_64-linux/digest/md5.so: undefined symbol: rb_Digest_MD5_Init – /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/x86_64-linux/digest/md5.so (LoadError) from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/generators/app_base.rb:1:in `’ from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/generators/rails/app/app_generator.rb:1:in `’ from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/commands/application.rb:2:in `’ from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /home/serge1peshcoff/.rvm/gems/ruby-2.2.3/gems/railties-4.2.4/lib/rails/cli.rb:14:in `’ from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /home/serge1peshcoff/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from […]

已经激活的rake版本与Gemfile所需的版本不同,可以防止rake命令

这是我的错误: rake aborted! Gem::LoadError: You have already activated rake 10.3.1, but your Gemfile requires rake 10.2.2. Prepending `bundle exec` to your command may solve this. /Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:34:in `block in setup’ /Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:19:in `setup’ /Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup’ /Users/AaronWilliamson/.gem/ruby/2.1.0/gems/bundler-1.5.3/lib/bundler/setup.rb:7:in `’ /Users/AaronWilliamson/Desktop/Ripelist-Classifieds/config/boot.rb:4:in `’ /Users/AaronWilliamson/Desktop/Ripelist-Classifieds/config/application.rb:1:in `’ /Users/AaronWilliamson/Desktop/Ripelist-Classifieds/Rakefile:4:in `’ LoadError: cannot load such file — bundler/setup /Users/AaronWilliamson/Desktop/Ripelist-Classifieds/config/boot.rb:4:in `’ /Users/AaronWilliamson/Desktop/Ripelist-Classifieds/config/application.rb:1:in `’ /Users/AaronWilliamson/Desktop/Ripelist-Classifieds/Rakefile:4:in `’ (See […]

使用Rpush Gem Ruby on Rails向App发送通知

我试图使用Rpush Gem在我的应用程序中实现推送通知。 这是迄今为止我尝试过的。 if @push_notification.present? else app = Rpush::Apns::App.new app.name = “ios_app” app.certificate = File.read(“config/apns-dev.pem”) app.environment = “development” # APNs environment. app.password = “” app.connections = 1 app.save! end n = Rpush::Apns::Notification.new n.app = Rpush::Apns::App.find_by_name(“ios_app”) n.device_token = session[:push_notification_token] n.alert = “hi im alert!” n.data = { foo: :bar } n.save! 这会将通知保存到数据库中。 我想知道如何发送此通知。

使用twitter gem获取标签

我正在使用twitter gem在ruby中传输推文。 我的代码是 client.filter(:track => topics.join(“,”)) do |object| if(object.is_a?(Twitter::Entities)) puts object.text if object.is_a?(Twitter::Tweet) puts object.created_at puts object.hashtags.to_s puts object.user.name end end 我需要在推文中获取主题标签 ,如果我使用上面的代码我得到输出为 [#”coffee”, :indices=>[20, 27]}>, #”mornings”, :indices=>[28, 37]}>, #”cantstopmoving”, :indices=>[38, 53]}>] 有没有办法获取单个主题标签