Implement `file_contains' condition keyword
This commit is contained in:
@@ -13,9 +13,10 @@ module Producer
|
||||
end
|
||||
end
|
||||
|
||||
define_test :has_env, Tests::HasEnv
|
||||
define_test :has_dir, Tests::HasDir
|
||||
define_test :has_file, Tests::HasFile
|
||||
define_test :file_contains, Tests::FileContains
|
||||
define_test :has_env, Tests::HasEnv
|
||||
define_test :has_dir, Tests::HasDir
|
||||
define_test :has_file, Tests::HasFile
|
||||
|
||||
attr_reader :block, :env, :tests
|
||||
|
||||
|
18
lib/producer/core/tests/file_contains.rb
Normal file
18
lib/producer/core/tests/file_contains.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
module Producer
|
||||
module Core
|
||||
module Tests
|
||||
class FileContains < Test
|
||||
def verify
|
||||
content = file_content
|
||||
content ? content.include?(arguments[1]) : false
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def file_content
|
||||
fs.file_read(arguments[0])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user