nwiki 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.org CHANGED
@@ -1,4 +1,8 @@
1
1
  * CHANGELOG
2
+ ** 0.0.9
3
+ - [fix] Fix url in the feed
4
+ - [feature] Use recent version of jQuery
5
+ - [feature] refine display layout
2
6
  ** 0.0.8
3
7
  - [feature] Config files move to branch
4
8
  - [feature] Introduce atom feed
@@ -1,3 +1,5 @@
1
+ require 'rack'
2
+
1
3
  module Nwiki
2
4
  module Core
3
5
  class File
@@ -1,4 +1,5 @@
1
- # -*- coding: utf-8 -*-
1
+ require 'rack'
2
+
2
3
  module Nwiki
3
4
  module Core
4
5
  class Wiki
@@ -7,7 +7,7 @@ module Nwiki
7
7
  def initialize git_repo_path
8
8
  @builder = Rack::Builder.new {
9
9
  map '/articles.xml' do
10
- run Feed.new git_repo_path
10
+ run Feed.new git_repo_path, articles_path: '/articles'
11
11
  end
12
12
  map '/articles' do
13
13
  run Html.new git_repo_path
@@ -21,9 +21,12 @@ module Nwiki
21
21
  end
22
22
 
23
23
  class Feed
24
- def initialize git_repo_path
24
+ attr_reader :articles_path
25
+
26
+ def initialize git_repo_path, opts = {}
25
27
  @wiki = Nwiki::Core::Wiki.new git_repo_path
26
28
  raise unless @wiki.exist?
29
+ @articles_path = opts[:articles_path] || ''
27
30
  end
28
31
 
29
32
  def call env
@@ -53,7 +56,7 @@ module Nwiki
53
56
  path.gsub!(/\.org$/, '')
54
57
 
55
58
  maker.items.new_item do |item|
56
- item.link = Rack::Request.new(env).url.gsub(Regexp.new(Rack::Request.new(env).fullpath), "/#{path}")
59
+ item.link = Rack::Request.new(env).url.gsub(Regexp.new(Rack::Request.new(env).fullpath), "#{articles_path}/#{path}")
57
60
  item.title = File.basename(path)
58
61
  item.date = date
59
62
  end
@@ -90,13 +93,21 @@ module Nwiki
90
93
  <html>
91
94
  <head>
92
95
  <title><%= page.title %> - <%= @wiki.title %></title>
96
+ <link rel="alternate" type="application/atom+xml" title="ATOM Feed" href="/articles.xml">
93
97
  <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
94
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
98
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
95
99
  <script src="/bootstrap/js/bootstrap.min.js"></script>
96
100
  </head>
97
101
  <body>
98
- <h1><%= @wiki.title %></h1>
99
- <%= page.to_html %>
102
+ <div class="container">
103
+ <div class="row">
104
+ <div class="span12">
105
+ <h1><%= @wiki.title %></h1>
106
+ <h2><%= @wiki.subtitle %></h2>
107
+ <%= page.to_html %>
108
+ </div>
109
+ </div>
110
+ </div>
100
111
  </body>
101
112
  </html>
102
113
  EOS
data/lib/nwiki/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nwiki
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
@@ -39,7 +39,7 @@ module Nwiki
39
39
  it { subject.author.name.content.should eq 'niku' }
40
40
  it { subject.date.should eq Time.parse('2014-02-06') }
41
41
  it { subject.id.content.should eq 'http://example.org/articles.xml' }
42
- it { subject.items.first.link.href.should eq 'http://example.org/icon.png' }
42
+ it { subject.items.first.link.href.should eq 'http://example.org/articles/icon.png' }
43
43
  it { subject.items.first.title.content.should eq "icon.png" }
44
44
  it { subject.items.first.date.should eq Time.parse('2012-08-09 20:15:07 +0900') }
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nwiki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-09 00:00:00.000000000 Z
12
+ date: 2013-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gollum
@@ -295,12 +295,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
295
295
  - - ! '>='
296
296
  - !ruby/object:Gem::Version
297
297
  version: '0'
298
+ segments:
299
+ - 0
300
+ hash: 3482978652974879203
298
301
  required_rubygems_version: !ruby/object:Gem::Requirement
299
302
  none: false
300
303
  requirements:
301
304
  - - ! '>='
302
305
  - !ruby/object:Gem::Version
303
306
  version: '0'
307
+ segments:
308
+ - 0
309
+ hash: 3482978652974879203
304
310
  requirements: []
305
311
  rubyforge_project:
306
312
  rubygems_version: 1.8.23