webby 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/History.txt +11 -0
  2. data/Manifest.txt +45 -2
  3. data/Rakefile +1 -2
  4. data/examples/webby/content/css/site.css +1 -1
  5. data/examples/webby/content/learn/index.txt +1 -1
  6. data/examples/webby/content/release-notes/index.txt +21 -0
  7. data/examples/webby/content/release-notes/rel-0-9-0/index.txt +1 -0
  8. data/examples/webby/content/release-notes/rel-0-9-1/index.txt +93 -0
  9. data/examples/webby/content/tips_and_tricks/index.txt +14 -13
  10. data/examples/webby/content/tutorial/index.txt +13 -9
  11. data/examples/webby/content/user-manual/index.txt +8 -8
  12. data/examples/webby/layouts/default.txt +1 -1
  13. data/lib/webby.rb +2 -1
  14. data/lib/webby/apps/main.rb +25 -13
  15. data/lib/webby/auto_builder.rb +2 -0
  16. data/lib/webby/builder.rb +2 -5
  17. data/lib/webby/filters.rb +5 -13
  18. data/lib/webby/renderer.rb +7 -5
  19. data/lib/webby/resources.rb +54 -14
  20. data/lib/webby/resources/db.rb +4 -4
  21. data/lib/webby/resources/layout.rb +14 -23
  22. data/lib/webby/resources/meta_file.rb +208 -0
  23. data/lib/webby/resources/page.rb +21 -58
  24. data/lib/webby/resources/partial.rb +10 -4
  25. data/lib/webby/resources/resource.rb +68 -27
  26. data/lib/webby/resources/static.rb +6 -22
  27. data/lib/webby/stelan/paginator.rb +17 -2
  28. data/spec/data/Sitefile +9 -0
  29. data/spec/data/content/_partial.txt +10 -0
  30. data/spec/data/content/css/coderay.css +111 -0
  31. data/spec/data/content/css/site.css +67 -0
  32. data/spec/data/content/css/tumblog.css +308 -0
  33. data/spec/data/content/images/tumblog/permalink.gif +0 -0
  34. data/spec/data/content/images/tumblog/rss.gif +0 -0
  35. data/spec/data/content/index.txt +19 -0
  36. data/spec/data/content/photos.txt +21 -0
  37. data/spec/data/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
  38. data/spec/data/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
  39. data/spec/data/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
  40. data/spec/data/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
  41. data/spec/data/content/tumblog/200807/up-a-tree/index.txt +13 -0
  42. data/spec/data/content/tumblog/index.txt +37 -0
  43. data/spec/data/content/tumblog/rss.txt +37 -0
  44. data/spec/data/hooligans/bad_meta_data_1.txt +34 -0
  45. data/spec/data/hooligans/bad_meta_data_2.txt +34 -0
  46. data/spec/data/layouts/default.txt +58 -0
  47. data/spec/data/layouts/tumblog/default.txt +44 -0
  48. data/spec/data/layouts/tumblog/post.txt +15 -0
  49. data/spec/data/lib/breadcrumbs.rb +28 -0
  50. data/spec/data/lib/tumblog_helper.rb +32 -0
  51. data/spec/data/tasks/tumblog.rake +30 -0
  52. data/spec/data/templates/_partial.erb +10 -0
  53. data/spec/data/templates/atom_feed.erb +40 -0
  54. data/spec/data/templates/page.erb +18 -0
  55. data/spec/data/templates/presentation.erb +40 -0
  56. data/spec/data/templates/tumblog/conversation.erb +12 -0
  57. data/spec/data/templates/tumblog/link.erb +10 -0
  58. data/spec/data/templates/tumblog/photo.erb +13 -0
  59. data/spec/data/templates/tumblog/post.erb +12 -0
  60. data/spec/data/templates/tumblog/quote.erb +11 -0
  61. data/spec/spec_helper.rb +37 -0
  62. data/spec/webby/apps/generator_spec.rb +4 -0
  63. data/spec/webby/apps/main_spec.rb +16 -3
  64. data/spec/webby/filters/textile_spec.rb +20 -0
  65. data/spec/webby/renderer_spec.rb +139 -0
  66. data/spec/webby/resources/db_spec.rb +250 -0
  67. data/spec/webby/resources/layout_spec.rb +83 -0
  68. data/spec/webby/resources/meta_file_spec.rb +157 -0
  69. data/spec/webby/resources/page_spec.rb +111 -0
  70. data/spec/webby/resources/partial_spec.rb +58 -0
  71. data/spec/webby/resources/resource_spec.rb +214 -0
  72. data/spec/webby/resources/static_spec.rb +49 -0
  73. data/spec/webby/resources_spec.rb +55 -3
  74. metadata +64 -6
  75. data/lib/webby/resources/file.rb +0 -221
  76. data/spec/webby/resources/file_spec.rb +0 -104
@@ -1,104 +0,0 @@
1
-
2
- require ::File.join(::File.dirname(__FILE__), %w[.. .. spec_helper])
3
-
4
- # ---------------------------------------------------------------------------
5
- describe Webby::Resources::File do
6
-
7
- FN = ::File.expand_path(::File.join(::File.dirname(__FILE__), '..', '..', 'lorem_ipsum.txt'))
8
- FN_YAML = FN.gsub %r/\.txt\z/, '_yaml.txt'
9
- LINES = [
10
- "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla orci\n",
11
- "ante, aliquet ac, vulputate ut, suscipit et, sapien. Integer elementum\n",
12
- "nisi quis magna tincidunt mattis. Aliquam semper. Pellentesque pretium.\n",
13
- "Ut a ligula sit amet pede malesuada laoreet. Ut et purus. Morbi turpis\n",
14
- "justo, pharetra vitae, consequat a, sodales vitae, tortor. Donec non\n",
15
- "massa. Maecenas adipiscing venenatis nisi. Proin vulputate lorem posuere\n",
16
- "mi. Cras sagittis. Pellentesque tortor mauris, accumsan vitae, ultrices\n",
17
- "vel, tristique ultricies, eros. Donec fringilla hendrerit mauris. Nam in\n",
18
- "orci. Curabitur congue consectetuer leo. Donec ut pede. Proin et lorem.\n",
19
- "Aliquam eget lacus. In nibh.\n"
20
- ]
21
-
22
- before do
23
- ::File.open(FN,'w') {|fd| fd.write LINES}
24
- ::File.open(FN_YAML,'w') do |fd|
25
- fd.write "--- \n- one\n- two\n- three\n--- \n"
26
- fd.write LINES
27
- end
28
- end
29
-
30
- after do
31
- ::FileUtils.rm_f(FN)
32
- ::FileUtils.rm_f(FN_YAML)
33
- end
34
-
35
- it 'should return nil for meta-data on regular files' do
36
- begin
37
- fd = Webby::Resources::File.new FN, 'r'
38
- fd.meta_data.should be_nil
39
-
40
- fd.readlines.should == LINES
41
- ensure
42
- fd.close
43
- end
44
- end
45
-
46
- it 'should add meta-data to the top of a file' do
47
- Webby::Resources::File.open(FN,'a+') do |fd|
48
- fd.meta_data.should be_nil
49
- fd.meta_data = %w(one two three)
50
- end
51
-
52
- Webby::Resources::File.open(FN,'r') do |fd|
53
- fd.meta_data.should == %w(one two three)
54
- end
55
-
56
- ::File.open(FN_YAML, 'r') do |fd|
57
- ary = LINES.dup
58
- ary.insert 0, [
59
- "--- \n",
60
- "- one\n",
61
- "- two\n",
62
- "- three\n",
63
- "--- \n"
64
- ]
65
- fd.readlines.should == ary.flatten
66
- end
67
- end
68
-
69
- it 'should remove the meta-data when set to nil' do
70
- Webby::Resources::File.open(FN_YAML,'a+') do |fd|
71
- fd.meta_data.should == %w(one two three)
72
- fd.meta_data = nil
73
- end
74
-
75
- Webby::Resources::File.open(FN_YAML,'r') do |fd|
76
- fd.meta_data.should be_nil
77
- end
78
-
79
- ::File.open(FN_YAML, 'r') do |fd|
80
- fd.readlines.should == LINES
81
- end
82
- end
83
-
84
- it 'should skip the meta-data when reading from the file' do
85
- begin
86
- fd = Webby::Resources::File.new FN_YAML, 'r'
87
- fd.meta_data.should == %w(one two three)
88
-
89
- fd.getc.should == ?L; fd.seek 0
90
- fd.gets.should == LINES.first; fd.seek 0
91
- fd.read(5).should == 'Lorem'; fd.seek 0
92
- fd.read_nonblock(11) == 'Lorem ipsum'; fd.seek 0
93
- fd.readchar.should == ?L; fd.seek 0
94
- fd.readline.should == LINES.first; fd.seek 0
95
- fd.readlines.should == LINES; fd.seek 0
96
- fd.readpartial(11).should == 'Lorem ipsum'; fd.seek 0
97
-
98
- ensure
99
- fd.close
100
- end
101
- end
102
- end # describe Webby::Resources::File
103
-
104
- # EOF