mushin_ext_github 0.1.0 → 0.2.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 +4 -4
- data/.gitignore +2 -0
- data/Github.gemspec +2 -2
- data/lib/Github/version.rb +1 -1
- data/lib/mushin_ext_github.rb +41 -20
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20da49b6e6d93c4c1202fc3611e18fe60dcf3ace
|
4
|
+
data.tar.gz: 95e0a341d36a68627a782be2f3f65d175e07cbb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a2dcefba04c954cdfc5c398d56b7adf8700972b6fbfc5e6d6598af6840f5b5803a772d6b98de2026ba0d6cb90719d830e9686a90975cd0f800e70104154a008
|
7
|
+
data.tar.gz: 7c55779027cd6cb5f4cd3fa9f5752f2643b50521a69cf4502eb2275c6f8d676a27f0617cbc577ca546104aab97a6967c84b684b5ed95a9fdd5934b4835d95908
|
data/.gitignore
CHANGED
data/Github.gemspec
CHANGED
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency "bundler", "~> 1.13"
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
35
|
spec.add_development_dependency "minitest", "~> 5.0"
|
36
|
-
spec.add_dependency 'mushin'
|
36
|
+
spec.add_dependency 'mushin'
|
37
|
+
spec.add_dependency "octokit", "~> 4.0"
|
37
38
|
end
|
38
|
-
|
data/lib/Github/version.rb
CHANGED
data/lib/mushin_ext_github.rb
CHANGED
@@ -1,27 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require 'mushin'
|
2
|
+
require 'octokit'
|
3
|
+
require_relative 'Github/version'
|
4
4
|
|
5
5
|
module Github
|
6
|
-
|
7
|
-
|
6
|
+
class Ext
|
7
|
+
using Mushin::Ext
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
9
|
+
def initialize app=nil, opts={}, params={}
|
10
|
+
@app = app
|
11
|
+
@opts = opts
|
12
|
+
@params = params
|
13
|
+
end
|
14
|
+
def call env
|
15
|
+
env ||= Hash.new
|
16
|
+
|
17
|
+
case @opts[:cqrs]
|
18
|
+
when :cqrs_query
|
19
|
+
#inbound code
|
20
|
+
@app.call(env)
|
21
|
+
#outbound code
|
22
|
+
when :cqrs_command
|
23
|
+
#inbound code
|
24
|
+
@client = Octokit::Client.new(:login => @opts[:auth_username], :password => @opts[:auth_password])
|
25
|
+
user = @client.user
|
26
|
+
env[:login] = user.login
|
27
|
+
|
28
|
+
#TODO in case of private repos the clone_url should be prefixed with a token and passed to other domain extenstions to handle the local work
|
29
|
+
if !@params[:username].nil? && !@params[:reponame].nil? then
|
30
|
+
@slug = @params[:username] + "/" + @params[:reponame]
|
31
|
+
env[:slug] = @slug
|
32
|
+
env[:repo_metadata] = @client.repo(@slug).to_h
|
33
|
+
env[:clone_url] = @client.repo(@slug).clone_url
|
34
|
+
elsif !@params[:slug].nil? then
|
35
|
+
@slug = @params[:slug]
|
36
|
+
env[:slug] = @slug
|
37
|
+
env[:repo_metadata] = @client.repo(@slug).to_h
|
38
|
+
env[:clone_url] = @client.repo(@slug).clone_url
|
24
39
|
end
|
40
|
+
@app.call(env)
|
41
|
+
#outbound code
|
42
|
+
else
|
43
|
+
raise "you must specifiy if your cqrs call is command or query?"
|
25
44
|
end
|
45
|
+
end
|
46
|
+
end
|
26
47
|
|
27
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mushin_ext_github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zotherstupidguy
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: octokit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.0'
|
69
83
|
description: a mushin-ext for github
|
70
84
|
email:
|
71
85
|
- zotherstupidguy@gmail.com
|