Module: WordpressDeploy::Config
- Defined in:
- lib/wordpress_deploy/config.rb
Overview
Config defines all of the locations of input and output files. Specifically, the locations of the test definitions, the locations of the test results, and the locations of the build applications.
Class Method Summary collapse
- .clean! ⇒ Object
- .config_dir ⇒ Object
- .config_dir=(new_config_dir) ⇒ Object
- .log_file ⇒ Object
- .logging=(new_log) ⇒ Object
- .logging? ⇒ Boolean
- .root_dir ⇒ Object
- .root_dir=(new_root) ⇒ Object
-
.set_options(options = {}) ⇒ Object
Setup required paths based on the given options.
- .sql_dir ⇒ Object
- .sql_dir=(new_sql_dir) ⇒ Object
- .wp_dir ⇒ Object
- .wp_dir=(new_wp_dir) ⇒ Object
Class Method Details
.clean! ⇒ Object
73 74 75 |
# File 'lib/wordpress_deploy/config.rb', line 73 def self.clean! FileUtils.rm Dir.glob(File.join(root_dir, "*.log")) end |
.config_dir ⇒ Object
45 46 47 48 |
# File 'lib/wordpress_deploy/config.rb', line 45 def self.config_dir @@config_dir ||= "config" File. File.join(root_dir, @@config_dir) end |
.config_dir=(new_config_dir) ⇒ Object
41 42 43 |
# File 'lib/wordpress_deploy/config.rb', line 41 def self.config_dir=(new_config_dir) @@config_dir = new_config_dir end |
.log_file ⇒ Object
68 69 70 71 |
# File 'lib/wordpress_deploy/config.rb', line 68 def self.log_file @@log_file ||= "#{Time.now.strftime("%Y_%m_%d_%H_%M_%S")}.log" File. File.join(root_dir, @@log_file) end |
.logging=(new_log) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/wordpress_deploy/config.rb', line 18 def self.logging=(new_log) # Only set @@logging if new_log is a boolean if !!new_log == new_log @@logging = new_log else @@logging = false end end |
.logging? ⇒ Boolean
27 28 29 30 |
# File 'lib/wordpress_deploy/config.rb', line 27 def self.logging? @@logging ||= false @@logging end |
.root_dir ⇒ Object
36 37 38 39 |
# File 'lib/wordpress_deploy/config.rb', line 36 def self.root_dir @@root_dir ||= Dir.pwd File. @@root_dir end |
.root_dir=(new_root) ⇒ Object
32 33 34 |
# File 'lib/wordpress_deploy/config.rb', line 32 def self.root_dir=(new_root) @@root_dir = new_root end |
.set_options(options = {}) ⇒ Object
Setup required paths based on the given options
11 12 13 14 15 16 |
# File 'lib/wordpress_deploy/config.rb', line 11 def self.( = {}) .each do |option, value| method = "#{option}=" send(method, value) if respond_to? method and !value.empty? end end |
.sql_dir ⇒ Object
63 64 65 66 |
# File 'lib/wordpress_deploy/config.rb', line 63 def self.sql_dir @@sql_dir ||= "sql" File. File.join(root_dir, @@sql_dir) end |
.sql_dir=(new_sql_dir) ⇒ Object
59 60 61 |
# File 'lib/wordpress_deploy/config.rb', line 59 def self.sql_dir=(new_sql_dir) @@sql_dir = new_sql_dir end |
.wp_dir ⇒ Object
54 55 56 57 |
# File 'lib/wordpress_deploy/config.rb', line 54 def self.wp_dir @@wp_dir ||= "site" File. File.join(root_dir, @@wp_dir) end |
.wp_dir=(new_wp_dir) ⇒ Object
50 51 52 |
# File 'lib/wordpress_deploy/config.rb', line 50 def self.wp_dir=(new_wp_dir) @@wp_dir = new_wp_dir end |