gemspecs

How to use 'debugger' and 'pry' when developing a gem? (Ruby)

℡╲_俬逩灬. 提交于 2019-12-02 03:39:31
I'm developing a gem, and my Gemfile looks like this: source :rubygems gemspec group :development, :test do gem "pry" gem "debugger" gem "rake" end However, I don't want people to have to install pry and debugger when running tests, but I also want to be able to require them in my tests (because I'm running tests prefixed with bundle exec , and I cannot get it them in my load path if they're not in the Gemfile). How do I achieve this? Also, when to put gems that I use for development in the gemspec, and when to put them in the Gemfile? I really don't know the difference. You can add gems to

How to add dependency of a local gem to a rails plugin/engine, in .gemspec file

一曲冷凌霜 提交于 2019-11-30 16:26:05
问题 I had tried in this way: s.add_dependency 'gem', :path => '../gem' like add gem in the gemfile, but it doesn't work, and will cause this error: /Users/chenqh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb:81:in `parse': Illformed requirement 回答1: It's likely not possible to add local dependencies because other users will not be able to access the gem as it is local dependent and hence of no use after publish. Instead of that, Add remote dependency in your own

How do I get the version from a gemspec file?

本秂侑毒 提交于 2019-11-30 08:38:56
Is there a clean way to extract the version string from a .gemspec file? (The gem is not yet installed) e.g. somethingcool.gemspec is Gem::Specification.new do |s| s.name = "somethingcool" s.version = "1.2.3" ... etc ... end I want to extract "1.2.3". I could grep it out but there must be a better way. require "rubygems" spec = Gem::Specification::load("example.gemspec") puts spec.version 来源: https://stackoverflow.com/questions/3262697/how-do-i-get-the-version-from-a-gemspec-file

How do I get the version from a gemspec file?

本秂侑毒 提交于 2019-11-29 11:40:02
问题 Is there a clean way to extract the version string from a .gemspec file? (The gem is not yet installed) e.g. somethingcool.gemspec is Gem::Specification.new do |s| s.name = "somethingcool" s.version = "1.2.3" ... etc ... end I want to extract "1.2.3". I could grep it out but there must be a better way. 回答1: require "rubygems" spec = Gem::Specification::load("example.gemspec") puts spec.version 来源: https://stackoverflow.com/questions/3262697/how-do-i-get-the-version-from-a-gemspec-file

Invalid gemspec -Illformed requirement [“#<YAML::Syck::DefaultKey:0xb5f9c990> 3.2.0”]

坚强是说给别人听的谎言 提交于 2019-11-28 09:43:35
Invalid gemspec in [/usr/lib/ruby/gems/1.8/specifications/activemodel-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb5f9c990> 3.2.0"] From trying to do a sudo gem update for other issues getting this hundreds of time as sudo gem update goes through each gem and gets the message for most of them This can happen when upgrading to Rails 3.2 . Updating Rubygems should fix this issue. gem update --system Hope this helps. Rainer Blessing I still had the errors after updating the rubygem. Then I ran rvm gemset empty to delete the gems. This fixed it for me. datnt I had this issue

Ruby Gemspec Dependency: Is possible have a git branch dependency?

这一生的挚爱 提交于 2019-11-28 04:48:25
Is possible have a git branch dependency, inside mygem.gemspec? I'm thinking something similar to the following: gem.add_runtime_dependency 'oauth2', :git => 'git@github.com:lgs/oauth2.git' ... but it doesn't work. gtd This is not possible, and likely never will be because it would be rather heavy-handed for RubyGems to allow gem developers to require that users have a specific version control system installed to access a gem. Gems should be self-contained with a minimal number of dependencies so that people can use them in as wide an array of application as possible. If you want to do this

Invalid gemspec -Illformed requirement [“#<YAML::Syck::DefaultKey:0xb5f9c990> 3.2.0”]

我的梦境 提交于 2019-11-27 03:10:09
问题 Invalid gemspec in [/usr/lib/ruby/gems/1.8/specifications/activemodel-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb5f9c990> 3.2.0"] From trying to do a sudo gem update for other issues getting this hundreds of time as sudo gem update goes through each gem and gets the message for most of them 回答1: This can happen when upgrading to Rails 3.2 . Updating Rubygems should fix this issue. gem update --system Hope this helps. 回答2: I still had the errors after updating the