rubygems-code_finder 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3893255e756fac25b7a9cf3b006ca5b4ebb8947e
4
+ data.tar.gz: 7487c80c93d5ac140c57c818fd446efe2b32d4b2
5
+ SHA512:
6
+ metadata.gz: eaefc4952bae7251397f40bf6ecb86802941739d20959cc226a1228df331484b9491c6d4d8cf34a8b8eee9ecd94a91283ca1706c7f20361395a6b9ad3c0279f7
7
+ data.tar.gz: 572558fc0c93a6b98f3f192549e4870c4ca840d556aa1c07968f699b36172692eba7a4b98d0527f00c90137ddb85dd616b59e1a318e81d4be4b72942f26a5fbb
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.0
5
+ branches:
6
+ only:
7
+ - master
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rubygems-code_finder.gemspec
4
+ gemspec
5
+
6
+ gem 'oj'
7
+ gem 'byebug'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 sanemat
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Rubygems::CodeFinder
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rubygems-code_finder.png)](http://badge.fury.io/rb/rubygems-code_finder)
4
+ [![Build Status](https://api.travis-ci.org/sanemat/rubygems-code_finder.png?branch=master)](https://travis-ci.org/sanemat/rubygems-code_finder)
5
+ [![Code Climate](https://codeclimate.com/github/sanemat/rubygems-code_finder.png)](https://codeclimate.com/github/sanemat/rubygems-code_finder)
6
+ [![Coverage Status](https://coveralls.io/repos/sanemat/rubygems-code_finder/badge.png?branch=master)](https://coveralls.io/r/sanemat/rubygems-code_finder)
7
+ [![Dependency Status](https://gemnasium.com/sanemat/rubygems-code_finder.png)](https://gemnasium.com/sanemat/rubygems-code_finder)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'rubygems-code_finder'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rubygems-code_finder
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it ( https://github.com/[my-github-username]/rubygems-code_finder/fork )
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ RSpec::Core::RakeTask.new('spec')
4
+ task default: :spec
@@ -0,0 +1,5 @@
1
+ module Rubygems
2
+ module CodeFinder
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ require 'rubygems/code_finder/version'
2
+ require 'faraday'
3
+ require 'multi_json'
4
+ require 'uri'
5
+
6
+ module Rubygems
7
+ module CodeFinder
8
+ extend self
9
+ class RubygemsNotFound < StandardError; end
10
+ class RepositoryNotFound < StandardError; end
11
+
12
+ def url(name, github_strict: true)
13
+ conn = Faraday.new 'https://rubygems.org'
14
+ response = conn.get('/api/v1/gems/' + name + '.json')
15
+ fail RubygemsNotFound unless response.status == 200
16
+ parse_response_body(response.body)
17
+ end
18
+
19
+ def parse_response_body(body)
20
+ data = MultiJson.load(body)
21
+ return data['source_code_uri'] if URI.parse(data['source_code_uri']).host == 'github.com'
22
+ return data['homepage_uri'] if URI.parse(data['homepage_uri']).host == 'github.com'
23
+ fail RepositoryNotFound
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rubygems/code_finder/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rubygems-code_finder'
8
+ spec.version = Rubygems::CodeFinder::VERSION
9
+ spec.authors = ['sanemat']
10
+ spec.email = ['o.gata.ken@gmail.com']
11
+ spec.summary = %q{Easy to find rubygems' github repository.}
12
+ spec.description = %q{Find repos from api.rubygems.org response, gem spec, github search, etc.}
13
+ spec.homepage = 'https://github.com/sanemat/rubygems-code_finder'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'faraday'
22
+ spec.add_dependency 'multi_json'
23
+
24
+ spec.add_development_dependency 'bundler', '>= 1.3'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec', '>= 3.0.0.beta2'
27
+ spec.add_development_dependency 'webmock'
28
+ end
@@ -0,0 +1 @@
1
+ {"name":"tachikoma","downloads":4326,"version":"4.0.3","version_downloads":163,"platform":"ruby","authors":"sanemat","info":"Interval pull requester with bundle/carton update.","licenses":["MIT"],"project_uri":"http://rubygems.org/gems/tachikoma","gem_uri":"http://rubygems.org/gems/tachikoma-4.0.3.gem","homepage_uri":"https://github.com/sanemat/tachikoma","wiki_uri":"","documentation_uri":"","mailing_list_uri":"","source_code_uri":"https://github.com/sanemat/tachikoma","bug_tracker_uri":"","dependencies":{"development":[{"name":"bundler","requirements":"~> 1.3"},{"name":"dotenv","requirements":">= 0"},{"name":"rspec","requirements":">= 3.0.0.beta"}],"runtime":[{"name":"json","requirements":">= 0"},{"name":"octokit","requirements":"< 3, >= 2"},{"name":"rake","requirements":">= 0"},{"name":"safe_yaml","requirements":">= 0"},{"name":"thor","requirements":">= 0"}]}}
@@ -0,0 +1,11 @@
1
+ require_relative '../../spec_helper'
2
+ require 'byebug'
3
+
4
+ describe Rubygems::CodeFinder do
5
+ it 'returns source_code_uri' do
6
+ stub_request(:get, 'https://rubygems.org/api/v1/gems/tachikoma.json').
7
+ to_return(status: 200, body: File.new('./spec/fixtures/tachikoma.json'), headers: {})
8
+
9
+ expect(Rubygems::CodeFinder.url('tachikoma')).to eq 'https://github.com/sanemat/tachikoma'
10
+ end
11
+ end
@@ -0,0 +1,85 @@
1
+ lib = File.expand_path('../../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'rubygems-code_finder'
4
+ require 'webmock/rspec'
5
+
6
+ # This file was generated by the `rspec --init` command. Conventionally, all
7
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
8
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
9
+ # file to always be loaded, without a need to explicitly require it in any files.
10
+ #
11
+ # Given that it is always loaded, you are encouraged to keep this file as
12
+ # light-weight as possible. Requiring heavyweight dependencies from this file
13
+ # (such as loading up an entire rails app) will add to the boot time of your
14
+ # spec suite on EVERY spec run, even for an individual file that may not need
15
+ # all of that loaded.
16
+ #
17
+ # The `.rspec` file also contains a few flags that are not defaults but that
18
+ # users commonly want.
19
+ #
20
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
+ RSpec.configure do |config|
22
+ # The settings below are suggested to provide a good initial experience
23
+ # with RSpec, but feel free to customize to your heart's content.
24
+ # These two settings work together to allow you to limit a spec run
25
+ # to individual examples or groups you care about by tagging them with
26
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
27
+ # get run.
28
+ config.filter_run :focus
29
+ config.run_all_when_everything_filtered = true
30
+
31
+ # Many RSpec users commonly either run the entire suite or an individual
32
+ # file, and it's useful to allow more verbose output when running an
33
+ # individual spec file.
34
+ if config.files_to_run.one?
35
+ # RSpec filters the backtrace by default so as not to be so noisy.
36
+ # This causes the full backtrace to be printed when running a single
37
+ # spec file (e.g. to troubleshoot a particular spec failure).
38
+ config.full_backtrace = true
39
+
40
+ # Use the documentation formatter for detailed output,
41
+ # unless a formatter has already been configured
42
+ # (e.g. via a command-line flag).
43
+ config.formatter = 'doc' if config.formatters.none?
44
+ end
45
+
46
+ # Print the 10 slowest examples and example groups at the
47
+ # end of the spec run, to help surface which specs are running
48
+ # particularly slow.
49
+ config.profile_examples = 10
50
+
51
+ # Run specs in random order to surface order dependencies. If you find an
52
+ # order dependency and want to debug it, you can fix the order by providing
53
+ # the seed, which is printed after each run.
54
+ # --seed 1234
55
+ config.order = :random
56
+
57
+ # Seed global randomization in this process using the `--seed` CLI option.
58
+ # Setting this allows you to use `--seed` to deterministically reproduce
59
+ # spec failures related to randomization by passing the same `--seed` value
60
+ # as the one that triggered the failure.
61
+ Kernel.srand config.seed
62
+
63
+ # rspec-expectations config goes here. You can use an alternate
64
+ # assertion/expectation library such as wrong or the stdlib/minitest
65
+ # assertions if you prefer.
66
+ config.expect_with :rspec do |expectations|
67
+ # Enable only the newer, non-monkey-patching expect syntax.
68
+ # For more details, see:
69
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
70
+ expectations.syntax = :expect
71
+ end
72
+
73
+ # rspec-mocks config goes here. You can use an alternate spec double
74
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
75
+ config.mock_with :rspec do |mocks|
76
+ # Enable only the newer, non-monkey-patching expect syntax.
77
+ # For more details, see:
78
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
79
+ mocks.syntax = :expect
80
+
81
+ # Prevents you from mocking or stubbing a method that does not exist on
82
+ # a real object. This is generally recommended.
83
+ mocks.verify_partial_doubles = true
84
+ end
85
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygems-code_finder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - sanemat
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
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: multi_json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 3.0.0.beta2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.0.0.beta2
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Find repos from api.rubygems.org response, gem spec, github search, etc.
98
+ email:
99
+ - o.gata.ken@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - lib/rubygems-code_finder.rb
112
+ - lib/rubygems/code_finder/version.rb
113
+ - rubygems-code_finder.gemspec
114
+ - spec/fixtures/tachikoma.json
115
+ - spec/rubygems/code_finder/url_spec.rb
116
+ - spec/spec_helper.rb
117
+ homepage: https://github.com/sanemat/rubygems-code_finder
118
+ licenses:
119
+ - MIT
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.2.0
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Easy to find rubygems' github repository.
141
+ test_files:
142
+ - spec/fixtures/tachikoma.json
143
+ - spec/rubygems/code_finder/url_spec.rb
144
+ - spec/spec_helper.rb