Module: Edfize
- Defined in:
- lib/edfize.rb,
lib/edfize/edf.rb,
lib/edfize/tests.rb,
lib/edfize/signal.rb,
lib/edfize/version.rb,
lib/edfize/tests/result.rb,
lib/edfize/tests/runner.rb,
lib/edfize/tests/check_length.rb,
lib/edfize/tests/check_valid_date.rb,
lib/edfize/tests/check_reserved_area.rb,
lib/edfize/tests/check_reserved_signal_areas.rb
Overview
Loads EDFs, prints information, runs tests
Defined Under Namespace
Modules: Tests, VERSION
Classes: Edf, Signal
Class Method Summary
collapse
Class Method Details
.check(argv) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/edfize.rb', line 35
def self.check(argv)
test_start_time = Time.now
edf_count = 0
test_count = 0
failure_count = 0
total_edfs = edf_paths.count
show_passing = argv.include?("--failing") ? false : true
puts "Started\n"
edfs.each do |edf|
runner = Edfize::Tests::Runner.new(edf, argv)
runner.run_tests
test_count += runner.tests_run
failure_count += runner.tests_failed
edf_count += 1
print "\rChecked EDF #{edf_count} of #{total_edfs}" unless show_passing || !runner.tests_failed.zero?
end
puts "\nFinished in #{Time.now - test_start_time}s"
puts "#{edf_count} EDF#{"s" unless edf_count == 1}, #{test_count} test#{"s" unless test_count == 1}, " + "#{failure_count} failure#{"s" unless failure_count == 1}".send(failure_count == 0 ? :green : :red)
end
|
.edf_paths(recursive: true) ⇒ Object
82
83
84
85
|
# File 'lib/edfize.rb', line 82
def self.edf_paths(recursive: true)
path = "#{"**/" if recursive}*.edf"
Dir.glob(path, File::FNM_CASEFOLD)
end
|
.edfs(recursive: true) ⇒ Object
Returns an enumerator of EDFs.
75
76
77
78
79
80
|
# File 'lib/edfize.rb', line 75
def self.edfs(recursive: true)
return enum_for(:edfs, recursive: recursive) unless block_given?
edf_paths(recursive: recursive).each do |file_path|
yield Edf.new(file_path)
end
end
|
.help ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/edfize.rb', line 55
def self.help
help_message = "Usage: edfize COMMAND [ARGS]\n\nThe most common edfize commands are:\n[t]est Check EDFs in directory and subdirectories\n --failing Only display failing tests\n --quiet Suppress failing test descriptions\n[r]un Print EDF header information\n[h]elp Show edfize command documentation\n[v]ersion Returns the version of Edfize\n\nCommands can be referenced by the first letter:\nEx: `edfize t`, for test\n\n"
puts help_message
end
|
.launch(argv) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/edfize.rb', line 10
def self.launch(argv)
case argv.first.to_s.scan(/\w/).first
when "v"
version
when "c", "t"
check(argv[1..-1])
when "r"
else
help
end
end
|
23
24
25
26
27
28
29
|
# File 'lib/edfize.rb', line 23
def self.
puts "----------------"
edfs.each do |edf|
edf.
puts "----------------"
end
end
|
.version ⇒ Object
31
32
33
|
# File 'lib/edfize.rb', line 31
def self.version
puts "Edfize #{Edfize::VERSION::STRING}"
end
|