Skip to content

Commit

Permalink
Add 'watch' task.
Browse files Browse the repository at this point in the history
  • Loading branch information
basking2 committed Apr 11, 2021
1 parent 962a2ff commit 0a7288a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ gem "rake", "~> 13.0"
gem "asciidoctor-pdf", "~> 1.5"

gem "asciidoctor-diagram", "~> 2.1"

gem "listen", "~> 3.4"
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ GEM
concurrent-ruby (1.1.8)
css_parser (1.7.1)
addressable
ffi (1.15.0)
hashery (2.1.2)
listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
pdf-core (0.7.0)
pdf-reader (2.4.1)
Ascii85 (~> 1.0.0)
Expand All @@ -51,6 +55,9 @@ GEM
prawn (~> 2.2)
public_suffix (4.0.6)
rake (13.0.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
ruby-rc4 (0.1.5)
safe_yaml (1.0.5)
Expand All @@ -65,6 +72,7 @@ PLATFORMS
DEPENDENCIES
asciidoctor-diagram (~> 2.1)
asciidoctor-pdf (~> 1.5)
listen (~> 3.4)
rake (~> 13.0)

BUNDLED WITH
Expand Down
14 changes: 14 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,20 @@ task :htmldocs => [ directory(htmldir), *htmldocs ]

task :pdfdocs => [ directory(pdfdir), *pdfdocs ]

desc "Watch this directory for changes and rebuild on changes."
task :watch do
require 'listen'
listener = Listen.to('.') do |modified, added, removed|
if modified.length > 0 || added.length > 0
Rake::Task[:default].invoke
Rake.application.tasks.each { |t| t.reenable }
end
end

listener.start
sleep
end

task :init => [
directory(htmldir),
directory(pdfdir),
Expand Down

0 comments on commit 0a7288a

Please sign in to comment.