serif 0.5 → 0.5.1
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/README.md +1 -1
- data/lib/serif/commands.rb +1 -0
- data/lib/serif/content_file.rb +4 -2
- data/lib/serif/draft.rb +2 -0
- data/serif.gemspec +1 -1
- data/test/content_file_spec.rb +28 -0
- data/test/draft_spec.rb +15 -0
- data/test/site_dir/_site/drafts/another-sample-draft/{add25848a94509103cb492c47e3a04b7b2a56299de207155fbffec42dc4b.html → 893209b2ce83164321ca8f311a32a3c87399498377e1229e7ecc26ff850f.html} +0 -0
- data/test/site_dir/_site/drafts/sample-draft/{0b6fc164b8534d5d5a9fcfc5c709265d33f1577cd0fe2f4e23042e92f0c1.html → 1b015cdf8a931d05f12b95c6a9ea308c6e006596d6ccae5849935e7aaf24.html} +0 -0
- data/test/site_dir/_trash/{1364747613-test-draft → 1365433969-test-draft} +1 -1
- data/test/site_dir/_trash/1365433970-autopublish-draft +5 -0
- data/test/site_dir/_trash/1365433970-test-draft +4 -0
- metadata +69 -68
- data/test/site_dir/_trash/1364747613-autopublish-draft +0 -5
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Serif is a static site generator and blogging system powered by markdown files a
|
|
|
6
6
|
|
|
7
7
|
Serif releases you from managing a file system so you can focus on writing content.
|
|
8
8
|
|
|
9
|
-
Having problems with Serif? [Open an issue on GitHub](https://github.com/aprescott/serif/issues), use the [Serif Google Group](https://groups.google.com/forum/#!forum/serif-rb), or
|
|
9
|
+
Having problems with Serif? [Open an issue on GitHub](https://github.com/aprescott/serif/issues), use the [Serif Google Group](https://groups.google.com/forum/#!forum/serif-rb), or join the Freenode#serif IRC channel at irc://irc.freenode.net/serif.
|
|
10
10
|
|
|
11
11
|
## First time use
|
|
12
12
|
|
data/lib/serif/commands.rb
CHANGED
data/lib/serif/content_file.rb
CHANGED
|
@@ -51,12 +51,14 @@ class ContentFile
|
|
|
51
51
|
@cached_headers = nil
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
# Returns true if the file is in the directory for draft content.
|
|
54
55
|
def draft?
|
|
55
|
-
|
|
56
|
+
File.dirname(path) == File.join(site.directory, Draft.dirname)
|
|
56
57
|
end
|
|
57
58
|
|
|
59
|
+
# Returns true if the file is in the directory for published posts.
|
|
58
60
|
def published?
|
|
59
|
-
|
|
61
|
+
File.dirname(path) == File.join(site.directory, Post.dirname)
|
|
60
62
|
end
|
|
61
63
|
|
|
62
64
|
def content(include_headers = false)
|
data/lib/serif/draft.rb
CHANGED
|
@@ -41,6 +41,8 @@ class Draft < ContentFile
|
|
|
41
41
|
publish_time = Time.now
|
|
42
42
|
date = Time.now.strftime("%Y-%m-%d")
|
|
43
43
|
filename = "#{date}-#{slug}"
|
|
44
|
+
|
|
45
|
+
FileUtils.mkdir_p("#{site.directory}/#{Post.dirname}")
|
|
44
46
|
full_published_path = File.expand_path("#{site.directory}/#{Post.dirname}/#{filename}")
|
|
45
47
|
|
|
46
48
|
raise "conflict, post exists already" if File.exist?(full_published_path)
|
data/serif.gemspec
CHANGED
data/test/content_file_spec.rb
CHANGED
|
@@ -36,6 +36,34 @@ describe Serif::ContentFile do
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
describe "draft?" do
|
|
40
|
+
it "is true if the file is in the _drafts directory" do
|
|
41
|
+
subject.drafts.each do |d|
|
|
42
|
+
d.draft?.should be_true
|
|
43
|
+
d.published?.should be_false
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
d = subject.drafts.sample
|
|
47
|
+
orig_path = d.path
|
|
48
|
+
d.stub(:path) { orig_path.gsub(/^#{Regexp.quote(testing_dir("_drafts"))}/, testing_dir("_anything")) }
|
|
49
|
+
d.draft?.should be_false
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe "published?" do
|
|
54
|
+
it "is true if the file is in the _posts directory" do
|
|
55
|
+
subject.posts.each do |p|
|
|
56
|
+
p.published?.should be_true
|
|
57
|
+
p.draft?.should be_false
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
p = subject.posts.sample
|
|
61
|
+
orig_path = p.path
|
|
62
|
+
p.stub(:path) { orig_path.gsub(/^#{Regexp.quote(testing_dir("_posts"))}/, testing_dir("_anything")) }
|
|
63
|
+
p.published?.should be_false
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
39
67
|
describe "#title=" do
|
|
40
68
|
it "sets the underlying header value to the assigned title" do
|
|
41
69
|
(subject.drafts + subject.posts).each do |content_file|
|
data/test/draft_spec.rb
CHANGED
|
@@ -115,6 +115,21 @@ describe Serif::Draft do
|
|
|
115
115
|
FileUtils.rm_f(published_path)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
+
it "creates the posts directory if it doens't already exist" do
|
|
119
|
+
draft = D.new(@site)
|
|
120
|
+
draft.slug = "test-draft"
|
|
121
|
+
draft.title = "Some draft title"
|
|
122
|
+
draft.save("some content")
|
|
123
|
+
|
|
124
|
+
FileUtils.should_receive(:mkdir_p).with(testing_dir("_posts")).and_call_original
|
|
125
|
+
|
|
126
|
+
begin
|
|
127
|
+
draft.publish!
|
|
128
|
+
ensure
|
|
129
|
+
FileUtils.rm(draft.path)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
118
133
|
it "makes the post available in Site#posts and Site#to_liquid even straight after a generate" do
|
|
119
134
|
draft = D.new(@site)
|
|
120
135
|
draft.slug = "test-draft-to-go-into-liquid"
|
|
File without changes
|
|
File without changes
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: serif
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 0.5.1
|
|
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-
|
|
12
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rack
|
|
@@ -260,90 +260,91 @@ executables:
|
|
|
260
260
|
extensions: []
|
|
261
261
|
extra_rdoc_files: []
|
|
262
262
|
files:
|
|
263
|
+
- lib/serif/admin_server.rb
|
|
264
|
+
- lib/serif/commands.rb
|
|
265
|
+
- lib/serif/config.rb
|
|
263
266
|
- lib/serif/content_file.rb
|
|
264
|
-
- lib/serif/
|
|
267
|
+
- lib/serif/draft.rb
|
|
268
|
+
- lib/serif/errors.rb
|
|
265
269
|
- lib/serif/markup_renderer.rb
|
|
266
270
|
- lib/serif/post.rb
|
|
267
|
-
- lib/serif/
|
|
268
|
-
- lib/serif/config.rb
|
|
269
|
-
- lib/serif/admin_server.rb
|
|
270
|
-
- lib/serif/draft.rb
|
|
271
|
-
- lib/serif/commands.rb
|
|
271
|
+
- lib/serif/server.rb
|
|
272
272
|
- lib/serif/site.rb
|
|
273
273
|
- lib/serif.rb
|
|
274
|
-
- statics/templates/admin/new_draft.liquid
|
|
275
|
-
- statics/templates/admin/edit_draft.liquid
|
|
276
|
-
- statics/templates/admin/layout.liquid
|
|
277
|
-
- statics/templates/admin/index.liquid
|
|
278
|
-
- statics/templates/admin/bookmarks.liquid
|
|
279
|
-
- statics/templates/admin/edit_post.liquid
|
|
280
|
-
- statics/skeleton/index.html
|
|
281
|
-
- statics/skeleton/_templates/archive_page.html
|
|
282
|
-
- statics/skeleton/_templates/post.html
|
|
283
|
-
- statics/skeleton/_drafts/sample-draft
|
|
284
|
-
- statics/skeleton/_config.yml
|
|
285
|
-
- statics/skeleton/_layouts/default.html
|
|
286
|
-
- statics/skeleton/archive.html
|
|
287
|
-
- statics/assets/js/mousetrap.min.js
|
|
288
|
-
- statics/assets/js/jquery.insert.js
|
|
289
274
|
- statics/assets/js/attachment.js
|
|
290
275
|
- statics/assets/js/jquery.autosize.js
|
|
291
276
|
- statics/assets/js/jquery.drop.js
|
|
277
|
+
- statics/assets/js/jquery.insert.js
|
|
278
|
+
- statics/assets/js/mousetrap.min.js
|
|
279
|
+
- statics/skeleton/_config.yml
|
|
280
|
+
- statics/skeleton/_drafts/sample-draft
|
|
281
|
+
- statics/skeleton/_layouts/default.html
|
|
282
|
+
- statics/skeleton/_templates/archive_page.html
|
|
283
|
+
- statics/skeleton/_templates/post.html
|
|
284
|
+
- statics/skeleton/archive.html
|
|
285
|
+
- statics/skeleton/index.html
|
|
286
|
+
- statics/templates/admin/bookmarks.liquid
|
|
287
|
+
- statics/templates/admin/edit_draft.liquid
|
|
288
|
+
- statics/templates/admin/edit_post.liquid
|
|
289
|
+
- statics/templates/admin/index.liquid
|
|
290
|
+
- statics/templates/admin/layout.liquid
|
|
291
|
+
- statics/templates/admin/new_draft.liquid
|
|
292
292
|
- bin/serif
|
|
293
|
-
- test/
|
|
294
|
-
- test/filters_spec.rb
|
|
293
|
+
- test/commands_spec.rb
|
|
295
294
|
- test/config_spec.rb
|
|
296
|
-
- test/liquid_filter_date_extension_spec.rb
|
|
297
|
-
- test/site_spec.rb
|
|
298
295
|
- test/content_file_spec.rb
|
|
299
296
|
- test/draft_spec.rb
|
|
297
|
+
- test/file_digest_tag_spec.rb
|
|
298
|
+
- test/filters_spec.rb
|
|
299
|
+
- test/liquid_filter_date_extension_spec.rb
|
|
300
300
|
- test/markup_renderer_spec.rb
|
|
301
|
-
- test/
|
|
302
|
-
- test/site_dir/
|
|
303
|
-
- test/site_dir/_templates/post.html
|
|
301
|
+
- test/post_spec.rb
|
|
302
|
+
- test/site_dir/_config.yml
|
|
304
303
|
- test/site_dir/_drafts/another-sample-draft
|
|
305
304
|
- test/site_dir/_drafts/sample-draft
|
|
306
|
-
- test/site_dir/
|
|
307
|
-
- test/site_dir/
|
|
308
|
-
- test/site_dir/
|
|
309
|
-
- test/site_dir/
|
|
310
|
-
- test/site_dir/
|
|
311
|
-
- test/site_dir/
|
|
312
|
-
- test/site_dir/
|
|
313
|
-
- test/site_dir/_site/
|
|
314
|
-
- test/site_dir/_site/
|
|
315
|
-
- test/site_dir/_site/
|
|
316
|
-
- test/site_dir/_site/test-archive/2399/01.html
|
|
317
|
-
- test/site_dir/_site/drafts/another-sample-draft/add25848a94509103cb492c47e3a04b7b2a56299de207155fbffec42dc4b.html
|
|
318
|
-
- test/site_dir/_site/drafts/sample-draft/0b6fc164b8534d5d5a9fcfc5c709265d33f1577cd0fe2f4e23042e92f0c1.html
|
|
319
|
-
- test/site_dir/_site/index.html
|
|
305
|
+
- test/site_dir/_layouts/alt-layout.html
|
|
306
|
+
- test/site_dir/_layouts/default.html
|
|
307
|
+
- test/site_dir/_posts/2012-01-05-sample-post
|
|
308
|
+
- test/site_dir/_posts/2013-01-01-second-post
|
|
309
|
+
- test/site_dir/_posts/2013-03-07-post-with-custom-layout
|
|
310
|
+
- test/site_dir/_posts/2399-01-01-penultimate-post
|
|
311
|
+
- test/site_dir/_posts/2400-01-01-final-post
|
|
312
|
+
- test/site_dir/_site/archive.html
|
|
313
|
+
- test/site_dir/_site/drafts/another-sample-draft/893209b2ce83164321ca8f311a32a3c87399498377e1229e7ecc26ff850f.html
|
|
314
|
+
- test/site_dir/_site/drafts/sample-draft/1b015cdf8a931d05f12b95c6a9ea308c6e006596d6ccae5849935e7aaf24.html
|
|
320
315
|
- test/site_dir/_site/file-digest-test.html
|
|
316
|
+
- test/site_dir/_site/index.html
|
|
321
317
|
- test/site_dir/_site/page-alt-layout.html
|
|
322
318
|
- test/site_dir/_site/page-header-but-no-layout.html
|
|
323
|
-
- test/site_dir/_site/test-
|
|
319
|
+
- test/site_dir/_site/test-archive/2012/11.html
|
|
320
|
+
- test/site_dir/_site/test-archive/2012/12.html
|
|
321
|
+
- test/site_dir/_site/test-archive/2013/01.html
|
|
322
|
+
- test/site_dir/_site/test-archive/2013/03.html
|
|
323
|
+
- test/site_dir/_site/test-archive/2399/01.html
|
|
324
|
+
- test/site_dir/_site/test-archive/2400/01.html
|
|
324
325
|
- test/site_dir/_site/test-blog/final-post.html
|
|
326
|
+
- test/site_dir/_site/test-blog/penultimate-post.html
|
|
325
327
|
- test/site_dir/_site/test-blog/post-to-be-published-on-generate.html
|
|
326
|
-
- test/site_dir/_site/test-blog/second-post.html
|
|
327
328
|
- test/site_dir/_site/test-blog/post-with-custom-layout.html
|
|
328
329
|
- test/site_dir/_site/test-blog/sample-post.html
|
|
329
|
-
- test/site_dir/_site/test-blog/
|
|
330
|
+
- test/site_dir/_site/test-blog/second-post.html
|
|
330
331
|
- test/site_dir/_site/test-smarty-filter.html
|
|
331
|
-
- test/site_dir/_site/
|
|
332
|
-
- test/site_dir/
|
|
333
|
-
- test/site_dir/
|
|
334
|
-
- test/site_dir/
|
|
335
|
-
- test/site_dir/
|
|
336
|
-
- test/site_dir/
|
|
337
|
-
- test/site_dir/_posts/2399-01-01-penultimate-post
|
|
338
|
-
- test/site_dir/_posts/2013-01-01-second-post
|
|
339
|
-
- test/site_dir/test-smarty-filter.html
|
|
340
|
-
- test/site_dir/_layouts/alt-layout.html
|
|
341
|
-
- test/site_dir/_layouts/default.html
|
|
332
|
+
- test/site_dir/_site/test-stylesheet.css
|
|
333
|
+
- test/site_dir/_templates/archive_page.html
|
|
334
|
+
- test/site_dir/_templates/post.html
|
|
335
|
+
- test/site_dir/_trash/1365433969-test-draft
|
|
336
|
+
- test/site_dir/_trash/1365433970-autopublish-draft
|
|
337
|
+
- test/site_dir/_trash/1365433970-test-draft
|
|
342
338
|
- test/site_dir/archive.html
|
|
343
|
-
- test/
|
|
339
|
+
- test/site_dir/file-digest-test.html
|
|
340
|
+
- test/site_dir/index.html
|
|
341
|
+
- test/site_dir/page-alt-layout.html
|
|
342
|
+
- test/site_dir/page-header-but-no-layout.html
|
|
343
|
+
- test/site_dir/test-smarty-filter.html
|
|
344
|
+
- test/site_dir/test-stylesheet.css
|
|
344
345
|
- test/site_generation_spec.rb
|
|
345
|
-
- test/
|
|
346
|
-
- test/
|
|
346
|
+
- test/site_spec.rb
|
|
347
|
+
- test/test_helper.rb
|
|
347
348
|
- serif.gemspec
|
|
348
349
|
- rakefile
|
|
349
350
|
- LICENSE
|
|
@@ -376,15 +377,15 @@ specification_version: 3
|
|
|
376
377
|
summary: Static site generator and markdown-based blogging with an optional admin
|
|
377
378
|
interface complete with drag-and-drop image uploading.
|
|
378
379
|
test_files:
|
|
379
|
-
- test/
|
|
380
|
-
- test/filters_spec.rb
|
|
380
|
+
- test/commands_spec.rb
|
|
381
381
|
- test/config_spec.rb
|
|
382
|
-
- test/liquid_filter_date_extension_spec.rb
|
|
383
|
-
- test/site_spec.rb
|
|
384
382
|
- test/content_file_spec.rb
|
|
385
383
|
- test/draft_spec.rb
|
|
386
|
-
- test/markup_renderer_spec.rb
|
|
387
384
|
- test/file_digest_tag_spec.rb
|
|
388
|
-
- test/
|
|
385
|
+
- test/filters_spec.rb
|
|
386
|
+
- test/liquid_filter_date_extension_spec.rb
|
|
387
|
+
- test/markup_renderer_spec.rb
|
|
389
388
|
- test/post_spec.rb
|
|
390
|
-
- test/
|
|
389
|
+
- test/site_generation_spec.rb
|
|
390
|
+
- test/site_spec.rb
|
|
391
|
+
- test/test_helper.rb
|