logtwuncator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.txt +4 -3
- data/lib/log_twuncator/truncator.rb +6 -2
- data/lib/log_twuncator/win32_file.rb +2 -3
- data/lib/log_twuncator.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
log_twuncator
|
2
2
|
by Adam Meehan (adam.meehan@gmail.com)
|
3
|
-
http://
|
3
|
+
http://logtwuncator.rubyforge.org/
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
@@ -30,7 +30,7 @@ Credits:
|
|
30
30
|
Herryanto Siatono (http://www.pluitsolutions.com/) for his
|
31
31
|
win32 Ferret service which I based some of the service structure on.
|
32
32
|
|
33
|
-
pdumpfs project (http://0xcc.net/pdumpfs/index.html.en) where I
|
33
|
+
pdumpfs project (http://0xcc.net/pdumpfs/index.html.en) where I found
|
34
34
|
the win32 API stuff in Ruby to do the file creation date changes.
|
35
35
|
|
36
36
|
|
@@ -53,8 +53,9 @@ the win32 API stuff in Ruby to do the file creation date changes.
|
|
53
53
|
win32-service gem required to run as service
|
54
54
|
|
55
55
|
== INSTALL:
|
56
|
+
I messed up the naming of the gem when creating on rubyforge forgive me. So the gem is call logtwuncator but executables are log_twuncator_*
|
56
57
|
|
57
|
-
gem install
|
58
|
+
gem install logtwuncator
|
58
59
|
|
59
60
|
== USAGE:
|
60
61
|
|
@@ -14,11 +14,15 @@ module LogTwuncator
|
|
14
14
|
|
15
15
|
TIMESTAMP_FORMAT = "%Y%m%d%H%M%S"
|
16
16
|
|
17
|
-
|
17
|
+
ATTRIBUTES = [:name, :age, :size, :source_dir, :filter, :archive_dir, :archive_name, :logger]
|
18
|
+
|
19
|
+
ATTRIBUTES.each {|attrib| attr_reader attrib}
|
18
20
|
|
19
21
|
def initialize(options)
|
20
22
|
@options = @@defaults.merge(options)
|
21
|
-
|
23
|
+
ATTRIBUTES.each {|sym|
|
24
|
+
instance_variable_set("@#{sym}".to_sym, @options[sym])
|
25
|
+
}
|
22
26
|
if errors = self.class.validate_options(@options)
|
23
27
|
raise InvalidTruncatorOptions, errors.join("\n")
|
24
28
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'Win32API'
|
2
2
|
|
3
|
-
# This code has
|
3
|
+
# This code has adapted from pdumpfs project http://raa.ruby-lang.org/project/pdumpfs/
|
4
4
|
# Uses the Win32API to do win32 system calls to change file dates
|
5
5
|
module LogTwuncator
|
6
6
|
class Win32File
|
@@ -8,8 +8,7 @@ module LogTwuncator
|
|
8
8
|
GENERIC_EXECUTE = 0x20000000
|
9
9
|
GENERIC_ALL = 0x10000000
|
10
10
|
FILE_SHARE_WRITE = 2
|
11
|
-
OPEN_EXISTING = 3
|
12
|
-
FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
|
11
|
+
OPEN_EXISTING = 3
|
13
12
|
|
14
13
|
GetLocaltime = Win32API.new("kernel32", "GetLocalTime", "P", 'V')
|
15
14
|
SystemTimeToFileTime = Win32API.new("kernel32", "SystemTimeToFileTime", "PP", 'I')
|
data/lib/log_twuncator.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: logtwuncator
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-10-
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2007-10-24 00:00:00 +10:00
|
8
8
|
summary: A win32 log file truncator and archiver with windows service
|
9
9
|
require_paths:
|
10
10
|
- lib
|