rblosxom 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ 2011-01-03 Percy Lau <percy.lau@gmail.com> 0.1.4
2
+ * see hg log -r 33:26
3
+
1
4
  2011-01-01 Percy Lau <percy.lau@gmail.com> 0.1.3
2
5
  * Added wiki_render, Up to ruby1.9
3
6
 
data/Manifest CHANGED
@@ -8,6 +8,8 @@ Rakefile
8
8
  VERSION
9
9
  bin/rblosxom-demo
10
10
  config/rackup.ru
11
+ config/main.yml
12
+ config/wiki.yml
11
13
  demo/grid.rb
12
14
  demo/main.rb
13
15
  demo/wiki_render.rb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/config/main.yml ADDED
@@ -0,0 +1,14 @@
1
+ title: Rblosxom
2
+ slogan: a blosxom program.
3
+ keywords: ruby, blosxom.
4
+ description: Rblosxom is a blosxom program.
5
+ language: en
6
+ datadir: ./data/main
7
+ url: http://rblosxom.heroku.com/
8
+ depth: 0
9
+ num_entries: 40
10
+ file_extension: mkd
11
+ default_flavour: html
12
+ show_future_entries: 0
13
+ theme: default
14
+ copyright: Rblosxom
data/config/rackup.ru CHANGED
@@ -15,6 +15,7 @@ $LOAD_PATH.unshift File.expand_path("../demo", File.dirname(__FILE__))
15
15
 
16
16
  require 'main'
17
17
  Rblosxom::Main.log_level = Logger::DEBUG
18
+ Rblosxom::Main.config_file = File.expand_path("main.yml", File.dirname(__FILE__))
18
19
  map "/" do
19
20
  run Rblosxom::Main
20
21
  end
@@ -25,6 +26,8 @@ map '/grid' do
25
26
  end
26
27
 
27
28
  require 'wiki_render'
29
+ Rblosxom::Wiki.root = File.expand_path("..", File.dirname(__FILE__))
30
+ Rblosxom::Wiki.config_file = File.expand_path("wiki.yml", File.dirname(__FILE__))
28
31
  map '/wiki' do
29
32
  run Rblosxom::Wiki
30
33
  end
data/config/wiki.yml ADDED
@@ -0,0 +1,14 @@
1
+ title: Rblosxom Wiki
2
+ slogan: a blosxom program.
3
+ keywords: ruby, blosxom.
4
+ description: Rblosxom is a blosxom program.
5
+ language: en
6
+ datadir: ./data/wiki
7
+ url: http://rblosxom.heroku.com/
8
+ depth: 0
9
+ num_entries: 40
10
+ file_extension: mkd
11
+ default_flavour: html
12
+ show_future_entries: 0
13
+ theme: default
14
+ copyright: Rblosxom
data/demo/main.rb CHANGED
@@ -6,7 +6,11 @@ module Rblosxom
6
6
  set_common_variables
7
7
  @log.info "Main start"
8
8
  @log.debug "Main debug"
9
- content = File.read(File.expand_path("../README.mkd", File.dirname(__FILE__)))
9
+ index_file = File.expand_path("#{@root}/#{@config["datadir"]}/main.mkd")
10
+ unless File.exist?(index_file)
11
+ index_file = File.expand_path("#{@root}/README.mkd")
12
+ end
13
+ content = File.read(index_file)
10
14
  haml :index, :layout => true, :locals => { :content => content }
11
15
  end
12
16
  end
data/demo/wiki_render.rb CHANGED
@@ -17,7 +17,9 @@ module Rblosxom
17
17
  end
18
18
 
19
19
  def pages
20
- (Dir["**/*.mkd"] + Dir["**/*.markdown"] + Dir["**/*.textile"]).sort
20
+ Dir.chdir(File.expand_path("#{@root}/#{@config["datadir"]}")) {
21
+ (Dir["**/*.mkd"] + Dir["**/*.markdown"] + Dir["**/*.textile"]).sort
22
+ }
21
23
  end
22
24
  end
23
25
  end
@@ -41,7 +43,8 @@ module Rblosxom
41
43
  @log.info "Wiki Render #{request.env["PATH_INFO"]}"
42
44
  @log.info "Wiki Render #{params[:captures]}"
43
45
 
44
- request_file = request.env["PATH_INFO"][1..-1]
46
+ request_file = File.expand_path("#{@root}/#{@config["datadir"]}/#{request.env["PATH_INFO"][1..-1]}")
47
+ @log.debug "Wiki Render request file: #{request_file}"
45
48
  begin
46
49
  content = File.open(request_file) do |file|
47
50
  ext = request_file.split(".")[-1];
@@ -53,7 +56,7 @@ module Rblosxom
53
56
  else
54
57
  file.read
55
58
  end
56
- end
59
+ end
57
60
  haml :wiki, :layout => true, :locals => { :content => content }
58
61
  rescue
59
62
  #raise Sinatra::NotFound
data/lib/rblosxom/base.rb CHANGED
@@ -16,6 +16,7 @@ module Rblosxom
16
16
  def set_common_variables
17
17
  require 'fileutils'
18
18
  require 'logger'
19
+ @root = options.root
19
20
  @config = options.config
20
21
  @log = Proc.new {
21
22
  if options.log_file
@@ -71,7 +72,7 @@ module Rblosxom
71
72
  keywords: ruby, blosxom.
72
73
  description: Rblosxom is a blosxom program.
73
74
  language: en
74
- datadir: /data
75
+ datadir: ./data
75
76
  url: http://rblosxom.heroku.com/
76
77
  depth: 0
77
78
  num_entries: 40
data/rblosxom.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rblosxom}
5
- s.version = "0.1.3"
5
+ s.version = "0.1.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Percy Lau"]
9
- s.date = %q{2011-01-01}
9
+ s.date = %q{2011-01-03}
10
10
  s.default_executable = %q{rblosxom-demo}
11
11
  s.description = %q{Rblosxom is a blosxom program written in ruby.}
12
12
  s.email = %q{percy.lau@gmail.com}
13
13
  s.executables = ["rblosxom-demo"]
14
14
  s.extra_rdoc_files = ["README.mkd", "bin/rblosxom-demo", "lib/rblosxom.rb", "lib/rblosxom/base.rb"]
15
- s.files = ["AUTHORS", "ChangeLog", "INSTALL", "MIT-LICENSE", "Manifest", "README.mkd", "Rakefile", "VERSION", "bin/rblosxom-demo", "config/rackup.ru", "demo/grid.rb", "demo/main.rb", "demo/wiki_render.rb", "lib/rblosxom.rb", "lib/rblosxom/base.rb", "public/config.rb", "public/images/12_col.gif", "public/images/16_col.gif", "public/sass/grid.sass", "public/sass/screen.sass", "public/stylesheets/grid.css", "public/stylesheets/screen.css", "rblosxom.gemspec", "views/footer.haml", "views/grid.haml", "views/header.haml", "views/index.haml", "views/layout.haml", "views/404.haml", "views/500.haml", "views/wiki.haml", "views/wikis.haml"]
15
+ s.files = ["AUTHORS", "ChangeLog", "INSTALL", "MIT-LICENSE", "Manifest", "README.mkd", "Rakefile", "VERSION", "bin/rblosxom-demo", "config/rackup.ru", "config/main.yml", "config/wiki.yml", "demo/grid.rb", "demo/main.rb", "demo/wiki_render.rb", "lib/rblosxom.rb", "lib/rblosxom/base.rb", "public/config.rb", "public/images/12_col.gif", "public/images/16_col.gif", "public/sass/grid.sass", "public/sass/screen.sass", "public/stylesheets/grid.css", "public/stylesheets/screen.css", "rblosxom.gemspec", "views/footer.haml", "views/grid.haml", "views/header.haml", "views/index.haml", "views/layout.haml", "views/404.haml", "views/500.haml", "views/wiki.haml", "views/wikis.haml"]
16
16
  s.homepage = %q{http://rblosxom.heroku.com}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rblosxom", "--main", "README.mkd"]
18
18
  s.require_paths = ["lib"]
data/views/wikis.haml CHANGED
@@ -5,7 +5,7 @@
5
5
  %ul
6
6
  - pages.each do |page|
7
7
  %li
8
- %a{:href => "wiki/#{page}"}= page
8
+ %a{:href => "#{request.env["SCRIPT_NAME"]}/#{page}"}= page
9
9
 
10
10
  #footer
11
11
  .inner= haml :footer, :layout => false, :locals => { }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Percy Lau
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-01 00:00:00 +08:00
17
+ date: 2011-01-03 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -91,6 +91,8 @@ files:
91
91
  - VERSION
92
92
  - bin/rblosxom-demo
93
93
  - config/rackup.ru
94
+ - config/main.yml
95
+ - config/wiki.yml
94
96
  - demo/grid.rb
95
97
  - demo/main.rb
96
98
  - demo/wiki_render.rb