webby 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. data/History.txt +20 -0
  2. data/{README.txt → README.rdoc} +9 -9
  3. data/Rakefile +19 -6
  4. data/examples/blog/content/css/blueprint/ie.css +26 -0
  5. data/examples/blog/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
  6. data/examples/blog/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
  7. data/examples/blog/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
  8. data/examples/{website/content/css/blueprint/plugins/buttons/Readme → blog/content/css/blueprint/plugins/buttons/readme.txt} +3 -2
  9. data/examples/{website/content/css/blueprint/plugins/buttons/buttons.css → blog/content/css/blueprint/plugins/buttons/screen.css} +1 -1
  10. data/examples/blog/content/css/blueprint/plugins/fancy-type/readme.txt +14 -0
  11. data/examples/{website/content/css/blueprint/plugins/fancy-type/fancy-type.css → blog/content/css/blueprint/plugins/fancy-type/screen.css} +71 -74
  12. data/examples/blog/content/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
  13. data/examples/blog/content/css/blueprint/plugins/link-icons/icons/email.png +0 -0
  14. data/examples/blog/content/css/blueprint/plugins/link-icons/icons/external.png +0 -0
  15. data/examples/blog/content/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
  16. data/examples/blog/content/css/blueprint/plugins/link-icons/icons/im.png +0 -0
  17. data/examples/blog/content/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  18. data/examples/blog/content/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
  19. data/examples/blog/content/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
  20. data/examples/blog/content/css/blueprint/plugins/link-icons/readme.txt +18 -0
  21. data/examples/blog/content/css/blueprint/plugins/link-icons/screen.css +40 -0
  22. data/examples/blog/content/css/blueprint/plugins/rtl/readme.txt +10 -0
  23. data/examples/blog/content/css/blueprint/plugins/rtl/screen.css +109 -0
  24. data/examples/blog/content/css/blueprint/print.css +30 -0
  25. data/examples/blog/content/css/blueprint/screen.css +251 -0
  26. data/examples/blog/content/css/blueprint/src/forms.css +49 -0
  27. data/examples/blog/content/css/blueprint/src/grid.css +212 -0
  28. data/examples/{website/content/css/blueprint/lib → blog/content/css/blueprint/src}/grid.png +0 -0
  29. data/examples/blog/content/css/blueprint/src/ie.css +59 -0
  30. data/examples/blog/content/css/blueprint/src/print.css +85 -0
  31. data/examples/{website/content/css/blueprint/lib → blog/content/css/blueprint/src}/reset.css +14 -15
  32. data/examples/blog/content/css/blueprint/src/typography.css +105 -0
  33. data/examples/blog/content/css/coderay.css +111 -0
  34. data/examples/blog/content/css/site.css +67 -0
  35. data/examples/blog/layouts/default.txt +61 -0
  36. data/examples/blog/tasks/blog.rake +5 -1
  37. data/examples/presentation/Sitefile +2 -2
  38. data/examples/tumblog/tasks/tumblog.rake +5 -1
  39. data/examples/webby/Sitefile +2 -2
  40. data/examples/webby/content/communicate/index.txt +2 -2
  41. data/examples/webby/content/index.txt +1 -1
  42. data/examples/webby/content/release-notes/rel-0-9-3/index.txt +0 -2
  43. data/examples/webby/content/release-notes/rel-0-9-4/index.txt +33 -0
  44. data/examples/webby/content/sitemap.txt +2 -2
  45. data/examples/webby/content/user-manual/index.txt +3 -3
  46. data/examples/website/content/css/blueprint/ie.css +26 -0
  47. data/examples/website/content/css/blueprint/plugins/buttons/readme.txt +32 -0
  48. data/examples/website/content/css/blueprint/plugins/buttons/screen.css +97 -0
  49. data/examples/website/content/css/blueprint/plugins/fancy-type/readme.txt +14 -0
  50. data/examples/website/content/css/blueprint/plugins/fancy-type/screen.css +71 -0
  51. data/examples/website/content/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
  52. data/examples/website/content/css/blueprint/plugins/link-icons/icons/email.png +0 -0
  53. data/examples/website/content/css/blueprint/plugins/link-icons/icons/external.png +0 -0
  54. data/examples/website/content/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
  55. data/examples/website/content/css/blueprint/plugins/link-icons/icons/im.png +0 -0
  56. data/examples/website/content/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  57. data/examples/website/content/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
  58. data/examples/website/content/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
  59. data/examples/website/content/css/blueprint/plugins/link-icons/readme.txt +18 -0
  60. data/examples/website/content/css/blueprint/plugins/link-icons/screen.css +40 -0
  61. data/examples/website/content/css/blueprint/plugins/rtl/readme.txt +10 -0
  62. data/examples/website/content/css/blueprint/plugins/rtl/screen.css +109 -0
  63. data/examples/website/content/css/blueprint/print.css +30 -68
  64. data/examples/website/content/css/blueprint/screen.css +251 -22
  65. data/examples/website/content/css/blueprint/src/forms.css +49 -0
  66. data/examples/website/content/css/blueprint/src/grid.css +212 -0
  67. data/examples/website/content/css/blueprint/src/grid.png +0 -0
  68. data/examples/website/content/css/blueprint/src/ie.css +59 -0
  69. data/examples/website/content/css/blueprint/src/print.css +85 -0
  70. data/examples/website/content/css/blueprint/src/reset.css +38 -0
  71. data/examples/website/content/css/blueprint/src/typography.css +105 -0
  72. data/examples/website/layouts/default.txt +5 -2
  73. data/lib/webby.rb +36 -102
  74. data/lib/webby/apps/generator.rb +2 -2
  75. data/lib/webby/apps/main.rb +36 -62
  76. data/lib/webby/auto_builder.rb +3 -3
  77. data/lib/webby/builder.rb +5 -13
  78. data/lib/webby/config.rb +172 -0
  79. data/lib/webby/filters.rb +2 -0
  80. data/lib/webby/filters/haml.rb +13 -0
  81. data/lib/webby/filters/maruku.rb +16 -0
  82. data/lib/webby/filters/outline.rb +1 -1
  83. data/lib/webby/filters/sass.rb +14 -0
  84. data/lib/webby/filters/slides.rb +2 -2
  85. data/lib/webby/filters/tidy.rb +5 -0
  86. data/lib/webby/helpers/coderay_helper.rb +27 -3
  87. data/lib/webby/helpers/graphviz_helper.rb +20 -3
  88. data/lib/webby/helpers/tex_img_helper.rb +25 -5
  89. data/lib/webby/helpers/ultraviolet_helper.rb +19 -5
  90. data/lib/webby/link_validator.rb +59 -51
  91. data/lib/webby/renderer.rb +9 -6
  92. data/lib/webby/resources.rb +2 -1
  93. data/lib/webby/resources/page.rb +4 -1
  94. data/lib/webby/tasks/create.rake +1 -1
  95. data/lib/webby/tasks/validate.rake +1 -1
  96. data/spec/data/html/anchor.html +11 -0
  97. data/spec/data/html/external.html +10 -0
  98. data/spec/data/html/invalid-relative.html +10 -0
  99. data/spec/data/html/relative-anchor.html +10 -0
  100. data/spec/data/html/relative-invalid-anchor.html +10 -0
  101. data/spec/data/html/relative.html +10 -0
  102. data/spec/data/site/tasks/tumblog.rake +5 -1
  103. data/spec/spec_helper.rb +8 -1
  104. data/spec/webby/apps/generator_spec.rb +36 -3
  105. data/spec/webby/apps/main_spec.rb +2 -1
  106. data/spec/webby/filters/basepath_spec.rb +2 -2
  107. data/spec/webby/filters/maruku_spec.rb +31 -0
  108. data/spec/webby/filters/textile_spec.rb +15 -4
  109. data/spec/webby/helpers/capture_helper_spec.rb +1 -1
  110. data/spec/webby/link_validator_spec.rb +154 -0
  111. data/spec/webby/resources/db_spec.rb +24 -24
  112. data/spec/webby/resources/layout_spec.rb +1 -1
  113. data/spec/webby/resources/page_spec.rb +8 -2
  114. data/spec/webby/resources/resource_spec.rb +1 -1
  115. data/spec/webby/resources_spec.rb +1 -1
  116. data/tasks/ann.rake +1 -2
  117. data/tasks/bones.rake +0 -1
  118. data/tasks/gem.rake +48 -34
  119. data/tasks/git.rake +0 -1
  120. data/tasks/mswin32.rake +38 -0
  121. data/tasks/notes.rake +0 -1
  122. data/tasks/post_load.rake +4 -9
  123. data/tasks/rdoc.rake +4 -4
  124. data/tasks/setup.rb +50 -26
  125. data/tasks/spec.rake +1 -2
  126. data/tasks/svn.rake +47 -0
  127. data/tasks/test.rake +40 -0
  128. data/tasks/website.rake +0 -1
  129. data/tasks/zentest.rake +36 -0
  130. metadata +104 -33
  131. data/Manifest.txt +0 -228
  132. data/examples/website/content/css/blueprint/License.txt +0 -21
  133. data/examples/website/content/css/blueprint/Readme.txt +0 -100
  134. data/examples/website/content/css/blueprint/compressed/print.css +0 -76
  135. data/examples/website/content/css/blueprint/compressed/screen.css +0 -696
  136. data/examples/website/content/css/blueprint/lib/forms.css +0 -45
  137. data/examples/website/content/css/blueprint/lib/grid.css +0 -193
  138. data/examples/website/content/css/blueprint/lib/ie.css +0 -30
  139. data/examples/website/content/css/blueprint/lib/typography.css +0 -116
  140. data/examples/website/content/css/blueprint/plugins/css-classes/Readme +0 -14
  141. data/examples/website/content/css/blueprint/plugins/css-classes/css-classes.css +0 -24
  142. data/examples/website/content/css/blueprint/plugins/fancy-type/Readme +0 -22
  143. data/examples/website/content/css/blueprint/plugins/fancy-type/fancy-type-compressed.css +0 -5
  144. data/lib/webby/stelan/spawner.rb +0 -339
  145. data/tasks/manifest.rake +0 -48
@@ -3,6 +3,20 @@
3
3
 
4
4
  if try_require 'uv'
5
5
 
6
+ Loquacious.configuration_for(:webby) {
7
+ desc "Options for UltraViolet syntax highlighting."
8
+ uv {
9
+ desc 'The language to highlight (ruby, c, html, ...).'
10
+ lang 'ruby'
11
+
12
+ desc 'Display line numbers (true, false).'
13
+ line_numbers false
14
+
15
+ desc 'See the UltraViolet documentation for a list of available themes.'
16
+ theme 'mac_classic'
17
+ }
18
+ }
19
+
6
20
  module Webby::Helpers
7
21
  module UltraVioletHelper
8
22
 
@@ -39,13 +53,13 @@ module UltraVioletHelper
39
53
  return if text.empty?
40
54
 
41
55
  defaults = ::Webby.site.uv
42
- lang = opts.getopt(:lang, defaults[:lang])
43
- line_numbers = opts.getopt(:line_numbers, defaults[:line_numbers])
44
- theme = opts.getopt(:theme, defaults[:theme])
56
+ lang = opts.getopt(:lang, defaults.lang)
57
+ line_numbers = opts.getopt(:line_numbers, defaults.line_numbers)
58
+ theme = opts.getopt(:theme, defaults.theme)
45
59
 
46
- out = '<div class="UltraViolet">'
60
+ out = %Q{<div class="UltraViolet">\n}
47
61
  out << Uv.parse(text, "xhtml", lang, line_numbers, theme)
48
- out << '</div>'
62
+ out << %Q{\n</div>}
49
63
 
50
64
  # put some guards around the output (specifically for textile)
51
65
  out = _guard(out)
@@ -56,18 +56,18 @@ class LinkValidator
56
56
  @log.info "validating #{fn}"
57
57
 
58
58
  dir = ::File.dirname(fn)
59
- @doc = Hpricot(::File.read(fn))
59
+ doc = Hpricot(::File.read(fn))
60
60
 
61
61
  ::Webby.site.xpaths.each do |xpath|
62
62
  @attr_name = nil
63
63
 
64
- @doc.search(xpath).each do |element|
65
- @attr_name ||= @attr_rgxp.match(xpath)[1]
66
- uri = URI.parse(element.get_attribute(@attr_name))
67
- validate_uri(uri, dir)
64
+ doc.search(xpath).each do |element|
65
+ attr_name ||= @attr_rgxp.match(xpath)[1]
66
+ uri = URI.parse(element.get_attribute(attr_name))
67
+ validate_uri(uri, dir, doc)
68
68
  end
69
69
  end
70
- @doc = @attr_name = nil
70
+ return nil # side effect of original implementation
71
71
  end
72
72
 
73
73
  # Validate the the page the _uri_ refers to actually exists. The directory
@@ -80,54 +80,15 @@ class LinkValidator
80
80
  # will only take place if the LinkValidator was created with the :external
81
81
  # flag set to true.
82
82
  #
83
- def validate_uri( uri, dir )
84
- # for relative URIs, we can see if the file exists in the output folder
85
- if uri.relative?
86
- return validate_anchor(uri, @doc) if uri.path.empty?
87
-
88
- path = if uri.path =~ %r/^\//
89
- ::File.join(::Webby.site.output_dir, uri.path)
90
- else
91
- ::File.join(dir, uri.path)
92
- end
93
- path = ::File.join(path, 'index.html') if ::File.extname(path).empty?
94
-
95
- uri_str = path.dup
96
- (uri_str << '#' << uri.fragment) if uri.fragment
97
- return if @valid_uris.include? uri_str
98
-
99
- if test ?f, path
100
- valid = if uri.fragment
101
- validate_anchor(uri, Hpricot(::File.read(path)))
102
- else true end
103
- @valid_uris << uri_str if valid
104
- else
105
- @log.error "invalid URI '#{uri.to_s}'"
106
- end
107
-
108
- # if the URI responds to the open mehod, then try to access the URI
109
- elsif uri.respond_to? :open
110
- return unless @validate_externals
111
- return if @valid_uris.include? uri.to_s
83
+ def validate_uri( uri, dir, doc )
84
+ # do not retry external uris that have already been validated
85
+ return if @valid_uris.include? uri.to_s
112
86
 
113
- if @invalid_uris.include? uri.to_s
114
- @log.error "could not open URI '#{uri.to_s}'"
115
- return
116
- end
117
-
118
- begin
119
- uri.open {|_| nil}
120
- @valid_uris << uri.to_s
121
- rescue Exception
122
- @log.error "could not open URI '#{uri.to_s}'"
123
- @invalid_uris << uri.to_s
124
- end
87
+ return validate_relative_uri(uri, dir, doc) if uri.relative?
88
+ return validate_external_uri(uri, dir, doc) if uri.respond_to? :open
125
89
 
126
90
  # otherwise, post a warning that the URI could not be validated
127
- else
128
- return if @valid_uris.include? uri.to_s
129
- @log.warn "could not validate URI '#{uri.to_s}'"
130
- end
91
+ @log.warn "could not validate URI '#{uri.to_s}'"
131
92
  end
132
93
 
133
94
  # Validate that the anchor fragment of the URI exists in the given
@@ -146,6 +107,53 @@ class LinkValidator
146
107
  else true end
147
108
  end
148
109
 
110
+ # Validate that the file pointed to by the relative URI exists in the output
111
+ # directory. If the URI has an anchor, validate that the anchor exists as
112
+ # well.
113
+ #
114
+ def validate_relative_uri( uri, dir, doc )
115
+ return validate_anchor(uri, doc) if uri.path.empty?
116
+
117
+ path = if uri.path =~ %r/^\//
118
+ ::File.join(::Webby.site.output_dir, uri.path)
119
+ else
120
+ ::File.join(dir, uri.path)
121
+ end
122
+ path = ::File.join(path, 'index.html') if ::File.extname(path).empty?
123
+
124
+ uri_str = path.dup
125
+ (uri_str << '#' << uri.fragment) if uri.fragment
126
+ return if @valid_uris.include? uri_str
127
+
128
+ if test ?f, path
129
+ valid = if uri.fragment
130
+ validate_anchor(uri, Hpricot(::File.read(path)))
131
+ else true end
132
+ @valid_uris << uri_str if valid
133
+ else
134
+ @log.error "invalid URI '#{uri.to_s}'"
135
+ end
136
+ end
137
+
138
+ # Validate that an external URI can be opened
139
+ #
140
+ def validate_external_uri( uri, dir, doc )
141
+ return unless @validate_externals
142
+
143
+ if @invalid_uris.include? uri.to_s
144
+ @log.error "could not open URI '#{uri.to_s}'"
145
+ return
146
+ end
147
+
148
+ begin
149
+ uri.open {|_| nil}
150
+ @valid_uris << uri.to_s
151
+ rescue Exception
152
+ @log.error "could not open URI '#{uri.to_s}'"
153
+ @invalid_uris << uri.to_s
154
+ end
155
+ end
156
+
149
157
  end # class LinkValidator
150
158
  end # module Webby
151
159
 
@@ -36,12 +36,15 @@ class Renderer
36
36
  renderer = self.new(page)
37
37
 
38
38
  loop {
39
- FileUtils.mkdir_p ::File.dirname(page.destination)
39
+ dest = page.destination
40
+ FileUtils.mkdir_p ::File.dirname(dest)
40
41
  journal.create_or_update(page)
41
42
 
42
- ::File.open(page.destination, 'w') do |fd|
43
- fd.write(renderer._layout_page)
43
+ text = renderer._layout_page
44
+ unless text.nil?
45
+ ::File.open(dest, 'w') {|fd| fd.write(text)}
44
46
  end
47
+
45
48
  break unless renderer._next_page
46
49
  }
47
50
  end
@@ -234,10 +237,10 @@ class Renderer
234
237
  rescue ::Webby::Error => err
235
238
  logger.error "while rendering page '#{@page.path}'"
236
239
  logger.error err.message
237
- rescue => err
240
+ return nil
241
+ rescue Exception => err
238
242
  logger.error "while rendering page '#{@page.path}'"
239
243
  logger.fatal err
240
- exit 1
241
244
  ensure
242
245
  @content = nil
243
246
  @@stack.clear
@@ -336,7 +339,7 @@ class Renderer
336
339
  # the partial. If a full path is given, then the partial is searched for
337
340
  # in that directory.
338
341
  #
339
- # Raies a Webby::Error if the partial could not be found.
342
+ # Raises a Webby::Error if the partial could not be found.
340
343
  #
341
344
  def _find_partial( part )
342
345
  case part
@@ -86,7 +86,8 @@ module Webby::Resources
86
86
  # +nil+ if no layout exists under that filename.
87
87
  #
88
88
  def find_layout( filename )
89
- return if filename.nil?
89
+ return unless filename
90
+ filename = filename.to_s
90
91
 
91
92
  fn = self.basename(filename)
92
93
  dir = ::File.dirname(filename)
@@ -49,7 +49,10 @@ class Page < Resource
49
49
  return @url unless @url.nil?
50
50
 
51
51
  @url = super
52
- @url = File.dirname(@url) if filename == 'index'
52
+ if filename == 'index'
53
+ @url = File.dirname(@url)
54
+ @url << '/' unless %r/\/$/ =~ @url
55
+ end
53
56
  @url
54
57
  end
55
58
 
@@ -13,7 +13,7 @@ namespace :create do
13
13
  page, title, dir = Webby::Builder.new_page_info
14
14
  page = Webby::Builder.create(page, :from => template,
15
15
  :locals => {:title => title, :directory => dir})
16
- exec(::Webby.editor, page) unless ::Webby.editor.nil?
16
+ Webby.exec_editor(page)
17
17
  end
18
18
  end # each
19
19
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  namespace :validate do
3
3
 
4
- desc 'Validate hyperlinks (exclude exteranl sites)'
4
+ desc 'Validate hyperlinks (exclude external sites)'
5
5
  task :internal => :build do
6
6
  Webby::LinkValidator.validate(:external => false)
7
7
  end
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Anchor</title>
6
+ </head>
7
+ <body>
8
+ <a href="#anchor"></a>
9
+ <a id="anchor"></a>
10
+ </body>
11
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Anchor</title>
6
+ </head>
7
+ <body>
8
+ <a href="http://www.google.com"></a>
9
+ </body>
10
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Anchor</title>
6
+ </head>
7
+ <body>
8
+ <a href="/invalid.html"></a>
9
+ </body>
10
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Anchor</title>
6
+ </head>
7
+ <body>
8
+ <a href="/anchor.html#anchor"></a>
9
+ </body>
10
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Anchor</title>
6
+ </head>
7
+ <body>
8
+ <a href="/anchor.html#invalid"></a>
9
+ </body>
10
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Anchor</title>
6
+ </head>
7
+ <body>
8
+ <a href="/anchor.html"></a>
9
+ </body>
10
+ </html>
@@ -1,3 +1,7 @@
1
+ Loquacious.configuration_for(:webby) {
2
+ desc "The default directory where new tumblog posts will be created."
3
+ tumblog_dir 'blog'
4
+ }
1
5
 
2
6
  namespace :tumblog do
3
7
 
@@ -21,7 +25,7 @@ namespace :tumblog do
21
25
  page = File.join(dir, File.basename(page))
22
26
  page = Webby::Builder.create(page, :from => template,
23
27
  :locals => {:title => title, :directory => dir})
24
- exec(::Webby.editor, page) unless ::Webby.editor.nil?
28
+ Webby.exec_editor(page)
25
29
  end
26
30
  end # each
27
31
 
@@ -3,10 +3,17 @@
3
3
  unless defined? WEBBY_SPEC_HELPER
4
4
  WEBBY_SPEC_HELPER = true
5
5
 
6
- require 'rubygems'
7
6
  require 'fileutils'
8
7
  require 'stringio'
9
8
 
9
+ begin
10
+ require 'fake_web'
11
+ $test_externals = true
12
+ rescue LoadError
13
+ retry if require 'rubygems'
14
+ $test_externals = false
15
+ end
16
+
10
17
  require File.expand_path(
11
18
  File.join(File.dirname(__FILE__), %w[.. lib webby]))
12
19
 
@@ -36,13 +36,14 @@ describe Webby::Apps::Generator do
36
36
  "content",
37
37
  "content/css",
38
38
  "content/css/blueprint",
39
- "content/css/blueprint/compressed",
40
- "content/css/blueprint/lib",
41
39
  "content/css/blueprint/plugins",
42
40
  "content/css/blueprint/plugins/buttons",
43
41
  "content/css/blueprint/plugins/buttons/icons",
44
- "content/css/blueprint/plugins/css-classes",
45
42
  "content/css/blueprint/plugins/fancy-type",
43
+ "content/css/blueprint/plugins/link-icons",
44
+ "content/css/blueprint/plugins/link-icons/icons",
45
+ "content/css/blueprint/plugins/rtl",
46
+ "content/css/blueprint/src",
46
47
  "layouts",
47
48
  "lib",
48
49
  "templates"
@@ -51,6 +52,38 @@ describe Webby::Apps::Generator do
51
52
  h["layouts"].should == %w[layouts/default.txt]
52
53
  end
53
54
 
55
+ it "should return a list of all the blog files from the template" do
56
+ @generator.parse %w[blog foo]
57
+
58
+ h = @generator.site_files
59
+ h.keys.sort.should == [
60
+ "",
61
+ "content",
62
+ "content/css",
63
+ "content/css/blueprint",
64
+ "content/css/blueprint/plugins",
65
+ "content/css/blueprint/plugins/buttons",
66
+ "content/css/blueprint/plugins/buttons/icons",
67
+ "content/css/blueprint/plugins/fancy-type",
68
+ "content/css/blueprint/plugins/link-icons",
69
+ "content/css/blueprint/plugins/link-icons/icons",
70
+ "content/css/blueprint/plugins/rtl",
71
+ "content/css/blueprint/src",
72
+ "layouts",
73
+ "tasks",
74
+ "templates",
75
+ "templates/blog"
76
+ ]
77
+ h["layouts"].should == %w[layouts/default.txt]
78
+ h["tasks"].should == %w[tasks/blog.rake]
79
+ h["templates"].should == %w[templates/atom_feed.erb]
80
+ h["templates/blog"].should == [
81
+ "templates/blog/year.erb",
82
+ "templates/blog/post.erb",
83
+ "templates/blog/month.erb"
84
+ ]
85
+ end
86
+
54
87
  describe "when parsing command line arguments" do
55
88
 
56
89
  before :each do
@@ -78,7 +78,8 @@ describe Webby::Apps::Main do
78
78
 
79
79
  describe ".parse" do
80
80
  it "should pass environment variables to the rake application" do
81
- ARGV = ary = []
81
+ ary = ARGV
82
+ ARGV.replace []
82
83
  args = %w[rebuild foo BASE=http://www.example.com bar]
83
84
  @main.parse args
84
85
  ary.should == %w[rebuild BASE=http://www.example.com]
@@ -108,13 +108,13 @@ describe Webby::Filters::BasePath do
108
108
 
109
109
  it 'is restrictive to the configured xpaths' do
110
110
  Webby.site.base = 'not a real site'
111
- input = @input % ['<img src="/foo/picture.jpg" />', '<a href="/page.html">Page Title</a>']
111
+ input = @input % ['<foo src="/foo/picture.jpg" />', '<a href="/page.html">Page Title</a>']
112
112
 
113
113
  bp = Webby::Filters::BasePath.new(input, 'html')
114
114
  bp.filter.should == <<-HTML
115
115
  <html>
116
116
  <head>
117
- <img src="/foo/picture.jpg" />
117
+ <foo src="/foo/picture.jpg" />
118
118
  </head>
119
119
  <body>
120
120
  <a href="not a real site/page.html">Page Title</a>