Class: Lono::ProjectChecker
- Inherits:
-
Object
- Object
- Lono::ProjectChecker
- Defined in:
- lib/lono/project_checker.rb
Class Method Summary collapse
-
.check ⇒ Object
If not, provide a friendly message and exit.
Instance Method Summary collapse
- #check ⇒ Object
- #config_folder_exist ⇒ Object
- #empty_folders ⇒ Object
- #quit ⇒ Object
- #templates_folder_exist ⇒ Object
Class Method Details
.check ⇒ Object
If not, provide a friendly message and exit.
4 5 6 |
# File 'lib/lono/project_checker.rb', line 4 def self.check new.check end |
Instance Method Details
#check ⇒ Object
8 9 10 11 12 |
# File 'lib/lono/project_checker.rb', line 8 def check config_folder_exist templates_folder_exist empty_folders end |
#config_folder_exist ⇒ Object
14 15 16 17 18 19 |
# File 'lib/lono/project_checker.rb', line 14 def config_folder_exist unless File.exist?("#{Lono.root}/config") puts "The config folder does not exist in this project. Are you sure this is a lono project?" quit end end |
#empty_folders ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lono/project_checker.rb', line 28 def empty_folders if Dir["#{Lono.root}/config/**/*.rb"].empty? puts "The config folder does not contain any lono template definitions." quit end if Dir["#{Lono.root}/templates/**/*"].empty? puts "The templates folder does not contain any lono template definitions." quit end end |
#quit ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/lono/project_checker.rb', line 39 def quit if ENV['TEST'] == '1' raise("Not in lono project") else exit 1 end end |