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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e5fd572c73f3b019598a5f63b741c5d0df96fcd0
4
+ data.tar.gz: 76e36c5b3f687e42c7d819f3a5e21b9ab938a027
5
+ SHA512:
6
+ metadata.gz: d904e79ab4c23037895cd7b1a916b08c7e2d8b0d21abcf5de54fb2d2981427b2d5a354d26af7cfda9eab520d89ea3f3c60537ed5b8e7717751a68337a787635c
7
+ data.tar.gz: 1e3dd26392ccc0179eee5b29573a0a6b358e35eb8e12b758d5ab4cc10eb827c002352bc3934a38b2541d58b399c3024fbb12f2dc19941176397f847d9da0fd58
data/Gemfile CHANGED
@@ -1,29 +1,33 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  group :development do
4
- gem 'spectator', '>= 1.2.5'
5
- gem 'hashery', '>= 2.1.0'
6
- gem 'rspec', '>= 2.9'
7
- gem 'rake', '>= 0.9.2'
4
+ gem 'spectator', '~> 1.2.6'
5
+ gem 'hashery', '~> 2.1.1'
6
+ gem 'rspec', '~> 2.14.1'
7
+ gem 'rake', '~> 10.2.2'
8
+ gem 'guard-rspec', '~> 4.2.0', :require => false
9
+ gem 'pry', '~> 0.9.12', :require => false
10
+ gem 'pry-nav', '~> 0.2', :require => false
8
11
  end
9
12
 
10
13
  group :test do
11
- gem 'rb-inotify', '>= 0.9.0'
12
- gem 'rack-test'
13
- gem 'tilt', '>= 1.3.5', '< 2.0'
14
- gem 'coffee-script', '>= 2.2.0'
15
- gem 'asciidoctor', '>= 0.1.3' # >= 0.1.1 is required for front matter integration
16
- gem 'slim', '>= 1.3.6'
17
- gem 'kramdown', '>= 0.14.2'
18
- gem 'therubyracer', '0.10.0', :platforms => :ruby
19
- gem 'therubyrhino', '~> 2.0.2', :platforms => :jruby
20
- gem 'less', '>= 2.2.2'
21
- gem 'org-ruby', '>= 0.7'
22
- gem 'RedCloth', '>= 4.2.9'
23
- gem 'mustache', '>= 0.99.4'
24
- gem 'uglifier', '>= 1.3.0'
25
- gem 'htmlcompressor', '>= 0.0.7'
26
- gem 'git', '~> 1.2.5'
14
+ gem 'rb-inotify', '~> 0.9.3'
15
+ gem 'rack-test', '~> 0.6.2'
16
+ gem 'tilt', '~> 2.0.1'
17
+ gem 'coffee-script', '~> 2.2.0'
18
+ gem 'asciidoctor', '~> 0.1.4'
19
+ gem 'slim', '~> 2.0.2'
20
+ gem 'kramdown', '~> 1.3.3'
21
+ gem 'therubyracer', '~> 0.10.0', :platforms => :ruby
22
+ gem 'therubyrhino', '~> 2.0.3', :platforms => :jruby
23
+ gem 'less', '~> 2.5.0'
24
+ gem 'org-ruby', '~> 0.9.3'
25
+ gem 'RedCloth', '~> 4.2.9'
26
+ gem 'mustache', '~> 0.99.5'
27
+ gem 'uglifier', '~> 2.5.0'
28
+ gem 'htmlcompressor', '~> 0.0.7'
29
+ gem 'haml-contrib', '~> 1.0.0'
30
+ gem "win32-open3-19", :platforms => :mingw # htmlcompressor depends on old yui compressor, that needs this on win32
27
31
  end
28
32
 
29
33
  gemspec
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2013 Bob McWhirter and contributors (see git log)
1
+ Copyright (c) 2010-2014 Bob McWhirter and contributors (see git log)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to
@@ -6,13 +6,13 @@ deal in the Software without restriction, including without limitation the
6
6
  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
7
  sell copies of the Software, and to permit persons to whom the Software is
8
8
  furnished to do so, subject to the following conditions:
9
-
9
+
10
10
  The above copyright notice and this permission notice shall be included in
11
11
  all copies or substantial portions of the Software.
12
-
12
+
13
13
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
14
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
15
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
17
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
18
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -8,7 +8,7 @@ Please see the complete site at <http://awestruct.org/>.
8
8
 
9
9
  # License
10
10
 
11
- Copyright (c) 2010-2011 Bob McWhirter and contributors (see git log)
11
+ Copyright (c) 2010-2014 Bob McWhirter and contributors (see git log)
12
12
 
13
13
  Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  of this software and associated documentation files (the "Software"), to
@@ -16,16 +16,16 @@ Please see the complete site at <http://awestruct.org/>.
16
16
  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
17
17
  sell copies of the Software, and to permit persons to whom the Software is
18
18
  furnished to do so, subject to the following conditions:
19
-
19
+
20
20
  The above copyright notice and this permission notice shall be included in
21
21
  all copies or substantial portions of the Software.
22
-
22
+
23
23
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
24
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
25
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
26
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
27
27
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28
28
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
29
 
30
- It also uses code from the Sequel project under the same license.
30
+ It also uses code from the Sequel project under the same license.
31
31
 
@@ -4,7 +4,7 @@ require 'awestruct/version'
4
4
  spec = Gem::Specification.new do |s|
5
5
  s.name = 'awestruct'
6
6
  s.version = Awestruct::VERSION
7
- s.date = '2013-12-03'
7
+ s.date = '2014-04-07'
8
8
 
9
9
  s.authors = ['Bob McWhirter', 'Jason Porter', 'Lance Ball', 'Dan Allen', 'Torsten Curdt', 'other contributors']
10
10
  s.email = ['bob@mcwhirter.org', 'lightguard.jp@gmail.com', 'lball@redhat.com', 'dan.j.allen@gmail.com', 'tcurdt@vafer.org']
@@ -32,17 +32,20 @@ Any markup languages you are using and its dependencies.
32
32
  Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if you're running on MRI. JRuby should be using haml 4.0.0+ with Kramdown.'
33
33
  EOS
34
34
 
35
- s.add_dependency 'haml', '~> 4.0.1'
36
- s.add_dependency 'nokogiri', '1.5.10'
37
- s.add_dependency 'tilt', '>= 1.3.5', '< 2.0'
38
- s.add_dependency 'compass', '>= 0.12.1'
35
+ s.add_dependency 'haml', '~> 4.0.5'
36
+ s.add_dependency 'asciidoctor' # we're pretty good about backwards compat
37
+ s.add_dependency 'nokogiri', '~> 1.5.10'
38
+ s.add_dependency 'tilt', '~> 2.0.1'
39
+ s.add_dependency 'compass', '~> 0.12.4'
39
40
  s.add_dependency 'compass-960-plugin', '~> 0.10.4'
40
- s.add_dependency 'bootstrap-sass', '>= 2.3.1.0'
41
- s.add_dependency 'zurb-foundation', '>= 4.0.9', '< 5.0'
42
- s.add_dependency 'mime-types', '1.25'
43
- s.add_dependency 'rest-client', '>= 1.6.7'
41
+ s.add_dependency 'bootstrap-sass', '~> 3.1.1.0'
42
+ s.add_dependency 'zurb-foundation', '~> 4.3.2'
43
+ s.add_dependency 'mime-types', '~> 2.1'
44
+ s.add_dependency 'rest-client', '~> 1.6.7'
44
45
  s.add_dependency 'ruby-s3cmd', '~> 0.1.5'
45
-
46
- s.add_dependency 'listen', '~> 1.0'
46
+ s.add_dependency 'listen', '~> 2.7.1'
47
47
  s.add_dependency 'rack', '~> 1.5.2'
48
+ s.add_dependency 'git', '~> 1.2.6'
49
+ s.add_dependency 'guard-livereload', '~> 2.1.2'
50
+ s.add_dependency 'colorize', '~> 0.7.1'
48
51
  end
@@ -1,4 +1,3 @@
1
-
2
1
  require 'awestruct/dependencies'
3
2
 
4
3
  module Awestruct
@@ -1,28 +1,34 @@
1
- #require 'guard/awestruct'
2
1
  require 'awestruct/util/exception_helper'
3
2
 
4
3
  require 'listen'
4
+ require 'guard/livereload'
5
5
 
6
6
  module Awestruct
7
7
  module CLI
8
8
  class Auto
9
9
 
10
- def initialize(config)
10
+ def initialize(config, base_url)
11
11
  @config = config
12
+ @base_url = base_url
12
13
  end
13
14
 
14
15
  def run()
15
16
  generate_thread = nil
16
17
  current_path = nil
17
18
 
19
+ guard = if ( @config.options.livereload )
20
+ guard = Guard::LiveReload.new
21
+ guard.start
22
+ guard
23
+ else
24
+ nil
25
+ end
26
+
18
27
  force_polling = ( RUBY_PLATFORM =~ /mingw/ ? true : false )
19
- listener = Listen.to( @config.dir, :relative_paths=>true, :latency=>0.5, :force_polling=>force_polling )
20
- listener.ignore( %r(\.awestruct) )
21
- listener.ignore( %r(^#{File.basename( @config.tmp_dir )}) )
22
- listener.ignore( %r(^#{File.basename( @config.output_dir )}) )
23
- listener.change do |modified, added, removed|
24
- modified.each do |path|
28
+ listener = Listen.to( @config.dir, :latency=>0.5, :force_polling=>force_polling ) do |modified, added, removed|
29
+ modified.each do |path| # path is absolute path
25
30
  engine = ::Awestruct::Engine.instance
31
+
26
32
  unless ( path =~ %r(#{File.basename( engine.config.output_dir) }) || path =~ /.awestruct/ )
27
33
  begin
28
34
  if path.eql? current_path
@@ -37,8 +43,26 @@ module Awestruct
37
43
 
38
44
  generate_thread = Thread.new {
39
45
  begin
40
- engine.generate_page_by_output_path( path )
41
- $LOG.info "Generating.... done!" if $LOG.info?
46
+
47
+ page = engine.page_by_output_path(path)
48
+ if ( page )
49
+
50
+ pages = engine.generate_page_and_dependencies( page )
51
+
52
+ if ( guard )
53
+ urls = pages.map do |p|
54
+ @base_url + p.url.to_s
55
+ end
56
+
57
+ guard.run_on_modifications(urls)
58
+ end
59
+
60
+ $LOG.info "Regeneration finished." if $LOG.info?
61
+
62
+ else
63
+ $LOG.error "Failed to find page from path #{path}"
64
+ end
65
+
42
66
  rescue => e
43
67
  ExceptionHelper.log_building_error e, path
44
68
  end
@@ -49,7 +73,10 @@ module Awestruct
49
73
  end
50
74
  end
51
75
  end
52
- listener.start(false)
76
+ listener.ignore( %r(\.awestruct) )
77
+ listener.ignore( %r(^#{File.basename( @config.tmp_dir )}) )
78
+ listener.ignore( %r(^#{File.basename( @config.output_dir )}) )
79
+ listener.start
53
80
  end
54
81
 
55
82
  end
@@ -2,6 +2,7 @@ require 'pathname'
2
2
  require 'logger'
3
3
  require 'awestruct/logger'
4
4
  require 'awestruct/cli/options'
5
+ require 'awestruct/util/exception_helper'
5
6
 
6
7
  module Awestruct
7
8
  module CLI
@@ -37,58 +38,72 @@ module Awestruct
37
38
  end
38
39
 
39
40
  def invoke!
40
- load_profile() unless ( options.init )
41
+ begin
42
+ load_profile() unless ( options.init )
43
+
44
+ setup_config()
45
+
46
+ invoke_init() if ( options.init )
47
+ invoke_script() if ( options.script )
48
+ invoke_force() if ( options.force )
49
+ invoke_generate() if ( options.generate )
50
+ invoke_deploy() if ( options.deploy )
51
+ invoke_server() if ( options.server )
52
+ invoke_auto() if ( options.auto )
53
+
54
+ wait_for_completion()
55
+ @success = false if ExceptionHelper.build_failed?
56
+ rescue
57
+ @success = false
58
+ false
59
+ end
60
+ end
41
61
 
42
- setup_config()
62
+ def load_profile()
63
+ site_yaml_file = File.join( @options.source_dir, '_config', 'site.yml' )
43
64
 
44
- invoke_init() if ( options.init )
45
- invoke_script() if ( options.script )
46
- invoke_force() if ( options.force )
47
- invoke_generate() if ( options.generate )
48
- invoke_deploy() if ( options.deploy )
49
- invoke_server() if ( options.server )
50
- invoke_auto() if ( options.auto )
65
+ if ( !File.exist?( site_yaml_file ) )
66
+ abort( "No config file at #{site_yaml_file}" )
67
+ end
51
68
 
52
- wait_for_completion()
53
- success
54
- end
69
+ site_yaml = YAML.load( File.read( site_yaml_file ) )
55
70
 
56
- def load_profile()
57
- site_yaml_file = File.join( Dir.pwd, '_config', 'site.yml' )
58
- if ( File.exist?( site_yaml_file ) )
59
- site_yaml = YAML.load( File.read( site_yaml_file ) )
60
- if site_yaml
61
- profiles_data = site_yaml['profiles'] || {}
62
- @profile = if profiles_data.nil?
63
- nil
64
- else
65
- if options.profile
66
- profiles_data[options.profile] || {}
67
- else
68
- # if no profile given, pick the first with deploy config
69
- options.profile, profile_data = profiles_data.select { |k,v| v && v['deploy'] }.first
70
- profile_data
71
- end
72
- end
73
- end
71
+ if ( !site_yaml )
72
+ abort( "Failed to parse #{site_yaml_file}" )
73
+ end
74
+
75
+ profiles = site_yaml['profiles'] || {}
76
+
77
+ profile_name = options.profile
78
+
79
+ # use the one specified
80
+ profile = profiles[profile_name]
81
+ if ( !profile )
82
+ profile_name, profile = if ( options.deploy )
83
+ # or the first one having a deploy section
84
+ profiles.select { |k,v| v && v['deploy'] }
85
+ else
86
+ # or the first one having no deploy section
87
+ profiles.select { |k,v| v && !v['deploy'] }
88
+ end.first
74
89
  end
75
-
76
- unless @profile
77
- $LOG.error "Unable to locate profile: #{options.profile}" if options.profile && $LOG.error?
78
- options.profile = 'NONE'
79
- @profile = {}
80
- end
81
- $LOG.info "Using profile: #{options.profile}" if $LOG.info?
90
+
91
+ if profile
92
+ $LOG.info "Using profile: #{profile_name}" if $LOG.info?
93
+ end
94
+
95
+ @profile = profile || {}
82
96
  end
83
97
 
84
98
  def setup_config()
85
99
  @config = Awestruct::Config.new( @options )
86
100
  @config.track_dependencies = true if ( @options.auto )
87
101
  @config.verbose = true if ( @options.verbose )
102
+ @config.quiet = true if ( @options.quiet )
88
103
  end
89
104
 
90
105
  def invoke_init()
91
- Awestruct::CLI::Init.new( Dir.pwd, @options.framework, @options.scaffold ).run
106
+ Awestruct::CLI::Init.new( @options.source_dir, @options.framework, @options.scaffold ).run
92
107
  end
93
108
 
94
109
  def invoke_script()
@@ -118,7 +133,8 @@ module Awestruct
118
133
  end
119
134
 
120
135
  def invoke_auto()
121
- Awestruct::CLI::Auto.new( config ).run
136
+ base_url = profile['base_url'] || options.base_url
137
+ Awestruct::CLI::Auto.new( config, base_url ).run
122
138
  end
123
139
 
124
140
  def invoke_server()
@@ -31,24 +31,28 @@ module Awestruct
31
31
  attr_accessor :deploy
32
32
  attr_accessor :script
33
33
  attr_accessor :verbose
34
+ attr_accessor :quiet
34
35
  attr_accessor :source_dir
35
36
  attr_accessor :output_dir
37
+ attr_accessor :livereload
36
38
 
37
39
  def initialize()
38
- @generate = nil
39
- @server = false
40
- @port = DEFAULT_PORT
41
- @bind_addr = DEFAULT_BIND_ADDR
42
- @auto = false
43
- @force = false
44
- @init = false
45
- @framework = 'compass'
46
- @scaffold = true
47
- @base_url = nil
48
- @profile = nil
49
- @deploy = false
50
- @script = nil
51
- @verbose = false
40
+ @generate = nil
41
+ @server = false
42
+ @port = DEFAULT_PORT
43
+ @bind_addr = DEFAULT_BIND_ADDR
44
+ @auto = false
45
+ @force = false
46
+ @init = false
47
+ @framework = 'compass'
48
+ @scaffold = true
49
+ @base_url = nil
50
+ @profile = nil
51
+ @deploy = false
52
+ @script = nil
53
+ @verbose = false
54
+ @quiet = false
55
+ @livereload = false
52
56
  @source_dir = Dir.pwd
53
57
  @output_dir = File.expand_path '_site'
54
58
  end
@@ -62,6 +66,9 @@ module Awestruct
62
66
  opts.on('-w', '--verbose', 'Enable verbose mode') do |verbose|
63
67
  self.verbose = true
64
68
  end
69
+ opts.on('-q', '--quiet', 'Only display warnings and errors') do |quiet|
70
+ self.quiet = true
71
+ end
65
72
  opts.on( '-i', '--init', 'Initialize a new project in the current directory' ) do |init|
66
73
  self.init = init
67
74
  self.generate = false
@@ -87,19 +94,22 @@ module Awestruct
87
94
  self.port = DEFAULT_PORT
88
95
  self.profile = 'development'
89
96
  end
97
+ opts.on( '-a', '--auto', 'Auto-generate when changes are noticed' ) do |a|
98
+ self.auto = a
99
+ end
100
+ opts.on( '--livereload', 'Support for browser livereload' ) do |livereload|
101
+ self.livereload = livereload
102
+ end
90
103
 
91
104
  opts.on( '-P', '--profile PROFILE', 'Activate a configuration profile' ) do |profile|
92
105
  self.profile = profile
93
106
  end
94
-
107
+
95
108
  opts.on( '--deploy', 'Deploy site' ) do |deploy|
96
109
  self.deploy = deploy
97
110
  self.generate = false if self.generate.nil?
98
111
  end
99
-
100
- opts.on( '-a', '--auto', 'Auto-generate when changes are noticed' ) do |a|
101
- self.auto = a
102
- end
112
+
103
113
  opts.on( '-p', '--port PORT', Integer, "Server port (default: #{DEFAULT_PORT})" ) do |port|
104
114
  self.port = port
105
115
  end
@@ -119,15 +129,15 @@ module Awestruct
119
129
  opts.on( '--output-dir DIR', 'Location to output generated site (default: _site' ) do |output_dir|
120
130
  self.output_dir = File.expand_path output_dir
121
131
  end
122
-
132
+
123
133
  opts.separator ''
124
134
  opts.separator "Common options:"
125
-
135
+
126
136
  opts.on_tail("-h", "--help", "Show this message") do
127
137
  puts opts
128
138
  exit
129
139
  end
130
-
140
+
131
141
  opts.on_tail("-v", "--version", "Display the version") do
132
142
  puts "Awestruct: #{Awestruct::VERSION}"
133
143
  puts "http://awestruct.org/"