Class: Lono::ProjectChecker
- Inherits:
-
Object
- Object
- Lono::ProjectChecker
- Defined in:
- lib/lono/project_checker.rb
Overview
Checks to see command is running in a lono project. If not, provide a friendly message and possibly exit.
Class Method Summary collapse
- .check ⇒ Object
- .check_lono_project ⇒ Object
-
.empty_templates ⇒ Object
Dont exit for this one.
- .quit(signal) ⇒ Object
Class Method Details
.check ⇒ Object
7 8 9 |
# File 'lib/lono/project_checker.rb', line 7 def check check_lono_project end |
.check_lono_project ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/lono/project_checker.rb', line 11 def check_lono_project paths = %w[ config/settings.yml app/definitions app/templates ] paths.each do |path| unless File.exist?("#{Lono.root}/#{path}") puts "ERROR: The #{path} does not exist in this project. Are you sure you are in lono project?".colorize(:red) quit 1 end end end |
.empty_templates ⇒ Object
Dont exit for this one. It’s okay. But show a warning.
26 27 28 29 30 |
# File 'lib/lono/project_checker.rb', line 26 def empty_templates if Dir["#{Lono.config.templates_path}/**/*"].empty? puts "INFO: The app/templates folder does not contain any lono template definitions.".colorize(:yellow) end end |
.quit(signal) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/lono/project_checker.rb', line 32 def quit(signal) if ENV['TEST'] == '1' signal == 0 || raise("Not in lono project") else exit(signal) end end |