blogit 0.7.0 → 0.8.0

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.
Files changed (36) hide show
  1. data/README.md +12 -0
  2. data/app/assets/stylesheets/blogit/pygments.css +69 -0
  3. data/app/helpers/blogit/application_helper.rb +1 -18
  4. data/app/models/blogit/post.rb +6 -0
  5. data/app/views/blogit/comments/_comment.html.erb +4 -2
  6. data/app/views/blogit/posts/_blogger_information.html.erb +1 -1
  7. data/app/views/blogit/posts/index.rss.builder +2 -2
  8. data/config/locales/en.yml +1 -1
  9. data/config/locales/fr.yml +1 -1
  10. data/lib/blogit/parsers/markdown_parser.rb +30 -9
  11. data/lib/blogit/version.rb +1 -1
  12. data/lib/generators/blogit/views_generator.rb +19 -0
  13. data/spec/controllers/blogit/posts_controller_spec.rb +16 -10
  14. data/spec/dummy/app/assets/stylesheets/application.css +4 -1
  15. data/spec/dummy/app/views/layouts/application.html.erb +1 -1
  16. data/spec/dummy/db/development.sqlite3 +0 -0
  17. data/spec/dummy/db/test.sqlite3 +0 -0
  18. data/spec/dummy/log/development.log +1938 -0
  19. data/spec/dummy/log/test.log +6436 -0
  20. data/spec/dummy/tmp/cache/assets/CAA/340/sprockets%2Fa9991211287db8645603e5ba17008bbe +0 -0
  21. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  22. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  23. data/spec/dummy/tmp/cache/assets/D35/E90/sprockets%2F9542f66fea1d10b7924f3b6b31e1e2e0 +0 -0
  24. data/spec/dummy/tmp/cache/assets/D3D/D30/sprockets%2Ff1ebd04d570b12945debea975941815b +0 -0
  25. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  26. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  27. data/spec/dummy/tmp/cache/assets/D67/C10/sprockets%2Fa58c567f1eae28b401a6e9a0b3b71d93 +0 -0
  28. data/spec/dummy/tmp/cache/assets/D74/A60/sprockets%2F2add607cdb6c0b17fd866aac28895485 +0 -0
  29. data/spec/dummy/tmp/cache/assets/D78/4E0/sprockets%2F3d4e761a135f6b6e50b24defce90f798 +0 -0
  30. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  31. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  32. data/spec/dummy/tmp/pids/server.pid +1 -0
  33. data/spec/lib/blogit/parsers/markdown_parser_spec.rb +36 -8
  34. data/spec/models/blogit/post_spec.rb +21 -0
  35. metadata +20 -6
  36. data/spec/dummy/app/views/blogit/posts/_post_footer.html.erb +0 -1
@@ -0,0 +1 @@
1
+ 2799
@@ -19,17 +19,45 @@ describe Blogit::Parsers::MarkdownParser do
19
19
  system("pygmentize > /dev/null").should equal(true), "It seems that pygmentize is not installed on your system"
20
20
  end
21
21
 
22
- it "should highlight code if highlight_code_syntax is true" do
23
- Blogit::configuration.highlight_code_syntax = true
24
- parser.parsed.should =~
25
- Regexp.new("<h2>Header</h2>\n<div class=\"highlight\"><pre><span class=\"nb\">puts</span> <span class=\"s1\">&#39;hello world&#39;</span>\n</pre>\n</div>\n")
22
+ context "when highlight_code_syntax is true" do
23
+
24
+ before do
25
+ Blogit::configuration.highlight_code_syntax = true
26
+ end
27
+
28
+ it "should raise an exception if pygments isn't installed" do
29
+ original_path = ENV['PATH']
30
+ ENV['PATH'] = ""
31
+ expect { parser.parsed }.to raise_error
32
+ ENV["PATH"] = original_path
33
+ end
34
+
35
+ it "should highlight code syntax" do
36
+ parser.parsed.should =~
37
+ Regexp.new("<h2>Header</h2>\n<div class=\"highlight\"><pre><span class=\"nb\">puts</span> <span class=\"s1\">&#39;hello world&#39;</span>\n</pre>\n</div>\n")
38
+ end
39
+
26
40
  end
27
41
 
28
- it "shoud not highlight code if highlight_code_syntax is false" do
29
- Blogit.configuration.highlight_code_syntax = false
30
- parser.parsed.should == "<h2>Header</h2>\n\n<pre><code class=\"ruby\">puts &#39;hello world&#39;\n</code></pre>\n"
42
+ context "when highlight_code_syntax is false" do
43
+
44
+ before do
45
+ Blogit::configuration.highlight_code_syntax = false
46
+ end
47
+
48
+ it "should not raise an exception, even if pygments isn't installed" do
49
+ original_path = ENV['PATH']
50
+ ENV['PATH'] = ""
51
+ expect { parser.parsed }.to_not raise_error
52
+ ENV["PATH"] = original_path
53
+ end
54
+
55
+ it "shoud not highlight code" do
56
+ parser.parsed.should == "<h2>Header</h2>\n\n<pre><code class=\"ruby\">puts &#39;hello world&#39;\n</code></pre>\n"
57
+ end
58
+
31
59
  end
32
60
 
33
61
  end
34
62
 
35
- end
63
+ end
@@ -148,4 +148,25 @@ describe Blogit::Post do
148
148
 
149
149
  end
150
150
 
151
+ describe "body preview" do
152
+ it "should not truncate a short body" do
153
+ post = Blogit::Post.new(body: "short body")
154
+
155
+ post.short_body.should == post.body
156
+ end
157
+
158
+ it "should not truncate a long body" do
159
+ post = Blogit::Post.new(body: "t\n"*300)
160
+
161
+ post.short_body.should == "t\n"*198 + "t..."
162
+ end
163
+
164
+ it "should not cut the body in the middle of an image declaration" do
165
+ body = "some text\n"*35 + '"!http://www.images.com/blogit/P6876.thumb.jpg(Look at this)!\":http://www.images.com/blogit/P6976.jpb'
166
+ post = Blogit::Post.new(body: body)
167
+
168
+ post.short_body.should_not include('"!http://www.images.com')
169
+ end
170
+ end
171
+
151
172
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blogit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
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-02-27 00:00:00.000000000 Z
12
+ date: 2013-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: RedCloth
@@ -310,6 +310,7 @@ files:
310
310
  - app/assets/javascripts/blogit/archive.js
311
311
  - app/assets/javascripts/blogit/index.js
312
312
  - app/assets/stylesheets/blogit/index.css
313
+ - app/assets/stylesheets/blogit/pygments.css
313
314
  - app/controllers/blogit/application_controller.rb
314
315
  - app/controllers/blogit/comments_controller.rb
315
316
  - app/controllers/blogit/posts_controller.rb
@@ -365,6 +366,7 @@ files:
365
366
  - lib/blogit.rb
366
367
  - lib/generators/blogit/install_generator.rb
367
368
  - lib/generators/blogit/USAGE
369
+ - lib/generators/blogit/views_generator.rb
368
370
  - lib/generators/templates/blogit.rb
369
371
  - lib/tasks/blog_tasks.rake
370
372
  - lib/validators/absence_validator.rb
@@ -387,7 +389,6 @@ files:
387
389
  - spec/dummy/app/helpers/users_helper.rb
388
390
  - spec/dummy/app/models/person.rb
389
391
  - spec/dummy/app/models/user.rb
390
- - spec/dummy/app/views/blogit/posts/_post_footer.html.erb
391
392
  - spec/dummy/app/views/layouts/application.html.erb
392
393
  - spec/dummy/app/views/people/_form.html.erb
393
394
  - spec/dummy/app/views/people/edit.html.erb
@@ -440,6 +441,7 @@ files:
440
441
  - spec/dummy/test/unit/helpers/users_helper_test.rb
441
442
  - spec/dummy/test/unit/person_test.rb
442
443
  - spec/dummy/test/unit/user_test.rb
444
+ - spec/dummy/tmp/cache/assets/CAA/340/sprockets%2Fa9991211287db8645603e5ba17008bbe
443
445
  - spec/dummy/tmp/cache/assets/CB5/DD0/sprockets%2F346324d2a51df58457807bee661c449c
444
446
  - spec/dummy/tmp/cache/assets/CB6/ED0/sprockets%2F4390d06699f3ad4262e342be530f9f91
445
447
  - spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
@@ -449,15 +451,21 @@ files:
449
451
  - spec/dummy/tmp/cache/assets/D09/740/sprockets%2F7a82d51e72434ef73fabb4a26131d945
450
452
  - spec/dummy/tmp/cache/assets/D11/CC0/sprockets%2F3a12dfa6665b5318fa99d097203ac7e7
451
453
  - spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
454
+ - spec/dummy/tmp/cache/assets/D35/E90/sprockets%2F9542f66fea1d10b7924f3b6b31e1e2e0
455
+ - spec/dummy/tmp/cache/assets/D3D/D30/sprockets%2Ff1ebd04d570b12945debea975941815b
452
456
  - spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
453
457
  - spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
454
458
  - spec/dummy/tmp/cache/assets/D61/6F0/sprockets%2F02da53eeca228bcef0c49278517111fe
455
459
  - spec/dummy/tmp/cache/assets/D66/900/sprockets%2F52de1b25e110e8a937b9e30b0a9e8da7
460
+ - spec/dummy/tmp/cache/assets/D67/C10/sprockets%2Fa58c567f1eae28b401a6e9a0b3b71d93
461
+ - spec/dummy/tmp/cache/assets/D74/A60/sprockets%2F2add607cdb6c0b17fd866aac28895485
462
+ - spec/dummy/tmp/cache/assets/D78/4E0/sprockets%2F3d4e761a135f6b6e50b24defce90f798
456
463
  - spec/dummy/tmp/cache/assets/DA7/D70/sprockets%2Fc627f052aaee94e9b24815d5aee4ff38
457
464
  - spec/dummy/tmp/cache/assets/DCA/9B0/sprockets%2Fdf0e8f8a85e5d4056b3fe1cec3b7131a
458
465
  - spec/dummy/tmp/cache/assets/DD2/6F0/sprockets%2Ffbe80717facec3dd9ea7ac008719c843
459
466
  - spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
460
467
  - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
468
+ - spec/dummy/tmp/pids/server.pid
461
469
  - spec/factories.rb
462
470
  - spec/helpers/blogit/application_helper_spec.rb
463
471
  - spec/helpers/blogit/posts_helper_spec.rb
@@ -487,7 +495,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
487
495
  version: '0'
488
496
  segments:
489
497
  - 0
490
- hash: 2849567003821066787
498
+ hash: 3856524180238568830
491
499
  required_rubygems_version: !ruby/object:Gem::Requirement
492
500
  none: false
493
501
  requirements:
@@ -496,7 +504,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
496
504
  version: '0'
497
505
  segments:
498
506
  - 0
499
- hash: 2849567003821066787
507
+ hash: 3856524180238568830
500
508
  requirements: []
501
509
  rubyforge_project:
502
510
  rubygems_version: 1.8.24
@@ -519,7 +527,6 @@ test_files:
519
527
  - spec/dummy/app/helpers/users_helper.rb
520
528
  - spec/dummy/app/models/person.rb
521
529
  - spec/dummy/app/models/user.rb
522
- - spec/dummy/app/views/blogit/posts/_post_footer.html.erb
523
530
  - spec/dummy/app/views/layouts/application.html.erb
524
531
  - spec/dummy/app/views/people/_form.html.erb
525
532
  - spec/dummy/app/views/people/edit.html.erb
@@ -572,6 +579,7 @@ test_files:
572
579
  - spec/dummy/test/unit/helpers/users_helper_test.rb
573
580
  - spec/dummy/test/unit/person_test.rb
574
581
  - spec/dummy/test/unit/user_test.rb
582
+ - spec/dummy/tmp/cache/assets/CAA/340/sprockets%2Fa9991211287db8645603e5ba17008bbe
575
583
  - spec/dummy/tmp/cache/assets/CB5/DD0/sprockets%2F346324d2a51df58457807bee661c449c
576
584
  - spec/dummy/tmp/cache/assets/CB6/ED0/sprockets%2F4390d06699f3ad4262e342be530f9f91
577
585
  - spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
@@ -581,15 +589,21 @@ test_files:
581
589
  - spec/dummy/tmp/cache/assets/D09/740/sprockets%2F7a82d51e72434ef73fabb4a26131d945
582
590
  - spec/dummy/tmp/cache/assets/D11/CC0/sprockets%2F3a12dfa6665b5318fa99d097203ac7e7
583
591
  - spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
592
+ - spec/dummy/tmp/cache/assets/D35/E90/sprockets%2F9542f66fea1d10b7924f3b6b31e1e2e0
593
+ - spec/dummy/tmp/cache/assets/D3D/D30/sprockets%2Ff1ebd04d570b12945debea975941815b
584
594
  - spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
585
595
  - spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
586
596
  - spec/dummy/tmp/cache/assets/D61/6F0/sprockets%2F02da53eeca228bcef0c49278517111fe
587
597
  - spec/dummy/tmp/cache/assets/D66/900/sprockets%2F52de1b25e110e8a937b9e30b0a9e8da7
598
+ - spec/dummy/tmp/cache/assets/D67/C10/sprockets%2Fa58c567f1eae28b401a6e9a0b3b71d93
599
+ - spec/dummy/tmp/cache/assets/D74/A60/sprockets%2F2add607cdb6c0b17fd866aac28895485
600
+ - spec/dummy/tmp/cache/assets/D78/4E0/sprockets%2F3d4e761a135f6b6e50b24defce90f798
588
601
  - spec/dummy/tmp/cache/assets/DA7/D70/sprockets%2Fc627f052aaee94e9b24815d5aee4ff38
589
602
  - spec/dummy/tmp/cache/assets/DCA/9B0/sprockets%2Fdf0e8f8a85e5d4056b3fe1cec3b7131a
590
603
  - spec/dummy/tmp/cache/assets/DD2/6F0/sprockets%2Ffbe80717facec3dd9ea7ac008719c843
591
604
  - spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
592
605
  - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
606
+ - spec/dummy/tmp/pids/server.pid
593
607
  - spec/factories.rb
594
608
  - spec/helpers/blogit/application_helper_spec.rb
595
609
  - spec/helpers/blogit/posts_helper_spec.rb
@@ -1 +0,0 @@
1
- <%= render "blogit/posts/related", post: post %>