标签: gem

gem install mysql2失败

我收到了这个错误:

sudo gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for rb_thread_blocking_region()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** 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
details.  You may …
Run Code Online (Sandbox Code Playgroud)

mysql ubuntu gem

27
推荐指数
3
解决办法
2万
查看次数

你如何检查是否已加载库/ ruby​​-gem?

在ruby代码中,我如何检查加载了哪些外部库?例如,

require 'some-library'
if is-loaded?('some-library')
  puts "this will run"
end
Run Code Online (Sandbox Code Playgroud)

要么

# require 'some-library' Don't load it in here
if is-loaded?('some-library')
  puts "this will not run"
end
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?

请注意我为什么需要这个:我正在研究繁荣,在Windows上,它将尝试包含'Win32/Console/ANSI',以启用ANSI颜色代码,如\ e [36m.我要做的是,如果系统是Windows并且未加载"Win32/Console/ANSI",它将附加颜色代码,因此不输出颜色代码.这是文件.

ruby gem

27
推荐指数
5
解决办法
1万
查看次数

为什么bundler无法访问http://rubygems.org?

捆绑安装昨天工作正常,但现在它在CL中返回此输出:

   ~/dev/rails/sample_app$ bundle install
   Fetching gem metadata from https://rubygems.org/.
   Error Bundler::HTTPError during request to dependency API
   Fetching full source index from https://rubygems.org/
   Could not reach https://rubygems.org/
Run Code Online (Sandbox Code Playgroud)

我对gem文件所做的唯一更改是在测试组中为factory girl(1.4.0)添加gem.

我不是在任何代理人背后工作,我也完全连接到互联网.似乎无法在谷歌上找到这样的东西.任何帮助将非常感激!

ruby gem ruby-on-rails bundler

27
推荐指数
3
解决办法
3万
查看次数

如何在rails中创建通知系统?

基本上,我想创建一个像Facebook和Stackoverflow的通知.具体来说,在帖子评论系统中,当帖子得到评论时,所涉及的每个人(创建帖子的人和创建评论的人,除了新的评论者)都会收到一条通知消息,说明此帖子已被评论.当人们阅读通知时,通知就会被驳回.

我曾尝试使用mailboxer gem来实现它,但遗憾的是没有使用其相关方法的可用示例,包括social_stream本身.

还有其他方法来创建通知系统吗?

当我尝试从头开始创建它时,我遇到了几个问题:

    Model Notification
    topic_id: integer
    user_id: integer
    checked: boolean #so we can tell whether the notification is read or not
Run Code Online (Sandbox Code Playgroud)
  1. 用户阅读后删除通知

我认为我们只需要在用户访问通知索引后将每个通知消息的"已检查"属性设置为true.(在NotificationsController中)

    def index
      @notifications=current_user.notication.all
      @notification.each do |notification|
         notification.checked = true
      end
      @notification.save!
    end
Run Code Online (Sandbox Code Playgroud)

2.选择要通知的用户(并排除用户发表新评论)

我只是不知道如何查询......

3.创建通知

我认为这应该是这样的

    #in CommentController
    def create
      #after creating comments, creat notifications
      @users.each do |user|
        Notification.create(topic_id:@topic, user_id: user.id)
      end
    end
Run Code Online (Sandbox Code Playgroud)

但我认为这真的很难看

没有必要解决上面的3个问题,任何简单的通知系统解决方案都是可取的,谢谢......

gem notifications ruby-on-rails

27
推荐指数
2
解决办法
2万
查看次数

简单的Rails 3 CMS Gem /插件?

任何人都可以为Rails 3推荐一个简单,轻量级的CMS gem或插件,可以轻松嵌入到现有的应用程序中吗?

gem plugins content-management-system ruby-on-rails-3

26
推荐指数
4
解决办法
1万
查看次数

开发宝石和测试

我是开发Ruby宝石的新手,但我想我会尝试一下.

最近在Railscasts上查看最新一集(http://railscasts.com/episodes/245-new-gem-with-bundler)我正在使用Bundler来创建我的宝石.

但是我对如何测试我的宝石毫无头绪.

当然我可以运行rake安装,然后从irb需要它,但这对我来说似乎是一种缓慢的工作流程.

我想做的是创建一个虚拟Rails应用程序,并通过引用它的源代码来要求gem.这可能吗?我确定我已经在某个地方读过这个...

谢谢!

ruby gem ruby-on-rails

26
推荐指数
4
解决办法
2万
查看次数

这是什么意思BUNDLE_DISABLE_SHARED_GEMS:'1'?

我找到了BUNDLE_DISABLE_SHARED_GEMS: '1',在.bundle/config.这是什么意思?

ruby gem config ruby-on-rails bundler

26
推荐指数
2
解决办法
7352
查看次数

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

我最近想更新我的gem包但遇到了libv8的安装问题(对therubyracer的要求):

Installing libv8 (3.3.10.3) with native extensions /usr/local/rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed
 to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /usr/local/rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb 
Checking for Python...*** 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
details.  You may need configuration options.

在therubyracer github网站上找到了问题报告,它建议卸载并重新安装libv8,但这不适用于我的Ubuntu 11.04机器.任何想法 - 还是我坚持旧版本一段时间?

gem ruby-on-rails

26
推荐指数
3
解决办法
6万
查看次数

安装debugger-linecache(1.1.1)时发生错误,Bundler无法继续

知道如何解决这个问题吗?

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/home/durrantm/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p194 provided with debugger-ruby_core_source gem.
**************************************************************************
Run Code Online (Sandbox Code Playgroud)

ruby gem ruby-on-rails gemfile

26
推荐指数
2
解决办法
1万
查看次数

Gem安装调试器错误

我在Mac OS 10.9.2上运行Rails v4.0.2并且我顺利完成了一切.我突然发现一个错误,当我尝试时,宝石丢失了rails server.我运行bundle install,这是输出:

Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Using rake 10.1.1
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.9.0
Using atomic 1.1.16
Using thread_safe 0.2.0
Using tzinfo 0.3.39
Using activesupport 4.0.2
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.2
Using mime-types 1.25.1
Using polyglot 0.3.4
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.2
Using activemodel 4.0.2
Using activerecord-deprecated_finders 1.0.3
Using arel …
Run Code Online (Sandbox Code Playgroud)

ruby gem ruby-on-rails rvm

25
推荐指数
4
解决办法
3万
查看次数