Class: Browserctl::Commands::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/browserctl/commands/init.rb

Constant Summary collapse

CONFIG_TEMPLATE =
<<~YAML
  # browserctl project configuration
  # Uncomment and edit to customise.

  # daemon: default          # named daemon instance (see browserd --name)
  # workflows_dir: .browserctl/workflows
YAML

Class Method Summary collapse

Class Method Details

.run(_args) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/browserctl/commands/init.rb', line 16

def self.run(_args)
  FileUtils.mkdir_p(".browserctl/workflows")
  FileUtils.touch(".browserctl/workflows/.keep")

  config_path = ".browserctl/config.yml"
  File.write(config_path, CONFIG_TEMPLATE) unless File.exist?(config_path)

  puts "Initialised browserctl project:"
  puts "  .browserctl/workflows/   (place workflow .rb files here)"
  puts "  .browserctl/config.yml   (project settings)"
end