class Luban::Deployment::Helpers::Configuration::Finder
Attributes
base_path[R]
config_file[R]
config_path[R]
config_root[R]
stage_config_file[R]
stage_config_path[R]
stage_templates_path[R]
target[R]
templates_path[R]
Public Class Methods
application(target)
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 130 def self.application(target); Application.new(target); end
default_templates_paths()
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 86 def self.default_templates_paths @default_templates_paths ||= [Pathname.new(File.join(File.dirname(__FILE__), '..', 'templates')).realpath] end
find_default_template_file(file_name)
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 91 def self.find_default_template_file(file_name) path = default_templates_paths.find { |p| p.join(file_name).file? } return path.join(file_name) unless path.nil? end
new(target)
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 142 def initialize(target) @target = target set_config_paths end
project(target)
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 129 def self.project(target); Project.new(target); end
Public Instance Methods
deployfile()
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 147 def deployfile; @deployfile ||= 'deploy.rb'; end
find_template_file(file_name)
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 170 def find_template_file(file_name) return file_path if (file_path = stage_templates_path.join(file_name)).file? return file_path if (file_path = templates_path.join(file_name)).file? end
load_configuration()
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 150 def load_configuration load_general_configuration load_stage_configuration end
load_general_configuration()
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 155 def load_general_configuration target.load_configuration_file(config_file) end
load_stage_configuration()
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 159 def load_stage_configuration if File.directory?(stage_config_path) ["*.rb", "{packages}/**/*.rb"].each do |pattern| Dir[stage_config_path.join(pattern)].each do |file| target.load_configuration_file(file) end end end target.load_configuration_file(stage_config_file) end
stagefile()
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 148 def stagefile; @stagefile ||= "#{target.stage}.rb"; end
Protected Instance Methods
set_config_paths()
click to toggle source
# File lib/luban/deployment/helpers/configuration.rb, line 177 def set_config_paths @config_root = base_path.join('config') @config_file = @config_root.join(deployfile) @config_path = @config_root.join(deployfile.sub('.rb', '')) @templates_path = @config_root.join('templates') @stage_config_file = @config_path.join(stagefile) @stage_config_path = @config_path.join(target.stage) @stage_templates_path = @stage_config_path.join('templates') end