module R2OAS::Configuration
Constants
- PUBLIC_VALID_OPTIONS_KEYS
- UNPUBLIC_VALID_OPTIONS_KEYS
- VALID_OPTIONS_KEYS
Public Class Methods
extended(base)
click to toggle source
# File lib/r2-oas/configuration.rb, line 27 def self.extended(base) base.send :set_default_for_configuration, base end
Public Instance Methods
app_configuration_options()
click to toggle source
# File lib/r2-oas/configuration.rb, line 50 def app_configuration_options AppConfiguration::VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end
configure() { |self| ... }
click to toggle source
# File lib/r2-oas/configuration.rb, line 31 def configure yield self if block_given? load_local_plugins end
init()
click to toggle source
# File lib/r2-oas/configuration.rb, line 60 def init old_stdout = $stdout $stdout = StringIO.new plugins_path = File.expand_path("#{root_dir_path}/#{local_plugins_dir_name}") plugins_helpers_path = "#{plugins_path}/helpers" tasks_path = File.expand_path("#{root_dir_path}/#{local_tasks_dir_name}") tasks_helpers_path = "#{tasks_path}/helpers" gitkeep_plugins_path = "#{plugins_path}/.gitkeep" gitkeep_plugins_helpers_path = "#{plugins_helpers_path}/.gitkeep" gitkeep_tasks_path = "#{tasks_path}/.gitkeep" gitkeep_tasks_helpers_path = "#{tasks_helpers_path}/.gitkeep" paths_config.create_dot_paths(false) mkdir_p_dir_or_skip(plugins_helpers_path) mkdir_p_dir_or_skip(tasks_helpers_path) write_file_or_skip(gitkeep_plugins_path, '') write_file_or_skip(gitkeep_plugins_helpers_path, '') write_file_or_skip(gitkeep_tasks_path, '') write_file_or_skip(gitkeep_tasks_helpers_path, '') if $stdout.string.present? STDOUT.puts $stdout.string else STDOUT.puts "Already Initialized existing oas_docs in #{root_dir_path}" end $stdout = old_stdout end
load_tasks()
click to toggle source
# File lib/r2-oas/configuration.rb, line 56 def load_tasks load_local_tasks end
logger()
click to toggle source
# File lib/r2-oas/configuration.rb, line 42 def logger @_stdout_logger ||= StdoutLogger.new end
options()
click to toggle source
# File lib/r2-oas/configuration.rb, line 36 def options VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end
output_dir_path()
click to toggle source
# File lib/r2-oas/configuration.rb, line 91 def output_dir_path output_path.to_s.split('/').slice(0..-2).join('/') end
paths_config()
click to toggle source
# File lib/r2-oas/configuration.rb, line 46 def paths_config @_paths_config ||= PathsConfig.new(root_dir_path, schema_save_dir_name) end
Private Instance Methods
load_local_plugins()
click to toggle source
# File lib/r2-oas/configuration.rb, line 104 def load_local_plugins plugins_path = File.expand_path("#{root_dir_path}/#{local_plugins_dir_name}") Dir.glob("#{plugins_path}/**/*.rb").sort.each do |file| require file if FileTest.exists?(file) end end
load_local_tasks()
click to toggle source
# File lib/r2-oas/configuration.rb, line 97 def load_local_tasks tasks_path = File.expand_path("#{root_dir_path}/#{local_tasks_dir_name}") Dir.glob("#{tasks_path}/**/*.rake").sort.each do |file| load file if FileTest.exists?(file) end end
set_default_for_configuration(target)
click to toggle source
# File lib/r2-oas/configuration.rb, line 111 def set_default_for_configuration(target) AppConfiguration.set_default(target) end