Class: Overapp::Project
- Includes:
- FromHash
- Defined in:
- lib/overapp/project.rb,
lib/overapp/project/write.rb
Defined Under Namespace
Classes: Write
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #combined_files(output_path) ⇒ Object
- #config_body ⇒ Object
- #overapp_entries ⇒ Object
- #overapps ⇒ Object
- #write_to!(output_path) ⇒ Object
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/overapp/project.rb', line 4 def path @path end |
Class Method Details
.project?(path) ⇒ Boolean
11 12 13 |
# File 'lib/overapp/project.rb', line 11 def project?(path) !!project_files.map { |x| "#{path}/#{x}" }.find { |x| FileTest.exist?(x) } end |
.project_files ⇒ Object
7 8 9 |
# File 'lib/overapp/project.rb', line 7 def project_files %w(.fstemplate .overapp .overlay) end |
Instance Method Details
#combined_files(output_path) ⇒ Object
57 58 59 60 |
# File 'lib/overapp/project.rb', line 57 def combined_files(output_path) raise 'here' Write.new(:output_path => output_path, :project => self).combined_files end |
#config_body ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/overapp/project.rb', line 16 def config_body file = klass.project_files.map { |x| "#{path}/#{x}" }.find { |x| FileTest.exist?(x) } if file File.read(file) else raise "no config found in #{path}" end end |
#overapp_entries ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/overapp/project.rb', line 32 def overapp_entries res = config.overapps local = config.overapps.find { |x| x.descriptor == "." } if local local.descriptor = path res else res + [ConfigEntry.new(:descriptor => path)] end end |
#overapps ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/overapp/project.rb', line 43 def overapps overapp_entries.map do |entry| if path == entry.descriptor Load::RawDir.new(:descriptor => path) else Load::Factory.new(:descriptor => entry.descriptor, :type => entry.type, :entry_ops => entry.entry_ops).loader end end end |