awestruct 0.5.4.rc3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +24 -20
  3. data/LICENSE.txt +4 -4
  4. data/README.md +5 -5
  5. data/awestruct.gemspec +14 -11
  6. data/lib/awestruct/astruct_mixin.rb +0 -1
  7. data/lib/awestruct/cli/auto.rb +38 -11
  8. data/lib/awestruct/cli/invoker.rb +55 -39
  9. data/lib/awestruct/cli/options.rb +32 -22
  10. data/lib/awestruct/compass/default_configuration.rb +108 -0
  11. data/lib/awestruct/config.rb +11 -10
  12. data/lib/awestruct/config/default-site.yml +1 -0
  13. data/lib/awestruct/context.rb +0 -1
  14. data/lib/awestruct/dependencies.rb +7 -9
  15. data/lib/awestruct/deploy/base_deploy.rb +6 -0
  16. data/lib/awestruct/deploy/github_pages_deploy.rb +1 -0
  17. data/lib/awestruct/deploy/rsync_deploy.rb +11 -7
  18. data/lib/awestruct/deployers.rb +0 -1
  19. data/lib/awestruct/engine.rb +41 -37
  20. data/lib/awestruct/extensions/cachebuster.rb +2 -2
  21. data/lib/awestruct/extensions/google_analytics.rb +57 -17
  22. data/lib/awestruct/extensions/minify.rb +4 -5
  23. data/lib/awestruct/extensions/obfuscate.rb +13 -3
  24. data/lib/awestruct/extensions/partial.rb +8 -1
  25. data/lib/awestruct/extensions/pipeline.rb +11 -6
  26. data/lib/awestruct/extensions/remotePartial.rb +1 -1
  27. data/lib/awestruct/extensions/sitemap.rb +5 -1
  28. data/lib/awestruct/frameworks/base_Gemfile +10 -7
  29. data/lib/awestruct/frameworks/base_Rakefile +5 -1
  30. data/lib/awestruct/handler_chain.rb +0 -1
  31. data/lib/awestruct/handler_chains.rb +5 -1
  32. data/lib/awestruct/handlers/asciidoctor_handler.rb +9 -22
  33. data/lib/awestruct/handlers/base_tilt_handler.rb +13 -8
  34. data/lib/awestruct/handlers/css_tilt_handler.rb +2 -1
  35. data/lib/awestruct/handlers/front_matter_handler.rb +1 -0
  36. data/lib/awestruct/handlers/interpolation_handler.rb +1 -1
  37. data/lib/awestruct/handlers/javascript_handler.rb +1 -2
  38. data/lib/awestruct/handlers/layout_handler.rb +3 -4
  39. data/lib/awestruct/handlers/no_op_handler.rb +0 -1
  40. data/lib/awestruct/handlers/page_delegating_handler.rb +0 -1
  41. data/lib/awestruct/handlers/template/asciidoc.rb +51 -47
  42. data/lib/awestruct/handlers/tilt_handler.rb +13 -6
  43. data/lib/awestruct/handlers/yaml_handler.rb +0 -1
  44. data/lib/awestruct/layouts.rb +1 -3
  45. data/lib/awestruct/logger.rb +10 -3
  46. data/lib/awestruct/page.rb +0 -1
  47. data/lib/awestruct/page_loader.rb +0 -2
  48. data/lib/awestruct/pipeline.rb +1 -1
  49. data/lib/awestruct/site.rb +0 -1
  50. data/lib/awestruct/util/exception_helper.rb +18 -6
  51. data/lib/awestruct/version.rb +1 -1
  52. data/man/awestruct.adoc +1 -1
  53. data/spec/{astruct_spec.rb → awestruct/astruct_spec.rb} +0 -0
  54. data/spec/{invoker_spec.rb → awestruct/cli/invoker_spec.rb} +6 -6
  55. data/spec/{options_spec.rb → awestruct/cli/options_spec.rb} +0 -0
  56. data/spec/awestruct/deploy/base_deploy_spec.rb +30 -0
  57. data/spec/{deploy_spec.rb → awestruct/deploy/deploy_spec.rb} +14 -11
  58. data/spec/{github_pages_deploy_spec.rb → awestruct/deploy/github_pages_deploy_spec.rb} +8 -7
  59. data/spec/{rsync_deploy_spec.rb → awestruct/deploy/rsync_deploy_spec.rb} +0 -0
  60. data/spec/{asciidoc_handler_spec.rb → awestruct/handlers/asciidoc_handler_spec.rb} +2 -3
  61. data/spec/{coffeescript_handler_spec.rb → awestruct/handlers/coffeescript_handler_spec.rb} +0 -0
  62. data/spec/{erb_handler_spec.rb → awestruct/handlers/erb_handler_spec.rb} +0 -0
  63. data/spec/{file_handler_spec.rb → awestruct/handlers/file_handler_spec.rb} +7 -7
  64. data/spec/{front_matter_handler_spec.rb → awestruct/handlers/front_matter_handler_spec.rb} +1 -1
  65. data/spec/{haml_handler_spec.rb → awestruct/handlers/haml_handler_spec.rb} +0 -0
  66. data/spec/{interpolation_handler_spec.rb → awestruct/handlers/interpolation_handler_spec.rb} +1 -1
  67. data/spec/{javascript_handler_spec.rb → awestruct/handlers/javascript_handler_spec.rb} +0 -0
  68. data/spec/{layout_handler_spec.rb → awestruct/handlers/layout_handler_spec.rb} +1 -1
  69. data/spec/{less_handler_spec.rb → awestruct/handlers/less_handler_spec.rb} +0 -0
  70. data/spec/{markdown_handler_spec.rb → awestruct/handlers/markdown_handler_spec.rb} +0 -0
  71. data/spec/{mustache_handler_spec.rb → awestruct/handlers/mustache_handler_spec.rb} +1 -0
  72. data/spec/{orgmode_handler_spec.rb → awestruct/handlers/orgmode_handler_spec.rb} +0 -0
  73. data/spec/{page_delegating_handler_spec.rb → awestruct/handlers/page_delegating_handler_spec.rb} +1 -1
  74. data/spec/{redirect_handler_spec.rb → awestruct/handlers/redirect_handler_spec.rb} +0 -0
  75. data/spec/{restructuredtext_handler_spec.rb → awestruct/handlers/restructuredtext_handler_spec.rb} +0 -0
  76. data/spec/{sass_handler_spec.rb → awestruct/handlers/sass_handler_spec.rb} +0 -0
  77. data/spec/{scss_handler_spec.rb → awestruct/handlers/scss_handler_spec.rb} +0 -0
  78. data/spec/{slim_handler_spec.rb → awestruct/handlers/slim_handler_spec.rb} +0 -0
  79. data/spec/{textile_handler_spec.rb → awestruct/handlers/textile_handler_spec.rb} +1 -0
  80. data/spec/{tilt_handler_spec.rb → awestruct/handlers/tilt_handler_spec.rb} +6 -8
  81. data/spec/{yaml_handler_spec.rb → awestruct/handlers/yaml_handler_spec.rb} +1 -1
  82. data/spec/config_spec.rb +3 -3
  83. data/spec/engine_spec.rb +30 -43
  84. data/spec/layouts_spec.rb +1 -1
  85. data/spec/minify_spec.rb +10 -10
  86. data/spec/page_loader_spec.rb +1 -1
  87. data/spec/page_loader_spec_for_layouts.rb +1 -1
  88. data/spec/page_spec.rb +1 -1
  89. data/spec/posts_archive_spec.rb +7 -7
  90. data/spec/server_spec.rb +1 -1
  91. data/spec/spec_helper.rb +2 -13
  92. data/spec/support/awestruct_setup.rb +30 -0
  93. data/spec/support/emmet_matchers.rb +4 -0
  94. data/spec/support/nokogiri_matchers.rb +4 -0
  95. data/spec/support/shared_handler_example.rb +1 -1
  96. data/spec/support/test-config/_config/site.yml +1 -0
  97. data/spec/{test-data → support/test-data}/.awestruct_ignore +0 -0
  98. data/spec/{test-data → support/test-data}/engine/_config/arbitrary.yml +0 -0
  99. data/spec/{test-data/gzip/no.html.gz → support/test-data/engine/_config/compass.rb} +0 -0
  100. data/spec/{test-data → support/test-data}/engine/_config/other.yml +0 -0
  101. data/spec/{test-data → support/test-data}/engine/_config/site.yml +3 -0
  102. data/spec/{test-data → support/test-data}/front-matter-empty.txt +0 -0
  103. data/spec/{test-data → support/test-data}/front-matter-file-no-content.txt +0 -0
  104. data/spec/{test-data → support/test-data}/front-matter-file-no-front.txt +0 -0
  105. data/spec/{test-data → support/test-data}/front-matter-file-utf8.txt +0 -0
  106. data/spec/{test-data → support/test-data}/front-matter-file.txt +0 -0
  107. data/spec/{test-data → support/test-data}/front-matter-looking.txt +0 -0
  108. data/spec/{test-data → support/test-data}/front-matter-middle.txt +0 -0
  109. data/spec/{test-data/gzip/no.txt → support/test-data/gzip/no.html.gz} +0 -0
  110. data/spec/{test-data/handlers/textile-empty-page.textile → support/test-data/gzip/no.txt} +0 -0
  111. data/spec/{test-data → support/test-data}/gzip/subdir/yes.css +0 -0
  112. data/spec/{test-data → support/test-data}/gzip/yes.html +0 -0
  113. data/spec/{test-data → support/test-data}/gzip/yes.js +0 -0
  114. data/spec/{test-data → support/test-data}/handlers/asciidoc-page.ad +0 -0
  115. data/spec/{test-data → support/test-data}/handlers/asciidoc-page.adoc +0 -0
  116. data/spec/{test-data → support/test-data}/handlers/asciidoc-page.asciidoc +0 -0
  117. data/spec/{test-data → support/test-data}/handlers/asciidoc_with_attributes.ad +0 -0
  118. data/spec/{test-data → support/test-data}/handlers/asciidoc_with_interpolation.ad +0 -0
  119. data/spec/{test-data → support/test-data}/handlers/asciidoc_without_interpolation.ad +0 -0
  120. data/spec/{test-data → support/test-data}/handlers/asciidoctor_with_front_matter.ad +0 -0
  121. data/spec/{test-data → support/test-data}/handlers/asciidoctor_with_headers.ad +0 -0
  122. data/spec/{test-data → support/test-data}/handlers/coffeescript-page.coffee +0 -0
  123. data/spec/{test-data → support/test-data}/handlers/empty-layout.haml +0 -0
  124. data/spec/{test-data → support/test-data}/handlers/erb-page.html.erb +0 -0
  125. data/spec/{test-data → support/test-data}/handlers/erb-page.xml.erb +0 -0
  126. data/spec/{test-data → support/test-data}/handlers/erb-utf-page.html.erb +0 -0
  127. data/spec/{test-data → support/test-data}/handlers/haml-error.html.haml +0 -0
  128. data/spec/{test-data → support/test-data}/handlers/haml-layout-two.html.haml +0 -0
  129. data/spec/{test-data → support/test-data}/handlers/haml-layout.html.haml +0 -0
  130. data/spec/{test-data → support/test-data}/handlers/haml-page.atom.haml +0 -0
  131. data/spec/{test-data → support/test-data}/handlers/haml-page.html.haml +0 -0
  132. data/spec/{test-data → support/test-data}/handlers/haml-page.xml.haml +0 -0
  133. data/spec/{test-data → support/test-data}/handlers/haml-with-markdown-page.html.haml +0 -0
  134. data/spec/{test-data → support/test-data}/handlers/haml-with-textile-page.html.haml +0 -0
  135. data/spec/{test-data → support/test-data}/handlers/haml-with-utf.html.haml +0 -0
  136. data/spec/{test-data → support/test-data}/handlers/haml-with-variables.html.haml +0 -0
  137. data/spec/{test-data → support/test-data}/handlers/hello.bogus +0 -0
  138. data/spec/{test-data → support/test-data}/handlers/inner-page.html.haml +0 -0
  139. data/spec/{test-data → support/test-data}/handlers/javascript-page.js +0 -0
  140. data/spec/{test-data → support/test-data}/handlers/less-page-include.less +0 -0
  141. data/spec/{test-data → support/test-data}/handlers/less-page-with-import.less +0 -0
  142. data/spec/{test-data → support/test-data}/handlers/less-page.less +0 -0
  143. data/spec/{test-data → support/test-data}/handlers/markdown-page.markdown +0 -0
  144. data/spec/{test-data → support/test-data}/handlers/markdown-page.md +0 -0
  145. data/spec/{test-data → support/test-data}/handlers/markdown-page.mkd +0 -0
  146. data/spec/{test-data → support/test-data}/handlers/mustache-page.html.mustache +0 -0
  147. data/spec/{test-data → support/test-data}/handlers/mustache-page.xml.mustache +0 -0
  148. data/spec/{test-data → support/test-data}/handlers/orgmode-page.org +0 -0
  149. data/spec/{test-data → support/test-data}/handlers/outer-layout.html.haml +0 -0
  150. data/spec/{test-data → support/test-data}/handlers/outside_relative/git_keep +0 -0
  151. data/spec/{test-data → support/test-data}/handlers/redirect-page.redirect +0 -0
  152. data/spec/{test-data → support/test-data}/handlers/restructuredtext-page.rst +0 -0
  153. data/spec/{test-data → support/test-data}/handlers/sass-page-include.sass +0 -0
  154. data/spec/{test-data → support/test-data}/handlers/sass-page.sass +0 -0
  155. data/spec/{test-data → support/test-data}/handlers/scss-page-include.scss +0 -0
  156. data/spec/{test-data → support/test-data}/handlers/scss-page.scss +0 -0
  157. data/spec/{test-data → support/test-data}/handlers/simple-redirect-page.redirect +0 -0
  158. data/spec/{test-data → support/test-data}/handlers/slim-page.atom.slim +0 -0
  159. data/spec/{test-data → support/test-data}/handlers/slim-page.html.slim +0 -0
  160. data/spec/{test-data → support/test-data}/handlers/slim-page.xml.slim +0 -0
  161. data/spec/{test-data → support/test-data}/handlers/slim-with-markdown-page.html.slim +0 -0
  162. data/spec/{test-data → support/test-data}/handlers/slim-with-utf.html.slim +0 -0
  163. data/spec/{test-data → support/test-data}/handlers/slim-with-variables.html.slim +0 -0
  164. data/spec/support/test-data/handlers/textile-empty-page.textile +0 -0
  165. data/spec/{test-data → support/test-data}/handlers/textile-page.textile +0 -0
  166. data/spec/{test-data → support/test-data}/images/logo.png +0 -0
  167. data/spec/{test-data → support/test-data}/index.html +0 -0
  168. data/spec/{test-data → support/test-data}/javascript/bootstrap-dropdown.js +0 -0
  169. data/spec/{test-data → support/test-data}/out-of-site/page-three.html.haml +0 -0
  170. data/spec/support/test-data/page-loader/.awestruct_ignore +2 -0
  171. data/spec/{test-data → support/test-data}/page-loader/_layouts/layout-one.md +0 -0
  172. data/spec/{test-data → support/test-data}/page-loader/_layouts/layout-two.html.haml +0 -0
  173. data/spec/{test-data → support/test-data}/page-loader/page-draft.md +0 -0
  174. data/spec/{test-data → support/test-data}/page-loader/page-one.md +0 -0
  175. data/spec/{test-data → support/test-data}/page-loader/page-two.html.haml +0 -0
  176. data/spec/{test-data → support/test-data}/simple-data.yaml +0 -0
  177. data/spec/{test-data → support/test-data}/simple-file.txt +0 -0
  178. data/spec/{test-data → support/test-data}/stylesheets/screen.css +0 -0
  179. data/spec/{test-data → support/test-data}/subdir/index.html +0 -0
  180. metadata +251 -232
@@ -0,0 +1,108 @@
1
+ require 'compass/configuration/defaults'
2
+
3
+ module Awestruct
4
+ module Compass
5
+ class DefaultConfiguration
6
+ #include ::Compass::Configuration::Defaults
7
+
8
+ attr_reader :site
9
+
10
+ def initialize site
11
+ @site = site
12
+ end
13
+
14
+ #def top_level
15
+ #self
16
+ #end
17
+
18
+ def project_type
19
+ :stand_alone
20
+ end
21
+
22
+ def environment
23
+ site.profile
24
+ end
25
+
26
+ def project_path
27
+ site.config.dir
28
+ end
29
+
30
+ def sass_dir
31
+ File.join site.config.dir, 'stylesheets'
32
+ end
33
+
34
+ def http_path
35
+ site.base_url
36
+ end
37
+
38
+ def css_dir
39
+ site.css_dir
40
+ end
41
+
42
+ def javascripts_dir
43
+ File.join site.config.dir, 'javascripts'
44
+ end
45
+
46
+ def http_javascripts_dir
47
+ File.join http_path, 'javascripts'
48
+ end
49
+
50
+ def http_stylesheets_dir
51
+ File.join http_path, 'stylesheets'
52
+ end
53
+
54
+ def images_dir
55
+ File.join site.config.dir, 'images'
56
+ end
57
+
58
+ def generated_images_dir
59
+ File.join site.output_path, 'images'
60
+ end
61
+
62
+ def http_generated_images_dir
63
+ File.join http_path, 'images'
64
+ end
65
+
66
+ def sprite_load_path
67
+ [images_path]
68
+ end
69
+
70
+ def images_path
71
+ File.join project_path, 'images'
72
+ end
73
+
74
+ def http_images_dir
75
+ File.join http_path, 'images'
76
+ end
77
+
78
+ def fonts_dir
79
+ File.join site.config.dir, 'fonts'
80
+ end
81
+
82
+ def http_fonts_dir
83
+ File.join http_path, 'fonts'
84
+ end
85
+
86
+ def line_comments
87
+ site.key?(:compass_line_comments) ? !!site.compass_line_comments : !site.profile.eql?('production')
88
+ end
89
+
90
+ def output_style
91
+ site.key?(:compass_output_style) ? site.compass_output_style.to_sym : site.profile.eql?('production') ? :compressed : :expanded
92
+ end
93
+
94
+ def relative_assets
95
+ false
96
+ end
97
+
98
+ def cache_dir
99
+ File.join site.config.dir, '.sass-cache'
100
+ end
101
+
102
+ def inherit_from! data
103
+ return
104
+ end
105
+ end
106
+ end
107
+ end
108
+
@@ -19,20 +19,21 @@ module Awestruct
19
19
  attr_accessor :stylesheets_dir
20
20
 
21
21
  attr_accessor :verbose
22
+ attr_accessor :quiet
22
23
  attr_accessor :options
23
24
 
24
25
  def initialize(opts = Awestruct::CLI::Options.new)
25
- @dir = Pathname.new( opts.source_dir )
26
- @layouts_dir = Pathname.new( File.join(@dir, '_layouts') )
27
- @config_dir = Pathname.new( File.join(@dir, '_config') )
28
- @input_dir = Pathname.new( File.join(@dir, '') )
29
- @output_dir = Pathname.new( opts.output_dir )
30
- @extension_dir = Pathname.new( File.join(@dir, '_ext') )
31
- @skin_dir = Pathname.new( File.join(@dir, '_skin') )
32
- @tmp_dir = Pathname.new( File.join(@dir, '_tmp') )
33
-
26
+ @dir = Pathname.new( opts.source_dir )
27
+ @layouts_dir = Pathname.new( File.join(@dir, '_layouts') )
28
+ @config_dir = Pathname.new( File.join(@dir, '_config') )
29
+ @input_dir = @dir
30
+ @output_dir = Pathname.new( opts.output_dir )
31
+ @extension_dir = Pathname.new( File.join(@dir, '_ext') )
32
+ @skin_dir = Pathname.new( File.join(@dir, '_skin') )
33
+ @tmp_dir = Pathname.new( File.join(@dir, '_tmp') )
34
34
  @images_dir = Pathname.new( File.join(@dir, 'images') )
35
35
  @stylesheets_dir = Pathname.new( File.join(@dir, 'stylesheets') )
36
+
36
37
  @options = opts
37
38
 
38
39
  # Dir[] doesn't like empty list
@@ -41,7 +42,7 @@ module Awestruct
41
42
  ignore_stmts = IO.read(ignore_file).each_line.map(&:strip)
42
43
  end
43
44
 
44
- @ignore = (!ignore_stmts.nil? and ignore_stmts.size > 0) ? Dir[*ignore_stmts] : []
45
+ @ignore = (!ignore_stmts.nil? and ignore_stmts.size > 0) ? Dir[*ignore_stmts] : []
45
46
 
46
47
  @track_dependencies = false
47
48
  end
@@ -1,4 +1,5 @@
1
1
  encoding: UTF-8
2
+ interpolate: false
2
3
 
3
4
  content_syntax:
4
5
  coffee: coffeescript
@@ -1,4 +1,3 @@
1
-
2
1
  require 'awestruct/astruct'
3
2
 
4
3
  module Awestruct
@@ -1,4 +1,3 @@
1
-
2
1
  module Awestruct
3
2
  class Dependencies
4
3
 
@@ -48,7 +47,7 @@ module Awestruct
48
47
 
49
48
 
50
49
  def self.track_dependency(dep)
51
- return if top_page.nil?
50
+ return if top_page.nil?
52
51
  return if top_page == dep
53
52
  $LOG.debug "dep #{top_page.relative_source_path} - #{dep.relative_source_path}" if $LOG.debug?
54
53
  top_page.dependencies.add_dependency(dep)
@@ -139,12 +138,12 @@ module Awestruct
139
138
 
140
139
  def clear
141
140
  @dependencies.clear
142
- @dependents.each do |d|
143
- if (d.instance_of? Awestruct::Dependencies)
144
- d.remove_dependent( page )
145
- else
146
- d.dependencies.remove_dependent( page )
147
- end
141
+ @dependents.each do |d|
142
+ if (d.instance_of? Awestruct::Dependencies)
143
+ d.remove_dependent( page )
144
+ else
145
+ d.dependencies.remove_dependent( page )
146
+ end
148
147
  end
149
148
  end
150
149
 
@@ -196,6 +195,5 @@ module Awestruct
196
195
  page.site.pages_by_relative_source_path[ path ]
197
196
  end
198
197
 
199
-
200
198
  end
201
199
  end
@@ -27,6 +27,11 @@ module Awestruct
27
27
  end
28
28
 
29
29
  def run
30
+ if ExceptionHelper.build_failed?
31
+ ExceptionHelper.log_message 'Not running deploy due to build failure'
32
+ return
33
+ end
34
+
30
35
  if @ignore_uncommitted == true
31
36
  compress_site
32
37
  publish_site
@@ -98,6 +103,7 @@ module Awestruct
98
103
  @scm = clazz.new
99
104
  rescue
100
105
  ExceptionHelper.log_message( "Could not resolve class for scm type: #{type}" )
106
+ ExceptionHelper.mark_failed
101
107
  end
102
108
  end
103
109
  end
@@ -45,6 +45,7 @@ module Awestruct
45
45
  git.commit("Published #{@branch} to GitHub pages.")
46
46
  rescue ::Git::GitExecuteError => e
47
47
  ExceptionHelper.log_message "Can't commit. #{e}."
48
+ ExceptionHelper.mark_failed
48
49
  end
49
50
  end
50
51
  git.reset_hard
@@ -27,25 +27,29 @@ module Awestruct
27
27
  threads << Thread.new(stdout) do |i|
28
28
  while ( ! i.eof? )
29
29
  line = i.readline
30
- case line[0,9]
30
+ head = line[0,9]
31
+ file = line[10..-1].chomp
32
+ case head
31
33
  when '<f.sT....'
32
- $LOG.info " updating #{line[10..-1]}" if $LOG.info?
34
+ $LOG.info " updating #{file}" if $LOG.info?
33
35
  when 'cd+++++++'
34
- $LOG.info " creating #{line[10..-1]}" if $LOG.info?
36
+ $LOG.info " creating #{file}" if $LOG.info?
35
37
  when '<f+++++++'
36
- $LOG.info " adding #{line[10..-1]}" if $LOG.info?
38
+ $LOG.info " adding #{file}" if $LOG.info?
37
39
  when '<f..T....'
38
40
  # ignoring unchanged files
39
- $LOG.debug " no change to #{line[10..-1]}" if $LOG.debug?
41
+ $LOG.debug " no change to #{file}" if $LOG.debug?
42
+ when '*deleting'
43
+ $LOG.info " deleting #{file}" if $LOG.info?
40
44
  else
41
- $LOG.info line if $LOG.info
45
+ $LOG.debug line if $LOG.debug
42
46
  end
43
47
  end
44
48
  end
45
49
  threads << Thread.new(stderr) do |i|
46
50
  while ( ! i.eof? )
47
51
  line = i.readline
48
- $LOG.info line if $LOG.info?
52
+ $LOG.error line if $LOG.error?
49
53
  end
50
54
  end
51
55
  threads.each{|t|t.join}
@@ -1,4 +1,3 @@
1
-
2
1
  module Awestruct
3
2
 
4
3
  class Deployers < Hash
@@ -2,6 +2,7 @@ require 'awestruct/util/inflector'
2
2
  require 'awestruct/util/default_inflections'
3
3
 
4
4
  require 'awestruct/config'
5
+ require 'awestruct/compass/default_configuration'
5
6
  require 'awestruct/site'
6
7
  require 'awestruct/pipeline'
7
8
  require 'awestruct/page'
@@ -12,6 +13,8 @@ require 'awestruct/extensions/pipeline'
12
13
  require 'fileutils'
13
14
  require 'set'
14
15
 
16
+ require 'compass'
17
+
15
18
  class OpenStruct
16
19
  def inspect
17
20
  "OpenStruct{...}"
@@ -123,9 +126,10 @@ module Awestruct
123
126
 
124
127
  def load_site_yaml(yaml_path, profile = nil)
125
128
  if ( File.exist?( yaml_path ) )
126
- data = YAML.load( File.read( yaml_path ) )
129
+ data = YAML.load( File.read( yaml_path, :encoding => 'bom|utf-8' ) )
127
130
  if ( profile )
128
- site.interpolate = true
131
+ # JP: Interpolation now turned off by default, turn it per page if needed
132
+ site.interpolate = false
129
133
  profile_data = {}
130
134
  data.each do |k,v|
131
135
  if ( ( k == 'profiles' ) && ( ! profile.nil? ) )
@@ -235,24 +239,21 @@ module Awestruct
235
239
  pipeline.execute( site )
236
240
  end
237
241
 
238
- def configure_compass
239
- Compass.configuration.project_type = :standalone
240
- Compass.configuration.project_path = site.config.dir
241
- Compass.configuration.sass_dir = 'stylesheets'
242
- Compass.configuration.http_path = site.base_url
243
-
242
+ def configure_compass
244
243
  site.images_dir = File.join( site.config.output_dir, 'images' )
245
244
  site.fonts_dir = File.join( site.config.output_dir, 'fonts' )
246
245
  site.stylesheets_dir = File.join( site.config.output_dir, 'stylesheets' )
247
246
  site.javascripts_dir = File.join( site.config.output_dir, 'javascripts' )
248
247
 
249
- Compass.configuration.css_dir = site.css_dir
250
- Compass.configuration.javascripts_dir = 'javascripts'
251
- Compass.configuration.images_dir = 'images'
252
- Compass.configuration.fonts_dir = 'fonts'
253
- Compass.configuration.line_comments = include_line_comments?
254
- Compass.configuration.output_style = compress_css?
255
- Compass.configuration.relative_assets = false
248
+ compass_config_file = File.join(site.config.config_dir, 'compass.rb')
249
+ if (File.exists? compass_config_file)
250
+ compass_configuration = ::Compass::Configuration::FileData.new_from_file(compass_config_file)
251
+ compass_configuration.inherit_from! ::Awestruct::Compass::DefaultConfiguration.new(site)
252
+ ::Compass.add_configuration compass_configuration
253
+ else
254
+ ::Compass.configuration.inherit_from! ::Awestruct::Compass::DefaultConfiguration.new(site)
255
+ end
256
+
256
257
  # TODO: Should we add an on_stylesheet_error block?
257
258
 
258
259
  # port old style configuration to new Tilt-based configuration
@@ -266,23 +267,15 @@ module Awestruct
266
267
  end
267
268
 
268
269
  if !sass_config.has_key?(:line_numbers) || site.profile.eql?('production')
269
- sass_config[:line_numbers] = Compass.configuration.line_comments
270
+ sass_config[:line_numbers] = ::Compass.configuration.line_comments
270
271
  end
271
272
 
272
273
  if !sass_config.has_key?(:style) || site.profile.eql?('production')
273
- sass_config[:style] = Compass.configuration.output_style
274
+ sass_config[:style] = ::Compass.configuration.output_style
274
275
  end
275
276
  end
276
277
  end
277
278
 
278
- def include_line_comments?
279
- site.key?(:compass_line_comments) ? !!site.compass_line_comments : !site.profile.eql?('production')
280
- end
281
-
282
- def compress_css?
283
- site.key?(:compass_output_style) ? site.compass_output_style.to_sym : site.profile.eql?('production') ? :compressed : :expanded
284
- end
285
-
286
279
  def load_pages
287
280
  $LOG.debug "layout_page_loader.load_all :post" if $LOG.debug?
288
281
  @layout_page_loader.load_all( :post )
@@ -304,7 +297,7 @@ module Awestruct
304
297
 
305
298
  def generate_page(page, generated_path, produce_output=true)
306
299
  if ( produce_output )
307
- $LOG.debug "Generating: #{generated_path}" if $LOG.debug?
300
+ $LOG.info "Generating: #{generated_path}" if $LOG.info? && !config.quiet
308
301
  FileUtils.mkdir_p( File.dirname( generated_path ) )
309
302
 
310
303
  c = page.rendered_content
@@ -323,19 +316,28 @@ module Awestruct
323
316
  end
324
317
  end
325
318
 
326
- def generate_page_by_output_path(path)
327
- full_path = File.join( '', path )
328
- page = site.pages.find{ |p| p.relative_source_path.to_s == full_path } ||
329
- site.layouts.find{ |p| p.relative_source_path.to_s == full_path }
330
- return if page.nil?
319
+ # path - relative to output dir
320
+ def page_by_output_path(path)
321
+ site.pages.find { |p|
322
+ p.source_path.to_s == path
323
+ } || site.layouts.find { |p|
324
+ p.source_path.to_s == path
325
+ }
326
+ end
327
+
328
+ def generate_page_and_dependencies(page)
329
+
330
+ if page.nil?
331
+ return
332
+ end
331
333
 
332
334
  if !page.output_path.nil?
333
335
  generate_page_internal(page)
334
336
  end
335
337
 
336
- pages = [] << page
338
+ pages = [ page ]
337
339
 
338
- pages.each{|page|
340
+ pages.each do |page|
339
341
  $LOG.debug "--------------------" if $LOG.debug?
340
342
  $LOG.debug "Page: #{page.output_path} #{page.relative_source_path} #{page.__is_layout ? 'Layout':''}" if $LOG.debug?
341
343
  $LOG.debug "Detected change in content (#{page.dependencies.content_hash})" if page.dependencies.has_changed_content if $LOG.debug?
@@ -349,12 +351,14 @@ module Awestruct
349
351
  $LOG.debug "\t\t Content <- #{page.dependencies.dependents.size}" if $LOG.debug?
350
352
  $LOG.debug "\t\t Key <- #{page.dependencies.key_dependents.size}" if $LOG.debug?
351
353
  $LOG.debug "--------------------" if $LOG.debug?
352
- }
354
+ end
353
355
 
354
356
  regen_pages = Set.new
357
+
355
358
  if page.dependencies.has_changed_content or page.__is_layout
356
359
  regen_pages += page.dependencies.dependents
357
360
  end
361
+
358
362
  regen_pages = regen_pages.sort do |x, y|
359
363
  xf = "#{@site.dir}#{x.relative_source_path}"
360
364
  yf = "#{@site.dir}#{y.relative_source_path}"
@@ -367,11 +371,13 @@ module Awestruct
367
371
  end
368
372
 
369
373
  $LOG.debug "Starting regeneration of content dependent pages:" if regen_pages.size > 0 && $LOG.debug?
370
- regen_pages.each{|x| $LOG.info x.output_path if $LOG.info?}
371
374
 
372
375
  regen_pages.each do |p|
373
376
  generate_page_internal(p)
377
+ pages << p
374
378
  end
379
+
380
+ pages
375
381
  end
376
382
 
377
383
  def generate_page_internal(p)
@@ -382,9 +388,7 @@ module Awestruct
382
388
  end
383
389
 
384
390
  ####
385
- ##
386
391
  ## compat with awestruct 0.2.x
387
- ##
388
392
  ####
389
393
 
390
394
  def load_page(path, options={})
@@ -3,11 +3,11 @@ module Awestruct
3
3
  module Cachebuster
4
4
 
5
5
  def cache(href)
6
- "#{href}?#{cachebuster}"
6
+ "#{href}?#{cachebuster}"
7
7
  end
8
8
 
9
9
  def cachebuster(p=page)
10
- ((site.timestamp || p.input_mtime || Time.now.to_i) / 1000).to_i.to_s
10
+ ((site.timestamp || p.input_mtime || Time.now.to_i) / 1000).to_i.to_s
11
11
  end
12
12
 
13
13
  end