awestruct 0.4.8 → 0.5.0.cr

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/lib/awestruct/astruct.rb +4 -0
  2. data/lib/awestruct/astruct_mixin.rb +3 -0
  3. data/lib/awestruct/cli/auto.rb +6 -6
  4. data/lib/awestruct/cli/deploy.rb +3 -3
  5. data/lib/awestruct/cli/generate.rb +5 -3
  6. data/lib/awestruct/cli/init.rb +1 -1
  7. data/lib/awestruct/cli/invoker.rb +10 -3
  8. data/lib/awestruct/cli/manifest.rb +18 -17
  9. data/lib/awestruct/cli/options.rb +7 -6
  10. data/lib/awestruct/cli/server.rb +7 -14
  11. data/lib/awestruct/config.rb +7 -1
  12. data/lib/awestruct/config/default-site.yml +30 -0
  13. data/lib/awestruct/context_helper.rb +7 -7
  14. data/lib/awestruct/dependencies.rb +14 -11
  15. data/lib/awestruct/deploy/base_deploy.rb +2 -2
  16. data/lib/awestruct/deploy/github_pages_deploy.rb +1 -1
  17. data/lib/awestruct/deploy/rsync_deploy.rb +11 -15
  18. data/lib/awestruct/deploy/s3_deploy.rb +9 -0
  19. data/lib/awestruct/engine.rb +72 -21
  20. data/lib/awestruct/extensions/minify.rb +21 -20
  21. data/lib/awestruct/extensions/paginator.rb +5 -5
  22. data/lib/awestruct/extensions/partial.rb +1 -1
  23. data/lib/awestruct/extensions/pipeline.rb +5 -1
  24. data/lib/awestruct/extensions/posts.rb +8 -4
  25. data/lib/awestruct/extensions/relative.rb +7 -2
  26. data/lib/awestruct/extensions/remotePartial.rb +1 -1
  27. data/lib/awestruct/extensions/sitemap.rb +1 -1
  28. data/lib/awestruct/frameworks/bootstrap/base_index.html.haml +1 -1
  29. data/lib/awestruct/frameworks/bootstrap/base_layout.html.haml +1 -1
  30. data/lib/awestruct/handler_chains.rb +8 -23
  31. data/lib/awestruct/handlers/asciidoctor_handler.rb +114 -0
  32. data/lib/awestruct/handlers/base_tilt_handler.rb +114 -0
  33. data/lib/awestruct/handlers/css_tilt_handler.rb +43 -0
  34. data/lib/awestruct/handlers/front_matter_handler.rb +1 -1
  35. data/lib/awestruct/handlers/interpolation_handler.rb +3 -3
  36. data/lib/awestruct/handlers/layout_handler.rb +6 -4
  37. data/lib/awestruct/handlers/restructuredtext_handler.rb +5 -5
  38. data/lib/awestruct/handlers/template/asciidoc.rb +41 -0
  39. data/lib/awestruct/handlers/template/mustache.rb +25 -0
  40. data/lib/awestruct/handlers/tilt_handler.rb +73 -0
  41. data/lib/awestruct/layouts.rb +1 -1
  42. data/lib/awestruct/logger.rb +59 -0
  43. data/lib/awestruct/page.rb +16 -3
  44. data/lib/awestruct/page_loader.rb +5 -5
  45. data/lib/awestruct/version.rb +1 -1
  46. data/man/awestruct.1 +163 -0
  47. data/spec/asciidoc_handler_spec.rb +75 -0
  48. data/spec/astruct_spec.rb +52 -0
  49. data/spec/coffeescript_handler_spec.rb +23 -0
  50. data/spec/config_spec.rb +22 -0
  51. data/spec/context_helper_spec.rb +115 -0
  52. data/spec/deploy_spec.rb +41 -0
  53. data/spec/disqus_spec.rb +43 -0
  54. data/spec/engine_spec.rb +115 -0
  55. data/spec/erb_handler_spec.rb +52 -0
  56. data/spec/file_handler_spec.rb +57 -0
  57. data/spec/front_matter_handler_spec.rb +42 -0
  58. data/spec/github_pages_deploy_spec.rb +56 -0
  59. data/spec/haml_handler_spec.rb +93 -0
  60. data/spec/handler_chain_spec.rb +44 -0
  61. data/spec/handler_chains_spec.rb +25 -0
  62. data/spec/interpolation_handler_spec.rb +35 -0
  63. data/spec/invoker_spec.rb +74 -0
  64. data/spec/javascript_handler_spec.rb +23 -0
  65. data/spec/layout_handler_spec.rb +77 -0
  66. data/spec/layouts_spec.rb +32 -0
  67. data/spec/less_handler_spec.rb +33 -0
  68. data/spec/markdown_handler_spec.rb +41 -0
  69. data/spec/minify_spec.rb +61 -0
  70. data/spec/mustache_handler_spec.rb +29 -0
  71. data/spec/options_spec.rb +97 -0
  72. data/spec/orgmode_handler_spec.rb +24 -0
  73. data/spec/page_delegating_handler_spec.rb +79 -0
  74. data/spec/page_loader_spec.rb +43 -0
  75. data/spec/page_loader_spec_for_layouts.rb +36 -0
  76. data/spec/page_spec.rb +65 -0
  77. data/spec/pipeline_spec.rb +12 -0
  78. data/spec/posts_archive_spec.rb +108 -0
  79. data/spec/redirect_handler_spec.rb +32 -0
  80. data/spec/restructuredtext_handler_spec.rb +22 -0
  81. data/spec/rsync_deploy_spec.rb +9 -0
  82. data/spec/sass_handler_spec.rb +23 -0
  83. data/spec/scss_handler_spec.rb +23 -0
  84. data/spec/server_spec.rb +45 -0
  85. data/spec/slim_handler_spec.rb +81 -0
  86. data/spec/spec_helper.rb +18 -0
  87. data/spec/support/nokogiri_matchers.rb +21 -0
  88. data/spec/support/shared_handler_example.rb +98 -0
  89. data/spec/test-data/engine/_config/arbitrary.yml +2 -0
  90. data/spec/test-data/engine/_config/other.yml +1 -0
  91. data/spec/test-data/engine/_config/site.yml +14 -0
  92. data/spec/test-data/front-matter-file-no-content.txt +2 -0
  93. data/spec/test-data/front-matter-file-no-front.txt +1 -0
  94. data/spec/test-data/front-matter-file.txt +4 -0
  95. data/spec/test-data/handlers/asciidoc-page.ad +3 -0
  96. data/spec/test-data/handlers/asciidoc-page.adoc +3 -0
  97. data/spec/test-data/handlers/asciidoc-page.asciidoc +3 -0
  98. data/spec/test-data/handlers/asciidoctor_with_front_matter.ad +6 -0
  99. data/spec/test-data/handlers/asciidoctor_with_headers.ad +8 -0
  100. data/spec/test-data/handlers/coffeescript-page.coffee +8 -0
  101. data/spec/test-data/handlers/erb-page.html.erb +6 -0
  102. data/spec/test-data/handlers/erb-page.xml.erb +2 -0
  103. data/spec/test-data/handlers/erb-utf-page.html.erb +2 -0
  104. data/spec/test-data/handlers/haml-layout-two.html.haml +7 -0
  105. data/spec/test-data/handlers/haml-layout.html.haml +4 -0
  106. data/spec/test-data/handlers/haml-page.atom.haml +4 -0
  107. data/spec/test-data/handlers/haml-page.html.haml +2 -0
  108. data/spec/test-data/handlers/haml-page.xml.haml +1 -0
  109. data/spec/test-data/handlers/haml-with-markdown-page.html.haml +6 -0
  110. data/spec/test-data/handlers/haml-with-textile-page.html.haml +6 -0
  111. data/spec/test-data/handlers/haml-with-utf.html.haml +2 -0
  112. data/spec/test-data/handlers/haml-with-variables.html.haml +2 -0
  113. data/spec/test-data/handlers/inner-page.html.haml +4 -0
  114. data/spec/test-data/handlers/javascript-page.js +1 -0
  115. data/spec/test-data/handlers/less-page-include.less +1 -0
  116. data/spec/test-data/handlers/less-page-with-import.less +4 -0
  117. data/spec/test-data/handlers/less-page.less +4 -0
  118. data/spec/test-data/handlers/markdown-page.markdown +2 -0
  119. data/spec/test-data/handlers/markdown-page.md +2 -0
  120. data/spec/test-data/handlers/markdown-page.mkd +2 -0
  121. data/spec/test-data/handlers/mustache-page.html.mustache +2 -0
  122. data/spec/test-data/handlers/mustache-page.xml.mustache +1 -0
  123. data/spec/test-data/handlers/orgmode-page.org +6 -0
  124. data/spec/test-data/handlers/outer-layout.html.haml +2 -0
  125. data/spec/test-data/handlers/outside_relative/git_keep +3 -0
  126. data/spec/test-data/handlers/redirect-page.redirect +1 -0
  127. data/spec/test-data/handlers/restructuredtext-page.rst +8 -0
  128. data/spec/test-data/handlers/sass-page-include.sass +1 -0
  129. data/spec/test-data/handlers/sass-page.sass +4 -0
  130. data/spec/test-data/handlers/scss-page-include.scss +1 -0
  131. data/spec/test-data/handlers/scss-page.scss +5 -0
  132. data/spec/test-data/handlers/simple-redirect-page.redirect +1 -0
  133. data/spec/test-data/handlers/slim-page.atom.slim +4 -0
  134. data/spec/test-data/handlers/slim-page.html.slim +1 -0
  135. data/spec/test-data/handlers/slim-page.xml.slim +1 -0
  136. data/spec/test-data/handlers/slim-with-markdown-page.html.slim +5 -0
  137. data/spec/test-data/handlers/slim-with-utf.html.slim +2 -0
  138. data/spec/test-data/handlers/slim-with-variables.html.slim +1 -0
  139. data/spec/test-data/handlers/textile-page.textile +1 -0
  140. data/spec/test-data/images/logo.png +0 -0
  141. data/spec/test-data/index.html +242 -0
  142. data/spec/test-data/javascript/bootstrap-dropdown.js +92 -0
  143. data/spec/test-data/out-of-site/page-three.html.haml +2 -0
  144. data/spec/test-data/page-loader/_layouts/layout-one.md +2 -0
  145. data/spec/test-data/page-loader/_layouts/layout-two.html.haml +2 -0
  146. data/spec/test-data/page-loader/page-draft.md +5 -0
  147. data/spec/test-data/page-loader/page-one.md +2 -0
  148. data/spec/test-data/page-loader/page-two.html.haml +2 -0
  149. data/spec/test-data/simple-data.yaml +1 -0
  150. data/spec/test-data/simple-file.txt +1 -0
  151. data/spec/test-data/stylesheets/screen.css +688 -0
  152. data/spec/textile_handler_spec.rb +22 -0
  153. data/spec/tilt_handler_spec.rb +81 -0
  154. data/spec/yaml_handler_spec.rb +21 -0
  155. metadata +243 -202
  156. data/lib/awestruct/handlers/asciidoc_handler.rb +0 -86
  157. data/lib/awestruct/handlers/base_sass_handler.rb +0 -42
  158. data/lib/awestruct/handlers/coffeescript_handler.rb +0 -48
  159. data/lib/awestruct/handlers/erb_handler.rb +0 -43
  160. data/lib/awestruct/handlers/haml_handler.rb +0 -54
  161. data/lib/awestruct/handlers/less_handler.rb +0 -37
  162. data/lib/awestruct/handlers/markdown_handler.rb +0 -50
  163. data/lib/awestruct/handlers/mustache_handler.rb +0 -44
  164. data/lib/awestruct/handlers/orgmode_handler.rb +0 -48
  165. data/lib/awestruct/handlers/sass_handler.rb +0 -21
  166. data/lib/awestruct/handlers/scss_handler.rb +0 -21
  167. data/lib/awestruct/handlers/textile_handler.rb +0 -58
@@ -1,8 +1,6 @@
1
1
 
2
2
  require 'awestruct/handlers/base_handler'
3
3
 
4
- require 'haml'
5
-
6
4
  module Awestruct
7
5
  module Handlers
8
6
  class LayoutHandler < BaseHandler
@@ -33,21 +31,24 @@ module Awestruct
33
31
  end
34
32
 
35
33
  def for_layout_chain(page, &block)
36
- # puts "for_layout_chain #{page.inspect}"
37
34
  current_page = page
35
+ $LOG.debug "layout_chain for #{current_page.source_path}" if $LOG.debug?
38
36
  while ( ! ( current_page.nil? || current_page.layout.nil? ) )
39
37
  current_page = site.layouts.find_matching( current_page.layout, current_page.output_extension )
40
- # puts "layout #{current_page.inspect}"
38
+ $LOG.debug "found matching layout for #{current_page}" if $LOG.debug?
41
39
  if ( ! current_page.nil? )
40
+ $LOG.debug "calling: #{block.inspect}" if $LOG.debug?
42
41
  block.call( current_page )
43
42
  end
44
43
  end
45
44
  end
46
45
 
47
46
  def rendered_content(context, with_layouts=true)
47
+ $LOG.debug "rendering content with layout #{with_layouts} for #{context}" if $LOG.debug?
48
48
  content = delegate.rendered_content( context, with_layouts )
49
49
 
50
50
  if ( with_layouts )
51
+ $LOG.debug "calling for_layout_chain" if $LOG.debug?
51
52
  for_layout_chain(context.__effective_page || context.page) do |layout|
52
53
  context.content = content
53
54
  context.__effective_page = layout
@@ -55,6 +56,7 @@ module Awestruct
55
56
  end
56
57
  end
57
58
 
59
+ $LOG.debug "finished rendering content for #{context}" if $LOG.debug?
58
60
  content
59
61
  end
60
62
 
@@ -6,13 +6,13 @@ require 'awestruct/handlers/front_matter_handler'
6
6
  require 'awestruct/handlers/interpolation_handler'
7
7
  require 'awestruct/handlers/layout_handler'
8
8
 
9
- require 'hpricot'
9
+ require 'nokogiri'
10
10
 
11
11
  module Awestruct
12
12
  module Handlers
13
13
  class RestructuredtextHandler < BaseHandler
14
14
 
15
- CHAIN = Awestruct::HandlerChain.new( /\.(adoc|asciidoc)$/,
15
+ CHAIN = Awestruct::HandlerChain.new( /\.(rst)$/,
16
16
  Awestruct::Handlers::FileHandler,
17
17
  Awestruct::Handlers::FrontMatterHandler,
18
18
  Awestruct::Handlers::InterpolationHandler,
@@ -54,11 +54,11 @@ module Awestruct
54
54
  "--no-doc-title",
55
55
  " --initial-header-level=#{hl}" ].join(' '),
56
56
  content )
57
- content = Hpricot( doc ).at( '/html/body/div[@class="document"]' ).inner_html.strip
57
+ content = Nokogiri::HTML( doc ).at( '/html/body/div[@class="document"]' ).inner_html.strip
58
58
  content = content.gsub( "\r", '' )
59
59
  rescue => e
60
- puts e
61
- puts e.backtrace
60
+ $LOG.error e if $LOG.error?
61
+ $LOG.error e.backtrace.join( "\n" ) if $LOG.error?
62
62
  end
63
63
  content
64
64
  end
@@ -0,0 +1,41 @@
1
+ require 'tilt/template'
2
+
3
+ module Tilt
4
+ class AsciidoctorTemplate < Template
5
+ self.default_mime_type = 'text/html'
6
+
7
+ def self.engine_initialized?
8
+ defined? ::Asciidoctor::Document
9
+ end
10
+
11
+ def initialize_engine
12
+ require_template_library 'asciidoctor'
13
+ end
14
+
15
+ def prepare
16
+ options[:header_footer] = false if options[:header_footer].nil?
17
+ end
18
+
19
+ def evaluate(scope, locals, &block)
20
+ @output ||= Asciidoctor.render(data, options, &block)
21
+ end
22
+
23
+ def allows_script?
24
+ false
25
+ end
26
+
27
+ def parse_headers(content, filter = /.*/)
28
+ doc = Asciidoctor.load(content, {:parse_header_only => true})
29
+ filtered = doc.attributes.select{|k,v| k =~ filter}.inject({}) do |hash, (k,v)|
30
+ hash[k.gsub(filter, '')] = v
31
+ hash
32
+ end
33
+
34
+ filtered['title'] = filtered['doctitle'] = doc.doctitle
35
+ filtered['date'] ||= doc.attributes['revdate'] unless doc.attributes['revdate'].nil?
36
+ filtered['author'] = doc.attributes['author'] unless doc.attributes['author'].nil?
37
+
38
+ filtered
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,25 @@
1
+ require 'tilt/template'
2
+
3
+ module Tilt
4
+ class MustacheTemplate < Template
5
+
6
+ def self.engine_initialized?
7
+ defined? ::Mustache
8
+ end
9
+
10
+ def initialize_engine
11
+ require_template_library 'mustache'
12
+ end
13
+
14
+ def prepare
15
+ end
16
+
17
+ def evaluate(scope, locals, &block)
18
+ @output ||= Mustache.render(data, scope)
19
+ end
20
+
21
+ def allows_script?
22
+ false
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,73 @@
1
+
2
+ require 'awestruct/handler_chain'
3
+ require 'awestruct/handlers/base_tilt_handler'
4
+ require 'awestruct/handlers/file_handler'
5
+ require 'awestruct/handlers/front_matter_handler'
6
+ require 'awestruct/handlers/interpolation_handler'
7
+ require 'awestruct/handlers/layout_handler'
8
+
9
+ require 'tilt'
10
+
11
+ module Awestruct
12
+ module Handlers
13
+
14
+ class TiltMatcher
15
+ def match(path)
16
+ !Tilt[path].nil?
17
+ end
18
+ end
19
+
20
+ class NonInterpolatingTiltMatcher
21
+ EXT_REGEX = /\.(haml|slim|erb|mustache)$/
22
+
23
+ def match(path)
24
+ if match = EXT_REGEX.match(path)
25
+ if match[0] == '.slim' && Tilt[path].nil?
26
+ require 'slim'
27
+ end
28
+ true
29
+ else
30
+ false
31
+ end
32
+ end
33
+ end
34
+
35
+ class TiltHandler < BaseTiltHandler
36
+
37
+ INTERPOLATION_CHAIN = Awestruct::HandlerChain.new( Awestruct::Handlers::TiltMatcher.new(),
38
+ Awestruct::Handlers::FileHandler,
39
+ Awestruct::Handlers::FrontMatterHandler,
40
+ Awestruct::Handlers::InterpolationHandler,
41
+ Awestruct::Handlers::TiltHandler,
42
+ Awestruct::Handlers::LayoutHandler
43
+ )
44
+
45
+ NON_INTERPOLATION_CHAIN = Awestruct::HandlerChain.new( Awestruct::Handlers::NonInterpolatingTiltMatcher.new(),
46
+ Awestruct::Handlers::FileHandler,
47
+ Awestruct::Handlers::FrontMatterHandler,
48
+ Awestruct::Handlers::TiltHandler,
49
+ Awestruct::Handlers::LayoutHandler
50
+ )
51
+
52
+ def initialize(site, delegate)
53
+ super( site, delegate )
54
+ end
55
+
56
+ end
57
+
58
+ end
59
+ end
60
+
61
+ require 'awestruct/handlers/template/mustache'
62
+ Tilt::register Tilt::MustacheTemplate, '.mustache'
63
+
64
+ # As of Haml 4.0.0, Textile is no longer registered by default
65
+ # Monkeypatch the Tilt templates to force Textile to be registered
66
+ class Tilt::HamlTemplate
67
+ def initialize_engine
68
+ require_template_library 'haml'
69
+ if Haml::VERSION >= '4.0.0' && !Haml::Filters.constants.include?('Textile')
70
+ Haml::Filters.register_tilt_filter 'Textile'
71
+ end
72
+ end
73
+ end
@@ -4,7 +4,7 @@ module Awestruct
4
4
  class Layouts < Array
5
5
 
6
6
  def find_matching(simple_name, output_extension)
7
- # puts "find matching ( #{simple_name}, #{output_extension} )"
7
+ $LOG.debug "find matching ( #{simple_name}, #{output_extension} )" if $LOG.debug?
8
8
  self.find{|e|
9
9
  ( e.simple_name == simple_name ) && ( e.output_extension == output_extension )
10
10
  }
@@ -0,0 +1,59 @@
1
+ require 'logger'
2
+
3
+ module Awestruct
4
+ class AwestructLoggerMultiIO
5
+ def initialize(log_to_debug_io = false, *targets)
6
+ @targets = targets
7
+ @log_to_debug = log_to_debug_io
8
+ end
9
+
10
+ def write(*args)
11
+ @targets.each do |target|
12
+ if target.instance_of?(File) && @log_to_debug
13
+ target.write(*args)
14
+ end
15
+ if args[0] !~/\[/ && target.instance_of?(IO)
16
+ target.write(*args)
17
+ end
18
+ end
19
+ end
20
+
21
+ def close
22
+ @targs.each(&:close)
23
+ end
24
+ end
25
+
26
+ class AwestructLogFormatter < Logger::Formatter
27
+ attr_accessor :level
28
+ attr_accessor :progname
29
+
30
+ def call(severity, timestamp, who, object)
31
+ is_debug = $LOG.level == Logger::DEBUG
32
+ if is_debug
33
+ # callstack inspection, include our caller
34
+ # turn this: "/usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'"
35
+ # into this: ["/usr/lib/ruby/1.8/irb/workspace.rb", "52", "irb_binding"]
36
+ #
37
+ # caller[3] is actually who invoked the Logger#<type>
38
+ # This only works if you use the severity methods
39
+ path, line, method = caller[3].split(/(?::in `|:|')/)
40
+ # Trim RUBYLIB path from 'file' if we can
41
+ #whence = $:.select { |p| path.start_with?(p) }[0]
42
+ whence = $:.detect { |p| path.start_with?(p) }
43
+ if !whence
44
+ # We get here if the path is not in $:
45
+ file = path
46
+ else
47
+ file = path[whence.length + 1..-1]
48
+ end
49
+ who = "#{file}:#{line}##{method}"
50
+ end
51
+
52
+ if severity =~ /DEBUG/
53
+ "[%s] %5s -- %s [%s]\n" % [timestamp.strftime('%Y-%m-%d %H:%M:%S'), severity, object, who]
54
+ else
55
+ "%s\n" % [object]
56
+ end
57
+ end
58
+ end
59
+ end
@@ -43,7 +43,7 @@ module Awestruct
43
43
 
44
44
  def inherit_front_matter_from(hash)
45
45
  hash.each do |k,v|
46
- #puts "#{self.output_path} overwrite key: #{k}:#{self[k]} -> #{v}" if ( key?( k ) and !self[k].nil? and !self[k].eql? v)
46
+ $LOG.debug "#{self.output_path} overwrite key: #{k}:#{self[k]} -> #{v}" if ( key?( k ) and !self[k].nil? and !self[k].eql? v) if $LOG.debug?
47
47
  unless ( key?( k ) )
48
48
  self[k.to_sym] = v
49
49
  end
@@ -130,10 +130,23 @@ module Awestruct
130
130
  c = nil
131
131
 
132
132
  begin
133
+ $LOG.debug "calling rendered_content on handler for page #{self.output_path}" if $LOG.debug?
133
134
  c = handler.rendered_content( context, with_layouts )
134
135
  # c = site.engine.pipeline.apply_transformers( context.site, self, c )
135
- rescue => e
136
- raise $!, "Failed to render #{self.url}", $!.backtrace
136
+ rescue StandardError => e
137
+ lineno = nil
138
+ if e.respond_to?(:lineno)
139
+ lineno = e.lineno
140
+ elsif e.respond_to?(:line)
141
+ lineno = e.line
142
+ end
143
+ if lineno
144
+ if self.handler.respond_to?(:content_line_offset)
145
+ lineno += self.handler.content_line_offset
146
+ end
147
+ end
148
+ lineinfo = lineno ? " at line #{lineno}" : ''
149
+ raise StandardError, %(Failed to render #{self.relative_source_path}#{lineinfo}\n#{e.class}: #{e.message.rstrip}), e.backtrace.join("\n")
137
150
  end
138
151
 
139
152
  if context.site.config.track_dependencies
@@ -26,28 +26,28 @@ module Awestruct
26
26
  pages = []
27
27
  root_dir.find do |path|
28
28
  if ( path == root_dir )
29
- puts "skip #{path}" if (site.config.verbose)
29
+ $LOG.debug "skip #{path}" if (site.config.verbose) if $LOG.debug?
30
30
  next
31
31
  end
32
32
  basename = File.basename( path )
33
33
  if ( basename == '.htaccess' )
34
34
  #special case
35
35
  elsif ( basename =~ /^[_.]/ )
36
- puts "skip #{path} and prune" if (site.config.verbose)
36
+ $LOG.debug "skip #{path} and prune" if (site.config.verbose) if $LOG.debug?
37
37
  Find.prune
38
38
  next
39
39
  end
40
40
  relative_path = path.relative_path_from( root_dir ).to_s
41
41
  if ignore?(relative_path)
42
- puts "skip ignored #{path} and prune" if (site.config.verbose)
42
+ $LOG.debug "skip ignored #{path} and prune" if (site.config.verbose) if $LOG.debug?
43
43
  Find.prune
44
44
  next
45
45
  end
46
46
  unless path.directory?
47
- puts "loading #{relative_path}" if (site.config.verbose)
47
+ $LOG.debug "loading #{relative_path}" if (site.config.verbose) if $LOG.debug?
48
48
  page = load_page( path, prepare )
49
49
  if ( page && !page.draft )
50
- #puts "loaded! #{path} and added to site"
50
+ $LOG.debug "loaded! #{path} and added to site" if $LOG.debug?
51
51
  #inherit_front_matter( page )
52
52
  site.send( @target ) << page
53
53
  pages << page
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Awestruct
3
- VERSION='0.4.8'
3
+ VERSION='0.5.0.cr'
4
4
  end
data/man/awestruct.1 ADDED
@@ -0,0 +1,163 @@
1
+ '\" t
2
+ .\" Title: awestruct
3
+ .\" Author: [see the "AUTHORS" section]
4
+ .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
5
+ .\" Date: 03/11/2013
6
+ .\" Manual: \ \&
7
+ .\" Source: \ \&
8
+ .\" Language: English
9
+ .\"
10
+ .TH "AWESTRUCT" "1" "03/11/2013" "\ \&" "\ \&"
11
+ .\" -----------------------------------------------------------------
12
+ .\" * Define some portability stuff
13
+ .\" -----------------------------------------------------------------
14
+ .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
+ .\" http://bugs.debian.org/507673
16
+ .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17
+ .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
+ .ie \n(.g .ds Aq \(aq
19
+ .el .ds Aq '
20
+ .\" -----------------------------------------------------------------
21
+ .\" * set default formatting
22
+ .\" -----------------------------------------------------------------
23
+ .\" disable hyphenation
24
+ .nh
25
+ .\" disable justification (adjust text to left margin only)
26
+ .ad l
27
+ .\" -----------------------------------------------------------------
28
+ .\" * MAIN CONTENT STARTS HERE *
29
+ .\" -----------------------------------------------------------------
30
+ .SH "NAME"
31
+ awestruct \- generates a static HTML site from templates in the current project
32
+ .SH "SYNOPSIS"
33
+ .sp
34
+ \fBawestruct\fR [\fIOPTION\fR]\&...
35
+ .SH "DESCRIPTION"
36
+ .sp
37
+ The awestruct(1) command generates a static HTML site for the current project\&. Awestruct recognizes a variety of templates supported by the Ruby ecosystem, many of which are handled by Tilt\&.
38
+ .sp
39
+ This command must be run from the root of the project\&.
40
+ .SH "OPTIONS"
41
+ .SS "Project Setup"
42
+ .PP
43
+ \fB\-i, \-\-init\fR
44
+ .RS 4
45
+ Initialize a new project in the
46
+ \fIcurrent\fR
47
+ directory\&.
48
+ .RE
49
+ .PP
50
+ \fB\-f, \-\-framework\fR=\fIFRAMEWORK\fR
51
+ .RS 4
52
+ Specify a Compass framework during initialization to use in the project\&. (\fIbootstrap\fR,
53
+ \fIblueprint\fR,
54
+ \fI960\fR)
55
+ .RE
56
+ .PP
57
+ \fB\-\-[no\-]scaffold\fR
58
+ .RS 4
59
+ Create scaffolding during initialization\&. (default: true)
60
+ .RE
61
+ .SS "Site Generation / Preview"
62
+ .PP
63
+ \fB\-d, \-\-dev\fR
64
+ .RS 4
65
+ Run in development mode\&. (implies
66
+ \fB\-\-auto\fR,
67
+ \fB\-\-server\fR,
68
+ \fB\-\-port 4242\fR
69
+ and
70
+ \fB\-\-profile development\fR)
71
+ .RE
72
+ .PP
73
+ \fB\-\-auto\fR
74
+ .RS 4
75
+ Auto\-generate files whenever changes are noticed\&.
76
+ .RE
77
+ .PP
78
+ \fB\-p, \-\-port\fR=\fIPORT\fR
79
+ .RS 4
80
+ The server port to use when running a local server\&. (default: 4242)
81
+ .RE
82
+ .PP
83
+ \fB\-b, \-\-bind\fR=\fIBIND\fR
84
+ .RS 4
85
+ The server address to use when running a local server\&. (default: 0\&.0\&.0\&.0)
86
+ .RE
87
+ .PP
88
+ \fB\-g, \-\-[no\-]generate\fR
89
+ .RS 4
90
+ Generate the site\&.
91
+ .RE
92
+ .PP
93
+ \fB\-P, \-\-profile\fR=\fIPROFILE\fR
94
+ .RS 4
95
+ Activate a configuration profile\&.
96
+ .RE
97
+ .PP
98
+ \fB\-\-force\fR
99
+ .RS 4
100
+ Force a regeneration of all files\&.
101
+ .RE
102
+ .PP
103
+ \fB\-s, \-\-server\fR
104
+ .RS 4
105
+ Serve the generated site from an embedded server\&.
106
+ .RE
107
+ .PP
108
+ \fB\-u, \-\-url\fR=\fIURL\fR
109
+ .RS 4
110
+ Set the site\&.base_url property\&.
111
+ .RE
112
+ .SS "Site Deployment"
113
+ .PP
114
+ \fB\-\-deploy\fR
115
+ .RS 4
116
+ Deploy the site\&.
117
+ .RE
118
+ .SS "Processing Information"
119
+ .PP
120
+ \fB\-w, \-\-verbose\fR
121
+ .RS 4
122
+ Verbosely print processing information and configuration file checks to STDERR\&.
123
+ .RE
124
+ .SS "Program Information"
125
+ .PP
126
+ \fB\-h, \-\-help\fR
127
+ .RS 4
128
+ Show the help message\&.
129
+ .RE
130
+ .PP
131
+ \fB\-v, \-\-version\fR
132
+ .RS 4
133
+ Print program version number\&.
134
+ .RE
135
+ .SH "EXIT STATUS"
136
+ .PP
137
+ \fB0\fR
138
+ .RS 4
139
+ Success
140
+ .RE
141
+ .PP
142
+ \fB1\fR
143
+ .RS 4
144
+ Failure (syntax or usage error; configuration error; document processing failure; unexpected error)\&.
145
+ .RE
146
+ .SH "BUGS"
147
+ .sp
148
+ See the \fBAwestruct\fR issue tracker: <\fBhttps://github\&.com/awestruct/awestruct/issues?state=open\fR>
149
+ .SH "AUTHORS"
150
+ .sp
151
+ \fBAwestruct\fR was created by Bob McWhirter and has received contributions from many other individuals\&. The tool was inspired by Jekyll in the same genre\&.
152
+ .SH "RESOURCES"
153
+ .sp
154
+ Git source repository on GitHub: <\fBhttps://github\&.com/awestruct/awestruct\fR>
155
+ .sp
156
+ Project web site: <\fBhttp://awestruct\&.org\fR>
157
+ .sp
158
+ GitHub organization: <\fBhttp://github\&.com/awestruct\fR>
159
+ .sp
160
+ Mailinglist / forum: <\fBhttp://talk\&.awestruct\&.org\fR>
161
+ .SH "COPYING"
162
+ .sp
163
+ Copyright (C) Bob McWhirter 2013\&. Free use of this software is granted under the terms of the MIT License\&.