Module: Deployment::Methods::Patch

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

Instance Method Summary collapse

Instance Method Details

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



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/depengine/dsl/patch.rb', line 66

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

  assigner = '='
  if not options[:assigner].nil?
    assigner = options[:assigner]
  end

  properties                 = Processor::Properties.new
  properties.assigner        = 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



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

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/depengine/dsl/patch.rb', line 19

def patch_strings (source, target, options={})
  patch_set = 'patch_properties'
  if not options[:patch_set].nil?
    patch_set = options[:patch_set]
  end
  Helper.validates_presence_of @cdb[patch_set],  "Properties not set"

  assigner = '='
  if not options[:assigner].nil?
    assigner = options[:assigner]
  end

  properties                 = Processor::Properties.new
  properties.assigner        = 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



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/depengine/dsl/patch.rb', line 42

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

  assigner = '='
  if not options[:assigner].nil?
    assigner = options[:assigner]
  end

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

  properties                 = Processor::Properties.new
  properties.assigner        = 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



86
87
88
# File 'lib/depengine/dsl/patch.rb', line 86

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