depengine 3.0.20 → 3.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -0
  3. data/.rubocop_todo.yml +52 -0
  4. data/Gemfile.lock +16 -1
  5. data/Rakefile +9 -9
  6. data/bin/cdb_crypt +2 -2
  7. data/bin/de +1 -1
  8. data/bin/depengine +2 -2
  9. data/bin/spec_setup +2 -2
  10. data/depengine.gemspec +22 -21
  11. data/lib/depengine/asserter/url.rb +8 -9
  12. data/lib/depengine/cli.rb +12 -14
  13. data/lib/depengine/dsl/cdb.rb +16 -17
  14. data/lib/depengine/dsl/deployment.rb +42 -50
  15. data/lib/depengine/dsl/dweb.rb +10 -11
  16. data/lib/depengine/dsl/executor.rb +5 -5
  17. data/lib/depengine/dsl/fileops.rb +3 -4
  18. data/lib/depengine/dsl/helper.rb +26 -28
  19. data/lib/depengine/dsl/iis.rb +21 -24
  20. data/lib/depengine/dsl/patch.rb +22 -46
  21. data/lib/depengine/dsl/publisher.rb +14 -14
  22. data/lib/depengine/dsl/remote.rb +11 -13
  23. data/lib/depengine/dsl/repository.rb +19 -21
  24. data/lib/depengine/dsl/template.rb +19 -19
  25. data/lib/depengine/dsl/zip.rb +24 -24
  26. data/lib/depengine/helper/cli_helper.rb +9 -11
  27. data/lib/depengine/helper/hudson.rb +15 -19
  28. data/lib/depengine/helper/mail.rb +19 -25
  29. data/lib/depengine/helper/properties.rb +33 -52
  30. data/lib/depengine/helper/smb.rb +19 -25
  31. data/lib/depengine/helper/validations.rb +7 -7
  32. data/lib/depengine/helper/yaml.rb +7 -9
  33. data/lib/depengine/log/log.rb +3 -6
  34. data/lib/depengine/processor/erb_template.rb +42 -47
  35. data/lib/depengine/processor/fileops.rb +39 -48
  36. data/lib/depengine/processor/local_execute.rb +6 -4
  37. data/lib/depengine/processor/properties.rb +34 -56
  38. data/lib/depengine/processor/sed.rb +8 -12
  39. data/lib/depengine/processor/tags.rb +9 -10
  40. data/lib/depengine/processor/template.rb +27 -32
  41. data/lib/depengine/processor/zip.rb +16 -20
  42. data/lib/depengine/provider/cdb.rb +64 -71
  43. data/lib/depengine/provider/cdb_filesystem.rb +18 -26
  44. data/lib/depengine/provider/git.rb +37 -42
  45. data/lib/depengine/provider/repository.rb +161 -176
  46. data/lib/depengine/publisher/dweb.rb +74 -90
  47. data/lib/depengine/publisher/iis.rb +23 -30
  48. data/lib/depengine/publisher/rsync.rb +14 -17
  49. data/lib/depengine/publisher/samba.rb +12 -14
  50. data/lib/depengine/publisher/sftp.rb +51 -61
  51. data/lib/depengine/publisher/ssh.rb +19 -22
  52. data/lib/depengine/publisher/tomcat.rb +19 -21
  53. data/lib/depengine/reporter/cdb.rb +2 -3
  54. data/lib/depengine/version.rb +1 -1
  55. data/lib/depengine.rb +1 -2
  56. data/spec/cdb_spec.rb +8 -10
  57. data/spec/demo_recipe/recipes/demo.rb +10 -10
  58. data/spec/deployhelper_spec.rb +20 -21
  59. data/spec/fileops_spec.rb +11 -12
  60. data/spec/git_spec.rb +8 -4
  61. data/spec/helper_spec.rb +75 -75
  62. data/spec/junit.rb +47 -49
  63. data/spec/local_execute.rb +7 -7
  64. data/spec/log_spec.rb +17 -18
  65. data/spec/properties_spec.rb +13 -15
  66. data/spec/recipe_spec.rb +15 -16
  67. data/spec/repository_spec.rb +20 -20
  68. data/spec/ssh_spec.rb +18 -19
  69. data/spec/template_spec.rb +30 -30
  70. data/spec/zip_spec.rb +7 -7
  71. metadata +18 -2
@@ -1,9 +1,9 @@
1
1
  module Deployment
2
2
  module Methods
3
- module Executor
4
- def local_execute(shell_cmds)
5
- Processor.local_execute(shell_cmds)
6
- end
7
- end
3
+ module Executor
4
+ def local_execute(shell_cmds)
5
+ Processor.local_execute(shell_cmds)
6
+ end
7
+ end
8
8
  end
9
9
  end
@@ -1,10 +1,9 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module Fileops
4
-
5
4
  # Copies a file or directory from a given source to a given target.<br>
6
5
  # Both are prefixed with the recipes +:deploy_home+.
7
- def copy(source, target, options={})
6
+ def copy(source, target, options = {})
8
7
  Processor.copy(File.join($recipe_config[:deploy_home], source), \
9
8
  File.join($recipe_config[:deploy_home], target), \
10
9
  options)
@@ -23,7 +22,7 @@ module Deployment
23
22
  # * +file+ - the file to change mode on
24
23
  # * +mode+ - the new file permission mode (e.g. "644")
25
24
  # * [+options+] - a hash with additional parameters. This is optional.
26
- def chmod(file, mode, options={})
25
+ def chmod(file, mode, options = {})
27
26
  Processor.chmod(File.join($recipe_config[:deploy_home], file), \
28
27
  mode, options)
29
28
  end
@@ -52,4 +51,4 @@ module Deployment
52
51
  end
53
52
  end
54
53
  end
55
- end
54
+ end
@@ -1,7 +1,6 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module Helper
4
-
5
4
  # Returns an time-dependant string that can be used in pseudo-unique
6
5
  # release versions and the such.
7
6
  #
@@ -10,7 +9,7 @@ module Deployment
10
9
  #
11
10
  # Parameters:
12
11
  # * +format+ - the strftime format that is to be used to generate the unique string. Defaults to "%Y-%m-%d_%s".
13
- def date_unique(format="%Y-%m-%d_%s")
12
+ def date_unique(format = '%Y-%m-%d_%s')
14
13
  @date_unique ||= Time.now.strftime(format)
15
14
  end
16
15
 
@@ -23,13 +22,13 @@ module Deployment
23
22
  # * +:from+ - the senders address
24
23
  # * +:to+ - the recipiants address
25
24
  def sendmail(options)
26
- Helper.validates_presence_of options[:from], "Mail-FROM not set"
27
- Helper.validates_presence_of options[:to], "Mail-TO not set"
28
- Helper.validates_presence_of options[:subject], "No mail subject set"
29
- Helper.validates_presence_of options[:body], "No mail body set"
25
+ Helper.validates_presence_of options[:from], 'Mail-FROM not set'
26
+ Helper.validates_presence_of options[:to], 'Mail-TO not set'
27
+ Helper.validates_presence_of options[:subject], 'No mail subject set'
28
+ Helper.validates_presence_of options[:body], 'No mail body set'
30
29
 
31
30
  helper = ::Helper::Mail.new
32
- helper.smtp_host = @cdb['smtp_host'] if @cdb and @cdb['smtp_host']
31
+ helper.smtp_host = @cdb['smtp_host'] if @cdb && @cdb['smtp_host']
33
32
  helper.sendmail(options)
34
33
  end
35
34
 
@@ -42,9 +41,9 @@ module Deployment
42
41
  # * +:check_port+ - the port to connect to
43
42
  # * +:check_uri+ - the recipiants address
44
43
  # * +:check_response_string+ - the string or regexp to check
45
- def assert_url_response_of(options={})
44
+ def assert_url_response_of(options = {})
46
45
  asserter = ::Asserter::Url.new
47
- asserter.check_protocol = options[:check_protocol] || @cdb['check_protocol'] || "http"
46
+ asserter.check_protocol = options[:check_protocol] || @cdb['check_protocol'] || 'http'
48
47
  asserter.check_host = options[:check_host] || @cdb['check_host']
49
48
  asserter.check_port = options[:check_port] || @cdb['check_port'] || '80'
50
49
  asserter.check_uri = options[:check_uri] || @cdb['check_uri'] || '/'
@@ -54,11 +53,11 @@ module Deployment
54
53
  end
55
54
 
56
55
  # Reports a deployment to its cdb.
57
- def report_to_cdb()
56
+ def report_to_cdb
58
57
  reporter = ::Reporter::Cdb.new
59
58
  reporter.version = @version.to_json
60
59
  reporter.worker = self
61
- reporter.set_version()
60
+ reporter.set_version
62
61
  end
63
62
 
64
63
  # Sends an email to report a deployment to a given recepiant.
@@ -71,16 +70,16 @@ module Deployment
71
70
  # * +:message+ - a additional message to send in the mail, commonly used to specify any non positive status.
72
71
  # * +:deploy_email_from+ - the senders address
73
72
  # * +:deploy_email_to+ - the recipiants address
74
- def report_by_mail(options={})
73
+ def report_by_mail(options = {})
75
74
  options = @cdb.merge($recipe_config).merge(options)
76
75
  options[:status] ||= 'success'
77
76
  options[:message] ||= ''
78
77
 
79
78
  mail_options = {
80
- :from => options[:deploy_email_from] || @cdb['deploy_email_from'],
81
- :to => options[:deploy_email_to] || @cdb['deploy_email_to'],
82
- :subject => "#{options[:env]} #{options[:job_name]} #{options[:module_name]} #{options[:application_name]} #{options[:version]} #{options[:status]}",
83
- :body => "Env: #{options[:env]}\nJob: #{options[:job_name]}\nModule: #{options[:module_name]}\nApplication: #{options[:application_name]}\nVersion: #{options[:version].to_json}\n#{options[:status]}.\n\n#{options[:message]}"
79
+ from: options[:deploy_email_from] || @cdb['deploy_email_from'],
80
+ to: options[:deploy_email_to] || @cdb['deploy_email_to'],
81
+ subject: "#{options[:env]} #{options[:job_name]} #{options[:module_name]} #{options[:application_name]} #{options[:version]} #{options[:status]}",
82
+ body: "Env: #{options[:env]}\nJob: #{options[:job_name]}\nModule: #{options[:module_name]}\nApplication: #{options[:application_name]}\nVersion: #{options[:version].to_json}\n#{options[:status]}.\n\n#{options[:message]}"
84
83
  }
85
84
  sendmail(mail_options)
86
85
  end
@@ -99,7 +98,7 @@ module Deployment
99
98
  # * +:deploy_email_from+ - the senders address
100
99
  # * +:deploy_email_to+ - the recipiants address
101
100
  # Please see `GITREVISIONS(7)` for more info on how to specify a revision range.
102
- def report_by_mail_with_git_history(r1='', r2='', options={})
101
+ def report_by_mail_with_git_history(r1 = '', r2 = '', options = {})
103
102
  git = Provider::Git.new
104
103
  git.repository_local_dir = options[:git_dir] || '.'
105
104
  options[:message] = (options[:message] || '') + git.history(r1, r2).to_s
@@ -121,7 +120,7 @@ module Deployment
121
120
  # * +:logfilename+ - the name of the logfile. Will be automatically prefixed with #{catalina_home}/logs/
122
121
  # * +:check_host+ - an options hash to pass to +#assert_url_response_of+ to check the status of the app
123
122
  # All parameters can also be spcified via CDB.
124
- def tomcat_deploy(options={})
123
+ def tomcat_deploy(options = {})
125
124
  publisher = ::Publisher::Tomcat.new
126
125
  publisher.servers = options[:servers] || @cdb['servers']
127
126
  publisher.runners = options[:runners] || @cdb['runners'] || publisher.servers
@@ -140,33 +139,32 @@ module Deployment
140
139
  # Parameters:
141
140
  # * +remote_path+ - the path to the remote share (e.g."smb://somehost/someshare")
142
141
  # * +:local_path+ - the local path in which the share will be mounted
143
- def samba_mount (remote_path, local_path)
142
+ def samba_mount(remote_path, local_path)
144
143
  smb = ::Helper::Smb.new
145
144
  smb.remote_path = remote_path
146
145
  smb.local_path = local_path
147
- smb.samba_mount()
146
+ smb.samba_mount
148
147
  end
149
148
 
150
149
  # Unmounts a previously mounted SMB share.
151
150
  #
152
151
  # Parameters:
153
152
  # * +:local_path+ - the local path in which the share is mounted
154
- def samba_umount (local_path)
153
+ def samba_umount(local_path)
155
154
  smb = ::Helper::Smb.new
156
155
  smb.local_path = local_path
157
- smb.samba_umount()
156
+ smb.samba_umount
158
157
  end
159
158
 
160
- def validates_presence_of(attribute, message=nil)
161
- raise ArgumentError, message || "Missing parameter", caller if attribute.nil?
159
+ def validates_presence_of(attribute, message = nil)
160
+ fail ArgumentError, message || 'Missing parameter', caller if attribute.nil?
162
161
  end
163
162
  module_function :validates_presence_of
164
163
 
165
- def validates_not_empty(attribute, message=nil)
166
- raise ArgumentError, message || "Parameter is empty", caller if attribute.nil?
164
+ def validates_not_empty(attribute, message = nil)
165
+ fail ArgumentError, message || 'Parameter is empty', caller if attribute.nil?
167
166
  end
168
167
  module_function :validates_not_empty
169
-
170
168
  end
171
169
  end
172
- end
170
+ end
@@ -1,20 +1,19 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module IIS
4
-
5
- def iis_build()
4
+ def iis_build
6
5
  Helper.validates_presence_of @cdb['iis_build_url'], \
7
- "iis_build_url parameter is missing"
6
+ 'iis_build_url parameter is missing'
8
7
  Helper.validates_presence_of @cdb['iis_build_protocol'], \
9
- "iis_build_protocol parameter is missing"
8
+ 'iis_build_protocol parameter is missing'
10
9
  Helper.validates_presence_of $recipe_config['TAG'], \
11
- "TAG parameter is missing"
10
+ 'TAG parameter is missing'
12
11
  Helper.validates_presence_of $recipe_config['ENVIRONMENT'], \
13
- "ENV parameter is missing"
14
- Helper.validates_presence_of @version['app'], \
15
- "VERSION parameter is missing"
12
+ 'ENV parameter is missing'
13
+ Helper.validates_presence_of @version['app'], \
14
+ 'VERSION parameter is missing'
16
15
  Helper.validates_presence_of $recipe_config['VALUE'], \
17
- "VALUE parameter is missing"
16
+ 'VALUE parameter is missing'
18
17
 
19
18
  iis = ::Publisher::IIS.new
20
19
  iis.protocol = @cdb['iis_build_protocol']
@@ -22,23 +21,23 @@ module Deployment
22
21
  if @cdb['http_read_timeout']
23
22
  iis.http_read_timeout = @cdb['http_read_timeout']
24
23
  else
25
- iis.http_read_timeout = 180
24
+ iis.http_read_timeout = 180
26
25
  end
27
26
 
28
27
  iis.build($recipe_config['TAG'], $recipe_config['ENVIRONMENT'], @version['app'], $recipe_config['VALUE'], $recipe_config[:application_name])
29
28
  end
30
29
 
31
- def iis_deploy(options={})
30
+ def iis_deploy(options = {})
32
31
  Helper.validates_presence_of options[:iis_deploy_url] || @cdb['iis_deploy_url'], \
33
- "iis_deploy_url parameter is missing"
32
+ 'iis_deploy_url parameter is missing'
34
33
  Helper.validates_presence_of @cdb['iis_application_name'], \
35
- "iis_application_name parameter is missing"
34
+ 'iis_application_name parameter is missing'
36
35
  Helper.validates_presence_of @cdb['iis_deploy_protocol'], \
37
- "iis_deploy_protocol parameter is missing"
36
+ 'iis_deploy_protocol parameter is missing'
38
37
  Helper.validates_presence_of $recipe_config['ENVIRONMENT'], \
39
- "ENV parameter is missing"
40
- Helper.validates_presence_of @version['app'], \
41
- "VERSION parameter is missing"
38
+ 'ENV parameter is missing'
39
+ Helper.validates_presence_of @version['app'], \
40
+ 'VERSION parameter is missing'
42
41
 
43
42
  iis = ::Publisher::IIS.new
44
43
  iis.protocol = @cdb['iis_deploy_protocol']
@@ -46,18 +45,17 @@ module Deployment
46
45
  if @cdb['http_read_timeout']
47
46
  iis.http_read_timeout = @cdb['http_read_timeout']
48
47
  else
49
- iis.http_read_timeout = 180
48
+ iis.http_read_timeout = 180
50
49
  end
51
50
 
52
51
  iis.deploy(@version['app'], @cdb['iis_application_name'], $recipe_config['ENVIRONMENT'].downcase)
53
52
  end
54
53
 
55
-
56
- def iis_appcmd()
54
+ def iis_appcmd
57
55
  Helper.validates_presence_of @cdb['iis_appcmd_url'], \
58
- "iis_appcmd_url parameter is missing"
56
+ 'iis_appcmd_url parameter is missing'
59
57
  Helper.validates_presence_of $recipe_config['VALUE'], \
60
- "VALUE parameter is missing"
58
+ 'VALUE parameter is missing'
61
59
 
62
60
  iis = ::Publisher::IIS.new
63
61
  iis.protocol = @cdb['iis_appcmd_protocol']
@@ -65,10 +63,9 @@ module Deployment
65
63
  if @cdb['http_read_timeout']
66
64
  iis.http_read_timeout = @cdb['http_read_timeout']
67
65
  else
68
- iis.http_read_timeout = 180
66
+ iis.http_read_timeout = 180
69
67
  end
70
68
  iis.appcmd($recipe_config['VALUE'])
71
-
72
69
  end
73
70
  end
74
71
  end
@@ -1,10 +1,9 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module Patch
4
-
5
- def patch_properties (source, target, options={})
4
+ def patch_properties(source, target, options = {})
6
5
  patch_set = options[:patch_set] || 'patch_properties'
7
- Helper.validates_presence_of @cdb[patch_set], "Can not find a valid patch_set"
6
+ Helper.validates_presence_of @cdb[patch_set], 'Can not find a valid patch_set'
8
7
 
9
8
  assigner = options[:assigner] || '='
10
9
 
@@ -13,49 +12,34 @@ module Deployment
13
12
  properties.assigner = assigner
14
13
  properties.patch(File.join($recipe_config[:deploy_home], source), \
15
14
  File.join($recipe_config[:deploy_home], target, \
16
- File.basename(source)))
15
+ File.basename(source)))
17
16
  end
18
17
 
19
- def patch_strings (source, target, options={})
20
- patch_set = 'patch_properties'
21
- if not options[:patch_set].nil?
22
- patch_set = options[:patch_set]
23
- end
24
- Helper.validates_presence_of @cdb[patch_set], "Properties not set"
18
+ def patch_strings(source, target, options = {})
19
+ patch_set = options[:patch_set].nil? ? 'patch_properties' : options[:patch_set]
25
20
 
26
- assigner = '='
27
- if not options[:assigner].nil?
28
- assigner = options[:assigner]
29
- end
21
+ Helper.validates_presence_of @cdb[patch_set], 'Properties not set'
30
22
 
31
23
  properties = Processor::Properties.new
32
- properties.assigner = assigner
24
+ properties.assigner = options[:assigner] || '='
33
25
  properties.properties_hash = @cdb[patch_set]
34
26
  ### add db_endpoint
35
27
  properties.properties_hash['db_endpoint_1'] = @cdb['db_endpoint_1']
36
- properties.properties_hash['db_endpoint_2'] = @cdb['db_endpoint_2']
28
+ properties.properties_hash['db_endpoint_2'] = @cdb['db_endpoint_2']
37
29
  properties.substitute(File.join($recipe_config[:deploy_home], source), \
38
- File.join($recipe_config[:deploy_home], target, \
39
- File.basename(source)))
30
+ File.join($recipe_config[:deploy_home], target, \
31
+ File.basename(source)))
40
32
  end
41
33
 
42
- def patch_strings_r (source, target, options={})
43
- patch_set = 'patch_properties'
44
- if not options[:patch_set].nil?
45
- patch_set = options[:patch_set]
46
- end
47
- Helper.validates_presence_of @cdb[patch_set], "Properties not set"
48
-
49
- assigner = '='
50
- if not options[:assigner].nil?
51
- assigner = options[:assigner]
52
- end
34
+ def patch_strings_r(source, target, options = {})
35
+ patch_set = options[:patch_set] || 'patch_properties'
36
+ Helper.validates_presence_of @cdb[patch_set], 'Properties not set'
53
37
 
54
38
  source_path = File.join($recipe_config[:deploy_home], source)
55
39
  target_path = File.join($recipe_config[:deploy_home], target)
56
40
 
57
41
  properties = Processor::Properties.new
58
- properties.assigner = assigner
42
+ properties.assigner = options[:assigner] || '='
59
43
  properties.properties_hash = @cdb[patch_set]
60
44
  ### add db_endpoint
61
45
  properties.properties_hash['db_endpoint_1'] = @cdb['db_endpoint_1']
@@ -63,28 +47,20 @@ module Deployment
63
47
  properties.substitute_r(source_path, target_path)
64
48
  end
65
49
 
66
- def add_properties (source, target, options={})
67
- patch_set = 'patch_properties'
68
- if not options[:patch_set].nil?
69
- patch_set = options[:patch_set]
70
- end
71
- Helper.validates_presence_of @cdb[patch_set], "Properties not set"
72
-
73
- assigner = '='
74
- if not options[:assigner].nil?
75
- assigner = options[:assigner]
76
- end
50
+ def add_properties(source, target, options = {})
51
+ patch_set = options[:patch_set] || 'patch_properties'
52
+ Helper.validates_presence_of @cdb[patch_set], 'Properties not set'
77
53
 
78
54
  properties = Processor::Properties.new
79
- properties.assigner = assigner
55
+ properties.assigner = options[:assigner] || '='
80
56
  properties.properties_hash = @cdb[patch_set]
81
57
  properties.add(File.join($recipe_config[:deploy_home], source), \
82
- File.join($recipe_config[:deploy_home], target, \
83
- File.basename(source)))
58
+ File.join($recipe_config[:deploy_home], target, \
59
+ File.basename(source)))
84
60
  end
85
61
 
86
- def sed_strings()
87
- Sed.copy($recipe_config[:source],$recipe_config[:target], $recipe_config[:pattern],$recipe_config[:replacement])
62
+ def sed_strings
63
+ Sed.copy($recipe_config[:source], $recipe_config[:target], $recipe_config[:pattern], $recipe_config[:replacement])
88
64
  end
89
65
  end
90
66
  end
@@ -1,7 +1,7 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module Publisher
4
- def samba_upload(source, target, options={})
4
+ def samba_upload(source, target, options = {})
5
5
  Helper.validates_presence_of source
6
6
  Helper.validates_presence_of target
7
7
 
@@ -10,15 +10,15 @@ module Deployment
10
10
  publisher.worker = self
11
11
  publisher.samba_mountpoints = options[:samba_mountpoints] || @cdb['samba_mountpoints']
12
12
 
13
- Helper.validates_presence_of publisher.samba_share, "Sambe share not set"
14
- Helper.validates_presence_of publisher.samba_mountpoints, "Sambe mountpoints not set"
13
+ Helper.validates_presence_of publisher.samba_share, 'Sambe share not set'
14
+ Helper.validates_presence_of publisher.samba_mountpoints, 'Sambe mountpoints not set'
15
15
 
16
16
  publisher.copy(File.join($recipe_config[:deploy_home], source), \
17
- target, options)
17
+ target, options)
18
18
  end
19
19
 
20
- def sftp_upload(source, target, options={})
21
- Helper.validates_presence_of @cdb['ssh_key_file'], "SSH-keyfile not set"
20
+ def sftp_upload(source, target, options = {})
21
+ Helper.validates_presence_of @cdb['ssh_key_file'], 'SSH-keyfile not set'
22
22
  Helper.validates_presence_of source
23
23
  Helper.validates_presence_of target
24
24
 
@@ -30,15 +30,15 @@ module Deployment
30
30
  publisher.ssh_key_file = File.join(File.dirname($exec_file_path), \
31
31
  publisher.ssh_key_file)
32
32
 
33
- Helper.validates_presence_of publisher.remote_host, "Remote host not set"
34
- Helper.validates_presence_of publisher.remote_user, "Remote user not set"
33
+ Helper.validates_presence_of publisher.remote_host, 'Remote host not set'
34
+ Helper.validates_presence_of publisher.remote_user, 'Remote user not set'
35
35
 
36
36
  publisher.copy(File.join($recipe_config[:deploy_home], source), \
37
- target, options)
37
+ target, options)
38
38
  end
39
39
 
40
- def sftp_chmod(path, permissions, options={})
41
- Helper.validates_presence_of @cdb['ssh_key_file'], "SSH-keyfile not set"
40
+ def sftp_chmod(path, permissions, options = {})
41
+ Helper.validates_presence_of @cdb['ssh_key_file'], 'SSH-keyfile not set'
42
42
  Helper.validates_presence_of path
43
43
  Helper.validates_presence_of permissions
44
44
 
@@ -50,11 +50,11 @@ module Deployment
50
50
  publisher.ssh_key_file = File.join(File.dirname($exec_file_path), \
51
51
  publisher.ssh_key_file)
52
52
 
53
- Helper.validates_presence_of publisher.remote_host, "Remote host not set"
54
- Helper.validates_presence_of publisher.remote_user, "Remote user not set"
53
+ Helper.validates_presence_of publisher.remote_host, 'Remote host not set'
54
+ Helper.validates_presence_of publisher.remote_user, 'Remote user not set'
55
55
 
56
56
  publisher.chmod(path, permissions, options)
57
57
  end
58
58
  end
59
59
  end
60
- end
60
+ end
@@ -1,10 +1,9 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module Remote
4
-
5
- def remote_execute(command, options={})
6
- Helper.validates_presence_of command, "No command to execute!"
7
- Helper.validates_presence_of @cdb['ssh_key_file'], "SSH keyfile not set"
4
+ def remote_execute(command, options = {})
5
+ Helper.validates_presence_of command, 'No command to execute!'
6
+ Helper.validates_presence_of @cdb['ssh_key_file'], 'SSH keyfile not set'
8
7
 
9
8
  publisher = ::Publisher::Ssh.new
10
9
  publisher.remote_host = options[:remote_host] || @cdb['remote_host']
@@ -13,9 +12,9 @@ module Deployment
13
12
  publisher.remote_execute(command)
14
13
  end
15
14
 
16
- def rsync(source, target, options={})
15
+ def rsync(source, target, options = {})
17
16
  if options[:local].nil? or options[:local] == false
18
- Helper.validates_presence_of @cdb['ssh_key_file'], "SSH-keyfile not set"
17
+ Helper.validates_presence_of @cdb['ssh_key_file'], 'SSH-keyfile not set'
19
18
  end
20
19
  Helper.validates_presence_of source
21
20
  Helper.validates_presence_of target
@@ -29,11 +28,11 @@ module Deployment
29
28
  # publisher.ssh_key_file)
30
29
 
31
30
  if options[:local].nil? or options[:local] == false
32
- Helper.validates_presence_of publisher.remote_host, "Remote host not set"
33
- Helper.validates_presence_of publisher.remote_user, "Remote user not set"
31
+ Helper.validates_presence_of publisher.remote_host, 'Remote host not set'
32
+ Helper.validates_presence_of publisher.remote_user, 'Remote user not set'
34
33
  end
35
34
 
36
- if source[0].chr == "/"
35
+ if source[0].chr == '/'
37
36
  source_path = source
38
37
  else
39
38
  source_path = File.join($recipe_config[:deploy_home], source)
@@ -42,8 +41,8 @@ module Deployment
42
41
  publisher.sync(source_path, target, options)
43
42
  end
44
43
 
45
- def remove_old_releases(path, num_of_releases_to_keep=1, release_name_shema=nil, options={})
46
- Helper.validates_presence_of path, "No path in which the releases are"
44
+ def remove_old_releases(path, num_of_releases_to_keep = 1, release_name_shema = nil, options = {})
45
+ Helper.validates_presence_of path, 'No path in which the releases are'
47
46
 
48
47
  release_name_shema = /[0-9]{4}\-[0-9]{2}\-[0-9]{2}_[0-9]+.*/ unless release_name_shema # e.g. timestamps like 2014-04-11_1397227004
49
48
 
@@ -53,7 +52,6 @@ module Deployment
53
52
  publisher.ssh_key_file = options[:ssh_key_file] || @cdb['ssh_key_file']
54
53
  publisher.remove_old_releases(path, num_of_releases_to_keep, release_name_shema)
55
54
  end
56
-
57
55
  end
58
56
  end
59
- end
57
+ end
@@ -1,34 +1,33 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module Repository
4
-
5
4
  def get_dir_from_samba(source, target)
6
- Helper.validates_presence_of @cdb['samba_repository'], "Samba repository not set"
5
+ Helper.validates_presence_of @cdb['samba_repository'], 'Samba repository not set'
7
6
 
8
7
  samba = Provider::Repository.new
9
8
  samba.repository = @cdb['samba_repository']
10
9
  samba.samba_mountpoints = @cdb['samba_mountpoints']
11
- samba.method = "samba"
10
+ samba.method = 'samba'
12
11
  samba.worker = self
13
12
  samba.get_from_repository(source, File.join($recipe_config[:deploy_home], target))
14
13
  end
15
14
 
16
15
  def get_file_from_maven(source, target)
17
- Helper.validates_presence_of @cdb['maven_repository'], "Maven repository not set"
16
+ Helper.validates_presence_of @cdb['maven_repository'], 'Maven repository not set'
18
17
 
19
18
  maven = Provider::Repository.new
20
19
  maven.repository = @cdb['maven_repository']
21
20
  maven.user = @cdb['maven_user']
22
21
  maven.password = @cdb['maven_password']
23
- maven.method = "maven"
22
+ maven.method = 'maven'
24
23
  maven.get_from_repository(source, File.join($recipe_config[:deploy_home], target))
25
24
  end
26
25
 
27
- def get_file_via_scp(source, target, options={})
26
+ def get_file_via_scp(source, target, options = {})
28
27
  Helper.validates_presence_of @cdb['scp_source_host'], \
29
- "scp source host not set"
28
+ 'scp source host not set'
30
29
  Helper.validates_presence_of @cdb['scp_source_user'], \
31
- "scp source user not set"
30
+ 'scp source user not set'
32
31
 
33
32
  scp = Provider::Repository.new
34
33
  scp.host = @cdb['scp_source_host']
@@ -40,25 +39,25 @@ module Deployment
40
39
  scp.sshkey = File.join(File.dirname($exec_file_path), \
41
40
  @cdb['ssh_key_file'])
42
41
  end
43
- scp.method = "scp"
42
+ scp.method = 'scp'
44
43
  scp.get_from_repository(source, File.join($recipe_config[:deploy_home], target))
45
44
  end
46
45
 
47
- def get_file_via_svn(source, target, options={})
46
+ def get_file_via_svn(source, target, options = {})
48
47
  Helper.validates_presence_of @cdb['svn_binary'], \
49
- "svn binary not set"
48
+ 'svn binary not set'
50
49
  Helper.validates_presence_of @cdb['svn_source_base_url'], \
51
- "svn base url not set"
50
+ 'svn base url not set'
52
51
  Helper.validates_presence_of @cdb['svn_source_user'], \
53
- "svn source user not set"
52
+ 'svn source user not set'
54
53
  Helper.validates_presence_of @cdb['svn_source_command'], \
55
- "svn command not set"
54
+ 'svn command not set'
56
55
 
57
56
  svn = Provider::Repository.new
58
57
  svn.svnbinary = @cdb['svn_binary']
59
58
  svn.user = @cdb['svn_source_user']
60
59
  svn.password = @cdb['svn_source_password'] if @cdb['svn_source_password']
61
- svn.method = "svn"
60
+ svn.method = 'svn'
62
61
 
63
62
  if options[:svn_command]
64
63
  svn.svncmd = options[:svn_command]
@@ -76,34 +75,33 @@ module Deployment
76
75
  File.join($recipe_config[:deploy_home], target))
77
76
  end
78
77
 
79
- def git_fetch(options={})
78
+ def git_fetch(options = {})
80
79
  publisher = ::Provider::Git.new
81
80
  publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url']
82
81
  publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local']
83
- publisher.fetch()
82
+ publisher.fetch
84
83
  end
85
84
 
86
- def git_checkout(branch_name, options={})
85
+ def git_checkout(branch_name, options = {})
87
86
  publisher = ::Provider::Git.new
88
87
  publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url']
89
88
  publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local']
90
89
  publisher.checkout(branch_name, options)
91
90
  end
92
91
 
93
- def git_submodule(submodule_option, options={})
92
+ def git_submodule(submodule_option, options = {})
94
93
  publisher = ::Provider::Git.new
95
94
  publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url']
96
95
  publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local']
97
96
  publisher.submodule(submodule_option, options)
98
97
  end
99
98
 
100
- def git_tag(tag_name, options={})
99
+ def git_tag(tag_name, options = {})
101
100
  publisher = ::Provider::Git.new
102
101
  publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url']
103
102
  publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local']
104
103
  publisher.tag(tag_name, options)
105
104
  end
106
-
107
105
  end
108
106
  end
109
107
  end