pokapoka 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22c342fb7d6f361baf2ac770c2cd705745f5d950
4
- data.tar.gz: 141ffd4b18d090f9a662bbf675d56f89bbdda8e0
3
+ metadata.gz: a4bd821c3acd88a84efe79df0d2fbc10926b5f18
4
+ data.tar.gz: 66842b9975b583c1708f8f3f1bebd6e2c39570f2
5
5
  SHA512:
6
- metadata.gz: 3c4b5d3c75400ac3088e3940af9b160b073df12a60b742b82a89563d04bad9c91f8faf8ae520b7d1cb7e863b0f1176cbbc868619c4698ed02b37ae9328674c05
7
- data.tar.gz: ddde67358efbaf63e954de1a24b750aa3092a1f812ba87c9195aa3facf1695ce664f6c766e0a3e6c97df2702f751c897403398d1408b53983df3e6692e8d99c9
6
+ metadata.gz: ffac04c88d2d064b60837993b2d66b7f200607f0fa27ed4053a309be54eb061665416aab5d164f3d7e4321fd6644388c1c2c7173f0ab423d212ccac20d03ece7
7
+ data.tar.gz: 353554526e26243e9714e7c2c173fe3adaa00c60c60e1c332a7441467cbf0c61696176728285a412b8c160bf7a12713c3b61e7c1bf431e1af9d20432ed54e051
data/lib/pokapoka.rb CHANGED
@@ -7,7 +7,7 @@ module Pokapoka
7
7
  def self.app
8
8
  tpl = '<html>
9
9
  <head>
10
- <link href="https://gist.github.com/assets/application-1a163d807985dac0d994594ef2558571.css" media="screen, print" rel="stylesheet" />
10
+ <link href="https://gist.github.com/assets/application-6ee6749e63e8ef98c7d45e7877a8c777.css" media="screen, print" rel="stylesheet" />
11
11
  <style type="text/css">article{max-width:900px;margin:auto;padding:50px;border:1px solid #ccc;border-top:0;}</style>
12
12
  </head>
13
13
  <body><article class="markdown-body">BODY</atricle></body>
@@ -15,12 +15,17 @@ module Pokapoka
15
15
 
16
16
  app = Proc.new do |env|
17
17
  path = env["PATH_INFO"].sub("/", "").strip
18
- path = path == "" ? "README.md" : path
19
18
 
20
- path = File.join(Dir.pwd, path)
19
+ candidates = if path == ""
20
+ ["README.md", "README.mkdwn", "README.markdown"]
21
+ else
22
+ [path]
23
+ end
24
+
25
+ file = candidates.map {|f| File.join(Dir.pwd, f) }.find {|f| File.exists?(f) }
21
26
 
22
- if File.exist?(path)
23
- [200, {"Content-type" => "text/html"}, tpl.gsub("BODY", GitHub::Markdown.render_gfm(File.read(path))).each_line]
27
+ if file
28
+ [200, {"Content-type" => "text/html"}, tpl.gsub("BODY", GitHub::Markdown.render_gfm(File.read(file))).each_line]
24
29
  else
25
30
  [404, {}, "File #{path} not found".each_line]
26
31
  end
@@ -1,3 +1,3 @@
1
1
  module Pokapoka
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pokapoka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tymon Tobolski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-02 00:00:00.000000000 Z
11
+ date: 2014-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -88,9 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.0.0
91
+ rubygems_version: 2.1.11
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Show .md files
95
95
  test_files: []
96
- has_rdoc: