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(shell, 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(shell, dir, all_types, excluded_types) ⇒ SyncPath
Returns a new instance of SyncPath.
205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/xapixctl/sync_cli.rb', line 205 def initialize(shell, dir, all_types, excluded_types) super(shell, 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 say "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.
203 204 205 |
# File 'lib/xapixctl/sync_cli.rb', line 203 def types_to_sync @types_to_sync end |
Instance Method Details
#resource_path(type) ⇒ Object
217 218 219 |
# File 'lib/xapixctl/sync_cli.rb', line 217 def resource_path(type) ResourcePath.new(@shell, @path.join(type.underscore)) end |
#update_excluded_types_file ⇒ Object
221 222 223 |
# File 'lib/xapixctl/sync_cli.rb', line 221 def update_excluded_types_file @excluded_types_file.write(@excluded_types.join(" ") + "\n") if @excluded_types.any? end |