From 404bbdad4c1cf8bedbb5a3c465a5fe20ac5cfe48 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 1 Oct 2014 14:56:26 +0100 Subject: [PATCH] Fix Guardfile --- Guardfile | 7 ++++--- src/main/ruby/readme.rb | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Guardfile b/Guardfile index bab596d..c6ce780 100644 --- a/Guardfile +++ b/Guardfile @@ -1,11 +1,12 @@ require 'asciidoctor' require 'erb' +require './src/main/ruby/readme.rb' options = {:mkdirs => true, :safe => :unsafe, :attributes => 'linkcss'} guard 'shell' do - watch(/^[A-Za-z].*\.adoc$/) {|m| - Asciidoctor.render_file('src/main/adoc/README.adoc', options.merge(:to_file => './README.md')) - Asciidoctor.render_file('src/main/adoc/spring-cloud-cli.adoc', options.merge(:to_dir => 'target/docs')) + watch(/^src\/[A-Za-z].*\.adoc$/) {|m| + SpringCloud::Build.render_file('src/main/asciidoc/README.adoc', :to_file => './README.adoc') + Asciidoctor.render_file('src/main/asciidoc/spring-cloud-cli.adoc', options.merge(:to_dir => 'target/generated-docs')) } end diff --git a/src/main/ruby/readme.rb b/src/main/ruby/readme.rb index 083a3b8..9526f77 100644 --- a/src/main/ruby/readme.rb +++ b/src/main/ruby/readme.rb @@ -41,8 +41,9 @@ module SpringCloud unless options[:to_file] puts out else - writer = File.new(options[:to_file],'w+') - out.each { |line| writer.write(line) } + File.open(options[:to_file],'w+') do |file| + out.each { |line| file.write(line) } + end end end