autobuild 1.2.9 → 1.2.10

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.
data/Changes.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == Version 1.2.10
2
+ * small fix
3
+ logs are sorted into subdirectories, following the structure of the
4
+ packages. Up until now, the mailing code was not searching for logfiles in the
5
+ subdirectories. This commit fixes this.
6
+
1
7
  == Version 1.2.9
2
8
  * small usability issue
3
9
  - provide the --keep-oldlogs command line option and the
data/lib/autobuild.rb CHANGED
@@ -3,6 +3,6 @@ require 'autobuild/reporting'
3
3
  require 'autobuild/package'
4
4
 
5
5
  module Autobuild
6
- VERSION = "1.2.9" unless defined? Autobuild::VERSION
6
+ VERSION = "1.2.10" unless defined? Autobuild::VERSION
7
7
  end
8
8
 
@@ -9,6 +9,7 @@ end
9
9
  require 'net/smtp'
10
10
  require 'socket'
11
11
  require 'etc'
12
+ require 'find'
12
13
 
13
14
  require 'autobuild/config'
14
15
  require 'autobuild/exceptions'
@@ -53,8 +54,12 @@ module Autobuild
53
54
  end
54
55
 
55
56
  ## Iterate on all log files
56
- def self.each_log(&iter)
57
- Dir.glob("#{Autobuild.logdir}/*.log", &iter)
57
+ def self.each_log
58
+ Find.find(Autobuild.logdir) do |path|
59
+ if File.file?(path) && path =~ /\.log$/
60
+ yield(path)
61
+ end
62
+ end
58
63
  end
59
64
  end
60
65
 
@@ -130,7 +135,8 @@ module Autobuild
130
135
 
131
136
  # Attach log files
132
137
  Reporting.each_log do |file|
133
- mail.add_file(file)
138
+ name = file[Autobuild.logdir.size..-1]
139
+ mail.add_file(name, file)
134
140
  end
135
141
 
136
142
  # Send the mails
@@ -151,10 +157,10 @@ end
151
157
  module RMail
152
158
  class Message
153
159
  ## Attachs a file to a message
154
- def add_file(path, content_type='text/plain')
160
+ def add_file(name, path, content_type='text/plain')
155
161
  part = RMail::Message.new
156
162
  part.header.set('Content-Type', content_type)
157
- part.header.set('Content-Disposition', 'attachment', 'filename' => File.basename(path))
163
+ part.header.set('Content-Disposition', 'attachment', 'filename' => name)
158
164
  part.body = ''
159
165
  File.open(path) do |file|
160
166
  part.body << file.readlines.join("")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-31 00:00:00 +02:00
12
+ date: 2009-04-01 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency