class Packtory::Config
Constants
- DEFAULT_CONFIG
- DEFAULT_PACKAGES
- PACKTORY_PACKFILE
Public Class Methods
config()
click to toggle source
# File lib/packtory/config.rb, line 35 def self.config if defined?(@@global_config) @@global_config else reset_config! end end
configure() { |config| ... }
click to toggle source
# File lib/packtory/config.rb, line 43 def self.configure yield config end
load_packfile()
click to toggle source
# File lib/packtory/config.rb, line 90 def self.load_packfile packfile_path = nil if ENV.include?('PACKTORY_PACKFILE') packfile_path = File.expand_path(ENV['PACKTORY_PACKFILE']) else packfile_path = search_up(PACKTORY_PACKFILE) end unless packfile_path.nil? load packfile_path end packfile_path end
load_patch()
click to toggle source
# File lib/packtory/config.rb, line 106 def self.load_patch PatchBundlerNoMetadataDeps.patch! end
reset_config!()
click to toggle source
# File lib/packtory/config.rb, line 47 def self.reset_config! @@global_config = DEFAULT_CONFIG.merge({ }) end
search_up(*names)
click to toggle source
# File lib/packtory/config.rb, line 67 def self.search_up(*names) previous = nil current = File.expand_path(config[:path] || Dir.pwd).untaint found_path = nil until !File.directory?(current) || current == previous || !found_path.nil? names.each do |name| path = File.join(current, name) if File.exists?(path) found_path = path break end end if found_path.nil? previous = current current = File.expand_path("..", current) end end found_path end
setup()
click to toggle source
# File lib/packtory/config.rb, line 110 def self.setup load_patch load_packfile setup_defaults end
setup_defaults()
click to toggle source
# File lib/packtory/config.rb, line 51 def self.setup_defaults if ENV.include?('PACKTORY_PACKAGES') && !ENV['PACKTORY_PACKAGES'].empty? config[:packages] = ENV['PACKTORY_PACKAGES'].split(',').collect { |p| p.to_sym } elsif config[:packages].nil? config[:packages] = DEFAULT_PACKAGES end if ENV.include?('PACKTORY_BUNDLE_WORKING_PATH') config[:bundle_working_path] = File.expand_path(ENV['PACKTORY_BUNDLE_WORKING_PATH']) end unless config[:dependencies].include?('ruby') config[:dependencies]['ruby'] = nil end end