Class: ConfCtl::ConfDir
- Inherits:
-
Object
- Object
- ConfCtl::ConfDir
- Includes:
- Singleton
- Defined in:
- lib/confctl/conf_dir.rb
Instance Method Summary collapse
-
#cache_dir ⇒ String
Path to configuration-specific cache directory.
- #changed? ⇒ Boolean
-
#generation_dir ⇒ String
Path to directory with build generations.
-
#hash ⇒ String
Unique hash identifying the configuration based on its filesystem path.
-
#initialize ⇒ ConfDir
constructor
A new instance of ConfDir.
-
#log_dir ⇒ String
Path to configuration-specific log directory.
-
#path ⇒ String
Path to the directory containing cluster configuration.
-
#short_hash ⇒ String
Shorter prefix of #hash.
- #state_mtime ⇒ Object
- #unchanged? ⇒ Boolean
- #update_state ⇒ Object
- #user_script_dir ⇒ Object
Constructor Details
Instance Method Details
#cache_dir ⇒ String
Path to configuration-specific cache directory
52 53 54 |
# File 'lib/confctl/conf_dir.rb', line 52 def cache_dir @cache_dir ||= File.join(path, '.confctl') end |
#changed? ⇒ Boolean
72 73 74 |
# File 'lib/confctl/conf_dir.rb', line 72 def changed? !unchanged? end |
#generation_dir ⇒ String
Path to directory with build generations
58 59 60 |
# File 'lib/confctl/conf_dir.rb', line 58 def generation_dir @generation_dir ||= File.join(cache_dir, 'generations') end |
#hash ⇒ String
Unique hash identifying the configuration based on its filesystem path
40 41 42 |
# File 'lib/confctl/conf_dir.rb', line 40 def hash @hash ||= Digest::SHA256.hexdigest(path) end |
#log_dir ⇒ String
Path to configuration-specific log directory
64 65 66 |
# File 'lib/confctl/conf_dir.rb', line 64 def log_dir @log_dir ||= File.join(cache_dir, 'logs') end |
#path ⇒ String
Path to the directory containing cluster configuration
34 35 36 |
# File 'lib/confctl/conf_dir.rb', line 34 def path @path ||= File.realpath(Dir.pwd) end |
#short_hash ⇒ String
Shorter prefix of #hash
46 47 48 |
# File 'lib/confctl/conf_dir.rb', line 46 def short_hash @short_hash ||= hash[0..7] end |
#state_mtime ⇒ Object
80 81 82 |
# File 'lib/confctl/conf_dir.rb', line 80 def state_mtime @cache.mtime end |
#unchanged? ⇒ Boolean
76 77 78 |
# File 'lib/confctl/conf_dir.rb', line 76 def unchanged? @cache.uptodate? end |
#update_state ⇒ Object
84 85 86 |
# File 'lib/confctl/conf_dir.rb', line 84 def update_state @cache.update end |
#user_script_dir ⇒ Object
68 69 70 |
# File 'lib/confctl/conf_dir.rb', line 68 def user_script_dir @user_script_dir ||= File.join(path, 'scripts') end |