From a5b362dff69bceb253a17ac43dbf6a5f3f35182b Mon Sep 17 00:00:00 2001 From: Geoffrey De Smet Date: Fri, 19 Dec 2014 16:57:15 +0100 Subject: [PATCH 1/5] Summary text in atom feed should remove leading whitespace (and trailing whitespace too) --- lib/awestruct/extensions/template.atom.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/awestruct/extensions/template.atom.haml b/lib/awestruct/extensions/template.atom.haml index 269f76d9..23d7cb7e 100644 --- a/lib/awestruct/extensions/template.atom.haml +++ b/lib/awestruct/extensions/template.atom.haml @@ -36,7 +36,7 @@ - for tag in entry.tags %category{:term=>"#{tag}"} %summary - #{summarize( html_to_text( entry.content ), 100 )} + #{summarize( html_to_text( entry.content ).strip, 100 )} %content{:type=>'html'} = clean_html( html_escape( fully_qualify_urls( site.base_url, find_and_preserve( entry.content ) ) ) ) From 3c4a213e52464ce461bc3f11d2463e51f51b1468 Mon Sep 17 00:00:00 2001 From: Aslak Knutsen Date: Sun, 29 Mar 2015 15:52:37 +0200 Subject: [PATCH 2/5] Add regenerate on Page HTTP Request access Add support for triggering generation of output on page access via WebServer instead of on page save. The reverse lookup allow us to regenerate only the requested page and not all the dependent pages or pages that use the given changed layout. Note: Only intended in development mode Enabled by default in dev mode: awstruct -d -P development Diabled via: --no-generate-on-access Can be used in combination with LiveReload, where backend will send updated URL's to LiveReload on Page save and normal LiveReload update Request will trigger regeneration. If Guard/LiveReload is disabled, --no-livereload, generate-on-access will be disabled and page and dependency generation will happen on save. Generate on access can be used without a connected LiveReload client, but then requires manual refresh. Generate on access will disable the full site generation on startup. To regenerate the complete site after dev is done one should use: awestruct -g --- lib/awestruct/cli/auto.rb | 46 ++++++++++++++++++---------------- lib/awestruct/cli/generate.rb | 5 ++-- lib/awestruct/cli/invoker.rb | 4 +-- lib/awestruct/cli/options.rb | 11 +++++++- lib/awestruct/cli/server.rb | 25 +++++++++++++----- lib/awestruct/engine.rb | 44 ++++++++++++++++++++------------ lib/awestruct/rack/generate.rb | 45 +++++++++++++++++++++++++++++++++ 7 files changed, 132 insertions(+), 48 deletions(-) create mode 100644 lib/awestruct/rack/generate.rb diff --git a/lib/awestruct/cli/auto.rb b/lib/awestruct/cli/auto.rb index 5457a82a..1fb7c3e0 100644 --- a/lib/awestruct/cli/auto.rb +++ b/lib/awestruct/cli/auto.rb @@ -18,12 +18,18 @@ def run() generate_thread = nil current_path = nil - guard = if ( @config.options.livereload ) - guard = Guard::LiveReload.new - guard.start - guard - else - nil + begin + guard = if ( @config.options.livereload ) + Guard.init({}) + guard = Guard::LiveReload.new + guard.start + guard + else + nil + end + rescue => e + puts e + puts e.backtrace end force_polling = ( RUBY_PLATFORM =~ /mingw/ ? true : false ) @@ -45,26 +51,24 @@ def run() generate_thread = Thread.new { begin - if ( File.extname(path) == '.sass' || File.extname(path) == '.scss' ) - # TODO use sass here, eventually, as soon as I can figure out how to get it and sprites to work - ::Compass::Commands::UpdateProject.new(engine.site.dir, {}).perform - # fixes the nil later on, there's an outstanding bug that css - # pages aren't output in the correct directory - pages = [] - else - page = engine.page_by_source_path(path) - pages = [] - if ( page ) + page = engine.page_by_source_path(path) + pages = [] + if ( page ) + unless ( guard ) pages = engine.generate_page_and_dependencies( page ) else - if File.exist? path - # chances are this is an extension or yaml file - pages = engine.run_auto_for_non_page(path) - end + pages = engine.page_dependencies( page ) + end + else + if File.exist? path + # chances are this is an extension or yaml file + pages = engine.run_auto_for_non_page(path, !@config.options.generate_on_access) end end - $LOG.info "Regeneration finished." if $LOG.info? + unless ( guard ) + $LOG.info "Regeneration finished." if $LOG.info? + end if ( guard ) urls = pages.map do |p| diff --git a/lib/awestruct/cli/generate.rb b/lib/awestruct/cli/generate.rb index 1bb4360b..cbcef03d 100644 --- a/lib/awestruct/cli/generate.rb +++ b/lib/awestruct/cli/generate.rb @@ -6,11 +6,12 @@ module Awestruct module CLI class Generate - def initialize(config, profile=nil, base_url=nil, default_base_url=Options::DEFAULT_BASE_URL, force=false) + def initialize(config, profile=nil, base_url=nil, default_base_url=Options::DEFAULT_BASE_URL, force=false, generate=true) @profile = profile @base_url = base_url @default_base_url = default_base_url @force = force + @generate = generate @engine = Awestruct::Engine.new( config ) end @@ -18,7 +19,7 @@ def run() begin base_url = @base_url || @default_base_url $LOG.info "Generating site: #{base_url}" if $LOG.info? - @engine.run( @profile, @base_url, @default_base_url, @force ) + @engine.run( @profile, @base_url, @default_base_url, @force, @generate ) rescue =>e ExceptionHelper.log_building_error e, '' return false diff --git a/lib/awestruct/cli/invoker.rb b/lib/awestruct/cli/invoker.rb index 7cdac199..842e9eb8 100644 --- a/lib/awestruct/cli/invoker.rb +++ b/lib/awestruct/cli/invoker.rb @@ -122,7 +122,7 @@ def invoke_force() def invoke_generate() base_url = profile['base_url'] || options.base_url - @success = Awestruct::CLI::Generate.new( config, options.profile, base_url, Options::DEFAULT_BASE_URL, options.force ).run + @success = Awestruct::CLI::Generate.new( config, options.profile, base_url, Options::DEFAULT_BASE_URL, options.force, !options.generate_on_access ).run end def invoke_deploy() @@ -144,7 +144,7 @@ def invoke_auto() end def invoke_server() - run_in_thread( Awestruct::CLI::Server.new( options.output_dir, options.bind_addr, options.port ) ) + run_in_thread( Awestruct::CLI::Server.new( options.output_dir, options.bind_addr, options.port, options.generate_on_access ) ) end diff --git a/lib/awestruct/cli/options.rb b/lib/awestruct/cli/options.rb index 8d188c5a..42cf41d8 100644 --- a/lib/awestruct/cli/options.rb +++ b/lib/awestruct/cli/options.rb @@ -16,6 +16,7 @@ class Options DEFAULT_BIND_ADDR = '0.0.0.0' DEFAULT_PORT = 4242 DEFAULT_BASE_URL = %(http://#{LOCAL_HOSTS[DEFAULT_BIND_ADDR] || DEFAULT_BIND_ADDR}:#{DEFAULT_PORT}) + DEFAULT_GENERATE_ON_ACCESS = false attr_accessor :generate attr_accessor :server @@ -36,6 +37,7 @@ class Options attr_accessor :output_dir attr_accessor :livereload attr_accessor :debug + attr_accessor :generate_on_access def initialize() @generate = nil @@ -56,6 +58,7 @@ def initialize() @livereload = false @source_dir = Dir.pwd @output_dir = File.expand_path '_site' + @generate_on_access = DEFAULT_GENERATE_ON_ACCESS end def self.parse!(args) @@ -92,12 +95,13 @@ def parse!(args) opts.on( '-u', '--url URL', 'Set site.base_url' ) do |url| self.base_url = url end - opts.on( '-d', '--dev', "Run site in development mode (--auto, --server, --port #{DEFAULT_PORT} and --profile development)" ) do |url| + opts.on( '-d', '--dev', "Run site in development mode (--auto, --server, --port #{DEFAULT_PORT}, --profile development, --livereload and --generate_on_access)" ) do |url| self.server = true self.auto = true self.port = DEFAULT_PORT self.profile = 'development' self.livereload = true + self.generate_on_access = true end opts.on( '-a', '--auto', 'Auto-generate when changes are noticed' ) do |a| self.auto = a @@ -105,6 +109,11 @@ def parse!(args) end opts.on( '--[no-]livereload', 'Support for browser livereload' ) do |livereload| self.livereload = livereload + self.generate_on_access = true if self.livereload + end + + opts.on( '--[no-]generate-on-access', 'Support for calling generate on HTTP access' ) do |generate_on_access| + self.generate_on_access = generate_on_access end opts.on( '-P', '--profile PROFILE', 'Activate a configuration profile' ) do |profile| diff --git a/lib/awestruct/cli/server.rb b/lib/awestruct/cli/server.rb index a13e1f9f..4c891b7b 100644 --- a/lib/awestruct/cli/server.rb +++ b/lib/awestruct/cli/server.rb @@ -1,27 +1,40 @@ require 'rack' +require 'rack/builder' require 'rack/server' require 'awestruct/rack/app' +require 'awestruct/rack/generate' module Awestruct module CLI class Server attr_reader :server - def initialize(path, bind_addr=Options::DEFAULT_BIND_ADDR, port=Options::DEFAULT_PORT) + def initialize(path, bind_addr=Options::DEFAULT_BIND_ADDR, port=Options::DEFAULT_PORT, generate_on_access=Options::DEFAULT_GENERATE_ON_ACCESS) @path = path @bind_addr = bind_addr @port = port + @generate_on_access = generate_on_access end def run url = %(http://#{Options::LOCAL_HOSTS[@bind_addr] || @bind_addr}:#{@port}) msg = %(Starting preview server at #{url} (Press Ctrl-C to shutdown)) puts %(#{'*' * msg.length}\n#{msg}\n#{'*' * msg.length}\n) - ::Rack::Server::start( :app => Awestruct::Rack::App.new( @path ), - :Port => @port, - :Host => @bind_addr - ) + + path = @path + generate_on_access = @generate_on_access + app = ::Rack::Builder.new do + use Awestruct::Rack::GenerateOnAccess if generate_on_access + map "/" do + run Awestruct::Rack::App.new( path ) + end + end + + ::Rack::Server::start( :app => app, + :Port => @port, + :Host => @bind_addr + ) end end end -end +end \ No newline at end of file diff --git a/lib/awestruct/engine.rb b/lib/awestruct/engine.rb index c846cb51..74617a7d 100644 --- a/lib/awestruct/engine.rb +++ b/lib/awestruct/engine.rb @@ -52,7 +52,7 @@ def config site.config end - def run(profile, base_url, default_base_url, force=false) + def run(profile, base_url, default_base_url, force=false, generate=true) $LOG.debug 'adjust_load_path' if $LOG.debug? adjust_load_path $LOG.debug 'load_default_site_yaml' if $LOG.debug? @@ -76,20 +76,25 @@ def run(profile, base_url, default_base_url, force=false) set_urls( site.pages ) $LOG.debug 'build_page_index' if $LOG.debug? build_page_index - $LOG.debug 'generate_output' if $LOG.debug? - $LOG.info 'Generating pages...' if $LOG.info? - generate_output + + if ( generate ) + $LOG.debug 'generate_output' if $LOG.debug? + $LOG.info 'Generating pages...' if $LOG.info? + generate_output + end return 0 end def build_page_index site.pages_by_relative_source_path = {} + site.pages_by_output_path = {} site.pages.each do |p| # Add the layout to the set of dependencies p.dependencies.add_dependency(site.layouts.find_matching(p.layout, p.output_extension)) if ( p.relative_source_path ) site.pages_by_relative_source_path[ p.relative_source_path ] = p end + site.pages_by_output_path[ p.output_path ] = p end site.layouts.each do |p| # Add the layout to the set of dependencies @@ -395,6 +400,19 @@ def generate_page_and_dependencies(page) generate_page_internal(page) end + regen_pages = page_dependencies( page ) + + $LOG.debug "Starting regeneration of content dependent pages:" if regen_pages.size > 0 && $LOG.debug? + + regen_pages.each do |p| + $LOG.info "Regenerating page #{p.output_path}" if $LOG.info? + generate_page_internal(p) + end + + regen_pages + end + + def page_dependencies(page) regen_pages = Set.new [ page ] regen_pages.merge page.dependencies.dependents @@ -411,18 +429,9 @@ def generate_page_and_dependencies(page) end regen_pages.merge temp_set - - $LOG.debug "Starting regeneration of content dependent pages:" if regen_pages.size > 0 && $LOG.debug? - - regen_pages.each do |p| - $LOG.info "Regenerating page #{p.output_path}" if $LOG.info? - generate_page_internal(p) - end - - regen_pages end - def run_auto_for_non_page(file) + def run_auto_for_non_page(file, generate = true) if File.extname(file) == '.rb' load file end @@ -430,8 +439,11 @@ def run_auto_for_non_page(file) load_yamls load_pipeline execute_pipeline - site.pages.each do |p| - generate_page_internal(p) + + if ( generate ) + site.pages.each do |p| + generate_page_internal(p) + end end site.pages end diff --git a/lib/awestruct/rack/generate.rb b/lib/awestruct/rack/generate.rb new file mode 100644 index 00000000..350b2744 --- /dev/null +++ b/lib/awestruct/rack/generate.rb @@ -0,0 +1,45 @@ + +module Awestruct + module Rack + + class GenerateOnAccess + def initialize(app) + @app = app + end + + def call(env) + engine = ::Awestruct::Engine.instance + + generate = false + + req_path = env['REQUEST_PATH'] + path = req_path + path = req_path + "index.html" if req_path.end_with? '/' + + page = engine.site.pages_by_output_path[path] + if page.nil? and !req_path.end_with? '/' + path = req_path + "/index.html" + page = engine.site.pages_by_output_path[path] + end + + generate_path = nil + + if !page.nil? + generate_path = File.join( engine.site.config.output_dir, page.output_path ) + + generate = true if page.stale_output? generate_path + generate = true if path.end_with? '.html' + end + + if generate + puts "Regenerate #{page.source_path}" + + engine.generate_page page, generate_path, true + end + + @app.call(env) + end + end + + end +end From 5881bdab4c47a92c96363443a1e9b2df6de0c489 Mon Sep 17 00:00:00 2001 From: Aslak Knutsen Date: Mon, 6 Apr 2015 14:32:24 +0200 Subject: [PATCH 3/5] Remove CSS framework version dependencies from Awestruct Move selection of CSS framework to Gemfile created during initialization of a new site. It should be up to each site to determine given version of e.g. bootstrap. --- awestruct.gemspec | 8 +++--- lib/awestruct/cli/init.rb | 3 +- lib/awestruct/cli/manifest.rb | 41 +++++++++++++++++++++++++++ lib/awestruct/frameworks/base_Gemfile | 13 ++++++++- 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/awestruct.gemspec b/awestruct.gemspec index b61ebd2f..fc618913 100644 --- a/awestruct.gemspec +++ b/awestruct.gemspec @@ -35,10 +35,6 @@ Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if s.add_dependency 'haml', '~> 4.0.5' s.add_dependency 'asciidoctor' # we're pretty good about backwards compat s.add_dependency 'tilt', '~> 2.0.1' - s.add_dependency 'compass', '~> 1.0.1' - s.add_dependency 'compass-960-plugin', '~> 0.10.4' - s.add_dependency 'bootstrap-sass', '~> 3.2.0.2' - s.add_dependency 'zurb-foundation', '~> 4.3.2' s.add_dependency 'mime-types', '~> 2.1' s.add_dependency 'rest-client', '~> 1.7.2' s.add_dependency 'ruby-s3cmd', '~> 0.1.5' @@ -50,4 +46,8 @@ Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if s.add_dependency 'parallel', '> 1.1.1' s.add_development_dependency 'nokogiri', '~> 1.5.10' + s.add_development_dependency 'compass', '~> 1.0.1' + s.add_development_dependency 'compass-960-plugin', '~> 0.10.4' + s.add_development_dependency 'bootstrap-sass', '~> 3.2.0.2' + s.add_development_dependency 'zurb-foundation', '~> 4.3.2' end diff --git a/lib/awestruct/cli/init.rb b/lib/awestruct/cli/init.rb index d429d7eb..a62ccb19 100644 --- a/lib/awestruct/cli/init.rb +++ b/lib/awestruct/cli/init.rb @@ -18,7 +18,6 @@ def self.framework_path(path, framework = nil) copy_file('_ext/pipeline.rb', Init.framework_path('base_pipeline.rb')) copy_file('.awestruct_ignore', Init.framework_path('base_awestruct_ignore')) copy_file('Rakefile', Init.framework_path('base_Rakefile')) - copy_file('Gemfile', Init.framework_path('base_Gemfile')) mkdir('stylesheets') } @@ -31,6 +30,8 @@ def initialize(dir = Dir.pwd, framework = 'compass', scaffold = true) def run() manifest = Manifest.new(BASE_MANIFEST) scaffold_name = @framework + manifest.template_file('Gemfile', Init.framework_path('base_Gemfile'), {:framework => @framework}) + lib = nil case @framework when 'compass' diff --git a/lib/awestruct/cli/manifest.rb b/lib/awestruct/cli/manifest.rb index e363ba8f..60cc3cd1 100644 --- a/lib/awestruct/cli/manifest.rb +++ b/lib/awestruct/cli/manifest.rb @@ -1,6 +1,9 @@ require 'sass/callbacks' require 'compass' require 'compass/commands' +require 'erb' +require 'rubygems/specification' +require 'ostruct' # TODO: We could create our own installer and use that @@ -22,6 +25,10 @@ def mkdir(path) steps << MkDir.new(path) end + def template_file(path, input_path, state = {}) + steps << TemplateFile.new(path, input_path, state.merge(load_gem)) + end + def copy_file(path, input_path, opts = {}) steps << CopyFile.new(path, input_path, opts) end @@ -68,6 +75,18 @@ def unperform(dir) end end + private + + def load_gem + spec = {:dependencies => {}} + gem_spec = Gem::Specification::load( + File.join(File.dirname(__FILE__), "../../../", "awestruct.gemspec")) + + gem_spec.dependencies.each { |d| spec[:dependencies][d.name] = d} + spec[:awestruct_version] = gem_spec.version + spec + end + ## ## ## @@ -202,6 +221,28 @@ def notunperform(dir) end + class TemplateFile + def initialize(path, input_path, state = {}) + @path = path + @input_path = input_path + @state = state + end + + def perform(dir) + + rendered = ERB.new(File.read(@input_path), nil, '<>').result( + OpenStruct.new(@state).instance_eval { binding }) + + p = File.join(dir, @path) + $LOG.info "Create file: #{p}" if $LOG.info? + File.open(p, 'w') { |f| f.write(rendered) } + end + + def unperform(dir) + # nothing + end + end + class InstallCompass def initialize(framework='compass') @framework = framework diff --git a/lib/awestruct/frameworks/base_Gemfile b/lib/awestruct/frameworks/base_Gemfile index 188a5ea3..5a409f72 100644 --- a/lib/awestruct/frameworks/base_Gemfile +++ b/lib/awestruct/frameworks/base_Gemfile @@ -24,9 +24,20 @@ source 'https://rubygems.org' # This tells Bundler where to look for gems -gem 'awestruct', '~> 0.5.3' # Goes without saying +gem 'awestruct', '>= <%= awestruct_version %>' # Goes without saying gem 'webrick', '~> 1.3.1' # The rack webserver to use in dev mode +gem 'compass', '<%= dependencies['compass'].requirement %>' +<% if framework.eql? 'bootstrap' %> +gem 'bootstrap-sass', '<%= dependencies['bootstrap-sass'].requirement %>' +<% end %> +<% if framework.eql? 'foundation' %> +gem 'zurb-foundation', '<%= dependencies['zurb-foundation'].requirement %>' +<% end %> +<% if framework.eql? '960' %> +gem 'compass-960-plugin', '<%= dependencies['compass-960-plugin'].requirement %>' +<% end %> + # FIXME # gem 'rake', '>= 0.9.2' # Needed for the Rakefile to work # gem 'coffee-script', '>= 2.2.0' # If using coffee-script or to remove the warning From 9e5e1b6bcfd8af9e57ac04c050012a8e854958ac Mon Sep 17 00:00:00 2001 From: LightGuard Date: Tue, 10 Feb 2015 13:26:42 -0700 Subject: [PATCH 4/5] Removing REXML Switching from REXML to Oga There is a small change that needs to happen to exiting sites using the atom feed: * Please update any resulting html that make use of tags with optional end tags to not have end tags. These tags are as follows: 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr' Fixing up tests --- awestruct.gemspec | 2 ++ lib/awestruct/context_helper.rb | 35 ++++++++++++--------------- spec/awestruct/context_helper_spec.rb | 10 ++++---- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/awestruct.gemspec b/awestruct.gemspec index b61ebd2f..28e3da1c 100644 --- a/awestruct.gemspec +++ b/awestruct.gemspec @@ -47,6 +47,8 @@ Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if s.add_dependency 'git', '~> 1.2.6' s.add_dependency 'guard-livereload', '~> 2.1.2' s.add_dependency 'colorize', '~> 0.7.1' + s.add_dependency 'oga', '~> 0.3' + s.add_dependency 'parallel', '> 1.1.1' s.add_development_dependency 'nokogiri', '~> 1.5.10' diff --git a/lib/awestruct/context_helper.rb b/lib/awestruct/context_helper.rb index 35d3a643..62783d66 100644 --- a/lib/awestruct/context_helper.rb +++ b/lib/awestruct/context_helper.rb @@ -1,8 +1,7 @@ -require 'rexml/document' +require 'oga' module Awestruct module ContextHelper - include REXML def html_to_text(str) str.gsub( /<[^>]+>/, '' ).gsub( / /, ' ' ) @@ -39,27 +38,23 @@ def summarize(text, numwords=20, ellipsis='...') end def fully_qualify_urls(base_url, text) - doc = Document.new text - doc.context[:attribute_quote] = :quote # Set double-quote as the attribute value delimiter + doc = Oga.parse_html text - XPath.each(doc, "//a") do |a| - a.attributes['href'] = fix_url( base_url, a.attributes['href'] ) if a.attributes['href'] - end - - XPath.each(doc, "//link") do |link| - link.attributes['href'] = fix_url( base_url, link.attributes['href'] ) - end - - XPath.each(doc, "//img") do |img| - img.attributes['src'] = fix_url( base_url, img.attributes['src'] ) + doc.each_node do |elem| + if (elem.is_a?(Oga::XML::Element) && elem.html?) + case elem.name + when 'a' + elem.set 'href', fix_url(base_url, elem.get('href')) if elem.get('href') + when 'link' + elem.set 'href', fix_url(base_url, elem.get('href')) if elem.get('href') + when 'img' + elem.set 'src', fix_url(base_url, elem.get('src')) if elem.get('src') + end + end end - if RUBY_VERSION.start_with? '1.8' - doc.to_s - else - doc.to_s.tap do |d| - d.force_encoding(text.encoding) if d.encoding != text.encoding - end + doc.to_xml.tap do |d| + d.force_encoding(text.encoding) if d.encoding != text.encoding end end diff --git a/spec/awestruct/context_helper_spec.rb b/spec/awestruct/context_helper_spec.rb index f93de92e..9a51d30a 100644 --- a/spec/awestruct/context_helper_spec.rb +++ b/spec/awestruct/context_helper_spec.rb @@ -76,21 +76,21 @@ class Tester describe "fully_qualify_urls" do it "should fix anchor tags" do str = "foobar" - @tester.fully_qualify_urls('http://foobar.com', str).should == "foobar" + @tester.fully_qualify_urls('http://foobar.com', str).should == %q(foobar) end it "should fix link tags" do - str = "" - @tester.fully_qualify_urls('http://foobar.com', str).should == "" + str = "" + @tester.fully_qualify_urls('http://foobar.com', str).should == %q() end it "should fix image tags" do str = "" - @tester.fully_qualify_urls('http://foobar.com', str).should == "" + @tester.fully_qualify_urls('http://foobar.com', str).should == %q() end it "should leave anchor tags with no href attribute (for page anchors) unchanged" do - str = "foobar" + str = %q(foobar) @tester.fully_qualify_urls('http://foobar.com', str).should == str end end From e0a84b307ad8938fdac5c25ddd1a29118f554a8f Mon Sep 17 00:00:00 2001 From: LightGuard Date: Mon, 6 Apr 2015 17:59:48 -0600 Subject: [PATCH 5/5] Test fails intermittently, this should fix it I'm starting up the Awestruct::Engine here with some basic data. --- spec/awestruct/pipeline_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/awestruct/pipeline_spec.rb b/spec/awestruct/pipeline_spec.rb index 8e1a1e0e..0b134b92 100644 --- a/spec/awestruct/pipeline_spec.rb +++ b/spec/awestruct/pipeline_spec.rb @@ -3,6 +3,14 @@ describe Awestruct::Pipeline do + before do + dir = Pathname.new( test_data_dir 'engine' ) + opts = Awestruct::CLI::Options.new + opts.source_dir = dir + + @site = Hashery::OpenCascade[ { :encoding=>false, :dir=>dir, :config=>Awestruct::Config.new( opts ) } ] + Awestruct::Engine.new(@site.config) + end it "should provide a way to find a matching handler chain for a given path" do pipeline = Awestruct::Pipeline.new