Class: Composer::Verify::Directory
- Inherits:
-
Object
- Object
- Composer::Verify::Directory
- Defined in:
- lib/composer/verify/directory.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Directory
constructor
A new instance of Directory.
- #verify(args) ⇒ Object
Constructor Details
#initialize(args) ⇒ Directory
Returns a new instance of Directory.
4 5 6 7 |
# File 'lib/composer/verify/directory.rb', line 4 def initialize(args) @config = args[:config] @logger = @config.logger end |
Instance Method Details
#verify(args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/composer/verify/directory.rb', line 9 def verify(args) @directory = args[:directory] unless Dir.exists? @directory error = "Directory '#{@directory}' does not exist." raise InvalidDirectory.new error end unless entries.include? 'chef-repo' error = "Directory '#{@directory}' does not include chef-repo." raise InvalidDirectory.new error end unless entries.include? 'app' error = "Directory '#{@directory}' does not include app." raise InvalidDirectory.new error end unless entries.include? 'cloud-formation-templates' error = "Directory '#{@directory}' does not include cloud-formation-template." raise InvalidDirectory.new error end @logger.info "Directory '#{@directory}' is valid." end |