class DevPKI::DataDirectory
Public Class Methods
absolute_path()
click to toggle source
# File lib/devpki/data_directory.rb, line 42 def self.absolute_path unexpanded = (case self.os when :linux File.join(XDG['DATA_HOME'].to_s, "devpki") when :macosx "~/Library/Application Support/devpki" else nil end) File.expand_path(unexpanded) end
absolute_path_for(file_name)
click to toggle source
# File lib/devpki/data_directory.rb, line 54 def self.absolute_path_for(file_name) File.expand_path(file_name, self.absolute_path) end
get()
click to toggle source
# File lib/devpki/data_directory.rb, line 58 def self.get if not Dir.exists?(self.absolute_path) Dir.mkdir(self.absolute_path) end Dir.new(self.absolute_path) end
os()
click to toggle source
# File lib/devpki/data_directory.rb, line 14 def self.os @os ||= ( host_os = RbConfig::CONFIG['host_os'] case host_os when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ :windows when /darwin|mac os/ :macosx when /linux/ :linux when /solaris|bsd/ :unix else raise Error.new("unknown os: #{host_os.inspect}") end ) end
platform_supported?()
click to toggle source
Only support OSX atm
# File lib/devpki/data_directory.rb, line 33 def self.platform_supported? return self.supported_operating_systems.include?(self.os) end
reset_to_empty()
click to toggle source
# File lib/devpki/data_directory.rb, line 37 def self.reset_to_empty FileUtils.rm_rf(self.absolute_path) self.get end
supported_operating_systems()
click to toggle source
# File lib/devpki/data_directory.rb, line 10 def self.supported_operating_systems [:linux, :macosx] end