Class: Overapp::Project

Inherits:
Object show all
Includes:
FromHash
Defined in:
lib/overapp/project.rb,
lib/overapp/project/write.rb

Defined Under Namespace

Classes: Write

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

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

Returns:

  • (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_filesObject



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_bodyObject



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_entriesObject



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

#overappsObject



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

#write_to!(output_path) ⇒ Object



53
54
55
# File 'lib/overapp/project.rb', line 53

def write_to!(output_path)
  Write.new(:output_path => output_path, :project => self).write!
end