Module: Qa::Authorities::LocalSubauthority

Included in:
Local
Defined in:
lib/qa/authorities/local_subauthority.rb

Instance Method Summary collapse

Instance Method Details

#namesObject

Local sub-authorities are any YAML files in the subauthorities_path



14
15
16
17
18
19
# File 'lib/qa/authorities/local_subauthority.rb', line 14

def names
  unless Dir.exists? subauthorities_path
    raise Qa::ConfigDirectoryNotFound, "There's no directory at #{subauthorities_path}. You must create it in order to use local authorities"
  end
  Dir.entries(subauthorities_path).map { |f| File.basename(f, ".yml") if f.match(/yml$/) }.compact
end

#subauthorities_pathObject

Path to sub-authority files is either the full path to a directory or the path to a directory relative to the Rails application



5
6
7
8
9
10
11
# File 'lib/qa/authorities/local_subauthority.rb', line 5

def subauthorities_path
  if AUTHORITIES_CONFIG[:local_path].starts_with?(File::Separator)
    AUTHORITIES_CONFIG[:local_path]
  else
    File.join(Rails.root, AUTHORITIES_CONFIG[:local_path])
  end
end