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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/edfize.rb', line 36
def self.check(argv)
test_start_time = Time.now
edf_count = 0
test_count = 0
failure_count = 0
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
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}".colorize(failure_count == 0 ? :green : :red)
end
|
.edf_paths(recursive: true) ⇒ Object
86
87
88
89
|
# File 'lib/edfize.rb', line 86
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.
79
80
81
82
83
84
|
# File 'lib/edfize.rb', line 79
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
|
.edfs_in_current_directory_and_subdirectories ⇒ Object
73
74
75
76
|
# File 'lib/edfize.rb', line 73
def self.edfs_in_current_directory_and_subdirectories
warn "[DEPRECATION] `edfs_in_current_directory_and_subdirectories` is deprecated. Please use `edf_paths` instead."
edf_paths(recursive: true)
end
|
.help ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/edfize.rb', line 53
def self.help
help_message = <<-EOT
Usage: edfize COMMAND [ARGS]
The most common edfize commands are:
[t]est Check EDFs in directory and subdirectories
--failing Only display failing tests
--quiet Suppress failing test descriptions
[r]un Print EDF header information
[h]elp Show edfize command documentation
[v]ersion Returns the version of Edfize
Commands can be referenced by the first letter:
Ex: `edfize t`, for test
EOT
puts help_message
end
|
.launch(argv) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/edfize.rb', line 11
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
|
24
25
26
27
28
29
30
|
# File 'lib/edfize.rb', line 24
def self.
puts '----------------'
edfs.each do |edf|
edf.
puts '----------------'
end
end
|
.version ⇒ Object
32
33
34
|
# File 'lib/edfize.rb', line 32
def self.version
puts "Edfize #{Edfize::VERSION::STRING}"
end
|