social_snippet-supports-github 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +9 -0
- data/.travis.yml +31 -0
- data/Gemfile +13 -0
- data/README.md +39 -0
- data/Rakefile +32 -0
- data/lib/social_snippet/repository/drivers/github_driver.rb +45 -0
- data/lib/social_snippet/supports/github/version.rb +7 -0
- data/lib/social_snippet/supports/github.rb +11 -0
- data/social_snippet-supports-github.gemspec +33 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODU3MDlmNmU0MjVkNGUwYTJkNzdkNGY5MWRlYWRkYWU0YTMwMGJhYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDFlNGE2MGJmMGM5ZDJhZDIxNmI5MThiODRjMzY1ZWY0NWIxOWE1Yw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTk1OGY5YmFlM2UxYmZmNDdmZDNlYmExMWIyYzNiNmYzZGIwM2M1YzVkODg2
|
10
|
+
MzBmNjk4YjRmOTg4M2M4NGFhMjQwZWMxZDUzZjc5M2U0NDA3NzYxZWNmZDUw
|
11
|
+
YTg0ODg3MDg5NWEyMTQ4M2I0NDQ1YjBiOGU5YWYxMTU4NmIwNTc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTQzMWZiYzAxNDI1YjEyZWI5YTQxZWQ4OTg3YjM1MDIwNTAwZDVhOTMxYzky
|
14
|
+
N2NiOWVkZGIyYzNlYWExMTdkNDZmNzgzOGY3ZjA5NjlkMWM4MWI1OWMyNTM1
|
15
|
+
NjE1ZmU2ODhhMWU2YzcxYTBlOTgxYzI3ZGY4MzEwMmVlNDI1M2Q=
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- "2.2"
|
5
|
+
- "2.1"
|
6
|
+
- "2.0"
|
7
|
+
- "1.9"
|
8
|
+
|
9
|
+
sudo: false
|
10
|
+
|
11
|
+
install:
|
12
|
+
- bundle install -j4 --path vendor/bundle
|
13
|
+
|
14
|
+
script:
|
15
|
+
- bundle exec rake spec
|
16
|
+
|
17
|
+
deploy:
|
18
|
+
provider: rubygems
|
19
|
+
api_key:
|
20
|
+
master:
|
21
|
+
secure: "IglhEWHd45IzaY7aCjIZz5LOU3IxzpJFerRfgTwKRZYLARjgtkkzARbAJ1PsnurtMdYA+aMHUiGPSgclMb+gLSXGjD1e+mx6cY0b7k4r7c8heFdKbnHIaC438fKqlqCew8oDsL1MACJO+2sZZClktnFRJnlVyQUxOaPQ0SmDzMQ="
|
22
|
+
gem:
|
23
|
+
master: social_snippet-supports-github
|
24
|
+
on:
|
25
|
+
repo: social-snippet/social-snippet-supports-github
|
26
|
+
ruby: "2.2"
|
27
|
+
|
28
|
+
cache:
|
29
|
+
directories:
|
30
|
+
- vendor/bundle
|
31
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in social_snippet-supports-github.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
if ::Dir.exists? "../social-snippet"
|
8
|
+
gem "social_snippet", :path => "../social-snippet"
|
9
|
+
else
|
10
|
+
gem "social_snippet", :github => "social-snippet/social-snippet"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# SocialSnippet::Supports::Github
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/social_snippet/supports/github`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'social_snippet-supports-github'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install social_snippet-supports-github
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/social_snippet-supports-github/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
task :default => [:spec]
|
5
|
+
|
6
|
+
#
|
7
|
+
# Testing
|
8
|
+
#
|
9
|
+
|
10
|
+
require "rspec/core/rake_task"
|
11
|
+
|
12
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
13
|
+
t.rspec_opts = [
|
14
|
+
"--format documentation",
|
15
|
+
"--color",
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# Documentation
|
21
|
+
#
|
22
|
+
|
23
|
+
require "yard"
|
24
|
+
require "yard/rake/yardoc_task"
|
25
|
+
|
26
|
+
# rake yard
|
27
|
+
YARD::Rake::YardocTask.new do |t|
|
28
|
+
t.files = [
|
29
|
+
"lib/{,**}/*.rb"
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module SocialSnippet::Repository::Drivers
|
2
|
+
|
3
|
+
GITHUB_CLIENT_ID = ENV["SOCIAL_SNIPPET_GITHUB_CLIENT_ID"]
|
4
|
+
GITHUB_CLIENT_SECRET = ENV["SOCIAL_SNIPPET_GITHUB_CLIENT_SECRET"]
|
5
|
+
|
6
|
+
class GitHubDriver < DriverBase
|
7
|
+
|
8
|
+
attr_reader :api_client
|
9
|
+
attr_reader :github_owner
|
10
|
+
attr_reader :github_repo
|
11
|
+
|
12
|
+
def fetch
|
13
|
+
@github_owner = parse_github_owner
|
14
|
+
@github_repo = parse_github_repo
|
15
|
+
@api_client = ::Octokit::Client.new(
|
16
|
+
:client_id => GITHUB_CLIENT_ID,
|
17
|
+
:client_secret => GITHUB_CLIENT_SECRET,
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def refs
|
22
|
+
api_client.refs("#{github_owner}/#{github_repo}")
|
23
|
+
.map {|info| info[:ref] }
|
24
|
+
.map {|ref| ref.gsub /^refs\/[a-z]+\//, "" }
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def parse_github_owner
|
30
|
+
/^\/(.+)\/.+/.match(::URI.parse(url).path)[1]
|
31
|
+
end
|
32
|
+
|
33
|
+
def parse_github_repo
|
34
|
+
uri_path = ::URI.parse(url).path
|
35
|
+
if /\.git$/ === uri_path
|
36
|
+
/^.+\/([^\/]+)/.match(uri_path)[1].gsub /\.git$/, ""
|
37
|
+
else
|
38
|
+
/^.+\/([^\/]+)/.match(uri_path)[1]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'social_snippet/supports/github/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "social_snippet-supports-github"
|
8
|
+
spec.version = SocialSnippet::Supports::Github::VERSION
|
9
|
+
spec.authors = ["Hiroyuki Sano"]
|
10
|
+
spec.email = ["sh19910711@gmail.com"]
|
11
|
+
|
12
|
+
if spec.respond_to?(:metadata)
|
13
|
+
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
|
14
|
+
end
|
15
|
+
|
16
|
+
spec.summary = %q{GitHub API Supports}
|
17
|
+
spec.homepage = "https://social-snippet.github.io"
|
18
|
+
spec.license = "MIT"
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.required_ruby_version = ">= 1.9.3"
|
26
|
+
|
27
|
+
spec.add_runtime_dependency "octokit", "~> 3.8.0"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler"
|
30
|
+
spec.add_development_dependency "rake"
|
31
|
+
spec.add_development_dependency "rspec"
|
32
|
+
spec.add_development_dependency "yard"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: social_snippet-supports-github
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hiroyuki Sano
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: octokit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.8.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.8.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: '0'
|
34
|
+
type: :development
|
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: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '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: '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: yard
|
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
|
+
description:
|
84
|
+
email:
|
85
|
+
- sh19910711@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .travis.yml
|
92
|
+
- Gemfile
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/social_snippet/repository/drivers/github_driver.rb
|
96
|
+
- lib/social_snippet/supports/github.rb
|
97
|
+
- lib/social_snippet/supports/github/version.rb
|
98
|
+
- social_snippet-supports-github.gemspec
|
99
|
+
homepage: https://social-snippet.github.io
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata:
|
103
|
+
allowed_push_host: ! 'TODO: Set to ''http://mygemserver.com'' to prevent pushes
|
104
|
+
to rubygems.org, or delete to allow pushes to any server.'
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 1.9.3
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.4.5
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: GitHub API Supports
|
125
|
+
test_files: []
|