castle-log 0.0.5 → 0.1.0
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 +4 -4
- data/lib/castle/log/file.rb +3 -5
- data/lib/castle/log/version.rb +1 -1
- data/spec/file_spec.rb +10 -2
- data/spec/session_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9d26d17bf903f0038b5057f53782d6d3cb2edcc4
|
|
4
|
+
data.tar.gz: 57101db560f62b05d21c3e732d16f7b664dd5c65
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5188fe7b857dfca1b2d8c714a01c7de3cc34f22282e62719a693d10bffe5ffc603366ccaa8b09a81a9ef852a96bd9f5be778cd8b17532ce323bed1c51fa6186f
|
|
7
|
+
data.tar.gz: b089e59141544d7ff6efa8de582a4e28a83dfda01aedb0cadc5b51db80a1e62f942663db46983c70a1f3e5eb41e5d2ee878d2e55d6bfc0e851384e2681f4ac7a
|
data/lib/castle/log/file.rb
CHANGED
|
@@ -14,14 +14,12 @@ module Castle
|
|
|
14
14
|
# @return [Array<Session>] Sessions contained in this file
|
|
15
15
|
attr_reader :sessions
|
|
16
16
|
|
|
17
|
-
# Determines if the file at the given URI is a Castle log file.
|
|
18
|
-
# to read the file, simply using #new should be preferred in favor of this, catching any
|
|
19
|
-
# errors that may be raised.
|
|
17
|
+
# Determines if the file at the given URI is a Castle log file.
|
|
20
18
|
#
|
|
21
19
|
# @param uri URI to file to read
|
|
22
|
-
# @return [
|
|
20
|
+
# @return [Castle::Log::File] loaded file if the file is a Castle log file, nil otherwise
|
|
23
21
|
def self.castle? uri
|
|
24
|
-
|
|
22
|
+
File.new(uri) rescue nil
|
|
25
23
|
end
|
|
26
24
|
|
|
27
25
|
def initialize uri
|
data/lib/castle/log/version.rb
CHANGED
data/spec/file_spec.rb
CHANGED
|
@@ -21,7 +21,7 @@ describe Castle::Log::File do
|
|
|
21
21
|
it { should have(1).sessions }
|
|
22
22
|
|
|
23
23
|
it 'should have a multi-line note field' do
|
|
24
|
-
subject.notes.split("\n").
|
|
24
|
+
expect(subject.notes.split("\n")).to have(3).lines
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
end
|
|
@@ -81,10 +81,18 @@ describe Castle::Log::File do
|
|
|
81
81
|
files.should have(5).files
|
|
82
82
|
|
|
83
83
|
files.each do |f|
|
|
84
|
-
Castle::Log::File.castle?(f).
|
|
84
|
+
expect(Castle::Log::File.castle?(f)).to be_true
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
it 'should return a file object' do
|
|
89
|
+
expect(Castle::Log::File.castle?(data_files[0])).to be_a(Castle::Log::File)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it 'should return nil when invalid' do
|
|
93
|
+
expect(Castle::Log::File.castle?(invalid_data_files[0])).to be_nil
|
|
94
|
+
end
|
|
95
|
+
|
|
88
96
|
end
|
|
89
97
|
|
|
90
98
|
end
|
data/spec/session_spec.rb
CHANGED
|
@@ -4,15 +4,15 @@ describe Castle::Log::Session do
|
|
|
4
4
|
|
|
5
5
|
context 'data file long-flight.csv' do
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
before(:all) { @file = Castle::Log::File.new(data_file('long-flight.csv')) }
|
|
8
8
|
|
|
9
|
-
subject { file }
|
|
9
|
+
subject { @file }
|
|
10
10
|
|
|
11
11
|
it { should have(1).sessions }
|
|
12
12
|
|
|
13
13
|
context 'session 1' do
|
|
14
14
|
|
|
15
|
-
subject { file.sessions[0] }
|
|
15
|
+
subject { @file.sessions[0] }
|
|
16
16
|
|
|
17
17
|
its(:duration) { should be_within(0.1).of(569.2) }
|
|
18
18
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: castle-log
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Veys
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: awesome_print
|