Code Monkey home page Code Monkey logo

gems's Introduction

Gems

Gem Version Build Status Code Climate Coverage Status

Ruby wrapper for the RubyGems.org API.

Installation

gem install gems

Documentation

https://rdoc.info/gems/gems

Usage Examples

require 'rubygems'
require 'gems'

# Return some basic information about rails.
Gems.info 'rails'

# Return some basic information about rails version 7.0.6.
Gems::V2.info 'rails', '7.0.6'

# Return an array of active gems that match the query.
Gems.search 'cucumber'

# Return all gems that you own.
Gems.gems

# Return all gems owned by Erik Michaels-Ober.
Gems.gems("sferik")

# Submit a gem to RubyGems.org.
Gems.push File.new 'gemcutter-0.2.1.gem'

# Remove a gem from RubyGems.org's index.
# Defaults to the latest version if no version is specified.
Gems.yank 'bills', '0.0.1'

# Update a previously yanked gem back into RubyGems.org's index.
# Defaults to the latest version if no version is specified.
Gems.unyank 'bills', '0.0.1'

# Return an array of version details for coulda.
Gems.versions 'coulda'

# Return an hash of latest version for coulda.
Gems.latest_version 'coulda'

# Return the total number of downloads for rails_admin 0.0.1.
# (Defaults to the latest version if no version is specified.)
Gems.total_downloads 'rails_admin', '0.0.1'

# Returns an array containing the top 50 downloaded gem versions of all time.
Gems.most_downloaded

# Return the total number of downloads by day for rails_admin 0.0.1.
# (Defaults to the latest version if no version is specified.)
Gems.downloads 'rails_admin', '0.0.1'

# Return the number of downloads by day for coulda 0.6.3 for the past 90 days.
# (Defaults to the latest version if no version is specified.)
Gems.downloads 'coulda', '0.6.3', Date.today - 90, Date.today

# Return the number of downloads by day for coulda 0.6.3 for the past year.
Gems.downloads 'coulda', '0.6.3', Date.today - 365, Date.today

# View all owners of a gem that you own.
Gems.owners 'gemcutter'

# Add an owner to a RubyGem you own, giving that user permission to manage it.
Gems.add_owner '[email protected]', 'gemcutter'

# Remove a user's permission to manage a RubyGem you own.
Gems.remove_owner '[email protected]', 'gemcutter'

# Return all the webhooks registered under your account.
Gems.web_hooks

# Add a webhook.
Gems.add_web_hook 'rails', 'http://example.com'

# Remove a webhook.
Gems.remove_web_hook 'rails', 'http://example.com'

# Test fire a webhook.
Gems.fire_web_hook 'rails', 'http://example.com'

# Returns the 50 gems most recently added to RubyGems.org
Gems.latest

# Returns the 50 most recently updated gems
Gems.just_updated

# Retrieve your API key using HTTP basic authentication.
Gems.configure do |config|
  config.username = '[email protected]'
  config.password = 'schwwwwing'
end
Gems.api_key

# Return an array of gem dependency details for all versions of all the given gems.
Gems.dependencies ['rails', 'thor']

# The following methods require authentication.
# By default, we load your API key from ~/.gem/credentials
# You can override this default by specifying a custom API key.
Gems.configure do |config|
  config.key = '701243f217cdf23b1370c7b66b65ca97'
end

Supported Ruby Versions

This library aims to support and is tested against the following Ruby implementations:

  • Ruby 2.3
  • Ruby 2.4
  • Ruby 2.5
  • Ruby 2.6
  • Ruby 2.7
  • Ruby 3.0
  • Ruby 3.1
  • Ruby 3.2
  • Ruby 3.3
  • JRuby

If something doesn't work on one of these interpreters, it's a bug.

This library may inadvertently work (or seem to work) on other Ruby implementations, however support will only be provided for the versions listed above.

If you would like this library to support another Ruby version, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.

Copyright

Copyright (c) 2011-2013 Erik Michaels-Ober. See LICENSE for details.

gems's People

Contributors

6thsigma avatar aaron1011 avatar aaronlasseigne avatar alup avatar banzaiman avatar bf4 avatar brixen avatar deivid-rodriguez avatar dependabot-preview[bot] avatar dhedlund avatar greysteil avatar hsbt avatar ivanovaleksey avatar m-nakamura145 avatar marcoroth avatar micfan avatar mjio avatar mlarraz avatar okuramasafumi avatar olleolleolle avatar rochefort avatar s2t2 avatar s4na avatar segiddins avatar seuros avatar sferik avatar tduffield avatar teancom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gems's Issues

new release ?

I noticed the gem switched from using yaml to json back in 2014
But the latest rubygems versions 0.8.3 is even older and uses yaml
any plans to release an update ?

T.

Getting more than 50 top downloaded

The Gems#most_downloaded method returns only the 50 most downloaded gems. Is there a way to increase that number? If so, it is not apparent in the doc/code. Thanks for your help!

Certificate expired

0 ~ ❯❯❯ gem cert --add <(curl -L https://raw.github.com/rubygems/gems/master/certs/sferik.pem)
Added '/CN=sferik/DC=gmail/DC=com'
0 ~ ❯❯❯ gem install gems -P HighSecurity
ERROR:  While executing gem ... (Gem::Security::Exception)
    certificate /CN=sferik/DC=gmail/DC=com not valid after 2014-02-03 10:02:27 UTC

undefined method `host' for Gem:Module (NoMethodError)

This isn't so much a bug as... a documentation request? I am using Gems in a project and tried to deploy it to Heroku. When the app goes to fire up, Gems tries to set the host name of rubygems.org, which it generally pulls from Gem.host. However, in the version of RubyGems that's installed on Heroku at the moment (1.3.7) doesn't support Gem.host.

I tried just setting the environment variable RUBYGEMS_HOST, but there are other conflicts with RubyGems. Would it be possible to note what version of RubyGems the latest release is tested against somewhere?

Some API results are the string "This rubygem could not be found."

This breaks the contract for the downloads method to return a Hash. It's also surprising since I got the gem name from a different api call which does have downloads. I haven't identified where the error is coming from or which other methods like return it. See https://gist.github.com/bf4/5952053#file-latest_downloads-yml-L301 for the list I'm generating (I'm interested in looking at gem download rates to see what the user base is for gems and authors etc)

# @return [Hash]
def downloads

Gems.downloads('energizer_bunny')
 => "This rubygem could not be found." 

Gems.latest.select {|g| g['name'] =~ /bunny/ }
 => [{"name"=>"energizer_bunny", "downloads"=>27, "version"=>"0.3.0", "version_downloads"=>27, "platform"=>"java", "authors"=>"Joel Friedman", "info"=>"Extra hot_bunnies.", "project_uri"=>"http://rubygems.org/gems/energizer_bunny", "gem_uri"=>"http://rubygems.org/gems/energizer_bunny-0.3.0-java.gem", "homepage_uri"=>"http://github.com/trunkclub/energizer_bunny", "wiki_uri"=>nil, "documentation_uri"=>nil, "mailing_list_uri"=>nil, "source_code_uri"=>nil, "bug_tracker_uri"=>nil, "dependencies"=>{"development"=>[{"name"=>"rspec", "requirements"=>"~> 2.11"}], "runtime"=>[{"name"=>"hot_bunnies", "requirements"=>"~> 1.4"}, {"name"=>"uuid", "requirements"=>"~> 2.0"}]}}] 

Gems.versions('energizer_bunny')
 => [{"authors"=>"Joel Friedman", "built_at"=>"2013-05-14T00:00:00Z", "description"=>"Extra hot_bunnies.", "downloads_count"=>27, "number"=>"0.3.0", "summary"=>"Declaratively configure hot_bunnies.", "platform"=>"java", "prerelease"=>false, "licenses"=>["MIT"]}] 

Error in Arch Linux

rp5 run texture1.rb

get error like this

libEGL warning: failed to create a pipe screen for i965
java.lang.NullPointerException
Java::JavaLang::RuntimeException
java.lang.NullPointerException

rp5 --nojruby run texture1.rb

no error

downloads per day should be removed

1.9.3-p392 :009 > Gems.downloads('rails', '4.0.0').map(&:last)
 => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

The backend data is pruned I believe, so no point in supporting this in the client.

Adding gem owner does not work for me

Not sure where to open this issue, but I am currently unable to add an owner to a gem I originally published, but the gem is maintained by a company I no longer work for.

Command line output:

> gem owner "omniauth-mydigipass" -a "[redacted email]" -V --debug
POST https://rubygems.org/api/v1/gems/omniauth-mydigipass/owners
Exception `OpenSSL::SSL::SSLError' at /Users/nathan/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/openssl/buffering.rb:174 - read would block
404 Not Found
Removing [redacted email]: Owner could not be found.

Is it regarded as a "remove" operation, because of the 404, or somehow it is regarded as remove, and thus I get a valid 404, because of course that owner is not yet an owner. I tried with -a and --add and both gave the same result.

Is this a network issue? I can push a gem (just released a new version of another gem). Or something else? A bit stumped here.

Tech-info: I had this issue with rubygems version 1.8.25, I upgraded to the latest 2.1.11 and still have that error (the error message improved, in the sense it now stats Removing ... and before it was just Owner could not be found). I am using ruby 1.9.3 on mac osx 10.8.

Can anybody give me a hint how to solve this?

README: Badge for CodeClimate invisible

Issue: there is an outdated (I think) badge for CodeClimate in the README.

Perhaps the way to include it changed.

The project's maintainer can enter the CodeClimate UI and find the section where the ID of the project is mentioned.

UI example of where to find the thing in another project (one which is open):

bild

I was unable to guess at the ID of the project, trying to add the badge.

Monthly downloads

Currently, there is no way in the api to get the number of downloads for the latest month. That figure is a very strong indicator of a project's usage, much more than the number of downloads of the latest version (or the total download count, for that matter), which can span many years.

It would be great if there was a way to get to that information through the RubyGems.org API, one way or another.

This issue is somewhat linked to that one: #16, which supports the removal of an API that used to give the information requested in this issue, but was strongly inaccurate.

Ruby Gems doesn't support repository behind Kerberos authentication

Currently Ruby Gems doesn't work with a repository that requires Kerberos authentication (or a proxy that requires authentication), it looks like there are libraries out there for Ruby that would do the heavy lifting of adding Kerberos support, http://httpirb.com/ would it be possible to just get this built into Gems? Or is there some workaround right now that I'm not aware of.

TypeError: incompatible marshal file format

When trying to call Gems.dependencies a TypeError is returned, running ruby 2.0.0p247 compiled by RVM on x86_64-linux.

2.0.0-p247 :001 > require 'gems'
 => true 
2.0.0-p247 :002 > Gems.dependencies ['rails', 'thor']
TypeError: incompatible marshal file format (can't be read)
format version 4.8 required; 60.104 given
from /home/peter/.rvm/gems/ruby-2.0.0-p247@g2e/gems/gems-0.8.1/lib/gems/client.rb:301:in `load'
from /home/peter/.rvm/gems/ruby-2.0.0-p247@g2e/gems/gems-0.8.1/lib/gems/client.rb:301:in `dependencies'
from /home/peter/.rvm/gems/ruby-2.0.0-p247@g2e/gems/gems-0.8.1/lib/gems.rb:17:in `method_missing'
from (irb):2
from /home/peter/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.