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,25 +1,25 @@
1
1
  module Deployment
2
2
  module Methods
3
3
  module Template
4
- def parse_template(source, target, content, options={})
5
- template = Processor::Template.new
6
- template.cdb = @cdb
7
- template.basepath = options[:basepath] || $recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]
8
- options[:excludes] = [] if options[:excludes].nil?
9
- options[:excludes] << '.svn'
4
+ def parse_template(source, target, content, options = {})
5
+ template = Processor::Template.new
6
+ template.cdb = @cdb
7
+ template.basepath = options[:basepath] || $recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]
8
+ options[:excludes] = [] if options[:excludes].nil?
9
+ options[:excludes] << '.svn'
10
10
  options[:excludes] << '.git'
11
- template.parse_template(source, content, ::Helper::path_in_deploy_home(target), options)
12
- end
11
+ template.parse_template(source, content, ::Helper.path_in_deploy_home(target), options)
12
+ end
13
13
 
14
- def parse_erb_template(source, target, content, options={})
15
- template = Processor::Template.new
16
- template.cdb = @cdb
17
- template.basepath = options[:basepath] || $recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]
18
- options[:excludes] = [] if options[:excludes].nil?
19
- options[:excludes] << '.svn'
14
+ def parse_erb_template(source, target, content, options = {})
15
+ template = Processor::Template.new
16
+ template.cdb = @cdb
17
+ template.basepath = options[:basepath] || $recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]
18
+ options[:excludes] = [] if options[:excludes].nil?
19
+ options[:excludes] << '.svn'
20
20
  options[:excludes] << '.git'
21
- template.parse_erb_template(source, content, ::Helper::path_in_deploy_home(target), options)
22
- end
23
- end
24
- end
25
- end
21
+ template.parse_erb_template(source, content, ::Helper.path_in_deploy_home(target), options)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,32 +1,32 @@
1
1
  module Deployment
2
2
  module Methods
3
- module Zip
4
- def unzip_file(zip_file, target_dir, filename=nil)
5
- Helper.validates_presence_of @cdb['unzip_bin']
3
+ module Zip
4
+ def unzip_file(zip_file, target_dir, filename = nil)
5
+ Helper.validates_presence_of @cdb['unzip_bin']
6
6
 
7
- Processor.unzip_file(File.join($recipe_config[:deploy_home], zip_file), \
8
- File.join($recipe_config[:deploy_home], target_dir), \
9
- filename,
10
- @cdb['unzip_bin'])
11
- end
7
+ Processor.unzip_file(File.join($recipe_config[:deploy_home], zip_file), \
8
+ File.join($recipe_config[:deploy_home], target_dir), \
9
+ filename,
10
+ @cdb['unzip_bin'])
11
+ end
12
12
 
13
- def tgz_file(tgz_file, source_dir, filename=nil)
14
- Helper.validates_presence_of @cdb['tar_bin']
13
+ def tgz_file(tgz_file, source_dir, filename = nil)
14
+ Helper.validates_presence_of @cdb['tar_bin']
15
15
 
16
- Processor.tgz_file(File.join($recipe_config[:deploy_home], tgz_file), \
17
- File.join($recipe_config[:deploy_home], source_dir), \
18
- filename,
19
- @cdb['tar_bin'])
20
- end
16
+ Processor.tgz_file(File.join($recipe_config[:deploy_home], tgz_file), \
17
+ File.join($recipe_config[:deploy_home], source_dir), \
18
+ filename,
19
+ @cdb['tar_bin'])
20
+ end
21
21
 
22
- def untgz_file(tgz_file, target_dir, filename=nil)
23
- Helper.validates_presence_of @cdb['tar_bin']
22
+ def untgz_file(tgz_file, target_dir, filename = nil)
23
+ Helper.validates_presence_of @cdb['tar_bin']
24
24
 
25
- Processor.untgz_file(File.join($recipe_config[:deploy_home], tgz_file), \
26
- File.join($recipe_config[:deploy_home], target_dir), \
27
- filename,
28
- @cdb['tar_bin'])
29
- end
30
- end
25
+ Processor.untgz_file(File.join($recipe_config[:deploy_home], tgz_file), \
26
+ File.join($recipe_config[:deploy_home], target_dir), \
27
+ filename,
28
+ @cdb['tar_bin'])
29
+ end
30
+ end
31
31
  end
32
- end
32
+ end
@@ -1,19 +1,18 @@
1
1
  module CLIHelper
2
-
3
2
  def setup_new_recipe(path)
4
3
  puts "Setting up a new deployment recipe in #{File.expand_path(path)}"
5
4
  require 'fileutils'
6
5
  require 'yaml'
7
6
  FileUtils.mkdir_p(File.expand_path(path))
8
7
  FileUtils.cd(File.expand_path(path))
9
- %w{cdb config recipe}.each {|d| FileUtils.mkdir_p d}
10
- %w{DEV PROD}.each do |env|
8
+ %w(cdb config recipe).each { |d| FileUtils.mkdir_p d }
9
+ %w(DEV PROD).each do |env|
11
10
  FileUtils.mkdir_p "cdb/#{env}"
12
- File.open("cdb/#{env}.yaml","w") {|f| f.write env_yaml("DEV")}
13
- File.open("cdb/#{env}/demoapplication.yaml","w") {|f| f.write application_yaml}
11
+ File.open("cdb/#{env}.yaml", 'w') { |f| f.write env_yaml('DEV') }
12
+ File.open("cdb/#{env}/demoapplication.yaml", 'w') { |f| f.write application_yaml }
14
13
  end
15
- FileUtils.touch("config/some_file_that_is_needed_for_the_deployment.jar")
16
- File.open("recipe/deploy.rb","w") {|f| f.write deploy_recipe_template}
14
+ FileUtils.touch('config/some_file_that_is_needed_for_the_deployment.jar')
15
+ File.open('recipe/deploy.rb', 'w') { |f| f.write deploy_recipe_template }
17
16
  exit 0
18
17
  end
19
18
 
@@ -26,9 +25,9 @@ module CLIHelper
26
25
 
27
26
  def application_yaml
28
27
  { 'taskname' => 'A demo applicaition deployment',
29
- 'app_hosts' => ['appserv01', 'appserv02'],
28
+ 'app_hosts' => %w(appserv01 appserv02),
30
29
  'deploy_path' => '/some/path/to/deploy/to/',
31
- 'patch_properties' => {'test.message' => 'foo'}
30
+ 'patch_properties' => { 'test.message' => 'foo' }
32
31
  }.to_yaml
33
32
  end
34
33
 
@@ -54,5 +53,4 @@ Deployment.deliver do
54
53
  end
55
54
  }
56
55
  end
57
-
58
- end
56
+ end
@@ -1,12 +1,11 @@
1
1
  module Helper
2
- def get_environemnt_variables(exception=[])
2
+ def get_environemnt_variables(exception = [])
3
3
  result = {}
4
4
 
5
5
  ENV.each do |key, value|
6
- unless (exception || []).include? key
7
- $log.writer.debug "Add environment variable #{key} with value #{value} to configuration hash"
8
- result[key] = value
9
- end
6
+ next if (exception || []).include? key
7
+ $log.writer.debug "Add environment variable #{key} with value #{value} to configuration hash"
8
+ result[key] = value
10
9
  end
11
10
 
12
11
  result
@@ -18,28 +17,26 @@ module Helper
18
17
  begin
19
18
  result = JSON.parse(version)
20
19
  rescue
21
- $log.writer.debug "Given version string is not a JSON object"
22
- result = {"app" => version, "cdb" => "", "depsw" => ""}
20
+ $log.writer.debug 'Given version string is not a JSON object'
21
+ result = { 'app' => version, 'cdb' => '', 'depsw' => '' }
23
22
  end
24
23
 
25
24
  result
26
25
  end
27
26
  module_function :parse_version
28
27
 
29
- def cleanup_workspace!(workspace, sub_dirs=nil)
28
+ def cleanup_workspace!(workspace, sub_dirs = nil)
30
29
  Helper.validates_presence_of workspace
31
30
 
32
31
  begin
33
- unless sub_dirs.respond_to?(:each)
34
- sub_dirs = ["**/*"]
35
- end
32
+ sub_dirs = ['**/*'] unless sub_dirs.respond_to?(:each)
36
33
  sub_dirs.each do |sub_dir|
37
34
  FileUtils.rm_rf Dir.glob("#{workspace}/#{sub_dir}")
38
35
  $log.writer.debug "Cleaning Workspace #{workspace}/#{sub_dir}"
39
36
  end
40
37
 
41
- rescue Exception => e
42
- $log.writer.error "Can not cleanup Workspace!"
38
+ rescue => e
39
+ $log.writer.error 'Can not cleanup Workspace!'
43
40
  $log.writer.error e.message
44
41
  exit 1
45
42
  end
@@ -49,19 +46,18 @@ module Helper
49
46
  def init_workspace(workspace)
50
47
  Helper.validates_presence_of workspace
51
48
 
52
- $log.writer.debug "Initialize Workspace"
53
- initial_dirs = %w{source target config keep log}
49
+ $log.writer.debug 'Initialize Workspace'
50
+ initial_dirs = %w(source target config keep log)
54
51
  begin
55
52
  initial_dirs.each do |dir|
56
- FileUtils.mkdir_p( File.join(workspace, dir) )
53
+ FileUtils.mkdir_p(File.join(workspace, dir))
57
54
  $log.writer.debug "Create directory #{File.join(workspace, dir)}"
58
55
  end
59
- rescue Exception => e
60
- $log.writer.error "Can not create initial directories in workspace!"
56
+ rescue => e
57
+ $log.writer.error 'Can not create initial directories in workspace!'
61
58
  $log.writer.error e.message
62
59
  exit 1
63
60
  end
64
61
  end
65
62
  module_function :init_workspace
66
63
  end
67
-
@@ -1,12 +1,10 @@
1
1
  module Helper
2
-
3
2
  class Mail
4
-
5
3
  attr_accessor :smtp_host, :smtp_port
6
4
 
7
5
  def initialize
8
- smtp_host ||= 'localhost'
9
- smtp_port ||= 25
6
+ @smtp_host ||= 'localhost'
7
+ @smtp_port ||= 25
10
8
  end
11
9
 
12
10
  # Sends an email via smtp.
@@ -17,27 +15,23 @@ module Helper
17
15
  # * +:to+ - the recipiants address
18
16
  # * +:subject+ - the email subject
19
17
  # * +:body+ - the actual text to send in the mail
20
- def sendmail(options={})
21
- begin
22
- Pony.mail( \
23
- :from => options[:from],
24
- :to => options[:to],
25
- :via => :smtp,
26
- :via_options => {
27
- :address => smtp_host,
28
- :port => smtp_port,
29
- :authentication => nil,
30
- :enable_starttls_auto => false
31
- },
32
- :subject => options[:subject],
33
- :body => options[:body]
34
- )
35
- rescue Exception => e
36
- $log.writer.error "Can not send mail via host #{smtp_host}"
37
- $log.writer.error e.message
38
- end
18
+ def sendmail(options = {})
19
+ Pony.mail( \
20
+ from: options[:from],
21
+ to: options[:to],
22
+ via: :smtp,
23
+ via_options: {
24
+ address: @smtp_host,
25
+ port: @smtp_port,
26
+ authentication: nil,
27
+ enable_starttls_auto: false
28
+ },
29
+ subject: options[:subject],
30
+ body: options[:body]
31
+ )
32
+ rescue => e
33
+ $log.writer.error "Can not send mail via host #{smtp_host}"
34
+ $log.writer.error e.message
39
35
  end
40
36
  end
41
-
42
37
  end
43
-
@@ -1,91 +1,72 @@
1
1
  module Helper
2
2
  class Properties
3
-
4
3
  attr_accessor :properties_hash
5
4
  attr_accessor :separator
6
-
7
- def initialize()
8
- properties_hash = {}
9
- separator = "="
10
- end
5
+
6
+ def initialize
7
+ @properties_hash = {}
8
+ @separator = '='
9
+ end
11
10
 
12
11
  ### patch properties (key/value)
13
12
  def patch(source, target)
14
-
15
- if not File.file? source
13
+ unless File.file? source
16
14
  $log.writer.error "File #{source} does not exists"
17
15
  exit 1
18
16
  end
19
-
17
+
20
18
  if target.nil?
21
- $log.writer.error "Parameter target not set"
19
+ $log.writer.error 'Parameter target not set'
22
20
  exit 1
23
21
  end
24
-
22
+
25
23
  if target.length == 0
26
- $log.writer.error "Parameter target not set"
24
+ $log.writer.error 'Parameter target not set'
27
25
  exit 1
28
26
  end
29
-
30
-
27
+
31
28
  ### read source file in array
32
29
  data = File.readlines(source)
33
30
 
34
- target_file = File.open(target, "w")
35
-
36
- data.each { |entry|
37
- if entry.include? separator
38
- keyvalue = entry.split(separator,2)
31
+ target_file = File.open(target, 'w')
39
32
 
40
- if keyvalue[1].class == TrueClass
41
- keyvalue[1] = 'true'
42
- end
43
- if properties_hash[keyvalue[0].strip].class == TrueClass
44
- properties_hash[keyvalue[0].strip] = 'true'
45
- end
33
+ data.each do |entry|
34
+ if entry.include? separator
35
+ keyvalue = entry.split(separator, 2)
46
36
 
47
- if keyvalue[1].class == FalseClass
48
- keyvalue[1] = 'false'
49
- end
50
- if properties_hash[keyvalue[0].strip].class == FalseClass
51
- properties_hash[keyvalue[0].strip] = 'false'
52
- end
37
+ keyvalue[1] = 'true' if keyvalue[1].class == TrueClass
38
+ keyvalue[1] = 'false' if keyvalue[1].class == FalseClass
39
+ properties_hash[keyvalue[0].strip] = 'true' if properties_hash[keyvalue[0].strip].class == TrueClass
40
+ properties_hash[keyvalue[0].strip] = 'false' if properties_hash[keyvalue[0].strip].class == FalseClass
53
41
 
54
- if properties_hash[keyvalue[0].strip] != nil
55
- entry = entry.sub(keyvalue[1].strip, properties_hash[keyvalue[0].strip])
56
- end
42
+ entry = entry.sub(keyvalue[1].strip, properties_hash[keyvalue[0].strip]) unless properties_hash[keyvalue[0].strip].nil?
57
43
  end
58
44
  target_file.puts entry
59
- }
60
-
45
+ end
46
+
61
47
  target_file.close
62
-
63
48
  end
64
49
 
65
50
  ### patch strings
66
51
  def substitute(source, target)
67
-
68
- if not File.file? source
52
+ unless File.file? source
69
53
  $log.writer.error "File #{source} does not exists"
70
- exit 1
71
- end
72
-
54
+ fail "File #{source} does not exists"
55
+ end
56
+
73
57
  ### read backup file in array
74
58
  data = File.readlines(source)
75
59
 
76
- target_file = File.open(target, "w")
77
-
78
- data.each { |entry|
79
- properties_hash.keys.each { |hashkey|
60
+ target_file = File.open(target, 'w')
61
+
62
+ data.each do |entry|
63
+ properties_hash.keys.each do |hashkey|
80
64
  entry = entry.sub(hashkey, properties_hash[hashkey])
81
- }
65
+ end
82
66
  target_file.puts entry
83
- }
84
-
67
+ end
68
+
85
69
  target_file.close
86
-
87
70
  end
88
-
89
71
  end
90
-
91
72
  end
@@ -1,43 +1,37 @@
1
1
  module Helper
2
-
3
2
  class Smb
4
-
5
3
  attr_accessor :remote_path
6
4
  attr_accessor :local_path
7
5
 
8
- def samba_mount()
9
- Helper.validates_presence_of remote_path, "Samba remote_path not set"
10
- Helper.validates_presence_of local_path, "Samba mountpoint not set"
6
+ def samba_mount
7
+ Helper.validates_presence_of remote_path, 'Samba remote_path not set'
8
+ Helper.validates_presence_of local_path, 'Samba mountpoint not set'
11
9
 
12
10
  $log.writer.debug "Mount samba share #{remote_path} to #{local_path}"
13
11
 
14
12
  # Check if already mounted (heuristik!)
15
- if File.stat('/').dev == File.stat(local_path).dev
16
- # Have to mount
17
-
18
- #### create mountpoint directory
19
- if not File.directory?(local_path)
20
- if not FileUtils.mkdir_p(local_path)
21
- $log.writer.error "Unable to create mountpoint directory #{local_path}"
22
- exit 1
23
- end
24
- end
13
+ return unless File.stat('/').dev == File.stat(local_path).dev
14
+ # Have to mount
25
15
 
26
- shell_cmd = "/sbin/mount.cifs #{remote_path} #{local_path}"
27
- $log.writer.debug "Execute command: #{shell_cmd}"
28
- output = system shell_cmd
29
- if not output
30
- $log.writer.error "#{shell_cmd} failed"
16
+ #### create mountpoint directory
17
+ unless File.directory?(local_path)
18
+ unless FileUtils.mkdir_p(local_path)
19
+ $log.writer.error "Unable to create mountpoint directory #{local_path}"
31
20
  exit 1
32
21
  end
33
22
  end
23
+
24
+ shell_cmd = "/sbin/mount.cifs #{remote_path} #{local_path}"
25
+ $log.writer.debug "Execute command: #{shell_cmd}"
26
+ output = system(shell_cmd)
27
+ return if output
28
+ $log.writer.error "#{shell_cmd} failed"
29
+ fail "#{shell_cmd} failed"
34
30
  end
35
31
 
36
- def samba_umount()
37
- Helper.validates_presence_of local_path, "Samba mountpoint not set"
38
- $log.writer.debug "Not yet implemented"
32
+ def samba_umount
33
+ Helper.validates_presence_of local_path, 'Samba mountpoint not set'
34
+ $log.writer.debug 'Not yet implemented'
39
35
  end
40
36
  end
41
-
42
37
  end
43
-
@@ -1,28 +1,28 @@
1
1
  module Helper
2
- def validates_presence_of(attribute, message=nil)
3
- raise ArgumentError, message || "Missing parameter", caller \
2
+ def validates_presence_of(attribute, message = nil)
3
+ fail ArgumentError, message || 'Missing parameter', caller \
4
4
  if attribute.nil?
5
5
  end
6
6
  module_function :validates_presence_of
7
7
 
8
- def validates_not_empty(attribute, message=nil)
9
- raise ArgumentError, message || "Parameter is empty", caller \
8
+ def validates_not_empty(attribute, message = nil)
9
+ fail ArgumentError, message || 'Parameter is empty', caller \
10
10
  if attribute.nil?
11
11
  end
12
12
  module_function :validates_not_empty
13
13
 
14
14
  def path_in_deploy_home(path)
15
- absolute_path?(path) ? path : File.join($recipe_config[:deploy_home] || "", path)
15
+ absolute_path?(path) ? path : File.join($recipe_config[:deploy_home] || '', path)
16
16
  end
17
17
  module_function :path_in_deploy_home
18
18
 
19
19
  def path_in_recipe_base_dir(path)
20
- absolute_path?(path) ? path : File.join($recipe_config[:recipe_base_dir] || "", path)
20
+ absolute_path?(path) ? path : File.join($recipe_config[:recipe_base_dir] || '', path)
21
21
  end
22
22
  module_function :path_in_recipe_base_dir
23
23
 
24
24
  def absolute_path?(path)
25
- path.start_with? "/"
25
+ path.start_with? '/'
26
26
  end
27
27
  module_function :absolute_path?
28
28
  end
@@ -1,15 +1,13 @@
1
1
  module Helper
2
2
  def yaml_parse(filename)
3
- if File.file? filename
4
- begin
5
- YAML::load_file(filename)
6
- rescue Exception => e
7
- $log.writer.error "YAML parsing in #{filename}"
8
- $log.writer.error e.message
9
- exit 1
10
- end
3
+ return unless File.file? filename
4
+ begin
5
+ YAML.load_file(filename)
6
+ rescue => e
7
+ $log.writer.error "YAML parsing in #{filename}"
8
+ $log.writer.error e.message
9
+ exit 1
11
10
  end
12
11
  end
13
12
  module_function :yaml_parse
14
13
  end
15
-
@@ -4,7 +4,7 @@ module Log
4
4
 
5
5
  attr_accessor :writer
6
6
 
7
- def initialize(target=StdoutOutputter.new('stdout_logger'))
7
+ def initialize(target = StdoutOutputter.new('stdout_logger'))
8
8
  target.level = Log4r::DEBUG
9
9
  @writer = Logger.new 'Deployment'
10
10
  @writer.outputters = target
@@ -12,9 +12,7 @@ module Log
12
12
 
13
13
  def level(name, level)
14
14
  @writer.outputters.each do |outputter|
15
- if outputter.name == name
16
- outputter.level = level
17
- end
15
+ outputter.level = level if outputter.name == name
18
16
  end
19
17
  end
20
18
 
@@ -26,10 +24,9 @@ module Log
26
24
  @writer.trace = false
27
25
  end
28
26
 
29
- def add_outputter(outputter, level=nil)
27
+ def add_outputter(outputter, level = nil)
30
28
  outputter.level = level if level
31
29
  @writer.add(outputter)
32
30
  end
33
-
34
31
  end
35
32
  end