Class: IronHammer::Deliverables::ConfigurationFile

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_hammer/deliverables/configuration_file.rb

Constant Summary collapse

PATTERN =
'*.{config,config.xml}'

Class Method Summary collapse

Class Method Details

.list(params = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/iron_hammer/deliverables/configuration_file.rb', line 8

def self.list params={}
  path        = params[:path] || raise(ArgumentError.new('must inform a path'))
  environment = params[:environment]
  suffix      = environment ? ('.' + environment) : ''
  pattern     = PATTERN + suffix
  
  Dir[File.join(path, pattern)].collect do |file|
    Deliverable.new(
      :path_on_package => '', 
      :actual_path => path, 
      :actual_name => original_name = file.split('/').last,
      :name_on_package => original_name.sub(suffix, '')
    )
  end
end