nkpart-dget 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.
- data/VERSION +1 -1
- data/bin/dget +1 -1
- data/dget.gemspec +2 -2
- data/lib/dget.rb +24 -5
- data/lib/dget/github.rb +6 -1
- data/spec/dget_spec.rb +10 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/bin/dget
CHANGED
data/dget.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dget}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nick Partridge"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-09}
|
13
13
|
s.default_executable = %q{dget}
|
14
14
|
s.description = %q{get local copies of github project wikis}
|
15
15
|
s.email = %q{nkpart@gmail.com}
|
data/lib/dget.rb
CHANGED
@@ -10,17 +10,36 @@ require "dget/github"
|
|
10
10
|
module DGet
|
11
11
|
VERSION = '0.0.1' unless defined? VERSION
|
12
12
|
|
13
|
-
|
13
|
+
GH = GitHubEngine.new unless defined? GH
|
14
|
+
GC = GoogleCodeEngine.new unless defined? GC
|
15
|
+
|
16
|
+
def self.parse_args args
|
17
|
+
if (args[0] =~ /github.com\/(.*)\/(.*)[\/]{0,1}/)
|
18
|
+
return ["github", $1 + "/" + $2, args[1]]
|
19
|
+
end
|
20
|
+
|
14
21
|
engine, project_spec, file = *args
|
15
|
-
if (engine && project_spec)
|
22
|
+
if (engine && project_spec)
|
23
|
+
return [engine, project_spec, file]
|
24
|
+
end
|
25
|
+
|
26
|
+
return []
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.cli(stdin, stdout, args)
|
30
|
+
parsed = parse_args(args)
|
31
|
+
if !parsed.empty?
|
32
|
+
engine, project_spec, file = *parsed
|
16
33
|
case engine
|
17
34
|
when "github"
|
18
|
-
|
35
|
+
GH.do(project_spec, file)
|
19
36
|
when "googlecode"
|
20
|
-
|
37
|
+
GC.do(project_spec, file)
|
21
38
|
end
|
22
39
|
else
|
23
|
-
stdout.puts "Usage:
|
40
|
+
stdout.puts "Usage: "
|
41
|
+
stdout.puts " dget [github|googlecode] [user/project|project] [file]"
|
42
|
+
stdout.puts " dget http://github.com/user/project [file]"
|
24
43
|
end
|
25
44
|
end
|
26
45
|
end
|
data/lib/dget/github.rb
CHANGED
@@ -55,6 +55,8 @@ module DGet
|
|
55
55
|
gh_doc = GitHubDoc.new(user, project_name)
|
56
56
|
file ||= file_for(user, project_name)
|
57
57
|
|
58
|
+
puts "Building wiki: #{user}/#{project_name} => #{file}"
|
59
|
+
|
58
60
|
content = build_content gh_doc
|
59
61
|
File.open(file, 'w') { |f| f.puts content }
|
60
62
|
end
|
@@ -78,7 +80,10 @@ module DGet
|
|
78
80
|
project_description = root.css("#repository_description").first.fmap(&:content)
|
79
81
|
main_content = root.css('.main').first.fmap(&:inner_html)
|
80
82
|
page_list = sidebar(pages)
|
81
|
-
|
83
|
+
i = 0 #todo better way to trace this?
|
84
|
+
page_content = pages.map { |title, id, content_f|
|
85
|
+
i += 1
|
86
|
+
puts " * [#{i}/#{pages.count}] #{title}"
|
82
87
|
"<div id=\"#{id}\">#{content_f[]}</div>"
|
83
88
|
}.join
|
84
89
|
|
data/spec/dget_spec.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "Dget" do
|
4
|
-
it "
|
5
|
-
|
4
|
+
it "should accept some args" do
|
5
|
+
[
|
6
|
+
[%w(github dpp/liftweb), ["github", "dpp/liftweb", nil]],
|
7
|
+
[%w(github dpp/liftweb test.html), ["github", "dpp/liftweb", 'test.html']],
|
8
|
+
[["http://wiki.github.com/jgarber/redcloth"], ["github", "jgarber/redcloth", nil]],
|
9
|
+
[["http://wiki.github.com/jgarber/redcloth", "test.html"], ["github", "jgarber/redcloth", "test.html"]]
|
10
|
+
].each do |args, out|
|
11
|
+
DGet.parse_args(args).should == out
|
12
|
+
end
|
13
|
+
|
6
14
|
end
|
7
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nkpart-dget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Partridge
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-09 00:00:00 -07:00
|
13
13
|
default_executable: dget
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|