Class: KBuilder::Watch::ActionNewBuilder

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

Overview

Action for creating a new app with .builders

Instance Attribute Summary

Attributes inherited from BaseAction

#options

Instance Method Summary collapse

Methods inherited from BaseAction

#initialize

Constructor Details

This class inherits a constructor from KBuilder::Watch::BaseAction

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/k_builder/watch/action_new_builder.rb', line 13

def run
  setup_file = File.join(options.new_watch_path, 'setup.rb')
  config_file = File.join(options.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(options.new_app_path, '.')}")
end