Class: Diogenes::Cli::Watch
- Inherits:
-
Object
- Object
- Diogenes::Cli::Watch
- Defined in:
- lib/diogenes/cli/watch.rb
Constant Summary collapse
- DIOGENES_DIR =
: String
".diogenes"
Class Method Summary collapse
-
.run(argv:, cwd:, out:, err:, **_opts) ⇒ Object
: (argv: Array, cwd: String, out: IO, err: IO, **untyped) -> Integer.
Instance Method Summary collapse
-
#initialize(argv:, cwd:, out:, err:) ⇒ Watch
constructor
: (argv: Array, cwd: String, out: IO, err: IO) -> void.
-
#run ⇒ Object
: () -> Integer.
Constructor Details
Class Method Details
.run(argv:, cwd:, out:, err:, **_opts) ⇒ Object
: (argv: Array, cwd: String, out: IO, err: IO, **untyped) -> Integer
12 13 14 |
# File 'lib/diogenes/cli/watch.rb', line 12 def self.run(argv:, cwd:, out:, err:, **_opts) new(argv:, cwd:, out:, err:).run end |
Instance Method Details
#run ⇒ Object
: () -> Integer
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/diogenes/cli/watch.rb', line 25 def run diogenes_dir = File.join(@cwd, DIOGENES_DIR) unless Dir.exist?(diogenes_dir) @err.puts "No #{DIOGENES_DIR}/ found. Run `diogenes init` first." return 1 end @out.puts "Watching #{DIOGENES_DIR}/ for changes. Press Ctrl+C to stop." @out.puts listener = build_listener(diogenes_dir) listener.start sleep 0 rescue Interrupt @out.puts "\nStopped." 0 end |