mushin_ext_github 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20da49b6e6d93c4c1202fc3611e18fe60dcf3ace
4
- data.tar.gz: 95e0a341d36a68627a782be2f3f65d175e07cbb1
3
+ metadata.gz: 9cb18c3b5f3a2cd9ff2002bf9fad3ac4b9e8cad6
4
+ data.tar.gz: 03a4809fb83c8a73ff43d5304011dec66417c26b
5
5
  SHA512:
6
- metadata.gz: 0a2dcefba04c954cdfc5c398d56b7adf8700972b6fbfc5e6d6598af6840f5b5803a772d6b98de2026ba0d6cb90719d830e9686a90975cd0f800e70104154a008
7
- data.tar.gz: 7c55779027cd6cb5f4cd3fa9f5752f2643b50521a69cf4502eb2275c6f8d676a27f0617cbc577ca546104aab97a6967c84b684b5ed95a9fdd5934b4835d95908
6
+ metadata.gz: b2e9f7bc202f3c2cb61e323c9f7f81ae5666e4f8f0ab2cc73a5dc4b074e5e802bee1df19757cdd84e45ecb7fd47bbac8b8abe9f95af12bbd5560799f2f7a9f31
7
+ data.tar.gz: d7466b06bb7cbf80a81f306b0d4ad6132ac280deb96ea751a0640b5120eb2ab1cb7d75966c9747638f7157c2a821089ff8d6ad575a4d22a7826415d095a6f9c9
@@ -1,3 +1,3 @@
1
1
  module Github
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -11,6 +11,11 @@ module Github
11
11
  @opts = opts
12
12
  @params = params
13
13
  end
14
+
15
+ def check_params *keys
16
+ return (keys.all? {|key| (@params.key?(key) && !@params[key].nil?)})
17
+ end
18
+
14
19
  def call env
15
20
  env ||= Hash.new
16
21
 
@@ -26,17 +31,16 @@ module Github
26
31
  env[:login] = user.login
27
32
 
28
33
  #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
34
+ if check_params(:username, :reponame) then
30
35
  @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
36
+ elsif check_params(:slug) then
35
37
  @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
39
38
  end
39
+
40
+ env[:slug] = @slug
41
+ env[:repo_metadata] = @client.repo(@slug).to_h unless @slug.nil?
42
+ env[:clone_url] = @client.repo(@slug).clone_url unless @slug.nil?
43
+
40
44
  @app.call(env)
41
45
  #outbound code
42
46
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mushin_ext_github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - zotherstupidguy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-21 00:00:00.000000000 Z
11
+ date: 2016-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler