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

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_dirObject



45
46
47
48
# File 'lib/wordpress_deploy/config.rb', line 45

def self.config_dir
  @@config_dir ||= "config"
  File.expand_path 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_fileObject



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.expand_path 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

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/wordpress_deploy/config.rb', line 27

def self.logging?
  @@logging ||= false
  @@logging
end

.root_dirObject



36
37
38
39
# File 'lib/wordpress_deploy/config.rb', line 36

def self.root_dir
  @@root_dir ||= Dir.pwd
  File.expand_path @@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.set_options(options = {})
  options.each do |option, value|
    method = "#{option}="
    send(method, value) if respond_to? method and !value.empty?
  end
end

.sql_dirObject



63
64
65
66
# File 'lib/wordpress_deploy/config.rb', line 63

def self.sql_dir
  @@sql_dir ||= "sql"
  File.expand_path 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_dirObject



54
55
56
57
# File 'lib/wordpress_deploy/config.rb', line 54

def self.wp_dir
  @@wp_dir ||= "site"
  File.expand_path 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