Module: FortMux

Defined in:
bin/fortmux,
lib/FortMux.rb

Overview

logger = Logger.new(‘foo.log’, 10, 1024000)

Defined Under Namespace

Classes: Cli, Config, Log, Status

Class Method Summary collapse

Class Method Details

.config_file_path(config_name) ⇒ Object



138
139
140
# File 'lib/FortMux.rb', line 138

def self.config_file_path config_name
  File.join FortMux::config_folder, "#{config_name}.yaml"
end

.config_filesObject



141
142
143
144
145
146
147
148
149
150
# File 'lib/FortMux.rb', line 141

def self.config_files
  files = []
  Dir.foreach(FortMux::config_folder) do |f|
    f_path = File.join(FortMux::config_folder,f)
    if File.file?(f_path) && File.extname(f) == ".yaml"
      files << File.basename(f,".yaml")
    end
  end
  files
end

.config_folderObject



151
152
153
154
155
# File 'lib/FortMux.rb', line 151

def self.config_folder
  folder_path = File.join(Dir.home,".fortmux")
  Dir.mkdir(folder_path) unless File.directory? folder_path
  folder_path
end

.load(config_name, options) ⇒ Object

Raises:

  • (IOError)


156
157
158
159
160
161
162
163
164
# File 'lib/FortMux.rb', line 156

def self.load(config_name,options)
  options = options || {}
  execute = options[:execute] || true
  config_file_path = FortMux::config_file_path config_name
  FortMux::Log::logger "load #{config_file_path}"
  raise IOError, "Config #{config_name} not found" unless File.exist? config_file_path
  loader = FortMux::Config.new config_file_path
  loader.load
end

.log_file_pathObject



165
166
167
168
169
# File 'lib/FortMux.rb', line 165

def self.log_file_path
  folder_path = File.join(FortMux::config_folder,"log")
  Dir.mkdir(folder_path) unless File.directory? folder_path
  File.join folder_path,"fortmux.log"
end