logaan-HAMwiki 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ == HAMwiki
2
+ by Colin Campbell-McPherson (colin@logaan.net)
3
+
4
+ https://github.com/logaan/hamwiki
5
+
6
+ == DESCRIPTION:
7
+
8
+ 200 lines of code, to manage all your documents in a microsecond, or your money back.
9
+
10
+ == DOCUMENTATION
11
+
12
+ You're looking at it.
13
+
14
+ == INSTALLATION
15
+
16
+ If you have the github gem source simple run 'gem install logaan-hamwiki'. Or to build the gem
17
+ yourself run 'rake package' from the root directory to build the gem.
18
+
19
+ == USAGE
20
+ * Run the server on your host (this can be your local box)
21
+ * Point a browser at the host on port 9292
22
+ * Click some links, read some text
23
+
24
+ == CONTRIBUTE:
25
+
26
+ Latest code is available at https://github.com/logaan/hamwiki
27
+
28
+ The 'master' branch can be cloned with:
29
+
30
+ $ git clone git://github.com/logaan/hamwiki.git
31
+
32
+ Contact me via email or github and I'll merge in your work!
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'rake/clean'
3
+ require 'rake/gempackagetask'
4
+
5
+ desc "Default Task"
6
+ task :default => :gem
7
+
8
+ spec = eval(File.read("hamwiki.gemspec"))
9
+
10
+ Rake::GemPackageTask.new(spec) do |pkg|
11
+ pkg.need_zip = true
12
+ pkg.need_tar = true
13
+ end
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+
8
+ <title>HAMwiki</title>
9
+
10
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript" charset="utf-8"></script>
11
+
12
+ <script type="text/javascript" charset="utf-8">
13
+ jQuery(function() {
14
+ load_content("/index")
15
+ load_content("/toc", "#toc")
16
+
17
+ $("body").click(function (event) {
18
+ if($(event.target).attr("class") == "wikilink") {
19
+ load_content($(event.target).attr("href"))
20
+ return false
21
+ }
22
+ })
23
+
24
+ })
25
+
26
+ function load_content (path, target){
27
+ target = target || "#content"
28
+
29
+ $.get(path, function(data){
30
+ $(target).html(format_text(data))
31
+ })
32
+ }
33
+
34
+ function format_text (text) {
35
+ text = text.replace(/\[\[(.*?)\]\]/, "<a href=\"/$1\" class=\"wikilink\">$1</a>")
36
+
37
+ return text
38
+ }
39
+ </script>
40
+
41
+ </head>
42
+
43
+ <body>
44
+
45
+ <div id="toc"></div>
46
+
47
+ <div id="content"></div>
48
+
49
+ </body>
50
+ </html>
@@ -0,0 +1,2 @@
1
+ The title of this article is index (the name of the file on the server) the contents are those of
2
+ the file.
@@ -0,0 +1 @@
1
+ [[index]]
@@ -0,0 +1,15 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "HAMwiki"
3
+ s.version = "0.0.2"
4
+ s.date = "2008-06-16"
5
+ s.summary = "A super fast wiki comprised of a JS driven client and a purpose build rack server."
6
+ s.email = "colin@logaan.net"
7
+ s.homepage = "http://github.com/logaan/hamwiki"
8
+ s.author = "Colin Campbell-McPherson"
9
+
10
+ s.description = <<-END
11
+ 200 lines of code, to manage all your documents in a microsecond, or your money back.
12
+ END
13
+
14
+ s.files = ["hamwiki.gemspec", "Rakefile", "README.rdoc", "client.html", "server.rb", "documents/index", "documents/toc"]
15
+ end
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rack'
5
+ require 'pp'
6
+
7
+ class HamWiki
8
+ def call env
9
+ case env["PATH_INFO"]
10
+ when "/"
11
+ [200, {"Content-Type" => "text/html"},
12
+ [File.read(File.join(File.dirname(__FILE__), "client.html"))]]
13
+ else
14
+ document = File.join(File.dirname(__FILE__), "documents", env["PATH_INFO"])
15
+
16
+ if File.file?(document) && File.readable?(document)
17
+ [200, {
18
+ "Last-Modified" => File.mtime(document).rfc822,
19
+ "Content-Type" => "text/plain",
20
+ "Content-Length" => File.size(document).to_s
21
+ }, File.read(document)]
22
+ else
23
+ [404, {"Content-Type" => "text/plain"},
24
+ ["404: File not found.\n"]]
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ Rack::Handler::WEBrick.run(Rack::Lint.new(HamWiki.new), :Port => 9292)
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logaan-HAMwiki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Colin Campbell-McPherson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-06-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: 200 lines of code, to manage all your documents in a microsecond, or your money back.
17
+ email: colin@logaan.net
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - hamwiki.gemspec
26
+ - Rakefile
27
+ - README.rdoc
28
+ - client.html
29
+ - server.rb
30
+ - documents/index
31
+ - documents/toc
32
+ has_rdoc: false
33
+ homepage: http://github.com/logaan/hamwiki
34
+ post_install_message:
35
+ rdoc_options: []
36
+
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ requirements: []
52
+
53
+ rubyforge_project:
54
+ rubygems_version: 1.2.0
55
+ signing_key:
56
+ specification_version: 2
57
+ summary: A super fast wiki comprised of a JS driven client and a purpose build rack server.
58
+ test_files: []
59
+