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.
Constant Summary collapse
- @@checked =
false
Class Method Summary collapse
- .check ⇒ Object
-
.empty_templates ⇒ Object
Dont exit for this one.
- .quit(signal) ⇒ Object
Class Method Details
.check ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lono/project_checker.rb', line 8 def check return if @@checked unless File.exist?("#{Lono.root}/configs/settings.yml") puts "ERROR: Could not find configs/settings.yml file. Are you sure you are in lono project?".color(:red) quit 1 end @@checked = true end |
.empty_templates ⇒ Object
Dont exit for this one. It’s okay. But show a warning.
20 21 22 23 24 |
# File 'lib/lono/project_checker.rb', line 20 def empty_templates if Dir["#{Lono.config.templates_path}/**/*"].empty? puts "INFO: The app/templates folder does not contain any lono template definitions.".color(:yellow) end end |
.quit(signal) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/lono/project_checker.rb', line 26 def quit(signal) if ENV['LONO_TEST'] == '1' signal == 0 || raise("Not in lono project. pwd: #{Dir.pwd}") else exit(signal) end end |