github-upload 0.0.1 → 0.0.2
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.
- data/bin/github-upload +5 -26
- metadata +5 -5
data/bin/github-upload
CHANGED
@@ -4,32 +4,6 @@ require 'confparser'
|
|
4
4
|
require 'optparse'
|
5
5
|
require 'net/github-upload'
|
6
6
|
|
7
|
-
module Net
|
8
|
-
module GitHub
|
9
|
-
class Upload
|
10
|
-
def list_files repos
|
11
|
-
raise "required repository name" unless repos
|
12
|
-
res = HTTPClient.get_content("https://github.com/#{repos}/downloads", {
|
13
|
-
"login" => @login,
|
14
|
-
"token" => @token
|
15
|
-
})
|
16
|
-
Nokogiri::HTML(res).xpath('id("manual_downloads")/li').map do |fileinfo|
|
17
|
-
obj = {
|
18
|
-
description: fileinfo.at_xpath('descendant::h4').text.force_encoding('BINARY').gsub(/.+?\xe2\x80\x94 (.+?)(\n\s*)?$/m, '\1'),
|
19
|
-
date: fileinfo.at_xpath('descendant::p/time').attribute('title').text,
|
20
|
-
size: fileinfo.at_xpath('descendant::p/strong').text,
|
21
|
-
id: /\d+$/.match(fileinfo.at_xpath('a').attribute('href').text)[0]
|
22
|
-
}
|
23
|
-
anchor = fileinfo.at_xpath('descendant::h4/a')
|
24
|
-
obj[:link] = anchor.attribute('href').text
|
25
|
-
obj[:name] = anchor.text
|
26
|
-
obj
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
7
|
def git_root (dir=Dir.pwd)
|
34
8
|
return dir if File.file?(File.join('.git', 'config'))
|
35
9
|
sup = File.dirname
|
@@ -54,6 +28,11 @@ OptionParser.new {|opts|
|
|
54
28
|
opts.on('-m', '--message MESSAGE', 'Insert an upload message') {|mes|
|
55
29
|
message = mes
|
56
30
|
}
|
31
|
+
|
32
|
+
opts.on_tail('-v', '--version', 'Show version') {
|
33
|
+
puts 'github-upload 0.0.2'
|
34
|
+
exit 0
|
35
|
+
}
|
57
36
|
}.tap {|opts|
|
58
37
|
o = opts.parse!(ARGV)
|
59
38
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- shura
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-08-
|
17
|
+
date: 2011-08-15 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -41,8 +41,8 @@ dependencies:
|
|
41
41
|
segments:
|
42
42
|
- 0
|
43
43
|
- 0
|
44
|
-
-
|
45
|
-
version: 0.0.
|
44
|
+
- 6
|
45
|
+
version: 0.0.6
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
description: A simple cli client to upload file in a github repository.
|