megam_gogs 0.3.0 → 0.4.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: 46fbc56cb1e5f41dd7a528290e92862f796aa35a
4
- data.tar.gz: 40a8946c92a6f1ca41d2ba010b780b0424f4d2b7
3
+ metadata.gz: cc7c80afb3a20c6887af0e14dc1d9dd3e90fd974
4
+ data.tar.gz: bbfe67069bc92a64c631b7ddc326efc366c0d50a
5
5
  SHA512:
6
- metadata.gz: 38d1170cadc249cdcc3c5931dfb8d83a5bb92bea3355b8660d8fc9bfb68037709dcbddcc590b7943075d5733d604b1a2fbc14f70af96b1a75f3257dd39fd8ff2
7
- data.tar.gz: 624b7983b514024963c608355ef6137ca210542629486e9be4168086da575b074f36920df5a13779859e38adb74705de221a2e662db7a2581d81ddd9d2420a45
6
+ metadata.gz: 001671c7ed32fd98238b7a2eafc7bd2c9cfdd1dba195448f6c20cdfda4e41491541351a9bf258fc3d7ce17f0dc2b5eccb88fa5554bc235e7b40506924c9e2f7f
7
+ data.tar.gz: 31670851b5c7f700bb5d09d67043c13462d50831416155eaaf60e08623684e80f31ab474f6e6ee2c36cc55fbbbb4084007477ad08abdf5a28612463ebcc33b6c
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in megam_api.gemspec
3
+ # Specify your gem's dependencies in megam_gogs.gemspec
4
4
  gemspec
@@ -169,7 +169,7 @@ module Megam
169
169
  acct.displayName(o["displayName"]) if o.has_key?("displayName]")
170
170
  acct.lastModified(o["lastModifiec"]) if o.has_key?("lastModified")
171
171
  acct.active(o["active"]) if o.has_key?("active")
172
- acct.some_msg[:code] = o["code"] if o.has_key?("code")
172
+ acct.some_msg[:status] = o["status"] if o.has_key?("status")
173
173
  acct.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
174
174
  acct.some_msg[:msg]= o["msg"] if o.has_key?("msg")
175
175
  acct.some_msg[:links] = o["links"] if o.has_key?("links")
@@ -16,29 +16,22 @@
16
16
  module Megam
17
17
  class GogsRepo
18
18
 
19
- # Transform the ruby obj -> to a Hash
19
+
20
20
  def self.to_hash(response)
21
- index_hash = []
22
- i = 0
23
- config = Nokogiri::XML(response.body)
24
- config.css("repositories repositories").map do |node|
25
- node.children.map {|n|
26
- if n.name == 'url'
27
- index_hash << n.text.strip
28
- end
29
- }
30
- end
31
- {:status => response.code, :body => index_hash, :some_msg => response.message }
21
+ puts "Enters to_hash! phew! no error!"
22
+ puts response.body
23
+ index_hash = response.body
24
+ {:status => response.status, :body => index_hash }
32
25
  end
33
26
 
34
27
 
35
- # Load a account by email_p
36
- def self.list(username, password)
37
- #acct = self.new(username, password)
28
+ def self.list(token)
29
+
30
+ puts "Wait! Will list repos!"
38
31
  megams = Megam::Gogs.new
39
- res = megams.get_repos(username, password)
32
+ res = megams.get_repos(token)
40
33
  hash = {}
41
- if res.code != "200"
34
+ if res.status != 200
42
35
  hash = self.error(res)
43
36
  else
44
37
  hash = self.to_hash(res)
@@ -47,7 +40,7 @@ module Megam
47
40
  end
48
41
 
49
42
  def self.error(response)
50
- {:status => response.code, :body => "", :some_msg => response.message }
43
+ {:status => response.status, :body => "" }
51
44
  end
52
45
 
53
46
  def to_s
@@ -18,28 +18,21 @@ module Megam
18
18
 
19
19
  # Transform the ruby obj -> to a Hash
20
20
  def self.to_hash(response)
21
- index_hash = []
22
- i = 0
23
- config = Nokogiri::XML(response.body)
24
- config.css("repositories repositories").map do |node|
25
- node.children.map {|n|
26
- if n.name == 'url'
27
- index_hash << n.text.strip
28
- end
29
- }
30
- end
31
- {:status => response.code, :body => index_hash, :some_msg => response.message }
21
+
22
+ index_hash = response.body
23
+ {:status => response.status, :body => index_hash }
32
24
  end
33
25
 
34
26
 
35
27
 
36
28
  def self.list(username, password)
37
- #acct = self.new(username, password)
38
- puts "Entering into the GOGS API successfully-0-0-0-0-0-0-0-0"
29
+
39
30
  megams = Megam::Gogs.new
40
31
  res = megams.get_tokens(username, password)
41
32
  hash = {}
42
- if res.code != "200"
33
+ puts res
34
+ puts res.status
35
+ if res.status != 200
43
36
  hash = self.error(res)
44
37
  else
45
38
  hash = self.to_hash(res)
@@ -48,7 +41,8 @@ module Megam
48
41
  end
49
42
 
50
43
  def self.error(response)
51
- {:status => response.code, :body => "", :some_msg => response.message }
44
+
45
+ {:status => response.status, :body => ""}
52
46
  end
53
47
 
54
48
  def to_s
data/lib/megam/gogs.rb CHANGED
@@ -17,9 +17,10 @@ require "megam/gogs/dumpout"
17
17
  require "megam/gogs/errors"
18
18
  require "megam/gogs/repos"
19
19
  require "megam/gogs/tokens"
20
- require "megam/core/gogs_client/gogs_repo"
21
- require "megam/core/gogs_client/gogs_account"
22
- require "megam/core/gogs_client/gogs_tokens"
20
+
21
+ require "megam/core/gogs_repo"
22
+ require "megam/core/gogs_account"
23
+ require "megam/core/gogs_tokens"
23
24
 
24
25
 
25
26
  module Megam
@@ -91,7 +92,7 @@ if params[:token].nil?
91
92
  puts response.inspect
92
93
  text.msg("END(#{(Time.now - start).to_s}s)")
93
94
  # reset (non-persistent) connection
94
- @connection_repo.reset
95
+ #@connection_repo.reset
95
96
 
96
97
  else
97
98
 
@@ -102,17 +103,14 @@ else
102
103
  puts response.inspect
103
104
  text.msg("END(#{(Time.now - start).to_s}s)")
104
105
  # reset (non-persistent) connection
105
- @connection_token.reset
106
-
107
-
108
-
109
-
106
+ #@connection_token.reset
110
107
  end
111
108
 
112
109
  response
113
110
 
114
111
  end
115
112
 
113
+ private
116
114
 
117
115
  #Make a lazy connection.
118
116
  def connection_repo
@@ -127,7 +125,7 @@ def connection_repo
127
125
 
128
126
 
129
127
  puts @options[:headers]
130
- puts "UNAMUNAUNAMUNAMUNAMUNAM"
128
+
131
129
 
132
130
  text.msg("HTTP Request Data:")
133
131
  text.msg("> HTTP #{@options[:scheme]}://#{@options[:host]}")
@@ -155,7 +153,7 @@ def connection_repo
155
153
  }).merge(@options[:headers])
156
154
 
157
155
  puts @options[:headers]
158
- puts "TESTESTESTESTSETESTSETESTESTESTES"
156
+
159
157
 
160
158
  text.msg("HTTP Request Data:")
161
159
  text.msg("> HTTP #{@options[:scheme]}://#{@options[:host]}")
@@ -172,26 +170,5 @@ def connection_repo
172
170
  @connection
173
171
  end
174
172
 
175
-
176
-
177
-
178
- =begin
179
- def encode_header(cmd_parms)
180
-
181
- #puts cmd_parms[:username]
182
- #puts cmd_parms[:password]
183
- @cred = "#{cmd_parms[:username]}:#{cmd_parms[:password]}"
184
- puts @cred
185
- puts "printing unamd and pass"
186
- basic = 'Basic'
187
- @final_cred64 = Base64.encode64(@cred)
188
- puts @final_cred64
189
- { :creds => "#{basic} #{@final_cred64}" }
190
173
  end
191
- =end
192
-
193
-
194
-
195
-
196
- end
197
174
  end
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class Gogs
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
File without changes
File without changes
data/test/test_repo.rb CHANGED
@@ -3,9 +3,9 @@ require 'nokogiri'
3
3
 
4
4
  class TestGogs < MiniTest::Unit::TestCase
5
5
  def test_getrepos
6
- token = '4760a3130da97bf258d8be4d55ac8165ba7a3e55'
6
+ token = 'bb229aba7cea113875834c84d339ec9928666643'
7
7
  response =megams.get_repos(token)
8
- assert_raises(ArgumentError)
8
+
9
9
  end
10
10
  =begin
11
11
  def test_getrepos_error
data/test/test_tokens.rb CHANGED
@@ -6,7 +6,7 @@ class TestGogs < MiniTest::Unit::TestCase
6
6
  name = "morpheyesh"
7
7
  pass = "123456"
8
8
  response =megams.get_tokens(name, pass)
9
- assert_raises(ArgumentError)
9
+
10
10
 
11
11
  end
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megam_gogs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raj Thilak,Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-20 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -81,11 +81,9 @@ files:
81
81
  - LICENSE
82
82
  - README.md
83
83
  - Rakefile
84
- - gogs_api.gemspec
85
- - lib/gogs_api.rb
86
- - lib/megam/core/gogs_client/gogs_account.rb
87
- - lib/megam/core/gogs_client/gogs_repo.rb
88
- - lib/megam/core/gogs_client/gogs_tokens.rb
84
+ - lib/megam/core/gogs_account.rb
85
+ - lib/megam/core/gogs_repo.rb
86
+ - lib/megam/core/gogs_tokens.rb
89
87
  - lib/megam/gogs.rb
90
88
  - lib/megam/gogs/accounts.rb
91
89
  - lib/megam/gogs/dumpout.rb
@@ -93,6 +91,8 @@ files:
93
91
  - lib/megam/gogs/repos.rb
94
92
  - lib/megam/gogs/tokens.rb
95
93
  - lib/megam/gogs/version.rb
94
+ - lib/megam_gogs.rb
95
+ - megam_gogs.gemspec
96
96
  - test.rb
97
97
  - test/test_helper.rb
98
98
  - test/test_repo.rb