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

.load(*args) ⇒ Object



17
18
19
# File 'lib/overapp/project.rb', line 17

def load(*args)
  new(*args)
end

.project?(path) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/overapp/project.rb', line 12

def project?(path)
  raise "checking for project, path doesn't exist #{path}" unless FileTest.exist?(path)
  !!project_files.map { |x| "#{path}/#{x}" }.find { |x| FileTest.exist?(x) }
end

.project_filesObject



8
9
10
# File 'lib/overapp/project.rb', line 8

def project_files
  %w(.fstemplate .overapp .overlay)
end

Instance Method Details

#combined_filesObject



66
67
68
# File 'lib/overapp/project.rb', line 66

def combined_files
  Write.new(:project => self).combined_files
end

#overapp_entriesObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/overapp/project.rb', line 38

def overapp_entries
  res = config.overapps
  local = config.overapps.find { |x| ['.',:self,path].include?(x.descriptor) }
  if local
    local.descriptor = path
    res
  else
    res + [ConfigEntry.new(:descriptor => path)]
  end
end

#overappsObject



52
53
54
55
56
57
58
59
60
# File 'lib/overapp/project.rb', line 52

def overapps
  overapp_entries.map do |entry|
    if path == entry.descriptor
      load_raw_dir_class.new(:descriptor => path)
    else
      load_factory_class.new(:descriptor => entry.descriptor, :type => entry.type, :entry_ops => entry.entry_ops).loader
    end
  end
end

#write_to!(output_path) ⇒ Object



62
63
64
# File 'lib/overapp/project.rb', line 62

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