libraries_io 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +10 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +58 -0
- data/LICENSE.txt +21 -0
- data/README.md +126 -0
- data/Rakefile +34 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/libraries_io.rb +32 -0
- data/lib/libraries_io/aliases.rb +12 -0
- data/lib/libraries_io/api.rb +109 -0
- data/lib/libraries_io/doc.rb +19 -0
- data/lib/libraries_io/version.rb +3 -0
- data/libraries_io.gemspec +35 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0d173a9971784964e6080c24fe77fdd6623cc6fab86996f69cbe6cde806d1fc3
|
4
|
+
data.tar.gz: 398f84d91d8cbdd17f9e0235b5ab747f25f28a8baf2ef3a93ab32bd05dced668
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1b8f2766e3a3122e0b58d0c18c7fdfb2985937ea6ce1a920eb55f5c90d81399379767ed282f45c04acd8e797c2973e7c397dde54b940ca28b4260ed905e55f33
|
7
|
+
data.tar.gz: c146076ec7d9cf69db84f35e730023195632faee801db9eadda87360779bdb5efc6c5bbbe824c20a4943cbaeabdbd6e53e130acf4efb290dabeeb6cc6c0df88d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at github@marc-andre.ca. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
libraries_io (0.1.0)
|
5
|
+
tlaw
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
crack (0.4.3)
|
13
|
+
safe_yaml (~> 1.0.0)
|
14
|
+
diff-lcs (1.3)
|
15
|
+
faraday (0.15.2)
|
16
|
+
multipart-post (>= 1.2, < 3)
|
17
|
+
faraday_middleware (0.12.2)
|
18
|
+
faraday (>= 0.7.4, < 1.0)
|
19
|
+
multipart-post (2.0.0)
|
20
|
+
public_suffix (3.0.3)
|
21
|
+
rake (10.5.0)
|
22
|
+
rspec (3.8.0)
|
23
|
+
rspec-core (~> 3.8.0)
|
24
|
+
rspec-expectations (~> 3.8.0)
|
25
|
+
rspec-mocks (~> 3.8.0)
|
26
|
+
rspec-core (3.8.0)
|
27
|
+
rspec-support (~> 3.8.0)
|
28
|
+
rspec-expectations (3.8.1)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-its (1.2.0)
|
32
|
+
rspec-core (>= 3.0.0)
|
33
|
+
rspec-expectations (>= 3.0.0)
|
34
|
+
rspec-mocks (3.8.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.8.0)
|
37
|
+
rspec-support (3.8.0)
|
38
|
+
safe_yaml (1.0.4)
|
39
|
+
tlaw (0.0.2)
|
40
|
+
addressable
|
41
|
+
crack
|
42
|
+
faraday
|
43
|
+
faraday_middleware
|
44
|
+
vcr (3.0.3)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
bundler (~> 1.16)
|
51
|
+
libraries_io!
|
52
|
+
rake (~> 10.0)
|
53
|
+
rspec (~> 3.0)
|
54
|
+
rspec-its
|
55
|
+
vcr (~> 3.0)
|
56
|
+
|
57
|
+
BUNDLED WITH
|
58
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Marc-Andre Lafortune
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
[](https://travis-ci.org/marcandre/libraries_io) [](https://rubygems.org/gems/libraries_io)
|
2
|
+
|
3
|
+
|
4
|
+
# LibrariesIO
|
5
|
+
|
6
|
+
This is a wrapper for [Libraries.io](https://libraries.io/api#project-dependencies)'s API.
|
7
|
+
|
8
|
+
It implements it in about 100 lines, thanks to the [`tlaw` gem](https://github.com/molybdenum-99/tlaw).
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
1) Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'libraries_io'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
2) Get an API key [from Libraries.io](https://libraries.io/account) and specify it either:
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Example:
|
27
|
+
|
28
|
+
```
|
29
|
+
api = LibrariesIO.new(api_key: 'your_key')
|
30
|
+
|
31
|
+
api.search('some_name') # => results
|
32
|
+
|
33
|
+
api.platform('rubygems').project('rails').contributors # => list of contributors
|
34
|
+
|
35
|
+
# Shortcut to platforms provided:
|
36
|
+
api.rubygems.project('rails') # ... same
|
37
|
+
```
|
38
|
+
|
39
|
+
Thanks to the `tlaw` gem, the mapping should be pretty obvious and you can check the API source for details, or use `inspect` or `describe`:
|
40
|
+
|
41
|
+
```
|
42
|
+
api.platform('rubygems').project('rails')
|
43
|
+
# => #<project(id: "rails") endpoints: info, dependencies, dependents, dependent_repositories, contributors, sourcerank, usage; docs: .describe
|
44
|
+
|
45
|
+
api.platform('rubygems').project('rails').describe
|
46
|
+
# => .project(id: "rails")
|
47
|
+
# @param id
|
48
|
+
#
|
49
|
+
# Endpoints:
|
50
|
+
#
|
51
|
+
# .info()
|
52
|
+
# Get information about a package and it's versions
|
53
|
+
#
|
54
|
+
# .dependencies(version="latest")
|
55
|
+
# Get a list of dependencies for a version of a project
|
56
|
+
#
|
57
|
+
# .dependents()
|
58
|
+
# Get packages that have at least one version that depends on a given project
|
59
|
+
#
|
60
|
+
# .dependent_repositories()
|
61
|
+
# Get repositories that depend on a given project
|
62
|
+
#
|
63
|
+
# .contributors()
|
64
|
+
# Get users that have contributed to a given project
|
65
|
+
#
|
66
|
+
# .sourcerank()
|
67
|
+
# Get breakdown of SourceRank score for a given project
|
68
|
+
#
|
69
|
+
# .usage()
|
70
|
+
# Get breakdown of version usage for a given project
|
71
|
+
|
72
|
+
api.platform('rubygems').project('rails').endpoints[:dependents].describe
|
73
|
+
# => .dependents()
|
74
|
+
# Get packages that have at least one version that depends on a given project
|
75
|
+
#
|
76
|
+
# Docs: https://libraries.io/api#project-dependents
|
77
|
+
```
|
78
|
+
|
79
|
+
### API implemented
|
80
|
+
|
81
|
+
All documented calls are implemented (except "subscriptions"):
|
82
|
+
|
83
|
+
* [api.platforms](https://libraries.io/api#platforms)
|
84
|
+
* [api.search(q, sort: nil, languages: nil, licenses: nil, keywords: nil, platforms: nil)](https://libraries.io/api#project-search)
|
85
|
+
* [api.platform(platform_id=nil).project(id=nil).info](https://libraries.io/api#project)
|
86
|
+
* [api.platform(platform_id=nil).project(id=nil).dependencies(version="latest")](https://libraries.io/api#project-dependencies)
|
87
|
+
* [api.platform(platform_id=nil).project(id=nil).dependents](https://libraries.io/api#project-dependents)
|
88
|
+
* [api.platform(platform_id=nil).project(id=nil).dependent_repositories](https://libraries.io/api#project-dependent-repositories)
|
89
|
+
* [api.platform(platform_id=nil).project(id=nil).contributors](https://libraries.io/api#project-contributors)
|
90
|
+
* [api.platform(platform_id=nil).project(id=nil).sourcerank](https://libraries.io/api#project-sourcerank)
|
91
|
+
* [api.platform(platform_id=nil).project(id=nil).usage](https://libraries.io/api#project-usage)
|
92
|
+
* [api.repository(owner:, name:, host: "github").info](https://libraries.io/api#repository)
|
93
|
+
* [api.repository(owner:, name:, host: "github").dependencies](https://libraries.io/api#repository-dependencies)
|
94
|
+
* [api.repository(owner:, name:, host: "github").projects](https://libraries.io/api#repository-projects)
|
95
|
+
* [api.user(name, host: "github").info](https://libraries.io/api#user)
|
96
|
+
* [api.user(name, host: "github").repositories](https://libraries.io/api#user-repositories)
|
97
|
+
* [api.user(name, host: "github").projects](https://libraries.io/api#user-projects)
|
98
|
+
* [api.user(name, host: "github").repository_contributions](https://libraries.io/api#user-repository-contributions)
|
99
|
+
* [api.user(name, host: "github").dependencies(platform: nil)](https://libraries.io/api#user-dependencies)
|
100
|
+
|
101
|
+
### API Key
|
102
|
+
|
103
|
+
You can specify the API key in various ways:
|
104
|
+
|
105
|
+
* providing it when instantiating an API: `LibrariesIO.new(api_key: 'your_key')`
|
106
|
+
* as an environment variable `LIBRARIES_IO_API_KEY`
|
107
|
+
* setting the global `LibrariesIO.api_key = "your_key"` after the library is loaded
|
108
|
+
* writing it in a local file `.libraries_io_api_key`
|
109
|
+
|
110
|
+
## Development
|
111
|
+
|
112
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
113
|
+
|
114
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
115
|
+
|
116
|
+
## Contributing
|
117
|
+
|
118
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/marcandre/libraries_io. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
119
|
+
|
120
|
+
## License
|
121
|
+
|
122
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
123
|
+
|
124
|
+
## Code of Conduct
|
125
|
+
|
126
|
+
Everyone interacting in the LibrariesIO project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/marcandre/libraries_io/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
module CallSequence
|
9
|
+
def call_sequence
|
10
|
+
params = param_set.to_code
|
11
|
+
if params.empty?
|
12
|
+
symbol.to_s
|
13
|
+
else
|
14
|
+
"#{symbol}(#{params})"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def gen_doc(namespace, prefix = '')
|
20
|
+
namespace.endpoints.each do |_key, endpoint|
|
21
|
+
puts "* [#{prefix}.#{endpoint.call_sequence}](#{endpoint.docs_link})"
|
22
|
+
end
|
23
|
+
namespace.namespaces.each do |_key, sub|
|
24
|
+
gen_doc(sub, "#{prefix}.#{sub.call_sequence}")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
task :gen_doc do
|
29
|
+
require_relative 'lib/libraries_io'
|
30
|
+
|
31
|
+
TLAW::APIPath.extend CallSequence
|
32
|
+
|
33
|
+
gen_doc(LibrariesIO::API, 'api')
|
34
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "libraries_io"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/libraries_io.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'tlaw'
|
2
|
+
|
3
|
+
require_relative 'libraries_io/version'
|
4
|
+
require_relative 'libraries_io/api'
|
5
|
+
require_relative 'libraries_io/aliases'
|
6
|
+
require_relative 'libraries_io/doc'
|
7
|
+
|
8
|
+
module LibrariesIO
|
9
|
+
class << self
|
10
|
+
attr_accessor :api_key
|
11
|
+
|
12
|
+
def new(**options)
|
13
|
+
API.new(**options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def api_key
|
17
|
+
@api_key ||= ENV['LIBRARIES_IO_API_KEY'] || File.read('.libraries_io_api_key').chomp
|
18
|
+
rescue
|
19
|
+
raise [
|
20
|
+
'You must specify a Libraries.io API key.',
|
21
|
+
'Get it at https://libraries.io/account and',
|
22
|
+
'specify it with an of:',
|
23
|
+
' LibrariesIO.new(api_key: "your_key")',
|
24
|
+
' or calling `LibrariesIO.api_key = "your_key"`',
|
25
|
+
' or setting the environment variable LIBRARIES_IO_API_KEY',
|
26
|
+
' or writing it to a file ".libraries_io_api_key".',
|
27
|
+
].join("\n")
|
28
|
+
end
|
29
|
+
|
30
|
+
API.setup_all_doc
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class LibrariesIO::API < TLAW::API
|
2
|
+
PLATFORMS = %i[go npm packagist maven rubygems pypi nuget bower wordpress cocoapods cpan cargo clojars
|
3
|
+
cran meteor hackage atom hex puppet platformio homebrew emacs swiftpm pub carthage julia
|
4
|
+
sublime dub elm racket haxelib nimble alcatraz purescript inqlude]
|
5
|
+
|
6
|
+
# define aliases so that `api.rubygems` == `api.platform('rubygems')`
|
7
|
+
PLATFORMS.each do |name|
|
8
|
+
define_method name do
|
9
|
+
platform(name.to_s)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
class LibrariesIO::API < TLAW::API
|
2
|
+
define do
|
3
|
+
desc 'API for [Libraries.io](https://libraries.io/)'
|
4
|
+
|
5
|
+
docs 'https://libraries.io/api'
|
6
|
+
|
7
|
+
base 'https://libraries.io/api'
|
8
|
+
|
9
|
+
param :api_key,
|
10
|
+
default: -> { LibrariesIO.api_key },
|
11
|
+
desc: 'get your api key from your account page: https://libraries.io/account'
|
12
|
+
param :page, desc: 'page (default 1)'
|
13
|
+
param :per_page, desc: 'results per page (default is `30`, max is `100`)'
|
14
|
+
|
15
|
+
|
16
|
+
endpoint :platforms do
|
17
|
+
desc "Get a list of supported package managers"
|
18
|
+
docs "https://libraries.io/api#platforms"
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace :platform, '/{platform_id}' do
|
22
|
+
namespace :project, '/{id}' do
|
23
|
+
endpoint :info, '' do
|
24
|
+
desc "Get information about a package and it's versions"
|
25
|
+
end
|
26
|
+
|
27
|
+
endpoint :dependencies, '/{version}/dependencies' do
|
28
|
+
param :version, default: 'latest', desc: 'Project version'
|
29
|
+
desc "Get a list of dependencies for a version of a project"
|
30
|
+
end
|
31
|
+
|
32
|
+
endpoint :dependents do
|
33
|
+
desc "Get packages that have at least one version that depends on a given project"
|
34
|
+
end
|
35
|
+
|
36
|
+
endpoint :dependent_repositories do
|
37
|
+
desc "Get repositories that depend on a given project"
|
38
|
+
end
|
39
|
+
|
40
|
+
endpoint :contributors do
|
41
|
+
desc "Get users that have contributed to a given project"
|
42
|
+
end
|
43
|
+
|
44
|
+
endpoint :sourcerank do
|
45
|
+
desc "Get breakdown of SourceRank score for a given project"
|
46
|
+
end
|
47
|
+
|
48
|
+
endpoint :usage do
|
49
|
+
desc "Get breakdown of version usage for a given project"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
endpoint :search do
|
55
|
+
desc 'Search for projects'
|
56
|
+
docs 'https://libraries.io/api#project-search' # only exception to our generic scheme, see doc.rb
|
57
|
+
param :q, keyword: false, required: true
|
58
|
+
param :sort, enum: %i[rank stars dependents_count dependent_repos_count latest_release_published_at contributions_count created_at]
|
59
|
+
param :languages
|
60
|
+
param :licenses
|
61
|
+
param :keywords
|
62
|
+
param :platforms
|
63
|
+
end
|
64
|
+
|
65
|
+
namespace :repository, '/{host}/{owner}/{name}' do
|
66
|
+
param :host, default: 'github', keyword: true
|
67
|
+
param :owner, required: true, keyword: true
|
68
|
+
param :name, required: true, keyword: true
|
69
|
+
|
70
|
+
endpoint :info, '' do
|
71
|
+
desc 'Get a info for a repository. Currently only works for open source repositories'
|
72
|
+
end
|
73
|
+
|
74
|
+
endpoint :dependencies do
|
75
|
+
desc 'Get a list of dependencies for a repositories. Currently only works for open source repositories'
|
76
|
+
end
|
77
|
+
|
78
|
+
endpoint :projects do
|
79
|
+
desc 'Get a list of packages referencing the given repository'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
namespace :user, '/{host}/{name}' do
|
84
|
+
param :name, required: true, keyword: false
|
85
|
+
param :host, default: 'github', keyword: true
|
86
|
+
|
87
|
+
endpoint :info, '' do
|
88
|
+
desc 'Get information for a given user or organization.'
|
89
|
+
end
|
90
|
+
|
91
|
+
endpoint :repositories do
|
92
|
+
desc 'Get repositories owned by a user.'
|
93
|
+
end
|
94
|
+
|
95
|
+
endpoint :projects do
|
96
|
+
desc "Get a list of packages referencing the given user's repositories."
|
97
|
+
end
|
98
|
+
|
99
|
+
endpoint :repository_contributions, '/repository-contributions' do
|
100
|
+
desc "Get a list of repositories that the given user has contributed to."
|
101
|
+
end
|
102
|
+
|
103
|
+
endpoint :dependencies do
|
104
|
+
param :platform, keyword: true, required: false
|
105
|
+
desc "Get a list of repositories that the given user has contributed to."
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class << LibrariesIO::API
|
2
|
+
private def endpoint_doc(namespace, name)
|
3
|
+
id = if name == :info
|
4
|
+
namespace
|
5
|
+
else
|
6
|
+
[namespace, name.to_s.gsub('_', '-')].compact.join('-')
|
7
|
+
end
|
8
|
+
[LibrariesIO::API.docs_link, id].join('#')
|
9
|
+
end
|
10
|
+
|
11
|
+
def setup_all_doc(prefix = nil, base = self)
|
12
|
+
base.endpoints.values.each do |endpoint|
|
13
|
+
endpoint.docs_link ||= endpoint_doc(prefix, endpoint.symbol)
|
14
|
+
end
|
15
|
+
base.namespaces.values.each do |namespace|
|
16
|
+
setup_all_doc(namespace.symbol, namespace)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "libraries_io/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "libraries_io"
|
8
|
+
spec.version = LibrariesIO::VERSION
|
9
|
+
spec.authors = ["Marc-Andre Lafortune"]
|
10
|
+
spec.email = ["github@marc-andre.ca"]
|
11
|
+
|
12
|
+
spec.summary = %q{A Wrapper for libraries.io}
|
13
|
+
spec.description = %q{A Wrapper for libraries.io built on tlaw}
|
14
|
+
spec.homepage = "https://github.com/marcandre/libraries_io"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.required_ruby_version = '>= 2.1.0'
|
27
|
+
|
28
|
+
spec.add_runtime_dependency "tlaw"
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
spec.add_development_dependency "rspec-its"
|
34
|
+
spec.add_development_dependency "vcr", "~> 3.0"
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: libraries_io
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marc-Andre Lafortune
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tlaw
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-its
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
description: A Wrapper for libraries.io built on tlaw
|
98
|
+
email:
|
99
|
+
- github@marc-andre.ca
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- lib/libraries_io.rb
|
116
|
+
- lib/libraries_io/aliases.rb
|
117
|
+
- lib/libraries_io/api.rb
|
118
|
+
- lib/libraries_io/doc.rb
|
119
|
+
- lib/libraries_io/version.rb
|
120
|
+
- libraries_io.gemspec
|
121
|
+
homepage: https://github.com/marcandre/libraries_io
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 2.1.0
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.7.7
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: A Wrapper for libraries.io
|
145
|
+
test_files: []
|