Module: Deployment::Methods::Patch

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

Instance Method Summary collapse

Instance Method Details

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



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/depengine/dsl/patch.rb', line 76

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
18
19
20
21
22
23
24
25
26
27
# File 'lib/depengine/dsl/patch.rb', line 5

def patch_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], \
     "Can not find a valid patch_set"

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

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



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/depengine/dsl/patch.rb', line 29

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



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/depengine/dsl/patch.rb', line 52

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



96
97
98
# File 'lib/depengine/dsl/patch.rb', line 96

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