Class: DockerSync::ProjectConfig
- Inherits:
 - 
      Object
      
        
- Object
 - DockerSync::ProjectConfig
 
 
- Extended by:
 - Forwardable
 
- Defined in:
 - lib/docker-sync/config/project_config.rb
 
Constant Summary collapse
- REQUIRED_CONFIG_VERSION =
 '2'.freeze
- ERROR_MISSING_CONFIG_VERSION =
 "Your docker-sync.yml file does not include a version: \"#{REQUIRED_CONFIG_VERSION}\""\ '(Add this if you migrated from docker-sync 0.1.x)'.freeze
- ERROR_MISMATCH_CONFIG_VERSION =
 'Your docker-sync.yml file does not match the required version '\ "(#{REQUIRED_CONFIG_VERSION}).".freeze
- ERROR_MISSING_SYNCS =
 'no syncs defined'.freeze
Instance Attribute Summary collapse
- 
  
    
      #config_path  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute config_path.
 
Instance Method Summary collapse
- #fswatch_required? ⇒ Boolean
 - 
  
    
      #initialize(config_path: nil, config_string: nil)  ⇒ ProjectConfig 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ProjectConfig.
 - #load_project_config(config_path = nil) ⇒ Object
 - #rsync_required? ⇒ Boolean
 - #unison_required? ⇒ Boolean
 
Constructor Details
#initialize(config_path: nil, config_string: nil) ⇒ ProjectConfig
Returns a new instance of ProjectConfig.
      28 29 30 31 32 33 34 35 36 37 38 39 40 41 42  | 
    
      # File 'lib/docker-sync/config/project_config.rb', line 28 def initialize(config_path: nil, config_string: nil) if config_string.nil? if config_path.nil? || config_path.empty? config_path = DockerSync::ConfigLocator.lookup_project_config_path end load_project_config(config_path) else @config = DockerSync::ConfigSerializer.default_deserializer_string(config_string) @config_path = nil end validate_config! normalize_config! end  | 
  
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
      23 24 25  | 
    
      # File 'lib/docker-sync/config/project_config.rb', line 23 def config_path @config_path end  | 
  
Instance Method Details
#fswatch_required? ⇒ Boolean
      64 65 66 67 68 69  | 
    
      # File 'lib/docker-sync/config/project_config.rb', line 64 def fswatch_required? # noinspection RubyUnusedLocalVariable config['syncs'].any? { |name, sync_config| sync_config['watch_strategy'] == 'fswatch' } end  | 
  
#load_project_config(config_path = nil) ⇒ Object
      44 45 46 47 48  | 
    
      # File 'lib/docker-sync/config/project_config.rb', line 44 def load_project_config(config_path = nil) @config_path = config_path return unless File.exist?(@config_path) @config = DockerSync::ConfigSerializer.default_deserializer_file(@config_path) end  | 
  
#rsync_required? ⇒ Boolean
      57 58 59 60 61 62  | 
    
      # File 'lib/docker-sync/config/project_config.rb', line 57 def rsync_required? # noinspection RubyUnusedLocalVariable config['syncs'].any? { |name, sync_config| sync_config['sync_strategy'] == 'rsync' } end  | 
  
#unison_required? ⇒ Boolean
      50 51 52 53 54 55  | 
    
      # File 'lib/docker-sync/config/project_config.rb', line 50 def unison_required? # noinspection RubyUnusedLocalVariable config['syncs'].any? { |name, sync_config| sync_config['sync_strategy'] == 'unison' || sync_config['watch_strategy'] == 'unison' } end  |