serif 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/Gemfile.lock +29 -14
  2. data/README.md +28 -14
  3. data/bin/serif +2 -69
  4. data/lib/serif.rb +1 -0
  5. data/lib/serif/admin_server.rb +55 -26
  6. data/lib/serif/commands.rb +150 -0
  7. data/lib/serif/content_file.rb +4 -0
  8. data/lib/serif/draft.rb +24 -2
  9. data/lib/serif/errors.rb +10 -0
  10. data/lib/serif/post.rb +4 -3
  11. data/lib/serif/site.rb +73 -4
  12. data/rakefile +10 -0
  13. data/serif.gemspec +5 -3
  14. data/statics/skeleton/_layouts/default.html +1 -1
  15. data/statics/templates/admin/bookmarks.liquid +17 -13
  16. data/statics/templates/admin/edit_draft.liquid +1 -1
  17. data/statics/templates/admin/edit_post.liquid +1 -1
  18. data/statics/templates/admin/index.liquid +2 -2
  19. data/statics/templates/admin/layout.liquid +16 -0
  20. data/test/commands_spec.rb +77 -0
  21. data/test/content_file_spec.rb +32 -1
  22. data/test/draft_spec.rb +50 -3
  23. data/test/post_spec.rb +31 -2
  24. data/test/site_dir/_layouts/default.html +2 -0
  25. data/test/site_dir/_site/archive.html +2 -0
  26. data/test/site_dir/_site/drafts/another-sample-draft/{481da12b79709bfa0547fa9b5754c9506fbed29afd0334e07a8c95e76850.html → add25848a94509103cb492c47e3a04b7b2a56299de207155fbffec42dc4b.html} +5 -2
  27. data/test/site_dir/_site/drafts/sample-draft/{a986a62ad5f6edd1fcac3d08f5b461b92bcb667a2af69505230c291d405c.html → 0b6fc164b8534d5d5a9fcfc5c709265d33f1577cd0fe2f4e23042e92f0c1.html} +5 -2
  28. data/test/site_dir/_site/index.html +2 -0
  29. data/test/site_dir/_site/page-header-but-no-layout.html +2 -0
  30. data/test/site_dir/_site/test-archive/2012/11.html +2 -0
  31. data/test/site_dir/_site/test-archive/2012/12.html +2 -0
  32. data/test/site_dir/_site/test-archive/2013/01.html +2 -0
  33. data/test/site_dir/_site/test-archive/2013/03.html +2 -0
  34. data/test/site_dir/_site/test-archive/2399/01.html +2 -0
  35. data/test/site_dir/_site/test-archive/2400/01.html +2 -0
  36. data/test/site_dir/_site/test-blog/final-post.html +4 -1
  37. data/test/site_dir/_site/test-blog/penultimate-post.html +4 -1
  38. data/test/site_dir/_site/test-blog/post-to-be-published-on-generate.html +4 -1
  39. data/test/site_dir/_site/test-blog/post-with-custom-layout.html +1 -0
  40. data/test/site_dir/_site/test-blog/sample-post.html +4 -1
  41. data/test/site_dir/_site/test-blog/second-post.html +4 -1
  42. data/test/site_dir/_site/test-smarty-filter.html +2 -0
  43. data/test/site_dir/_templates/post.html +1 -0
  44. data/test/site_dir/_trash/1364747613-autopublish-draft +5 -0
  45. data/test/site_dir/_trash/{1363633154-test-draft → 1364747613-test-draft} +1 -1
  46. data/test/site_generation_spec.rb +40 -9
  47. data/test/site_spec.rb +63 -0
  48. data/test/test_helper.rb +9 -0
  49. metadata +46 -10
  50. data/test/site_dir/_trash/1363633154-autopublish-draft +0 -5
@@ -4,6 +4,69 @@ describe Serif::Site do
4
4
  subject do
5
5
  Serif::Site.new(testing_dir)
6
6
  end
7
+
8
+ describe "#conflicts" do
9
+ context "with no arguments" do
10
+ it "is nil if there are no conflicts" do
11
+ subject.conflicts.should be_nil
12
+ end
13
+
14
+ it "is a map of url => conflicts_array if there are conflicts" do
15
+ d = Serif::Draft.new(subject)
16
+ conflicting_post = subject.posts.first
17
+ d.slug = conflicting_post.slug
18
+ d.title = "Anything you like"
19
+ d.save("# Some content")
20
+
21
+ # need this to be true
22
+ d.url.should == conflicting_post.url
23
+
24
+ begin
25
+ conflicts = subject.conflicts
26
+ conflicts.should_not be_nil
27
+ conflicts.class.should == Hash
28
+ conflicts.size.should == 1
29
+ conflicts.keys.should == [conflicting_post.url]
30
+ conflicts[conflicting_post.url].size.should == 2
31
+ ensure
32
+ FileUtils.rm(d.path)
33
+ end
34
+ end
35
+ end
36
+
37
+ context "with an argument given" do
38
+ it "is nil if there are no conflicts" do
39
+ subject.conflicts(subject.drafts.sample).should be_nil
40
+ subject.conflicts(subject.posts.sample).should be_nil
41
+
42
+ d = Serif::Draft.new(subject)
43
+ subject.conflicts(d).should be_nil
44
+ end
45
+
46
+ it "is an array of conflicting content if there are conflicts" do
47
+ d = Serif::Draft.new(subject)
48
+ conflicting_post = subject.posts.first
49
+ d.slug = conflicting_post.slug
50
+ d.title = "Anything you like"
51
+ d.save("# Some content")
52
+
53
+ # need this to be true
54
+ d.url.should == conflicting_post.url
55
+
56
+ begin
57
+ conflicts = subject.conflicts(d)
58
+ conflicts.should_not be_nil
59
+ conflicts.class.should == Array
60
+ conflicts.size.should == 2
61
+ conflicts.each do |e|
62
+ e.url.should == conflicting_post.url
63
+ end
64
+ ensure
65
+ FileUtils.rm(d.path)
66
+ end
67
+ end
68
+ end
69
+ end
7
70
 
8
71
  describe "#source_directory" do
9
72
  it "should be sane" do
@@ -1,4 +1,12 @@
1
1
  require "simplecov"
2
+
3
+ # if we're running on Travis, use Coveralls, otherwise
4
+ # let us generate SimpleCov output as normal.
5
+ if ENV["CI"]
6
+ require "coveralls"
7
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
8
+ end
9
+
2
10
  SimpleCov.start do
3
11
  add_filter "/test/"
4
12
  end
@@ -27,6 +35,7 @@ describe "curly quote patch" do
27
35
  end
28
36
 
29
37
  require "serif"
38
+ require "serif/commands"
30
39
  require "fileutils"
31
40
  require "pathname"
32
41
  require "time"
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: '0.4'
4
+ version: '0.5'
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-03-18 00:00:00.000000000 Z
12
+ date: 2013-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -219,8 +219,40 @@ dependencies:
219
219
  - - ~>
220
220
  - !ruby/object:Gem::Version
221
221
  version: 0.6.1
222
- description: Serif is a blogging system powered by markdown files and an optional
223
- admin interface complete with drag-and-drop image uploading.
222
+ - !ruby/object:Gem::Dependency
223
+ name: rdoc
224
+ requirement: !ruby/object:Gem::Requirement
225
+ none: false
226
+ requirements:
227
+ - - ~>
228
+ - !ruby/object:Gem::Version
229
+ version: 4.0.0
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ~>
236
+ - !ruby/object:Gem::Version
237
+ version: 4.0.0
238
+ - !ruby/object:Gem::Dependency
239
+ name: coveralls
240
+ requirement: !ruby/object:Gem::Requirement
241
+ none: false
242
+ requirements:
243
+ - - ! '>='
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ type: :development
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ description: Serif is a static site generator and blogging system powered by markdown
255
+ files and an optional admin interface complete with drag-and-drop image uploading.
224
256
  email:
225
257
  - adam@aprescott.com
226
258
  executables:
@@ -232,9 +264,11 @@ files:
232
264
  - lib/serif/server.rb
233
265
  - lib/serif/markup_renderer.rb
234
266
  - lib/serif/post.rb
267
+ - lib/serif/errors.rb
235
268
  - lib/serif/config.rb
236
269
  - lib/serif/admin_server.rb
237
270
  - lib/serif/draft.rb
271
+ - lib/serif/commands.rb
238
272
  - lib/serif/site.rb
239
273
  - lib/serif.rb
240
274
  - statics/templates/admin/new_draft.liquid
@@ -280,8 +314,8 @@ files:
280
314
  - test/site_dir/_site/test-archive/2012/11.html
281
315
  - test/site_dir/_site/test-archive/2400/01.html
282
316
  - test/site_dir/_site/test-archive/2399/01.html
283
- - test/site_dir/_site/drafts/another-sample-draft/481da12b79709bfa0547fa9b5754c9506fbed29afd0334e07a8c95e76850.html
284
- - test/site_dir/_site/drafts/sample-draft/a986a62ad5f6edd1fcac3d08f5b461b92bcb667a2af69505230c291d405c.html
317
+ - test/site_dir/_site/drafts/another-sample-draft/add25848a94509103cb492c47e3a04b7b2a56299de207155fbffec42dc4b.html
318
+ - test/site_dir/_site/drafts/sample-draft/0b6fc164b8534d5d5a9fcfc5c709265d33f1577cd0fe2f4e23042e92f0c1.html
285
319
  - test/site_dir/_site/index.html
286
320
  - test/site_dir/_site/file-digest-test.html
287
321
  - test/site_dir/_site/page-alt-layout.html
@@ -295,8 +329,8 @@ files:
295
329
  - test/site_dir/_site/test-blog/penultimate-post.html
296
330
  - test/site_dir/_site/test-smarty-filter.html
297
331
  - test/site_dir/_site/archive.html
298
- - test/site_dir/_trash/1363633154-autopublish-draft
299
- - test/site_dir/_trash/1363633154-test-draft
332
+ - test/site_dir/_trash/1364747613-autopublish-draft
333
+ - test/site_dir/_trash/1364747613-test-draft
300
334
  - test/site_dir/_posts/2013-03-07-post-with-custom-layout
301
335
  - test/site_dir/_posts/2012-01-05-sample-post
302
336
  - test/site_dir/_posts/2400-01-01-final-post
@@ -309,6 +343,7 @@ files:
309
343
  - test/file_digest_tag_spec.rb
310
344
  - test/site_generation_spec.rb
311
345
  - test/post_spec.rb
346
+ - test/commands_spec.rb
312
347
  - serif.gemspec
313
348
  - rakefile
314
349
  - LICENSE
@@ -338,8 +373,8 @@ rubyforge_project:
338
373
  rubygems_version: 1.8.24
339
374
  signing_key:
340
375
  specification_version: 3
341
- summary: Markdown-powered blogging with an optional admin interface with drag-and-drop
342
- image uploading.
376
+ summary: Static site generator and markdown-based blogging with an optional admin
377
+ interface complete with drag-and-drop image uploading.
343
378
  test_files:
344
379
  - test/test_helper.rb
345
380
  - test/filters_spec.rb
@@ -352,3 +387,4 @@ test_files:
352
387
  - test/file_digest_tag_spec.rb
353
388
  - test/site_generation_spec.rb
354
389
  - test/post_spec.rb
390
+ - test/commands_spec.rb
@@ -1,5 +0,0 @@
1
- title: Some draft title
2
- Updated: 2013-03-18T18:59:14+00:00
3
- Created: 2013-03-18T18:59:14+00:00
4
-
5
- some content