wonki 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/.gitignore +1 -0
- data/VERSION +1 -1
- data/lib/wonki/page_builder.rb +2 -2
- data/lib/wonki/page_not_found.rb +2 -2
- data/lib/wonki/wiki_page.rb +5 -5
- data/test/page_builder_test.rb +2 -2
- data/test/wiki_page_test.rb +2 -2
- data/wonki.gemspec +65 -0
- metadata +2 -1
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/wonki/page_builder.rb
CHANGED
@@ -2,7 +2,7 @@ require 'mime/types'
|
|
2
2
|
require 'grit'
|
3
3
|
require 'flannel'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Wonki
|
6
6
|
class PageBuilder
|
7
7
|
def initialize(repo_path)
|
8
8
|
@repo_path = repo_path
|
@@ -17,7 +17,7 @@ module Rubyyot
|
|
17
17
|
def find(name)
|
18
18
|
repository = Grit::Repo.new(@repo_path)
|
19
19
|
blob = (repository.tree/name)
|
20
|
-
raise
|
20
|
+
raise Wonki::PageNotFound.new if blob.nil?
|
21
21
|
blob.data
|
22
22
|
end
|
23
23
|
end
|
data/lib/wonki/page_not_found.rb
CHANGED
data/lib/wonki/wiki_page.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'wonki/page_builder'
|
2
2
|
require 'wonki/page_not_found'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Wonki
|
5
5
|
class WikiPage
|
6
6
|
def initialize(repo_path)
|
7
7
|
@repo_path = repo_path
|
@@ -14,16 +14,16 @@ module Rubyyot
|
|
14
14
|
|
15
15
|
def build_response(path)
|
16
16
|
path = "/home" if path == "/"
|
17
|
-
builder =
|
17
|
+
builder = Wonki::PageBuilder.new(@repo_path)
|
18
18
|
|
19
19
|
begin
|
20
20
|
response_body = builder.build(path)
|
21
21
|
status = 200
|
22
|
-
rescue
|
22
|
+
rescue Wonki::PageNotFound
|
23
23
|
response_body = "Page Not Found"
|
24
24
|
status = 404
|
25
|
-
rescue
|
26
|
-
response_body = "Server Error"
|
25
|
+
rescue e
|
26
|
+
response_body = "Server Error: #{e.message}\r\n#{e.stack_trace}"
|
27
27
|
status = 500
|
28
28
|
end
|
29
29
|
|
data/test/page_builder_test.rb
CHANGED
@@ -5,7 +5,7 @@ require 'lib/wonki/page_not_found'
|
|
5
5
|
class PageBuilderTest < Test::Unit::TestCase
|
6
6
|
context "Building a Page" do
|
7
7
|
setup do
|
8
|
-
@builder =
|
8
|
+
@builder = Wonki::PageBuilder.new("~/working/rubyyot-wiki-test")
|
9
9
|
end
|
10
10
|
|
11
11
|
should "include the location" do
|
@@ -33,7 +33,7 @@ class PageBuilderTest < Test::Unit::TestCase
|
|
33
33
|
begin
|
34
34
|
@builder.find("walla-walla-bing-bang")
|
35
35
|
assert false, "Should have thrown a page not found exception"
|
36
|
-
rescue
|
36
|
+
rescue Wonki::PageNotFound
|
37
37
|
assert true
|
38
38
|
end
|
39
39
|
end
|
data/test/wiki_page_test.rb
CHANGED
@@ -5,7 +5,7 @@ require 'lib/wonki/wiki_page'
|
|
5
5
|
class WikiPageTest < Test::Unit::TestCase
|
6
6
|
context "Returning a response" do
|
7
7
|
setup do
|
8
|
-
@page =
|
8
|
+
@page = Wonki::WikiPage.new("~/working/rubyyot-wiki-test")
|
9
9
|
@status, @headers, @body = @page.build_response("/foo")
|
10
10
|
end
|
11
11
|
|
@@ -24,7 +24,7 @@ class WikiPageTest < Test::Unit::TestCase
|
|
24
24
|
|
25
25
|
context "PageNotFound" do
|
26
26
|
setup do
|
27
|
-
@page =
|
27
|
+
@page = Wonki::WikiPage.new("~/working/rubyyot-wiki-test")
|
28
28
|
@status, @headers, @body = @page.build_response("/pagenotfound")
|
29
29
|
end
|
30
30
|
|
data/wonki.gemspec
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{wonki}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["rubyyot"]
|
12
|
+
s.date = %q{2010-01-12}
|
13
|
+
s.description = %q{a Rack and Git based wiki like thing}
|
14
|
+
s.email = %q{jamal.hansen@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/wonki.rb",
|
27
|
+
"lib/wonki/page_builder.rb",
|
28
|
+
"lib/wonki/page_not_found.rb",
|
29
|
+
"lib/wonki/wiki_page.rb",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/page_builder_test.rb",
|
32
|
+
"test/wiki_page_test.rb",
|
33
|
+
"wonki.gemspec"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/rubyyot/wonki}
|
36
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.5}
|
39
|
+
s.summary = %q{a simple Rack and Git based wiki like thing}
|
40
|
+
s.test_files = [
|
41
|
+
"test/wiki_page_test.rb",
|
42
|
+
"test/helper.rb",
|
43
|
+
"test/page_builder_test.rb"
|
44
|
+
]
|
45
|
+
|
46
|
+
if s.respond_to? :specification_version then
|
47
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
|
+
s.specification_version = 3
|
49
|
+
|
50
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
|
+
s.add_runtime_dependency(%q<grit>, [">= 0"])
|
52
|
+
s.add_runtime_dependency(%q<flannel>, [">= 0.1.5"])
|
53
|
+
s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<grit>, [">= 0"])
|
56
|
+
s.add_dependency(%q<flannel>, [">= 0.1.5"])
|
57
|
+
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
58
|
+
end
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<grit>, [">= 0"])
|
61
|
+
s.add_dependency(%q<flannel>, [">= 0.1.5"])
|
62
|
+
s.add_dependency(%q<shoulda>, [">= 2.10.2"])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wonki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rubyyot
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- test/helper.rb
|
66
66
|
- test/page_builder_test.rb
|
67
67
|
- test/wiki_page_test.rb
|
68
|
+
- wonki.gemspec
|
68
69
|
has_rdoc: true
|
69
70
|
homepage: http://github.com/rubyyot/wonki
|
70
71
|
licenses: []
|