zenweb 3.0.0.b1 → 3.0.0.b2

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/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 3.0.0.b2 / 2012-06-11
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added Page#change_frequency
6
+ * Added ability to specify DIR and DATE for new_post and new_page tasks
7
+
1
8
  === 3.0.0.b1 / 2012-05-25
2
9
 
3
10
  * 1 major enhancement:
data/README.txt CHANGED
@@ -1,6 +1,8 @@
1
1
  = ZenWeb
2
2
 
3
- * https://github.com/seattlerb/zenweb/
3
+ home :: https://github.com/seattlerb/zenweb
4
+ bugs :: https://github.com/seattlerb/zenweb/issues
5
+ rdoc :: http://docs.seattlerb.org/zenweb
4
6
 
5
7
  == DESCRIPTION:
6
8
 
data/lib/zenweb/page.rb CHANGED
@@ -160,6 +160,21 @@ module Zenweb
160
160
  path[/\d\d\d\d-\d\d-\d\d/]
161
161
  end
162
162
 
163
+ def change_frequency
164
+ days_old = (Time.now - self.date).to_i / 86400
165
+
166
+ case days_old
167
+ when 0...14 then
168
+ "daily"
169
+ when 14...56 then
170
+ "weekly"
171
+ when 56...365 then
172
+ "monthly"
173
+ else
174
+ "yearly"
175
+ end
176
+ end
177
+
163
178
  ##
164
179
  # Returns true if this is an html page.
165
180
 
@@ -51,18 +51,22 @@ task :realclean => :clean do
51
51
  rm_rf ".site"
52
52
  end
53
53
 
54
- def new_file title, dated = false
54
+ def new_file title, dir, date = false
55
55
  path = "#{title.strip.downcase.gsub(/\W+/, '-')}.html.md"
56
56
 
57
- if dated then
58
- today = Time.now.strftime '%Y-%m-%d'
59
- path = "#{today}-#{path}"
57
+ if date then
58
+ date = String === date ? Time.parse(date) : Time.now
59
+
60
+ path = "#{date.strftime '%Y-%m-%d'}-#{path}"
60
61
  end
61
62
 
63
+ date ||= Time.now
64
+ path = File.join dir, path
65
+
62
66
  open path, 'w' do |post|
63
67
  post.puts "---"
64
68
  post.puts "title: \"#{title}\""
65
- post.puts "date: #{Time.now.iso8601}"
69
+ post.puts "date: #{date.iso8601}"
66
70
  post.puts "..."
67
71
  post.puts
68
72
  end
@@ -72,18 +76,21 @@ end
72
76
 
73
77
  desc "Begin a new dated post: rake new_post['title']"
74
78
  task :new_post, :title do |t, args|
79
+ dir = ENV["DIR"] || "."
75
80
  title = args[:title] || "new-post"
81
+ date = ENV["DATE"] || :dated
76
82
 
77
- path = new_file title, true
83
+ path = new_file title, dir, date
78
84
 
79
85
  warn "Created new post: #{path}"
80
86
  end
81
87
 
82
88
  desc "Begin a new dated post: rake new_page['title']"
83
89
  task :new_page, :title do |t, args|
90
+ dir = ENV["DIR"] || "."
84
91
  title = args[:title] || "new-post"
85
92
 
86
- path = new_file title
93
+ path = new_file title, dir
87
94
 
88
95
  warn "Created new file: #{path}"
89
96
  end
data/lib/zenweb.rb CHANGED
@@ -6,7 +6,7 @@ require "time"
6
6
 
7
7
  module Zenweb
8
8
  # duh
9
- VERSION = "3.0.0.b1"
9
+ VERSION = "3.0.0.b2"
10
10
  end
11
11
 
12
12
  require "zenweb/site"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenweb
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1637566754
4
+ hash: -4064281384
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
10
  - b
11
- - 1
12
- version: 3.0.0.b1
11
+ - 2
12
+ version: 3.0.0.b2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Ryan Davis
@@ -38,7 +38,7 @@ cert_chain:
38
38
  FBHgymkyj/AOSqKRIpXPhjC6
39
39
  -----END CERTIFICATE-----
40
40
 
41
- date: 2012-05-25 00:00:00 Z
41
+ date: 2012-06-11 00:00:00 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: less
@@ -257,7 +257,7 @@ files:
257
257
  - test/test_zenweb_plugins_markdown.rb
258
258
  - test/test_zenweb_site.rb
259
259
  - .gemtest
260
- homepage: https://github.com/seattlerb/zenweb/
260
+ homepage: https://github.com/seattlerb/zenweb
261
261
  licenses: []
262
262
 
263
263
  post_install_message:
metadata.gz.sig CHANGED
Binary file