class SSLTool::CertificateStore::FilesystemAdapter
Public Class Methods
new(base_path)
click to toggle source
# File lib/ssltool/adapters/filesystem.rb, line 7 def initialize(base_path) @base_path = base_path end
Public Instance Methods
load_pool(pool_name)
click to toggle source
# File lib/ssltool/adapters/filesystem.rb, line 11 def load_pool(pool_name) Certificate.scan(read_pool(pool_name)).to_set end
store_pool(pool_name, certs)
click to toggle source
# File lib/ssltool/adapters/filesystem.rb, line 15 def store_pool(pool_name, certs) return if read_pool(pool_name) == certs.to_set open(pool_path(pool_name), 'w') { |io| io.puts certs.map(&:to_pem).sort } end
Private Instance Methods
pool_path(pool_name)
click to toggle source
# File lib/ssltool/adapters/filesystem.rb, line 22 def pool_path(pool_name) File.join(@base_path, "#{pool_name}.pem") end
read_pool(pool_name)
click to toggle source
# File lib/ssltool/adapters/filesystem.rb, line 26 def read_pool(pool_name) path = pool_path(pool_name) return "" unless File.exists?(path) File.read(path).strip end