Method: Constants#initialize
- Defined in:
- lib/protk/constants.rb
#initialize ⇒ Constants
Read the global constants file and initialize our class @env variable Initialize loggers
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/protk/constants.rb', line 140 def initialize() @data_lib_dir="#{File.dirname(__FILE__)}/data" @protk_dir="#{Dir.home}/.protk" if ( ENV['PROTK_INSTALL_DIR']!=nil ) p "Using protk install dir from shell" @protk_dir=ENV['PROTK_INSTALL_DIR'] end # Load Protk Defaults # default_config_yml = YAML.load_file "#{File.dirname(__FILE__)}/data/default_config.yml" throw "Unable to read the config file at #{File.dirname(__FILE__)}/data/default_config.yml" unless default_config_yml!=nil # User-defined defaults override protk defaults # user_config_yml = nil user_config_yml = YAML.load_file "#{@protk_dir}/config.yml" if File.exist? "#{@protk_dir}/config.yml" if ( user_config_yml !=nil ) @env = default_config_yml.merge user_config_yml else @env=default_config_yml end protk_tool_dirs=["tpp/bin","omssa","openms/bin","msgfplus","blast/bin","pwiz","tandem/bin"] # Construct the PATH variable by prepending our preferred paths # protk_paths=[] # Add PATHs if PROTK_XXX_ROOT is defined # protk_tool_dirs.each do |tooldir| env_value = ENV["PROTK_#{tooldir.upcase}_ROOT"] if ( env_value!=nil) protk_paths<<env_value end protk_paths<<"#{@protk_dir}/tools/#{tooldir}" end original_path=ENV['PATH'] protk_paths<<original_path ENV['PATH']=protk_paths.join(":") # puts "Path #{ENV['PATH']}" throw "No data found in config file" unless @env!=nil @info_level="fatal" @info_level=default_config_yml['message_level'] unless default_config_yml['message_level'].nil? end |