qwiki 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ gem 'github-markup'
4
+ gem 'haml'
5
+ gem 'rdoc'
6
+ gem 'sinatra'
7
+
8
+ # Add dependencies to develop your gem here.
9
+ # Include everything needed to run rake, tests, features, etc.
10
+ group :development do
11
+ gem "shoulda", ">= 0"
12
+ gem "bundler", "~> 1.0.0"
13
+ gem "jeweler", "~> 1.5.1"
14
+ gem "rcov", ">= 0"
15
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,32 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ github-markup (0.5.0)
6
+ haml (3.0.24)
7
+ jeweler (1.5.1)
8
+ bundler (~> 1.0.0)
9
+ git (>= 1.2.5)
10
+ rake
11
+ rack (1.2.1)
12
+ rake (0.8.7)
13
+ rcov (0.9.9)
14
+ rdoc (2.5.11)
15
+ shoulda (2.11.3)
16
+ sinatra (1.1.0)
17
+ rack (~> 1.1)
18
+ tilt (~> 1.1)
19
+ tilt (1.1)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ bundler (~> 1.0.0)
26
+ github-markup
27
+ haml
28
+ jeweler (~> 1.5.1)
29
+ rcov
30
+ rdoc
31
+ shoulda
32
+ sinatra
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Brian Alexander
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = qwiki
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to qwiki
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Brian Alexander. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "qwiki"
16
+ gem.homepage = "http://github.com/balexand/qwiki"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{Quickly render some wiki markup for your browser}
19
+ gem.description = %Q{A command-line web server that renders wiki markup files. It's handy when you want a quick preview of your markup.}
20
+ gem.email = "balexand@gmail.com"
21
+ gem.authors = ["Brian Alexander"]
22
+ end
23
+ Jeweler::RubygemsDotOrgTasks.new
24
+
25
+ require 'rake/testtask'
26
+ Rake::TestTask.new(:test) do |test|
27
+ test.libs << 'lib' << 'test'
28
+ test.pattern = 'test/**/test_*.rb'
29
+ test.verbose = true
30
+ end
31
+
32
+ require 'rcov/rcovtask'
33
+ Rcov::RcovTask.new do |test|
34
+ test.libs << 'test'
35
+ test.pattern = 'test/**/test_*.rb'
36
+ test.verbose = true
37
+ end
38
+
39
+ task :default => :test
40
+
41
+ require 'rake/rdoctask'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "qwiki #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
data/bin/qwiki ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
3
+ require 'qwiki'
4
+
5
+ Qwiki::App.run!
data/lib/qwiki/app.rb ADDED
@@ -0,0 +1,78 @@
1
+ require 'github/markup'
2
+ require 'haml'
3
+ require 'rdoc/markup/to_html'
4
+ require 'sinatra'
5
+
6
+ module Qwiki
7
+ # The Sinatra app. Run it like this:
8
+ # Qwiki::App.run!
9
+ class App < Sinatra::Base
10
+ enable :inline_templates, __FILE__
11
+
12
+ get "*" do
13
+ if File.directory?(request_path)
14
+ index(request_path)
15
+ elsif File.file?(request_path)
16
+ if request_path =~ /\.rdoc$/i
17
+ # Workaround: GitHub::Markup doesn't render RDOC in Ruby 1.9
18
+ # see https://github.com/github/markup/issues#issue/30
19
+ RDoc::Markup::ToHtml.new.convert(File.read(request_path))
20
+ else
21
+ GitHub::Markup.render(request_path)
22
+ end
23
+ else
24
+ raise Sinatra::NotFound
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ # Returns the full path of the file, given a path relative to the base path.
31
+ def full_path(relative)
32
+ # use PWD as base; later this could be a command-line option
33
+ File.expand_path(File.join(Dir.pwd, relative))
34
+ end
35
+
36
+ # Returns a path relative to the base path, given the full path. This is the inverse of
37
+ # full_path.
38
+ def relative_path(path)
39
+ path = File.expand_path(path)
40
+ root = full_path("")
41
+ if path.size >= root.size && path[0...root.size] == root
42
+ path[0...root.size] = ""
43
+ path = "/" if path.size == 0
44
+ path
45
+ end
46
+ end
47
+
48
+ # File path specified by the current request URL.
49
+ def request_path
50
+ @request_path ||= full_path(request.path)
51
+ end
52
+
53
+ # Renders an index page for the specified directory.
54
+ def index(path)
55
+ @entries = []
56
+ Dir.entries(path).each do |entry|
57
+ relative_path = relative_path(File.join(path, entry))
58
+ if entry != "." && relative_path
59
+ @entries << {:name => entry, :href => relative_path}
60
+ end
61
+ end
62
+ @path = path
63
+ haml :index
64
+ end
65
+ end
66
+ end
67
+
68
+ Qwiki::App.run!
69
+
70
+ __END__
71
+
72
+ @@ index
73
+ %h2= "Index of #{@path}"
74
+ %ul
75
+ - @entries.each do |entry|
76
+ %li
77
+ %a{:href => entry[:href]}= entry[:name]
78
+
data/lib/qwiki.rb ADDED
@@ -0,0 +1 @@
1
+ require 'qwiki/app'
data/qwiki.gemspec ADDED
@@ -0,0 +1,80 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{qwiki}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Brian Alexander"]
12
+ s.date = %q{2010-12-03}
13
+ s.default_executable = %q{qwiki}
14
+ s.description = %q{A command-line web server that renders wiki markup files. It's handy when you want a quick preview of your markup.}
15
+ s.email = %q{balexand@gmail.com}
16
+ s.executables = ["qwiki"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.rdoc",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "bin/qwiki",
30
+ "lib/qwiki.rb",
31
+ "lib/qwiki/app.rb",
32
+ "qwiki.gemspec",
33
+ "test/helper.rb",
34
+ "test/test_qwiki.rb"
35
+ ]
36
+ s.homepage = %q{http://github.com/balexand/qwiki}
37
+ s.licenses = ["MIT"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = %q{1.3.7}
40
+ s.summary = %q{Quickly render some wiki markup for your browser}
41
+ s.test_files = [
42
+ "test/helper.rb",
43
+ "test/test_qwiki.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::VERSION) >= Gem::Version.new('1.2.0') then
51
+ s.add_runtime_dependency(%q<github-markup>, [">= 0"])
52
+ s.add_runtime_dependency(%q<haml>, [">= 0"])
53
+ s.add_runtime_dependency(%q<rdoc>, [">= 0"])
54
+ s.add_runtime_dependency(%q<sinatra>, [">= 0"])
55
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
56
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
57
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
58
+ s.add_development_dependency(%q<rcov>, [">= 0"])
59
+ else
60
+ s.add_dependency(%q<github-markup>, [">= 0"])
61
+ s.add_dependency(%q<haml>, [">= 0"])
62
+ s.add_dependency(%q<rdoc>, [">= 0"])
63
+ s.add_dependency(%q<sinatra>, [">= 0"])
64
+ s.add_dependency(%q<shoulda>, [">= 0"])
65
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
66
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
67
+ s.add_dependency(%q<rcov>, [">= 0"])
68
+ end
69
+ else
70
+ s.add_dependency(%q<github-markup>, [">= 0"])
71
+ s.add_dependency(%q<haml>, [">= 0"])
72
+ s.add_dependency(%q<rdoc>, [">= 0"])
73
+ s.add_dependency(%q<sinatra>, [">= 0"])
74
+ s.add_dependency(%q<shoulda>, [">= 0"])
75
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
76
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
77
+ s.add_dependency(%q<rcov>, [">= 0"])
78
+ end
79
+ end
80
+
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'qwiki'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestQwiki < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: qwiki
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Brian Alexander
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-03 00:00:00 -08:00
18
+ default_executable: qwiki
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: github-markup
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ prerelease: false
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: haml
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
42
+ version: "0"
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: rdoc
48
+ requirement: &id003 !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: *id003
59
+ - !ruby/object:Gem::Dependency
60
+ name: sinatra
61
+ requirement: &id004 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ type: :runtime
70
+ prerelease: false
71
+ version_requirements: *id004
72
+ - !ruby/object:Gem::Dependency
73
+ name: shoulda
74
+ requirement: &id005 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: *id005
85
+ - !ruby/object:Gem::Dependency
86
+ name: bundler
87
+ requirement: &id006 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 1
94
+ - 0
95
+ - 0
96
+ version: 1.0.0
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: *id006
100
+ - !ruby/object:Gem::Dependency
101
+ name: jeweler
102
+ requirement: &id007 !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ~>
106
+ - !ruby/object:Gem::Version
107
+ segments:
108
+ - 1
109
+ - 5
110
+ - 1
111
+ version: 1.5.1
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: *id007
115
+ - !ruby/object:Gem::Dependency
116
+ name: rcov
117
+ requirement: &id008 !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ segments:
123
+ - 0
124
+ version: "0"
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: *id008
128
+ description: A command-line web server that renders wiki markup files. It's handy when you want a quick preview of your markup.
129
+ email: balexand@gmail.com
130
+ executables:
131
+ - qwiki
132
+ extensions: []
133
+
134
+ extra_rdoc_files:
135
+ - LICENSE.txt
136
+ - README.rdoc
137
+ files:
138
+ - .document
139
+ - Gemfile
140
+ - Gemfile.lock
141
+ - LICENSE.txt
142
+ - README.rdoc
143
+ - Rakefile
144
+ - VERSION
145
+ - bin/qwiki
146
+ - lib/qwiki.rb
147
+ - lib/qwiki/app.rb
148
+ - qwiki.gemspec
149
+ - test/helper.rb
150
+ - test/test_qwiki.rb
151
+ has_rdoc: true
152
+ homepage: http://github.com/balexand/qwiki
153
+ licenses:
154
+ - MIT
155
+ post_install_message:
156
+ rdoc_options: []
157
+
158
+ require_paths:
159
+ - lib
160
+ required_ruby_version: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ hash: 3059364095968798797
166
+ segments:
167
+ - 0
168
+ version: "0"
169
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ segments:
175
+ - 0
176
+ version: "0"
177
+ requirements: []
178
+
179
+ rubyforge_project:
180
+ rubygems_version: 1.3.7
181
+ signing_key:
182
+ specification_version: 3
183
+ summary: Quickly render some wiki markup for your browser
184
+ test_files:
185
+ - test/helper.rb
186
+ - test/test_qwiki.rb