Module: Ore::Checks
- Included in:
- Project
- Defined in:
- lib/ore/checks.rb
Overview
A mixin for Project which provides methods for checking files.
Instance Method Summary collapse
-
#check_directory(path) {|path| ... } ⇒ Object
protected
Checks if the path is a readable directory.
-
#check_executable(path) {|path| ... } ⇒ Object
protected
Checks if the path is an executable file.
-
#check_file(path) {|path| ... } ⇒ Object
protected
Checks if the path is a readable file.
-
#check_readable(path) {|path| ... } ⇒ Object
protected
Checks if the path is readable.
Instance Method Details
#check_directory(path) {|path| ... } ⇒ Object (protected)
Checks if the path is a readable directory.
36 37 38 39 40 41 42 43 44 |
# File 'lib/ore/checks.rb', line 36 def check_directory(path) check_readable(path) do |dir| if File.directory?(dir) yield dir else warn "#{dir} is not a directory!" end end end |
#check_executable(path) {|path| ... } ⇒ Object (protected)
Checks if the path is an executable file.
78 79 80 81 82 83 84 85 86 |
# File 'lib/ore/checks.rb', line 78 def check_executable(path) check_file(path) do |file| if File.executable?(file) yield file else warn "#{file} is not executable!" end end end |
#check_file(path) {|path| ... } ⇒ Object (protected)
Checks if the path is a readable file.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ore/checks.rb', line 56 def check_file(path) if @project_files.include?(path) check_readable(path) do |file| if File.file?(file) yield file else warn "#{file} is not a file!" end end end end |
#check_readable(path) {|path| ... } ⇒ Object (protected)
Checks if the path is readable.
18 19 20 21 22 23 24 |
# File 'lib/ore/checks.rb', line 18 def check_readable(path) if File.readable?(path) yield path else warn "#{path} is not readable!" end end |