Class: Appgen::Loader
- Inherits:
-
Object
- Object
- Appgen::Loader
- Defined in:
- lib/appgen/loader.rb
Class Method Summary collapse
Class Method Details
.find_local_path ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/appgen/loader.rb', line 11 def self.find_local_path Dir['*'].each do |entry| next if File.directory? entry next if entry.start_with? '.' puts "Found file named #{entry}" return entry end end |
.load(path = nil) ⇒ Object
5 6 7 8 9 |
# File 'lib/appgen/loader.rb', line 5 def self.load(path=nil) path = find_local_path if path.nil? puts 'No description found, you should add an app description in a file, or call appgen with a path or url.' and return if path.nil? read_description path end |
.read_description(path) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/appgen/loader.rb', line 20 def self.read_description(path) puts "Loading app description from #{path}" app = open(path) { |f| f.read } puts app app end |