lib/hyla/commands/watch.rb in hyla-1.0 vs lib/hyla/commands/watch.rb in hyla-1.0.1

- old
+ new

@@ -92,14 +92,16 @@ if !modified.nil? or !added.nil? modified.each do |modify| Hyla.logger.info "File modified : #{modify}" call_asciidoctor(modify) end + added.each do |add| Hyla.logger.info "File added : #{add}" call_asciidoctor(add) end + end end # callback Hyla.logger.info ">> ... Starting" Hyla.logger.info ">> Hyla has started to watch files in this output dir : #{@opts[:watch_dir]}" @@ -124,13 +126,15 @@ Hyla.logger.info ">> Directory of the file to be processed : #{dir_file}" Hyla.logger.info ">> File to be processed : #{file_to_process}" Hyla.logger.info ">> Extension of the file : #{@ext_name}" if @ext_name != '.html' - to_file = file_to_process.to_s.gsub('adoc', 'html') + # Generate File name + # Rename xxx.adoc, xxx.asciidoc, xxx.ad, xxx.index to xxx.html + to_file = file_to_process.to_s.gsub(/.adoc|.ad|.asciidoc|.index/, '.html') @opts[:to_file] = to_file - # TODO Check why asciidoctor populates new attributes and remove to_dir + # TODO Check why asciidoctor populates new attributes and removes to_dir # TODO when it is called a second time # Workaround - reset list, add again :out_dir @opts[:attributes] = {} @opts[:to_dir] = @received_opts[:destination]