lib/rbcli/configuration/config.rb in rbcli-0.1.10 vs lib/rbcli/configuration/config.rb in rbcli-0.2.0

- old
+ new

@@ -1,5 +1,25 @@ +################################################################################## +# RBCli -- A framework for developing command line applications in Ruby # +# Copyright (C) 2018 Andrew Khoury # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see <https://www.gnu.org/licenses/>. # +# # +# For questions regarding licensing, please contact andrew@blacknex.us # +################################################################################## + #### # Config Module #### # The config module manages two distinct sets of config: one is the user's, and one is the application's default. # This allows you to set default values for your configuration files, and can use the default values to generate a @@ -44,10 +64,11 @@ @merge_defaults = false @categorized_defaults = nil @loaded = false def self.set_userfile filename, merge_defaults: true, required: false + return if filename.nil? @config_file = File.expand_path filename @merge_defaults = merge_defaults @userfile_required = required @loaded = false end @@ -97,10 +118,10 @@ def self.load if (! @config_file.nil?) and File.exists? @config_file @config = YAML::load(File.read(@config_file)).deep_symbolize! @config.deep_merge! @config_defaults if @merge_defaults elsif @userfile_required - puts "User's config file not found at #{@config_file}. Please run this tool with the -g option to generate it." + puts "User's config file not found at #{@config_file}. Please run this tool with the `--generate-config` option to generate it." exit 1 else @config = @config_defaults end @loaded = true