systemd-journal 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -4
- data/Rakefile +2 -4
- data/lib/systemd/id128.rb +7 -9
- data/lib/systemd/journal/native.rb +1 -1
- data/lib/systemd/journal/navigable.rb +1 -1
- data/lib/systemd/journal/version.rb +1 -1
- data/lib/systemd/journal.rb +0 -5
- data/spec/fixtures/test.journal +0 -0
- data/spec/fixtures/test.json +463 -0
- data/spec/spec_helper.rb +21 -32
- data/spec/systemd/journal_spec.rb +73 -489
- data/systemd-journal.gemspec +6 -2
- metadata +70 -17
- data/.travis.yml +0 -5
- data/spec/no_ffi.rb +0 -4
- data/spec/systemd/id128_spec.rb +0 -39
- data/spec/systemd/journal_entry_spec.rb +0 -97
data/systemd-journal.gemspec
CHANGED
@@ -20,6 +20,10 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_dependency 'ffi', '~>1.9.0'
|
22
22
|
|
23
|
-
gem.add_development_dependency 'rspec'
|
24
|
-
gem.add_development_dependency 'simplecov'
|
23
|
+
gem.add_development_dependency 'rspec', '~> 3.0.0'
|
24
|
+
gem.add_development_dependency 'simplecov', '~> 0.7.1'
|
25
|
+
gem.add_development_dependency 'rubocop', '~> 0.23.0'
|
26
|
+
gem.add_development_dependency 'rake', '~> 10.1.0'
|
27
|
+
gem.add_development_dependency 'yard', '~> 0.8.7.4'
|
28
|
+
gem.add_development_dependency 'pry', '~> 0.10.0'
|
25
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: systemd-journal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Ledbetter
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -29,30 +29,86 @@ dependencies:
|
|
29
29
|
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 3.0.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 3.0.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: simplecov
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.7.1
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.7.1
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rubocop
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.23.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.23.0
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 10.1.0
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 10.1.0
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: yard
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
47
89
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
90
|
+
version: 0.8.7.4
|
49
91
|
type: :development
|
50
92
|
prerelease: false
|
51
93
|
version_requirements: !ruby/object:Gem::Requirement
|
52
94
|
requirements:
|
53
|
-
- - "
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.8.7.4
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: pry
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.10.0
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
54
110
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
111
|
+
version: 0.10.0
|
56
112
|
description: Provides the ability to navigate and read entries from the systemd journal
|
57
113
|
in ruby, as well as write events to the journal.
|
58
114
|
email:
|
@@ -63,7 +119,6 @@ extra_rdoc_files: []
|
|
63
119
|
files:
|
64
120
|
- ".gitignore"
|
65
121
|
- ".rubocop.yml"
|
66
|
-
- ".travis.yml"
|
67
122
|
- Gemfile
|
68
123
|
- LICENSE.txt
|
69
124
|
- README.md
|
@@ -84,10 +139,9 @@ files:
|
|
84
139
|
- lib/systemd/journal/writable.rb
|
85
140
|
- lib/systemd/journal_entry.rb
|
86
141
|
- lib/systemd/journal_error.rb
|
87
|
-
- spec/
|
142
|
+
- spec/fixtures/test.journal
|
143
|
+
- spec/fixtures/test.json
|
88
144
|
- spec/spec_helper.rb
|
89
|
-
- spec/systemd/id128_spec.rb
|
90
|
-
- spec/systemd/journal_entry_spec.rb
|
91
145
|
- spec/systemd/journal_spec.rb
|
92
146
|
- systemd-journal.gemspec
|
93
147
|
homepage: https://github.com/ledbettj/systemd-journal
|
@@ -115,9 +169,8 @@ signing_key:
|
|
115
169
|
specification_version: 4
|
116
170
|
summary: Ruby bindings to libsystemd-journal
|
117
171
|
test_files:
|
118
|
-
- spec/
|
172
|
+
- spec/fixtures/test.journal
|
173
|
+
- spec/fixtures/test.json
|
119
174
|
- spec/spec_helper.rb
|
120
|
-
- spec/systemd/id128_spec.rb
|
121
|
-
- spec/systemd/journal_entry_spec.rb
|
122
175
|
- spec/systemd/journal_spec.rb
|
123
176
|
has_rdoc:
|
data/.travis.yml
DELETED
data/spec/no_ffi.rb
DELETED
data/spec/systemd/id128_spec.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Systemd::Id128 do
|
4
|
-
|
5
|
-
describe 'boot_id' do
|
6
|
-
it 'returns a properly formatted string representing the boot id' do
|
7
|
-
Systemd::Id128::Native.should_receive(:sd_id128_get_boot) do |out|
|
8
|
-
dummy = [0xa1, 0x0c] * 8
|
9
|
-
out.write_array_of_uint8(dummy)
|
10
|
-
0
|
11
|
-
end
|
12
|
-
expect(Systemd::Id128.boot_id).to eq('a10c' * 8)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'machine_id' do
|
17
|
-
it 'returns a properly formatted string representing the machine id' do
|
18
|
-
Systemd::Id128::Native.should_receive(:sd_id128_get_machine) do |out|
|
19
|
-
dummy = [0xa1, 0x0c] * 8
|
20
|
-
out.write_array_of_uint8(dummy)
|
21
|
-
0
|
22
|
-
end
|
23
|
-
expect(Systemd::Id128.machine_id).to eq('a10c' * 8)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'random' do
|
28
|
-
it 'returns a random hex string' do
|
29
|
-
Systemd::Id128::Native.should_receive(:sd_id128_randomize) do |out|
|
30
|
-
dummy = [0xa1, 0x0c] * 8
|
31
|
-
out.write_array_of_uint8(dummy)
|
32
|
-
0
|
33
|
-
end
|
34
|
-
expect(Systemd::Id128.random).to eq('a10c' * 8)
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Systemd::JournalEntry do
|
4
|
-
subject do
|
5
|
-
Systemd::JournalEntry.new(
|
6
|
-
'_PID' => '125',
|
7
|
-
'_EXE' => '/usr/bin/sshd',
|
8
|
-
'PRIORITY' => '4',
|
9
|
-
'OBJECT_ID' => ':)'
|
10
|
-
)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'allows enumerating entries' do
|
14
|
-
expect { |b| subject.each(&b) }.to yield_successive_args(
|
15
|
-
%w{_PID 125},
|
16
|
-
%w{_EXE /usr/bin/sshd},
|
17
|
-
%w{PRIORITY 4},
|
18
|
-
%w{OBJECT_ID :)}
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'responds to field names as methods' do
|
23
|
-
expect(subject._pid).to eq('125')
|
24
|
-
expect(subject.priority).to eq('4')
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'doesnt overwrite existing methods' do
|
28
|
-
expect(subject.object_id).to_not eq(':)')
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'allows accessing via [string]' do
|
32
|
-
expect(subject['OBJECT_ID']).to eq(':)')
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'allows accessing via [symbol]' do
|
36
|
-
expect(subject[:object_id]).to eq(':)')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'lists all fields it contains' do
|
40
|
-
expect(subject.fields).to eq([:_pid, :_exe, :priority, :object_id])
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should not have a catalog' do
|
44
|
-
expect(subject.catalog?).to be_false
|
45
|
-
end
|
46
|
-
|
47
|
-
it "doesn't throw NoMethod errors" do
|
48
|
-
expect { subject.froobaz }.not_to raise_error
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'with catalogs' do
|
52
|
-
subject do
|
53
|
-
Systemd::JournalEntry.new(
|
54
|
-
'_PID' => '125',
|
55
|
-
'_EXE' => '/usr/bin/sshd',
|
56
|
-
'PRIORITY' => '4',
|
57
|
-
'MESSAGE_ID' => 'ab1fced28a0'
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
describe '#catalog?' do
|
62
|
-
it 'returns true if the entry has a message ID' do
|
63
|
-
expect(subject.catalog?).to be_true
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '#catalog' do
|
68
|
-
it 'asks the journal for the message with our ID' do
|
69
|
-
Systemd::Journal
|
70
|
-
.should_receive(:catalog_for)
|
71
|
-
.with('ab1fced28a0')
|
72
|
-
.and_return('catalog')
|
73
|
-
|
74
|
-
expect(subject.catalog).to eq('catalog')
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'does field replacement by default' do
|
78
|
-
Systemd::Journal
|
79
|
-
.should_receive(:catalog_for)
|
80
|
-
.with('ab1fced28a0')
|
81
|
-
.and_return('catalog @_PID@ @PRIORITY@')
|
82
|
-
|
83
|
-
expect(subject.catalog).to eq('catalog 125 4')
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'skips field replacement if requested' do
|
87
|
-
Systemd::Journal
|
88
|
-
.should_receive(:catalog_for)
|
89
|
-
.with('ab1fced28a0')
|
90
|
-
.and_return('cat @_PID@ @PRIORITY@')
|
91
|
-
|
92
|
-
expect(subject.catalog(replace: false)).to eq('cat @_PID@ @PRIORITY@')
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|