win32-eventlog 0.6.5 → 0.6.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d52dae3358b8e57d7d8bc400f6c9dec3730d8c2d
4
- data.tar.gz: 4b31e02d349c4f16f7859490484e8a9259c8b021
3
+ metadata.gz: ddf12eaa4b419f111eb52ec1e88c2eeb79f37ce8
4
+ data.tar.gz: bc574189877a4c4d8d37c66e65e80f1a8c8ceb18
5
5
  SHA512:
6
- metadata.gz: 6e3ee1e904e90de863c4bea4adc3b94de09fd36b205b9386188da842913302d441ddb680d110455a945fa58179afa32c308a20bab5cf8d49828ef25fc584b795
7
- data.tar.gz: 2887d615261afb3ce6924b7e44cd99b906d839dc97307240c4f5c33040df08bdeb3abc5fc05e1bdaf5b03f03ea58e0ecba91ca816265bc1c7062612ea35039c5
6
+ metadata.gz: ae2df2fe096c4fd6729f3c3b38779af85d3902f635b1882d28eddf2d1aabfb6b322f111541ca6a6975f9ae24a6bc3ebfa6be12ee634ac8a2f5808991c8964a50
7
+ data.tar.gz: 81b27c47f295da3352559f6cc241b3b1793aed86e072a7007c41d436dbcc3f32877101172f5325115e4208ccda748e0c04ab5fe48b82e060efc552a0df86c39b
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.6.6 - 25-Jun-2016
2
+ * Renamed the various modules that contain FFI information in order to
3
+ avoid a namespacing conflict. Thanks go to Bryan McLellan for the spot.
4
+ * Removed the helper.rb file which wasn't being used.
5
+ * Updated a few tests to not assume there are actually records in the
6
+ Application event log. Mostly this was for Appveyor.
7
+
1
8
  == 0.6.5 - 29-Oct-2015
2
9
  * Fixed some old code in the read method that was never properly updated.
3
10
  Thanks go to Jo�o Duarte for the spot.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ namespace :gem do
10
10
  require 'rubygems/package'
11
11
  spec = eval(IO.read('win32-eventlog.gemspec'))
12
12
  spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
13
- Gem::Package.build(spec)
13
+ Gem::Package.build(spec, true)
14
14
  end
15
15
 
16
16
  desc 'Install the win32-eventlog gem'
@@ -8,17 +8,17 @@ module Win32
8
8
  # The EventLog class encapsulates an Event Log source and provides methods
9
9
  # for interacting with that source.
10
10
  class EventLog
11
- include Windows::Constants
12
- include Windows::Structs
13
- include Windows::Functions
14
- extend Windows::Functions
11
+ include Windows::EventLogConstants
12
+ include Windows::EventLogStructs
13
+ include Windows::EventLogFunctions
14
+ extend Windows::EventLogFunctions
15
15
 
16
16
  # The EventLog::Error is raised in cases where interaction with the
17
17
  # event log should happen to fail for any reason.
18
18
  class Error < StandardError; end
19
19
 
20
20
  # The version of the win32-eventlog library
21
- VERSION = '0.6.5'
21
+ VERSION = '0.6.6'
22
22
 
23
23
  # The log is read in chronological order, i.e. oldest to newest.
24
24
  FORWARDS_READ = EVENTLOG_FORWARDS_READ
@@ -1051,6 +1051,7 @@ module Win32
1051
1051
  )
1052
1052
 
1053
1053
  if res == 0
1054
+ buf.clear
1054
1055
  event_id = 0xB0000000 | event_id
1055
1056
 
1056
1057
  res = FormatMessage(
@@ -1,5 +1,5 @@
1
1
  module Windows
2
- module Constants
2
+ module EventLogConstants
3
3
  private
4
4
 
5
5
  EVENTLOG_SEQUENTIAL_READ = 0x0001
@@ -1,7 +1,7 @@
1
1
  require 'ffi'
2
2
 
3
3
  module Windows
4
- module Functions
4
+ module EventLogFunctions
5
5
  extend FFI::Library
6
6
  ffi_lib :advapi32
7
7
 
@@ -1,7 +1,7 @@
1
1
  require 'ffi'
2
2
 
3
3
  module Windows
4
- module Structs
4
+ module EventLogStructs
5
5
  extend FFI::Library
6
6
  typedef :ulong, :dword
7
7
  typedef :ushort, :word
@@ -25,7 +25,7 @@ class TC_Win32_EventLog < Test::Unit::TestCase
25
25
  end
26
26
 
27
27
  test "version constant is set to expected value" do
28
- assert_equal('0.6.5', EventLog::VERSION)
28
+ assert_equal('0.6.6', EventLog::VERSION)
29
29
  end
30
30
 
31
31
  test "constructor basic functionality" do
@@ -177,20 +177,26 @@ class TC_Win32_EventLog < Test::Unit::TestCase
177
177
  end
178
178
 
179
179
  test "seek_read flag plus forwards_read flag works as expected" do
180
+ assert_nothing_raised{ @last = @log.read[-10] }
181
+
182
+ omit_unless(@last, "No records found, skipping")
180
183
  flags = EventLog::SEEK_READ | EventLog::FORWARDS_READ
181
- assert_nothing_raised{ @last = @log.read[-10].record_number }
184
+
182
185
  assert_nothing_raised{
183
- @records = EventLog.read(nil, nil, flags, @last)
186
+ @records = EventLog.read(nil, nil, flags, @last.record_number)
184
187
  }
188
+
185
189
  assert_equal(10, @records.length)
186
190
  end
187
191
 
188
- # This test could fail, since a record number + 10 may not actually exist.
192
+ # Allowing for 0 records is mostly for appveyor. I really need a more
193
+ # robust test approach here.
194
+ #
189
195
  test "seek_read flag plus backwards_read flag works as expected" do
190
196
  flags = EventLog::SEEK_READ | EventLog::BACKWARDS_READ
191
197
  assert_nothing_raised{ @last = @log.oldest_record_number + 10 }
192
198
  assert_nothing_raised{ @records = EventLog.read(nil, nil, flags, @last) }
193
- assert_equal(11, @records.length)
199
+ assert_true([0,11].include?(@records.length))
194
200
  end
195
201
 
196
202
  test "the eventlog struct returned by read is frozen" do
@@ -37,13 +37,14 @@ class TC_Win32_MC < Test::Unit::TestCase
37
37
  def test_03_create_res_file
38
38
  omit_if(@@rc_cmd.nil?, "'rc' command not found - skipping")
39
39
  assert_respond_to(@mc, :create_res_file)
40
- assert_equal(true, @mc.create_res_file)
40
+ assert_true(@mc.create_res_file)
41
41
  end
42
42
 
43
43
  def test_04_create_dll_file
44
44
  omit_if(@@link_cmd.nil?, "'link' command not found - skipping")
45
+ omit_unless(File.exist?(@mc.res_file), 'no res_file found - skipping')
45
46
  assert_respond_to(@mc, :create_dll_file)
46
- assert_equal(true, @mc.create_dll_file)
47
+ assert_true(@mc.create_dll_file)
47
48
  end
48
49
 
49
50
  def test_05_clean
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'win32-eventlog'
5
- spec.version = '0.6.5'
5
+ spec.version = '0.6.6'
6
6
  spec.authors = ['Daniel J. Berger', 'Park Heesob']
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.email = 'djberg96@gmail.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-eventlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -31,7 +31,7 @@ cert_chain:
31
31
  EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
32
32
  tGSHgAmcLlkdGgan182qsE/4kKM=
33
33
  -----END CERTIFICATE-----
34
- date: 2015-10-29 00:00:00.000000000 Z
34
+ date: 2016-06-25 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ffi
@@ -105,24 +105,31 @@ extra_rdoc_files:
105
105
  - MANIFEST
106
106
  - doc/tutorial.txt
107
107
  files:
108
- - CHANGES
109
- - MANIFEST
110
- - README
111
- - Rakefile
108
+ - certs
112
109
  - certs/djberg96_pub.pem
110
+ - CHANGES
111
+ - doc
113
112
  - doc/tutorial.txt
113
+ - examples
114
114
  - examples/example_notify.rb
115
115
  - examples/example_read.rb
116
116
  - examples/example_write.rb
117
- - lib/win32-eventlog.rb
117
+ - lib
118
+ - lib/win32
118
119
  - lib/win32/eventlog.rb
119
120
  - lib/win32/mc.rb
121
+ - lib/win32/windows
120
122
  - lib/win32/windows/constants.rb
121
123
  - lib/win32/windows/functions.rb
122
- - lib/win32/windows/helper.rb
123
124
  - lib/win32/windows/structs.rb
125
+ - lib/win32-eventlog.rb
126
+ - MANIFEST
127
+ - misc
124
128
  - misc/install_msg.rb
125
129
  - misc/rubymsg.mc
130
+ - Rakefile
131
+ - README
132
+ - test
126
133
  - test/foo.mc
127
134
  - test/test_eventlog.rb
128
135
  - test/test_mc.rb
@@ -147,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
154
  version: '0'
148
155
  requirements: []
149
156
  rubyforge_project:
150
- rubygems_version: 2.4.8
157
+ rubygems_version: 2.6.4
151
158
  signing_key:
152
159
  specification_version: 4
153
160
  summary: Interface for the MS Windows Event Log.
metadata.gz.sig CHANGED
Binary file
@@ -1,13 +0,0 @@
1
- class String
2
- # Convenience method for converting strings to UTF-16LE for wide character
3
- # functions that require it.
4
- def wincode
5
- (self.tr(File::SEPARATOR, File::ALT_SEPARATOR) + 0.chr).encode('UTF-16LE')
6
- end
7
-
8
- # Read a wide character string up until the first double null, and delete
9
- # any remaining null characters.
10
- def read_wide
11
- self[/^.*?(?=\x00{2})/].delete(0.chr)
12
- end
13
- end