Class: Mwc::Commands::Watch
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Mwc::Commands::Watch
- Includes:
- Utils::Command, Thor::Actions
- Defined in:
- lib/mwc/commands/watch.rb
Overview
:nodoc:
Constant Summary collapse
- DESIRE_FILES =
/\.(h|c|cpp|js)$/.freeze
Instance Method Summary collapse
Methods included from Utils::Command
Instance Method Details
#prepare ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/mwc/commands/watch.rb', line 22 def prepare @stopped = false @dirs = [ Mwc.root.join('src'), Mwc.root.join('include') ].map(&:to_s) end |
#setup_listener ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/mwc/commands/watch.rb', line 34 def setup_listener @listener = Listen.to(*@dirs, only: DESIRE_FILES) do |*_| Mwc.use(['env']) do # TODO: Allow change output directory empty_directory('dist') compile end end end |
#setup_tasks ⇒ Object
30 31 32 |
# File 'lib/mwc/commands/watch.rb', line 30 def setup_tasks Tasks.new end |
#start ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/mwc/commands/watch.rb', line 45 def start puts 'Starting watch file changes...' @listener.start Signal.trap(:INT) { exit } sleep end |