rblosxom 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,6 +1,8 @@
1
+ 2010-01-19 Percy Lau <percy.lau@gmail.com> 0.1.2
2
+ * Added logger handler, category_list and archive_list helper
3
+
1
4
  2009-12-23 Percy Lau <percy.lau@gmail.com> 0.1.1
2
5
  * Added Rblosxom options root, config_file, config
3
6
 
4
7
  2009-12-20 Percy Lau <percy.lau@gmail.com> 0.1.0
5
-
6
8
  * rblosxom init
data/README.rdoc CHANGED
@@ -1,5 +1,3 @@
1
- README
2
- ======
3
1
  [rblosxom][rblosxom]是一个[blosxom][blosxom]程序,
4
2
  它使用了下面的框架和工具:
5
3
 
@@ -8,7 +6,7 @@ README
8
6
  - [rdiscount][rdiscount]
9
7
  - [compass-960][compass_960]
10
8
 
11
- 目前这个版本也是第一个版本0.1.1,功能还不多。
9
+ 目前版本0.1.2
12
10
 
13
11
  Author
14
12
  ------
@@ -22,10 +20,6 @@ Install
22
20
  -------
23
21
  Please see the [INSTALL][install].
24
22
 
25
- More Information
26
- ----------------
27
- Please see the [wiki][wiki].
28
-
29
23
  License
30
24
  -------
31
25
  Released under [MIT License][license].
@@ -37,7 +31,6 @@ Released under [MIT License][license].
37
31
  [rdiscount]: http://github.com/rtomayko/rdiscount/
38
32
  [compass_960]: http://github.com/chriseppstein/compass-960-plugin/
39
33
  [rblosxom]: http://bitbucket.org/itsucks/rblosxom/
40
- [wiki]: http://bitbucket.org/itsucks/rblosxom/wiki/
41
34
  [license]: http://bitbucket.org/itsucks/rblosxom/src/tip/MIT-LICENSE
42
35
  [install]: http://bitbucket.org/itsucks/rblosxom/src/tip/INSTALL
43
36
  [changelog]: http://bitbucket.org/itsucks/rblosxom/src/tip/ChangeLog
data/demo/grid.rb CHANGED
@@ -4,6 +4,7 @@ module Rblosxom
4
4
  class Grid < Base
5
5
  get '/?' do
6
6
  set_common_variables
7
+ @log.info "Grid start"
7
8
  haml :grid, :layout => false, :locals => { }
8
9
  end
9
10
  end
data/demo/main.rb CHANGED
@@ -4,6 +4,7 @@ module Rblosxom
4
4
  class Main < Base
5
5
  get '/?' do
6
6
  set_common_variables
7
+ @log.info "Main start"
7
8
  content = File.read(File.expand_path("../README.rdoc", File.dirname(__FILE__)))
8
9
  haml :index, :layout => true, :locals => { :readme => content }
9
10
  end
data/lib/rblosxom/base.rb CHANGED
@@ -14,11 +14,51 @@ module Rblosxom
14
14
 
15
15
  module Helpers
16
16
  def set_common_variables
17
+ require 'ftools'
18
+ require 'logger'
17
19
  @config = options.config
20
+ @log = Proc.new {
21
+ if options.log_file
22
+ begin
23
+ unless File.exist?(options.log_file)
24
+ File.makedirs(File.dirname(options.log_file))
25
+ File.new(options.log_file, "w")
26
+ end
27
+ log = File.writable?(options.log_file) ? Logger.new(options.log_file) : Logger.new(STDOUT)
28
+ rescue
29
+ log = Logger.new(STDOUT)
30
+ end
31
+ else
32
+ log = Logger.new(STDOUT)
33
+ end
34
+ log.progname = "#{::Rblosxom.name}"
35
+ log.level = Logger::INFO
36
+ log.datetime_format = "%Y-%m-%d %H:%M:%S %Z "
37
+ log
38
+ }.call
18
39
 
19
40
  require 'date'
20
41
  @footer = { :year => %/#{DateTime.now.year}/, :copyright => %/#{options.config["copyright"]}/, :generator => %/rblosxom #{::Rblosxom::Version::STRING}/ }
21
42
  end
43
+
44
+ # all category list
45
+ def category_list
46
+ list = []
47
+ Dir["#{options.config["datadir"]}/**/*"].each do |path|
48
+ list.push([path, Dir["#{path}/*.#{options.config["file_extension"]}"].length]) if File.directory? path
49
+ end
50
+ list
51
+ end
52
+
53
+ # this year archive list
54
+ def archive_list
55
+ list = []
56
+ now = DateTime.now
57
+ this_year = now.year
58
+ this_month = now.month
59
+ 1.upto(now.month) { |m| list.push(DateTime.new(this_year, m)) }
60
+ list
61
+ end
22
62
  end
23
63
 
24
64
  class Base < Sinatra::Base
@@ -27,24 +67,25 @@ module Rblosxom
27
67
  unless defined? CONFIG
28
68
  CONFIG = YAML.load(<<-END)
29
69
  title: Rblosxom
30
- slogan: My Slogan.
31
- description: Ruby based blosxom.
70
+ slogan: a blosxom program.
71
+ keywords: ruby, blosxom.
72
+ description: Rblosxom is a blosxom program.
32
73
  language: en
33
74
  datadir: /data
34
- url: http://bitbucket.org/itsucks/rblosxom/
75
+ url: http://rblosxom.heroku.com/
35
76
  depth: 0
36
77
  num_entries: 40
37
78
  file_extension: mkd
38
79
  default_flavour: html
39
80
  show_future_entries: 0
40
81
  theme: default
41
- logger_level: info
42
82
  copyright: Rblosxom
43
83
  END
44
84
  end
45
85
 
46
86
  class << self
47
87
  attr_accessor :config_file
88
+ attr_accessor :log_file
48
89
  attr_reader :config
49
90
  end
50
91
  set :config, Proc.new { config_file ? YAML::load(File.read(config_file)) : CONFIG }
@@ -68,13 +68,13 @@ body
68
68
  :text-decoration none
69
69
  :color #999
70
70
  :font-weight bold
71
- &:after
72
- :text-decoration none
73
- :color #333
74
71
  &.active
75
72
  :text-decoration none
76
73
  :color #F90
77
74
  :font-weight bold
75
+ &:hover
76
+ :text-decoration none
77
+ :color #333
78
78
 
79
79
  #main
80
80
  p
@@ -90,14 +90,18 @@ body
90
90
  :color #F90
91
91
  :border-bottom 1px solid #E5E5E5
92
92
  .content
93
- +grid(8,12)
93
+ +grid(9,12)
94
94
  img
95
95
  :border 1px solid #CDCDCD
96
96
  :float left
97
97
  :margin 0px 15px 5px
98
98
  :padding 5px
99
99
  .sidebar
100
- +grid(4,12)
100
+ +grid(3,12)
101
+ p.title
102
+ :margin 0px 20px
103
+ :font-weight bold
104
+ :font-style oblique
101
105
 
102
106
  #footer
103
107
  .inner
@@ -205,6 +205,6 @@ body > #wrap { height: auto; min-height: 100%; }
205
205
  .clearfix { display: block; }
206
206
 
207
207
  /* End hide from IE-mac */
208
- .g12 { background-image: url('/images/12_col.gif?1261042258'); background-repeat: repeat-y; }
208
+ .g12 { background-image: url('/images/12_col.gif?1261547183'); background-repeat: repeat-y; }
209
209
 
210
- .g16 { background-image: url('/images/16_col.gif?1261042258'); background-repeat: repeat-y; }
210
+ .g16 { background-image: url('/images/16_col.gif?1261547183'); background-repeat: repeat-y; }
@@ -101,15 +101,16 @@ body { background-color: white; color: #666666; }
101
101
  #header ul { display: inline; float: left; margin-left: 10px; margin-right: 10px; width: 460px; list-style-type: none; text-align: right; color: #CCC; padding: 0; margin: 40px 15px 0 0; }
102
102
  #header ul li { display: inline; margin: 0 0 0 10px; }
103
103
  #header ul li a { text-decoration: none; color: #999; font-weight: bold; }
104
- #header ul li a:after { text-decoration: none; color: #333; }
105
104
  #header ul li a.active { text-decoration: none; color: #F90; font-weight: bold; }
105
+ #header ul li a:hover { text-decoration: none; color: #333; }
106
106
 
107
107
  #main p { margin: 0 15px 15px 15px; }
108
108
  #main h1 { color: #F90; font-size: 140%; }
109
109
  #main h2, #main h3 { margin: 0 0 15px 0; padding: 5px 15px; font-size: 120%; font-weight: normal; color: #F90; border-bottom: 1px solid #E5E5E5; }
110
- #main .content { display: inline; float: left; margin-left: 10px; margin-right: 10px; width: 620px; }
110
+ #main .content { display: inline; float: left; margin-left: 10px; margin-right: 10px; width: 700px; }
111
111
  #main .content img { border: 1px solid #CDCDCD; float: left; margin: 0px 15px 5px; padding: 5px; }
112
- #main .sidebar { display: inline; float: left; margin-left: 10px; margin-right: 10px; width: 300px; }
112
+ #main .sidebar { display: inline; float: left; margin-left: 10px; margin-right: 10px; width: 220px; }
113
+ #main .sidebar p.title { margin: 0px 20px; font-weight: bold; font-style: oblique; }
113
114
 
114
115
  #footer .inner { display: inline; float: left; margin-left: 10px; margin-right: 10px; width: 940px; border-top: 2px solid #F90; color: #999; }
115
116
  #footer .inner a { color: #999; text-decoration: none; }
data/rblosxom.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rblosxom'
3
- s.version = '0.1.1'
4
- s.date = '2009-12-23'
3
+ s.version = '0.1.2'
4
+ s.date = '2010-01-19'
5
5
 
6
6
  s.description = "Ruby based Blosxom."
7
7
  s.summary = "rblosxom is a Blosxom program written in ruby."
data/views/footer.haml CHANGED
@@ -1,4 +1,4 @@
1
1
  %p
2
2
  = %/&copy;#{@footer[:year]}/
3
- %a{:title=>"rbloxom home", :href=>"#{@config['url']}"}
3
+ %a{:title=>"home", :href=>"#{@config['url']}"}
4
4
  %strong= @footer[:copyright]
data/views/grid.haml CHANGED
@@ -3,15 +3,15 @@
3
3
  %head
4
4
  %title
5
5
  = @config["title"]
6
- compass-960 grid
6
+ 960 grid
7
7
  %meta{ "http-equiv" => "Content-Type", "content" => "application/xhtml+xml; charset=utf-8" }
8
8
  %meta{ "http-equiv" => "Content-Language", "content" => "zh-cn" }
9
-
10
9
  %meta{ "name" => "Language", "content" => "chinese" }
11
- %meta{ "name" => "robots", "content" => "index, follow, all" }
12
10
  %meta{ "name" => "generator", "content" => "#{@footer[:generator]}" }
13
11
  %meta{ :name => "robots", :content => "index, follow, noarchive" }
14
12
  %meta{ :name => "googlebot", :content => "noarchive" }
13
+ %meta{ "name" => "description", "content" => "960 grid demo" }
14
+ %meta{ "name" => "keywords", "content" => "compass 960gs" }
15
15
 
16
16
  %link{ :rel => "stylesheet", :href => "/stylesheets/grid.css", :media => "screen", :type => "text/css" }
17
17
 
data/views/header.haml CHANGED
@@ -1,9 +1,10 @@
1
1
  %h1
2
2
  = @config["title"]
3
- = ::Rblosxom::Version::STRING
3
+ %span
4
+ = @config["slogan"]
4
5
  %ul
5
6
  %li
6
- %a{:class=>"active", :title=>"rblosxom", :href=>"/"} rblosxom
7
+ %a{:class=>"active", :title=>"home", :href=>"/"} rblosxom
7
8
  %li
8
9
  |
9
10
  %li
data/views/layout.haml CHANGED
@@ -4,12 +4,12 @@
4
4
  %title= @config["title"]
5
5
  %meta{ "http-equiv" => "Content-Type", "content" => "application/xhtml+xml; charset=utf-8" }
6
6
  %meta{ "http-equiv" => "Content-Language", "content" => "zh-cn" }
7
-
8
7
  %meta{ "name" => "Language", "content" => "chinese" }
9
- %meta{ "name" => "robots", "content" => "index, follow, all" }
10
- %meta{ "name" => "generator", "content" => "#{@config["generator"]}" }
8
+ %meta{ "name" => "generator", "content" => "#{@footer[:generator]}" }
11
9
  %meta{ :name => "robots", :content => "index, follow, noarchive" }
12
10
  %meta{ :name => "googlebot", :content => "noarchive" }
11
+ %meta{ "name" => "description", "content" => @config["description"] }
12
+ %meta{ "name" => "keywords", "content" => @config["keywords"] }
13
13
 
14
14
  %link{ :rel => "stylesheet", :href => "/stylesheets/screen.css", :media => "screen", :type => "text/css" }
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rblosxom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Percy Lau
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-23 00:00:00 +08:00
12
+ date: 2010-01-19 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -74,22 +74,22 @@ files:
74
74
  - MIT-LICENSE
75
75
  - AUTHORS
76
76
  - config/rackup.ru
77
- - demo/main.rb
78
77
  - demo/grid.rb
79
- - public/images/16_col.gif
78
+ - demo/main.rb
80
79
  - public/images/12_col.gif
81
- - public/sass/_debug.sass
80
+ - public/images/16_col.gif
82
81
  - public/sass/_sticky_footer.sass
83
82
  - public/sass/_grid.sass
84
83
  - public/sass/grid.sass
84
+ - public/sass/_debug.sass
85
85
  - public/sass/screen.sass
86
- - public/stylesheets/grid.css
87
86
  - public/stylesheets/screen.css
88
- - views/layout.haml
89
- - views/footer.haml
90
- - views/index.haml
87
+ - public/stylesheets/grid.css
91
88
  - views/header.haml
92
89
  - views/grid.haml
90
+ - views/layout.haml
91
+ - views/index.haml
92
+ - views/footer.haml
93
93
  - rblosxom.gemspec
94
94
  has_rdoc: true
95
95
  homepage: http://rblosxom.heroku.com/
@@ -100,7 +100,7 @@ rdoc_options:
100
100
  - --line-numbers
101
101
  - --inline-source
102
102
  - --title
103
- - rblosxom 0.1.1
103
+ - rblosxom 0.1.2
104
104
  - --main
105
105
  - README.rdoc
106
106
  - --webcvs