Module: Deployment::Methods::Patch

Defined in:
lib/depengine/dsl/patch.rb

Instance Method Summary collapse

Instance Method Details

#add_properties(source, target, options = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/depengine/dsl/patch.rb', line 50

def add_properties(source, target, options = {})
  patch_set = options[:patch_set] || 'patch_properties'
  Helper.validates_presence_of @cdb[patch_set],  'Properties not set'

  properties                 = Processor::Properties.new
  properties.assigner        = options[:assigner] || '='
  properties.properties_hash = @cdb[patch_set]
  properties.add(File.join($recipe_config[:deploy_home], source), \
                 File.join($recipe_config[:deploy_home], target,  \
                           File.basename(source)))
end

#patch_properties(source, target, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/depengine/dsl/patch.rb', line 4

def patch_properties(source, target, options = {})
  patch_set = options[:patch_set] || 'patch_properties'
  Helper.validates_presence_of @cdb[patch_set], 'Can not find a valid patch_set'

  assigner = options[:assigner] || '='

  properties                 = Processor::Properties.new
  properties.properties_hash = @cdb[patch_set]
  properties.assigner        = assigner
  properties.patch(File.join($recipe_config[:deploy_home], source), \
                   File.join($recipe_config[:deploy_home], target,  \
                             File.basename(source)))
end

#patch_strings(source, target, options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/depengine/dsl/patch.rb', line 18

def patch_strings(source, target, options = {})
  patch_set = options[:patch_set].nil? ? 'patch_properties' : options[:patch_set]

  Helper.validates_presence_of @cdb[patch_set],  'Properties not set'

  properties                 = Processor::Properties.new
  properties.assigner        = options[:assigner] || '='
  properties.properties_hash = @cdb[patch_set]
  ### add db_endpoint
  properties.properties_hash['db_endpoint_1'] = @cdb['db_endpoint_1']
  properties.properties_hash['db_endpoint_2'] = @cdb['db_endpoint_2']
  properties.substitute(File.join($recipe_config[:deploy_home], source), \
                        File.join($recipe_config[:deploy_home], target,  \
                                  File.basename(source)))
end

#patch_strings_r(source, target, options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/depengine/dsl/patch.rb', line 34

def patch_strings_r(source, target, options = {})
  patch_set = options[:patch_set] || 'patch_properties'
  Helper.validates_presence_of @cdb[patch_set],  'Properties not set'

  source_path = File.join($recipe_config[:deploy_home], source)
  target_path = File.join($recipe_config[:deploy_home], target)

  properties                 = Processor::Properties.new
  properties.assigner        = options[:assigner] || '='
  properties.properties_hash = @cdb[patch_set]
  ### add db_endpoint
  properties.properties_hash['db_endpoint_1'] = @cdb['db_endpoint_1']
  properties.properties_hash['db_endpoint_2'] = @cdb['db_endpoint_2']
  properties.substitute_r(source_path, target_path)
end

#sed_stringsObject



62
63
64
# File 'lib/depengine/dsl/patch.rb', line 62

def sed_strings
  Sed.copy($recipe_config[:source], $recipe_config[:target], $recipe_config[:pattern], $recipe_config[:replacement])
end