Class: Xapixctl::SyncCli::SyncPath
- Inherits:
-
ResourcePath
- Object
- ResourcePath
- Xapixctl::SyncCli::SyncPath
- Defined in:
- lib/xapixctl/sync_cli.rb
Instance Attribute Summary collapse
-
#types_to_sync ⇒ Object
readonly
Returns the value of attribute types_to_sync.
Instance Method Summary collapse
-
#initialize(dir, all_types, excluded_types) ⇒ SyncPath
constructor
A new instance of SyncPath.
- #resource_path(type) ⇒ Object
- #update_excluded_types_file ⇒ Object
Methods inherited from ResourcePath
#load_resource, #load_resources, #remove_outdated_resources, #write_file, #write_resource_yaml
Constructor Details
#initialize(dir, all_types, excluded_types) ⇒ SyncPath
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/xapixctl/sync_cli.rb', line 130 def initialize(dir, all_types, excluded_types) super(Pathname.new(dir)) @all_types = all_types @excluded_types_file = @path.join('.excluded_types') @excluded_types = excluded_types || [] @excluded_types += @excluded_types_file.read.split if @excluded_types_file.exist? @excluded_types &= @all_types @excluded_types.sort! @types_to_sync = @all_types - @excluded_types puts "Resource types excluded from sync: #{@excluded_types.join(', ')}" if @excluded_types.any? end |
Instance Attribute Details
#types_to_sync ⇒ Object (readonly)
Returns the value of attribute types_to_sync.
128 129 130 |
# File 'lib/xapixctl/sync_cli.rb', line 128 def types_to_sync @types_to_sync end |
Instance Method Details
#resource_path(type) ⇒ Object
142 143 144 |
# File 'lib/xapixctl/sync_cli.rb', line 142 def resource_path(type) ResourcePath.new(@path.join(type.underscore)) end |
#update_excluded_types_file ⇒ Object
146 147 148 |
# File 'lib/xapixctl/sync_cli.rb', line 146 def update_excluded_types_file @excluded_types_file.write(@excluded_types.join(" ") + "\n") if @excluded_types.any? end |