autobuild 1.2.8 → 1.2.9

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,10 @@
1
+ == Version 1.2.9
2
+ * small usability issue
3
+ - provide the --keep-oldlogs command line option and the
4
+ Autobuild.erase_oldlogs configuration flag to configure whether old logs
5
+ should be kept (new data being appended to them), or erased
6
+ - change the default behaviour from keeping old logs to erasing them
7
+
1
8
  == Version 1.2.8
2
9
  * small fix
3
10
  - fixes --mail-smtp. This now works even without port specification.
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.8" unless defined? Autobuild::VERSION
6
+ VERSION = "1.2.9" unless defined? Autobuild::VERSION
7
7
  end
8
8
 
@@ -11,9 +11,9 @@ end
11
11
  # (see Autobuild::DEFAULT_OPTIONS) for the default values)
12
12
  # nice:: the nice value at which we should spawn subprocesses
13
13
  # srcdir:: the base source directory. If a package defines a relative srcdir, then
14
- # it is defined relatively to Autobuild.srcdir. Defaults to the current directory.
14
+ # it is defined relatively to Autobuild.srcdir. Defaults to the current directory.
15
15
  # prefix:: the base install directory. If a package defines a relative prefix, then
16
- # it is defined relatively to Autobuild.prefix.
16
+ # it is defined relatively to Autobuild.prefix.
17
17
  # verbose:: if true, displays all subprocesses output
18
18
  # debug:: more verbose than 'verbose': displays Rake's debugging output
19
19
  # do_update:: if we should update the packages
@@ -24,13 +24,15 @@ end
24
24
  # clean_log:: remove all logs before starting the build
25
25
  # packages:: a list of packages to build specifically
26
26
  # default_packages:: the list of packages to build if Autobuild.packages is empty.
27
- # It this array is empty too, build all defined packages.
27
+ # It this array is empty too, build all defined packages.
28
+ # keep_oldlogs:: if true, new runs will be appended to existing logfiles.
29
+ # Otherwise, the existing logfile contents is erased.
28
30
  module Autobuild
29
31
  class << self
30
32
  %w{ nice srcdir prefix
31
33
  verbose debug do_update do_build only_doc do_doc doc_errors
32
34
  daemonize clean_log packages default_packages
33
- doc_prefix }.each do |name|
35
+ doc_prefix keep_oldlogs}.each do |name|
34
36
  attr_accessor name
35
37
  end
36
38
 
@@ -49,7 +51,7 @@ module Autobuild
49
51
  :verbose => false, :debug => false, :do_build => true, :do_update => true,
50
52
  :daemonize => false, :packages => [], :default_packages => [],
51
53
  :only_doc => false, :do_doc => true, :doc_errors => false,
52
- :doc_prefix => 'doc' }
54
+ :doc_prefix => 'doc', :keep_oldlogs => false }
53
55
 
54
56
  @programs = Hash.new
55
57
  DEFAULT_OPTIONS.each do |name, value|
@@ -163,6 +165,7 @@ module Autobuild
163
165
  opts.separator "Program output"
164
166
  opts.on("--[no-]verbose", "display output of commands on stdout") do |@verbose| end
165
167
  opts.on("--[no-]debug", "debug information (for debugging purposes)") do |@debug| end
168
+ opts.on("--keep-oldlogs", "old logs will be kept, new program output being appended") do |@keep_oldlogs| end
166
169
 
167
170
  opts.separator ""
168
171
  opts.separator "Mail reports"
@@ -27,8 +27,17 @@ module Autobuild::Subprocess
27
27
  input_streams = command.collect { |o| $1 if o =~ /^\<(.+)/ }.compact
28
28
  command.reject! { |o| o =~ /^\<(.+)/ }
29
29
 
30
- status = File.open(logname, "a") do |logfile|
31
- logfile.puts command.join(" ")
30
+ open_flag = if Autobuild.keep_oldlogs then 'a'
31
+ else 'w'
32
+ end
33
+
34
+ status = File.open(logname, open_flag) do |logfile|
35
+ if Autobuild.keep_oldlogs
36
+ logfile.puts
37
+ end
38
+ logfile.puts "#{Time.now}: running"
39
+ logfile.puts " #{command.join(" ")}"
40
+ logfile.puts
32
41
  logfile.flush
33
42
 
34
43
  pread, pwrite = IO.pipe # to feed subprocess stdin
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.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux