Class: PolishGeeks::DevTools::Commands::RequiredFiles
- Defined in:
- lib/polish_geeks/dev_tools/commands/required_files.rb
Overview
Checks for required files
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#error_message ⇒ String
Error message.
-
#execute ⇒ String
Executes this command.
-
#valid? ⇒ Boolean
True if files exist and are not empty.
Methods inherited from Base
Instance Method Details
#error_message ⇒ String
Returns error message.
23 24 25 26 27 28 29 |
# File 'lib/polish_geeks/dev_tools/commands/required_files.rb', line 23 def return if @output.nil? err = 'Following files does not exist or are empty:' err << "\n" err << @output.join("\n") err << "\n" end |
#execute ⇒ String
Executes this command
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/polish_geeks/dev_tools/commands/required_files.rb', line 10 def execute output = [] required_files = ['README.md'] required_files.concat(::PolishGeeks::DevTools.config.required_files_include || []) required_files.each do |required_file| file_path = File.join(::PolishGeeks::DevTools.app_root, required_file) output << "#{file_path} not exist" unless File.exist?(file_path) output << "#{file_path} is empty" if File.zero?(file_path) end @output = output end |
#valid? ⇒ Boolean
Returns true if files exist and are not empty.
32 33 34 |
# File 'lib/polish_geeks/dev_tools/commands/required_files.rb', line 32 def valid? @output.empty? end |