WhiskeyDisk::Config::ProjectScopeFilter

Public Instance Methods

filter(data) click to toggle source
# File lib/whiskey_disk/config/filters/project_scope_filter.rb, line 27
def filter(data)
  return data unless needs_project_scoping?(data)
  override_project_name!(data)
  { project_name => data }
end
needs_project_scoping?(data) click to toggle source

is this data hash an environment data hash without a project name?

# File lib/whiskey_disk/config/filters/project_scope_filter.rb, line 16
def needs_project_scoping?(data)
  repository_depth(data) == 1
end
override_project_name!(data) click to toggle source

TODO: why do we continue to need override_project_name! ? TODO: this is invasive into Config's implementation

# File lib/whiskey_disk/config/filters/project_scope_filter.rb, line 22
def override_project_name!(data)
  return if ENV['to'] && ENV['to'] =~ /:/
  ENV['to'] = data[environment_name]['project'] + ':' + ENV['to'] if data[environment_name]['project']
end
repository_depth(data, depth = 0) click to toggle source
# File lib/whiskey_disk/config/filters/project_scope_filter.rb, line 9
def repository_depth(data, depth = 0)
  raise 'no repository found' unless data.respond_to?(:has_key?)
  return depth if data.has_key?('repository')
  repository_depth(data.values.first, depth + 1)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.