Class: Availability::Setup
- Inherits:
-
Object
- Object
- Availability::Setup
- Defined in:
- lib/availability/setup.rb
Overview
Creates deployment starter files without replacing existing configuration.
Constant Summary collapse
- SERVER_NAME_PATTERN =
/\A[a-zA-Z0-9.-]+\z/- URL_PATH_PATTERN =
%r{\A/[a-zA-Z0-9_-]+/\z}
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#log_dir ⇒ Object
readonly
Returns the value of attribute log_dir.
-
#nginx_path ⇒ Object
readonly
Returns the value of attribute nginx_path.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
Instance Method Summary collapse
-
#initialize(config_path:, nginx_path:, output_dir:, log_dir:, server_name:, url_path:) ⇒ Setup
constructor
A new instance of Setup.
- #run ⇒ Object
Constructor Details
#initialize(config_path:, nginx_path:, output_dir:, log_dir:, server_name:, url_path:) ⇒ Setup
Returns a new instance of Setup.
12 13 14 15 16 17 18 19 |
# File 'lib/availability/setup.rb', line 12 def initialize(config_path:, nginx_path:, output_dir:, log_dir:, server_name:, url_path:) @config_path = File.(config_path) @nginx_path = File.(nginx_path) @output_dir = File.(output_dir) @log_dir = File.(log_dir) @server_name = server_name @url_path = url_path end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
21 22 23 |
# File 'lib/availability/setup.rb', line 21 def config_path @config_path end |
#log_dir ⇒ Object (readonly)
Returns the value of attribute log_dir.
21 22 23 |
# File 'lib/availability/setup.rb', line 21 def log_dir @log_dir end |
#nginx_path ⇒ Object (readonly)
Returns the value of attribute nginx_path.
21 22 23 |
# File 'lib/availability/setup.rb', line 21 def nginx_path @nginx_path end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
21 22 23 |
# File 'lib/availability/setup.rb', line 21 def output_dir @output_dir end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/availability/setup.rb', line 23 def run validate! ensure_targets_are_available! create_files FileUtils.mkdir_p(output_dir) FileUtils.mkdir_p(log_dir) true rescue SystemCallError => e cleanup_created_files raise SetupError, "Setup failed: #{e.}" end |