Class: KBuilder::Watch::NewBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/k_builder/watch/new_builder.rb

Overview

Create a new folder for application with builders

Instance Method Summary collapse

Instance Method Details

#execute(_paths) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/k_builder/watch/new_builder.rb', line 8

def execute(_paths)
  setup_file = File.join(new_watch_path, 'setup.rb')
  config_file = File.join(new_watch_path, 'config', '_.rb')

  FileUtils.mkdir_p(File.dirname(config_file))
  File.write(setup_file, "require 'config/_'")                                unless File.exist?(setup_file)
  File.write(config_file, "puts '_'\n\n#require 'config/_initialize'")        unless File.exist?(config_file)

  system("code #{File.join(new_app_path, '.')}")
end