megam_gogs 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/megam/gogs.rb +67 -8
- data/lib/megam/gogs/version.rb +1 -1
- data/test/test_repo.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7e0025cdd7d1b01837b2d833a68979930972901
|
4
|
+
data.tar.gz: 1d5933d348d2807f6549ea025fe97f994d4b313e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f216d2c53855c1f6ea6dde34345c152eb6f5a095a61ff6a8ee109a4f351c4adf2b78e45e88b38f96af4b6c6205e8caacaf6a6c6314acd77d960357e8de5e8ed9
|
7
|
+
data.tar.gz: a2267d1bc619dd147b3042ceed1bb90fb025f82c277af87c5f827689ab62352c20d8c115f61d05670e21510741f2ebd9e620585952e98bfe3be02c731cf7c5b6
|
data/lib/megam/gogs.rb
CHANGED
@@ -75,30 +75,58 @@ def request(params,&block)
|
|
75
75
|
text.msg("> #{pkey}: #{pvalue}")
|
76
76
|
end
|
77
77
|
|
78
|
+
if params[:token].nil?
|
79
|
+
|
80
|
+
|
78
81
|
@uname = params[:username]
|
79
82
|
@pass = params[:password]
|
80
83
|
@cred = "#{@uname}:#{@pass}"
|
81
|
-
@tokens = params[:token]
|
82
84
|
@final_cred64 = Base64.encode64(@cred)
|
85
|
+
|
83
86
|
@final_hash = { :creds => "Basic #{@final_cred64}" }
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
+
|
88
|
+
response = connection_repo.request(dummy_params, &block)
|
89
|
+
|
90
|
+
puts response.inspect
|
91
|
+
text.msg("END(#{(Time.now - start).to_s}s)")
|
92
|
+
# reset (non-persistent) connection
|
93
|
+
@connection_repo.reset
|
94
|
+
|
95
|
+
else
|
96
|
+
|
97
|
+
@tokens = params[:token]
|
98
|
+
@final_token = { :token => "token #{@tokens}"}
|
99
|
+
response = connection_token.request(dummy_params, &block)
|
100
|
+
|
101
|
+
puts response.inspect
|
87
102
|
text.msg("END(#{(Time.now - start).to_s}s)")
|
88
103
|
# reset (non-persistent) connection
|
89
|
-
@
|
104
|
+
@connection_token.reset
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
end
|
110
|
+
|
90
111
|
response
|
91
112
|
|
92
113
|
end
|
93
114
|
|
94
115
|
|
95
116
|
#Make a lazy connection.
|
96
|
-
def
|
117
|
+
def connection_repo
|
97
118
|
@options[:path] =API_REST + @options[:path]
|
98
119
|
#headers_hash = encode_header(@options)
|
99
120
|
|
100
|
-
@options[:headers] = HEADERS.merge({
|
101
|
-
|
121
|
+
@options[:headers] = HEADERS.merge({
|
122
|
+
AUTH_PREFIX => @final_hash[:creds],
|
123
|
+
|
124
|
+
}).merge(@options[:headers])
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
puts @options[:headers]
|
129
|
+
puts "UNAMUNAUNAMUNAMUNAMUNAM"
|
102
130
|
|
103
131
|
text.msg("HTTP Request Data:")
|
104
132
|
text.msg("> HTTP #{@options[:scheme]}://#{@options[:host]}")
|
@@ -115,6 +143,37 @@ def connection
|
|
115
143
|
@connection
|
116
144
|
end
|
117
145
|
|
146
|
+
|
147
|
+
def connection_token
|
148
|
+
@options[:path] =API_REST + @options[:path]
|
149
|
+
#headers_hash = encode_header(@options)
|
150
|
+
|
151
|
+
@options[:headers] = HEADERS.merge({
|
152
|
+
AUTH_PREFIX => @final_token[:token],
|
153
|
+
|
154
|
+
}).merge(@options[:headers])
|
155
|
+
|
156
|
+
puts @options[:headers]
|
157
|
+
puts "TESTESTESTESTSETESTSETESTESTESTES"
|
158
|
+
|
159
|
+
text.msg("HTTP Request Data:")
|
160
|
+
text.msg("> HTTP #{@options[:scheme]}://#{@options[:host]}")
|
161
|
+
@options.each do |key, value|
|
162
|
+
text.msg("> #{key}: #{value}")
|
163
|
+
end
|
164
|
+
text.msg("End HTTP Request Data.")
|
165
|
+
if @options[:scheme] == "https"
|
166
|
+
@connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}",@options)
|
167
|
+
else
|
168
|
+
Excon.defaults[:ssl_verify_peer] = false
|
169
|
+
@connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}:3000",@options)
|
170
|
+
end
|
171
|
+
@connection
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
118
177
|
=begin
|
119
178
|
def encode_header(cmd_parms)
|
120
179
|
|
data/lib/megam/gogs/version.rb
CHANGED
data/test/test_repo.rb
CHANGED
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.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|