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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80a1e552180801be141930fb42d7ccf0b298ebde
4
- data.tar.gz: 96d44887c4a629e516b268d7aa03ef496da0c7bc
3
+ metadata.gz: 77d8ce63b2b7d174f750afd9267e3d87ebc7dfe4
4
+ data.tar.gz: 2d3878eb61c21a861bd43daa060253660d2dae2c
5
5
  SHA512:
6
- metadata.gz: 34787500598a6ab6d89c942ed198d1c1c68e4574138c01f6764eaa50447ee1e7cf3f38d5db5402bf38067e8c8f5fa56a479c82cbdd2a98026c86237f9c15e1d4
7
- data.tar.gz: 1099a7b739b491455d94756f0727010528eb7080975ada5aa499ff5bef30157e012cf2e9252ff13f85bcfbbbcab51e6f21525469d11145d45785990de36f446c
6
+ metadata.gz: 506d0e6e2a449ce90e46084a3dd0578219d73b743c7d5d33b5460ae0ed3b012fdce80ce6728db110c12a5685de0b673cdf285bae9bd5b980d4e78d80b7f34ed2
7
+ data.tar.gz: e496cbf6a995a0b23067aab36d2653c2bc6ddbd7c282dc2a43182ef21c0ad8a843a03599d7a6b879dfa0aa6abdd66ce2fa406c89288085b943ecddc0c2904509
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ inherit_from: .rubocop_todo.yml
2
+ AllCops:
3
+ Exclude:
4
+ - 'spec/demo_recipe/*+/*'
5
+ - 'spec/properties/**/*'
6
+ - 'spec/templates/**/*'
7
+ - 'spec/zip/**/*'
8
+
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,52 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-08-05 09:15:27 +0000 using RuboCop version 0.24.1.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 28
9
+ # Cop supports --auto-correct.
10
+ Style/AndOr:
11
+ Enabled: false
12
+
13
+ # Offense count: 2
14
+ Style/BlockNesting:
15
+ Max: 4
16
+
17
+ # Offense count: 5
18
+ # Configuration parameters: CountComments.
19
+ Style/ClassLength:
20
+ Max: 160
21
+
22
+ # Offense count: 18
23
+ Style/CyclomaticComplexity:
24
+ Max: 18
25
+
26
+ # Offense count: 48
27
+ Style/Documentation:
28
+ Enabled: false
29
+
30
+ # Offense count: 400
31
+ # Configuration parameters: AllowedVariables.
32
+ Style/GlobalVars:
33
+ Enabled: false
34
+
35
+ # Offense count: 195
36
+ # Configuration parameters: AllowURI.
37
+ Style/LineLength:
38
+ Max: 236
39
+
40
+ # Offense count: 66
41
+ # Configuration parameters: CountComments.
42
+ Style/MethodLength:
43
+ Max: 57
44
+
45
+ # Offense count: 19
46
+ # Cop supports --auto-correct.
47
+ Style/Not:
48
+ Enabled: false
49
+
50
+ # Offense count: 9
51
+ Style/SelfAssignment:
52
+ Enabled: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- depengine (3.0.13)
4
+ depengine (3.0.20)
5
5
  expect4r (~> 0.0)
6
6
  json (~> 1.4)
7
7
  log4r (~> 1.1)
@@ -15,6 +15,7 @@ PATH
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
+ ast (2.0.0)
18
19
  builder (3.2.2)
19
20
  diff-lcs (1.2.5)
20
21
  expect4r (0.0.10)
@@ -32,14 +33,19 @@ GEM
32
33
  net-sftp (2.1.2)
33
34
  net-ssh (>= 2.6.5)
34
35
  net-ssh (2.8.0)
36
+ parser (2.2.0.pre.3)
37
+ ast (>= 1.1, < 3.0)
38
+ slop (~> 3.4, >= 3.4.5)
35
39
  polyglot (0.3.4)
36
40
  pony (1.8)
37
41
  mail (>= 2.0)
42
+ powerpack (0.0.9)
38
43
  ptools (1.2.4)
39
44
  rack (1.5.2)
40
45
  rack-protection (1.5.3)
41
46
  rack
42
47
  radius (0.7.4)
48
+ rainbow (2.0.0)
43
49
  rspec (2.14.1)
44
50
  rspec-core (~> 2.14.0)
45
51
  rspec-expectations (~> 2.14.0)
@@ -48,10 +54,18 @@ GEM
48
54
  rspec-expectations (2.14.5)
49
55
  diff-lcs (>= 1.1.3, < 2.0)
50
56
  rspec-mocks (2.14.6)
57
+ rubocop (0.24.1)
58
+ json (>= 1.7.7, < 2)
59
+ parser (>= 2.2.0.pre.3, < 3.0)
60
+ powerpack (~> 0.0.6)
61
+ rainbow (>= 1.99.1, < 3.0)
62
+ ruby-progressbar (~> 1.4)
63
+ ruby-progressbar (1.5.1)
51
64
  sinatra (1.4.5)
52
65
  rack (~> 1.4)
53
66
  rack-protection (~> 1.4)
54
67
  tilt (~> 1.3, >= 1.3.4)
68
+ slop (3.6.0)
55
69
  tilt (1.4.1)
56
70
  treetop (1.4.15)
57
71
  polyglot
@@ -65,4 +79,5 @@ DEPENDENCIES
65
79
  depengine!
66
80
  fakefs (~> 0.5)
67
81
  rspec (~> 2.14)
82
+ rubocop (~> 0.24.1)
68
83
  sinatra (~> 1.4)
data/Rakefile CHANGED
@@ -1,16 +1,16 @@
1
- desc "run depengine"
1
+ desc 'run depengine'
2
2
  task :it do
3
- sh "bundle install"
4
- sh "`pwd`/bin/depengine"
3
+ sh 'bundle install'
4
+ sh '`pwd`/bin/depengine'
5
5
  end
6
6
 
7
- desc "Generate gem"
7
+ desc 'Generate gem'
8
8
  task :build do
9
- sh "gem build -V depengine.gemspec"
9
+ sh 'gem build -V depengine.gemspec'
10
10
  end
11
11
 
12
- desc "generates docs for the DSL"
12
+ desc 'generates docs for the DSL'
13
13
  task :doc do
14
- sh "rm -rf doc/"
15
- sh "rdoc lib/depengine/dsl/*.rb"
16
- end
14
+ sh 'rm -rf doc/'
15
+ sh 'rdoc lib/depengine/dsl/*.rb'
16
+ end
data/bin/cdb_crypt CHANGED
@@ -7,8 +7,8 @@
7
7
  #
8
8
 
9
9
  require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
11
+ Pathname.new(__FILE__).realpath)
12
12
 
13
13
  require 'rubygems'
14
14
  require 'bundler/setup'
data/bin/de CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
 
4
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
4
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
5
5
  require 'depengine'
6
6
  require 'depengine/cli'
7
7
 
data/bin/depengine CHANGED
@@ -7,8 +7,8 @@
7
7
  #
8
8
 
9
9
  require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
11
+ Pathname.new(__FILE__).realpath)
12
12
 
13
13
  require 'rubygems'
14
14
  require 'bundler/setup'
data/bin/spec_setup CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- puts "running apt-get to install packages:"
3
+ puts 'running apt-get to install packages:'
4
4
  `sudo apt-get install zip postfix subversion`
5
5
 
6
6
  puts "allowing #{ENV['USER']} to SSH into localhost"
7
- `ssh-keygen -f #{ENV['HOME']}/.ssh/id_rsa -N "" -q` unless File.exists? ENV['HOME']+"/.ssh/id_rsa"
7
+ `ssh-keygen -f #{ENV['HOME']}/.ssh/id_rsa -N "" -q` unless File.exist? ENV['HOME'] + '/.ssh/id_rsa'
8
8
  `cat #{ENV['HOME']}/.ssh/id_rsa.pub >> #{ENV['HOME']}/.ssh/authorized_keys`
data/depengine.gemspec CHANGED
@@ -3,36 +3,37 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'depengine/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "depengine"
6
+ s.name = 'depengine'
7
7
  s.version = Depengine::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Team Automatisierung"]
10
- s.email = ["team-automatisierung@sinnerschrader.com"]
11
- s.homepage = "http://www.sinnerschrader.com"
12
- s.summary = %q{Depengine generator}
13
- s.description = %q{Simply generates Depengine text.}
9
+ s.authors = ['Team Automatisierung']
10
+ s.email = ['team-automatisierung@sinnerschrader.com']
11
+ s.homepage = 'http://www.sinnerschrader.com'
12
+ s.summary = 'Depengine generator'
13
+ s.description = 'Simply generates Depengine text.'
14
14
 
15
- s.required_ruby_version = ">= 1.9.3"
15
+ s.required_ruby_version = '>= 1.9.3'
16
16
 
17
17
  # See http://spin.atomicobject.com/2011/01/10/using-bundler-for-ruby-gem-development/
18
- s.add_dependency "json", "~> 1.4"
19
- s.add_dependency "net-ssh", '~> 2.8'
20
- s.add_dependency "net-sftp", '~> 2.1'
21
- s.add_dependency "net-scp", '~> 1.1'
22
- s.add_dependency "log4r", '~> 1.1'
23
- s.add_dependency "pony", '~> 1.8'
24
- s.add_dependency "ptools", '~> 1.2'
25
- s.add_dependency "radius", '~> 0.7'
26
- s.add_dependency "expect4r", '~> 0.0'
18
+ s.add_dependency 'json', '~> 1.4'
19
+ s.add_dependency 'net-ssh', '~> 2.8'
20
+ s.add_dependency 'net-sftp', '~> 2.1'
21
+ s.add_dependency 'net-scp', '~> 1.1'
22
+ s.add_dependency 'log4r', '~> 1.1'
23
+ s.add_dependency 'pony', '~> 1.8'
24
+ s.add_dependency 'ptools', '~> 1.2'
25
+ s.add_dependency 'radius', '~> 0.7'
26
+ s.add_dependency 'expect4r', '~> 0.0'
27
27
 
28
- s.add_development_dependency "rspec", "~> 2.14"
29
- s.add_development_dependency "fakefs", '~> 0.5'
30
- s.add_development_dependency "sinatra", '~> 1.4'
31
- s.add_development_dependency "builder", '~> 3.2.0'
28
+ s.add_development_dependency 'rspec', '~> 2.14'
29
+ s.add_development_dependency 'fakefs', '~> 0.5'
30
+ s.add_development_dependency 'sinatra', '~> 1.4'
31
+ s.add_development_dependency 'builder', '~> 3.2.0'
32
+ s.add_development_dependency 'rubocop', '~> 0.24.1'
32
33
 
33
34
  s.files = `git ls-files`.split("\n")
34
35
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
35
36
 
36
37
  s.executables = %w(de depengine depengine.sh cdb_crypt)
37
- s.require_paths = ["lib"]
38
+ s.require_paths = ['lib']
38
39
  end
@@ -6,12 +6,12 @@ module Asserter
6
6
  attr_accessor :check_uri
7
7
  attr_accessor :check_response_string
8
8
 
9
- def assert_url_response_of(options={})
10
- Helper.validates_presence_of check_protocol, "check_protocol not set"
11
- Helper.validates_presence_of check_host, "check_host not set"
12
- Helper.validates_presence_of check_port, "check_port not set"
13
- Helper.validates_presence_of check_uri, "check_uri not set"
14
- Helper.validates_presence_of check_response_string, "check_response_string not set"
9
+ def assert_url_response_of(_options = {})
10
+ Helper.validates_presence_of check_protocol, 'check_protocol not set'
11
+ Helper.validates_presence_of check_host, 'check_host not set'
12
+ Helper.validates_presence_of check_port, 'check_port not set'
13
+ Helper.validates_presence_of check_uri, 'check_uri not set'
14
+ Helper.validates_presence_of check_response_string, 'check_response_string not set'
15
15
 
16
16
  check_url = "#{check_protocol}://#{check_host}:#{check_port}#{check_uri}"
17
17
  $log.writer.info "Checking URL = #{check_url} for \"#{check_response_string}\""
@@ -24,17 +24,16 @@ module Asserter
24
24
  $log.writer.debug "ResponseCode: #{response.code}"
25
25
  $log.writer.debug "ResponseMessage: #{response.message}"
26
26
  $log.writer.debug "ResponseBody: #{response.body}"
27
- if not response.code == '200'
27
+ unless response.code == '200'
28
28
  $log.writer.error "Got response code: #{response.code}"
29
29
  exit 1
30
30
  end
31
- if not response.body =~ Regexp.new(check_response_string)
31
+ unless response.body =~ Regexp.new(check_response_string)
32
32
  $log.writer.error "Expected: #{check_response_string}"
33
33
  $log.writer.error "Got: #{response.body}"
34
34
  exit 1
35
35
  end
36
36
  end
37
-
38
37
  end
39
38
  end
40
39
  end
data/lib/depengine/cli.rb CHANGED
@@ -1,21 +1,19 @@
1
1
  module Depengine
2
2
  module CLI
3
3
  class << self
4
-
5
- def run(args, input = $stdin, output = $stdout, error = $stderr) #:nodoc:
6
-
4
+ def run(args, _input = $stdin, _output = $stdout, error = $stderr) #:nodoc:
7
5
  @deploy_home = '.'
8
6
  @recipe_name = 'recipe/deploy.rb'
9
7
 
10
- args_size=args.size
8
+ args_size = args.size
11
9
 
12
10
  args.options do |o|
13
- o.banner = "Usage: #{File.basename($0)} [options]"
14
- o.separator ""
11
+ o.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options]"
12
+ o.separator ''
15
13
  o.on('-n', '--new [some_path]', 'create a new empty recipe directory structure') do |path|
16
14
  require_relative('helper/cli_helper')
17
15
  extend CLIHelper
18
- setup_new_recipe(path ||= ".")
16
+ setup_new_recipe(path || '.')
19
17
  end
20
18
  o.on('-h', '--deployhome [DIRNAME]', 'Home of deployments.') do |dname|
21
19
  set :deploy_home, dname
@@ -30,7 +28,7 @@ module Depengine
30
28
  set :env, ename
31
29
  end
32
30
  o.on('-t', '--maven_test_switch [SWITCH]', 'Disable mvn tests.') do |tname|
33
- set :maven_test_switch, tname
31
+ set :maven_test_switch, tname
34
32
  end
35
33
  o.on('-v', '--version [VERSION]', 'Version.') do |vname|
36
34
  set :version, vname
@@ -38,18 +36,18 @@ module Depengine
38
36
  o.parse!
39
37
  end
40
38
  unless args_size > 2
41
- error << args.options
42
- return 127
43
- end
39
+ error << args.options
40
+ return 127
41
+ end
44
42
 
45
- recipe_filename = File.join(($recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]), @recipe_name)
43
+ recipe_filename = File.join(($recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]), @recipe_name)
46
44
  puts "Evaluating recipe #{recipe_filename}"
47
45
  evaluate_recipe!(File.open(recipe_filename).read)
48
- return 0
46
+ 0
49
47
  end
50
48
 
51
49
  def evaluate_recipe!(recipe)
52
- eval(recipe)
50
+ eval(recipe) # rubocop:disable Lint/Eval
53
51
  end
54
52
  end
55
53
  end
@@ -1,20 +1,19 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module CDB
4
-
5
- def get_all_config_parameters
4
+ def get_all_config_parameters # rubocop:disable Style/AccessorMethodName
6
5
  # merge cdb data
7
6
  $recipe_config.merge @cdb
8
7
  end
9
8
 
10
9
  def get_cdb_parameters(version)
11
- Helper.validates_presence_of version, "version parameter is missing"
10
+ Helper.validates_presence_of version, 'version parameter is missing'
12
11
  Helper.validates_presence_of $recipe_config['cdb_host'], \
13
- "cdb_host parameter is missing"
12
+ 'cdb_host parameter is missing'
14
13
  Helper.validates_presence_of $recipe_config['cdb_context'], \
15
- "cdb_context parameter is missing"
14
+ 'cdb_context parameter is missing'
16
15
  Helper.validates_presence_of $recipe_config[:module_name], \
17
- "module_name parameter is missing"
16
+ 'module_name parameter is missing'
18
17
 
19
18
  cdb = Provider::CDB.new
20
19
  cdb.protocol = 'http'
@@ -22,17 +21,17 @@ module Deployment
22
21
  cdb.context = $recipe_config['cdb_context']
23
22
  cdb.env = $recipe_config[:env]
24
23
 
25
- cdb.get_parameters(File.join( $recipe_config[:env], \
26
- $recipe_config[:module_name] ), version)
24
+ cdb.get_parameters(File.join($recipe_config[:env], \
25
+ $recipe_config[:module_name]), version)
27
26
  end
28
27
 
29
28
  def set_cdb_parameter(key, value)
30
29
  Helper.validates_presence_of $recipe_config['cdb_host'], \
31
- "cdb_host parameter is missing"
30
+ 'cdb_host parameter is missing'
32
31
  Helper.validates_presence_of $recipe_config['cdb_context'], \
33
- "cdb_context parameter is missing"
32
+ 'cdb_context parameter is missing'
34
33
  Helper.validates_presence_of $recipe_config[:module_name], \
35
- "module_name parameter is missing"
34
+ 'module_name parameter is missing'
36
35
 
37
36
  cdb = Provider::CDB.new
38
37
  cdb.protocol = 'http'
@@ -40,15 +39,15 @@ module Deployment
40
39
  cdb.context = $recipe_config['cdb_context']
41
40
  cdb.env = $recipe_config[:env]
42
41
 
43
- cdb.set_parameter(File.join( $recipe_config[:env], \
44
- $recipe_config[:module_name] ), key, value)
42
+ cdb.set_parameter(File.join($recipe_config[:env], \
43
+ $recipe_config[:module_name]), key, value)
45
44
  end
46
45
 
47
46
  def set_cdb_parameter_4_app(module_name, app_name, key, value)
48
47
  Helper.validates_presence_of $recipe_config['cdb_host'], \
49
- "cdb_host parameter is missing"
48
+ 'cdb_host parameter is missing'
50
49
  Helper.validates_presence_of $recipe_config['cdb_context'], \
51
- "cdb_context parameter is missing"
50
+ 'cdb_context parameter is missing'
52
51
 
53
52
  cdb = Provider::CDB.new
54
53
  cdb.protocol = 'http'
@@ -56,8 +55,8 @@ module Deployment
56
55
  cdb.context = $recipe_config['cdb_context']
57
56
  cdb.env = $recipe_config['ENVIRONMENT']
58
57
 
59
- cdb.set_parameter(File.join( module_name, app_name ), key, value)
58
+ cdb.set_parameter(File.join(module_name, app_name), key, value)
60
59
  end
61
60
  end
62
61
  end
63
- end
62
+ end
@@ -11,50 +11,47 @@ module Deployment
11
11
  def self.deliver(&block)
12
12
  worker = Worker.new
13
13
  worker.instance_eval(&block)
14
- return worker
14
+ worker
15
15
  end
16
16
 
17
17
  class Worker
18
-
19
18
  attr_accessor :cdb
20
19
 
21
20
  def initialize
22
21
  # initialize logging
23
- if not $recipe_config[:log_level].nil?
22
+ unless $recipe_config[:log_level].nil?
24
23
  case $recipe_config[:log_level]
25
- when "DEBUG"
26
- $log.level('stdout_logger', Log4r::DEBUG)
27
- when "INFO"
28
- $log.level('stdout_logger', Log4r::INFO)
29
- when "WARN"
30
- $log.level('stdout_logger', Log4r::WARN)
31
- when "ERROR"
32
- $log.level('stdout_logger', Log4r::ERROR)
33
- when "FATAL"
34
- $log.level('stdout_logger', Log4r::FATAL)
24
+ when 'DEBUG'
25
+ $log.level('stdout_logger', Log4r::DEBUG)
26
+ when 'INFO'
27
+ $log.level('stdout_logger', Log4r::INFO)
28
+ when 'WARN'
29
+ $log.level('stdout_logger', Log4r::WARN)
30
+ when 'ERROR'
31
+ $log.level('stdout_logger', Log4r::ERROR)
32
+ when 'FATAL'
33
+ $log.level('stdout_logger', Log4r::FATAL)
35
34
  end
36
35
  end
37
- if $recipe_config[:log_trace]
38
- $log.enable_trace
39
- end
36
+ $log.enable_trace if $recipe_config[:log_trace]
40
37
 
41
38
  load_modules!
42
39
 
43
40
  # generate hash from environemnt variables and merge
44
- $recipe_config.merge! Helper.get_environemnt_variables($recipe_config['env_exceptions'] || "LS_COLORS TERMCAP")
41
+ $recipe_config.merge! Helper.get_environemnt_variables($recipe_config['env_exceptions'] || 'LS_COLORS TERMCAP')
45
42
 
46
43
  @version = Helper.parse_version($recipe_config[:version])
47
44
 
48
45
  # validate needed environment variables
49
- Helper.validates_not_empty $recipe_config[:env], "env is not set"
50
- Helper.validates_not_empty $recipe_config[:version], "version is not set"
51
- Helper.validates_not_empty $recipe_config[:deploy_home], "deploy_home is not set"
46
+ Helper.validates_not_empty $recipe_config[:env], 'env is not set'
47
+ Helper.validates_not_empty $recipe_config[:version], 'version is not set'
48
+ Helper.validates_not_empty $recipe_config[:deploy_home], 'deploy_home is not set'
52
49
 
53
50
  if $recipe_config[:skip_cdb_setup]
54
51
  @cdb = {}
55
52
  else
56
- $recipe_config['cdb_host'] ||= "filesystem"
57
- $recipe_config['cdb_context'] ||= ""
53
+ $recipe_config['cdb_host'] ||= 'filesystem'
54
+ $recipe_config['cdb_context'] ||= ''
58
55
  @cdb = get_cdb_parameters(@version['cdb'])
59
56
  end
60
57
 
@@ -62,27 +59,25 @@ module Deployment
62
59
 
63
60
  # the logfile needs a correct WORKSPACE and the initial dirs
64
61
  # so we have to set it here
65
- if $recipe_config[:log_file]
62
+ return unless $recipe_config[:log_file]
63
+ level = Log4r::INFO
64
+ $log.writer.info "Logfile level set to #{$recipe_config[:log_file_level]}"
65
+ case $recipe_config[:log_file_level]
66
+ when 'DEBUG'
67
+ level = Log4r::DEBUG
68
+ when 'INFO'
66
69
  level = Log4r::INFO
67
- $log.writer.info "Logfile level set to #{$recipe_config[:log_file_level]}"
68
- case $recipe_config[:log_file_level]
69
- when "DEBUG"
70
- level = Log4r::DEBUG
71
- when "INFO"
72
- level = Log4r::INFO
73
- when "WARN"
74
- level = Log4r::WARN
75
- when "ERROR"
76
- level = Log4r::ERROR
77
- when "FATAL"
78
- level = Log4r::FATAL
79
- end
80
- $log.add_outputter(Log4r::FileOutputter.new('log_file', \
81
- :filename => File.join($recipe_config[:deploy_home], 'log', \
82
- $recipe_config[:log_file])), \
83
- level)
70
+ when 'WARN'
71
+ level = Log4r::WARN
72
+ when 'ERROR'
73
+ level = Log4r::ERROR
74
+ when 'FATAL'
75
+ level = Log4r::FATAL
84
76
  end
85
-
77
+ $log.add_outputter(Log4r::FileOutputter.new('log_file', \
78
+ filename: File.join($recipe_config[:deploy_home], 'log', \
79
+ $recipe_config[:log_file])), \
80
+ level)
86
81
  end
87
82
 
88
83
  def load_modules!
@@ -110,28 +105,25 @@ module Deployment
110
105
 
111
106
  def setup_workspace!
112
107
  if $recipe_config[:cleanup_workspace_before]
113
- $log.writer.info "Remove all files from Workspace"
108
+ $log.writer.info 'Remove all files from Workspace'
114
109
  Helper.cleanup_workspace!($recipe_config[:deploy_home], $recipe_config[:cleanup_workspace_before])
115
110
  end
116
111
 
117
112
  Helper.init_workspace($recipe_config[:deploy_home])
118
113
 
119
- if $recipe_config[:copy_to_workspace]
120
- $recipe_config[:copy_to_workspace] = ["config"] unless $recipe_config[:copy_to_workspace].respond_to?(:each)
121
- $recipe_config[:copy_to_workspace].each do |dir|
122
- copy_to_workspace!(dir)
123
- end
114
+ return unless $recipe_config[:copy_to_workspace]
115
+ $recipe_config[:copy_to_workspace] = ['config'] unless $recipe_config[:copy_to_workspace].respond_to?(:each)
116
+ $recipe_config[:copy_to_workspace].each do |dir|
117
+ copy_to_workspace!(dir)
124
118
  end
125
119
  end
126
120
 
127
121
  def copy_to_workspace!(dir)
128
- Processor::copy(File.join($recipe_config[:recipe_base_dir], dir), $recipe_config[:deploy_home])
122
+ Processor.copy(File.join($recipe_config[:recipe_base_dir], dir), $recipe_config[:deploy_home])
129
123
  end
130
124
 
131
125
  # access configdata like this...
132
126
  # @hudson['USER']
133
127
  # $recipe_config[:application_name]
134
-
135
128
  end
136
129
  end
137
-
@@ -1,11 +1,10 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module DWEB
4
-
5
- def send_dweb_command(command, options={})
6
- Helper.validates_presence_of @cdb['staging_host'], "Staging Host not set"
7
- Helper.validates_presence_of @cdb['ssh_key_file_command'], "SSH keyfile not set"
8
- Helper.validates_presence_of @cdb['siteid'], "Siteid not set"
4
+ def send_dweb_command(command, options = {})
5
+ Helper.validates_presence_of @cdb['staging_host'], 'Staging Host not set'
6
+ Helper.validates_presence_of @cdb['ssh_key_file_command'], 'SSH keyfile not set'
7
+ Helper.validates_presence_of @cdb['siteid'], 'Siteid not set'
9
8
 
10
9
  publisher = ::Publisher::Dweb.new
11
10
  publisher.staging_host = @cdb['staging_host']
@@ -14,10 +13,10 @@ module Deployment
14
13
  publisher.send_command(command, options)
15
14
  end
16
15
 
17
- def dweb_upload(source, target, options={})
18
- Helper.validates_presence_of @cdb['staging_host'], "Staging Host not set"
19
- Helper.validates_presence_of @cdb['ssh_key_file'], "SSH keyfile not set"
20
- Helper.validates_presence_of @cdb['siteid'], "Siteid not set"
16
+ def dweb_upload(source, target, options = {})
17
+ Helper.validates_presence_of @cdb['staging_host'], 'Staging Host not set'
18
+ Helper.validates_presence_of @cdb['ssh_key_file'], 'SSH keyfile not set'
19
+ Helper.validates_presence_of @cdb['siteid'], 'Siteid not set'
21
20
  Helper.validates_presence_of source
22
21
  Helper.validates_presence_of target
23
22
 
@@ -33,7 +32,7 @@ module Deployment
33
32
  File.join('/vhosts/', vhost, target), options)
34
33
  end
35
34
 
36
- def dweb_link(source, symlink, options={})
35
+ def dweb_link(source, symlink, options = {})
37
36
  publisher = ::Publisher::Dweb.new
38
37
  publisher.staging_host = @cdb['staging_host']
39
38
  publisher.ssh_key_file = @cdb['ssh_key_file']
@@ -43,4 +42,4 @@ module Deployment
43
42
  end
44
43
  end
45
44
  end
46
- end
45
+ end