class Take::Project
Handles project information for a specific project. Tends to represent an entire directory.
Attributes
name[RW]
The name of the project. This is normally guessed from the directory name.
@return [String]
Public Class Methods
create(name = nil, path = nil, &block)
click to toggle source
Creates a new project with the block, and calls {#call}. Returns the created project. A name is not required.
@param [String?] name the name of the project. If it is not
given, it is assumed from the directory name.
@return [Project] @todo FIX
# File lib/take/project.rb, line 29 def self.create(name = nil, path = nil, &block) project = new(name, path, &block) project.call project end
new(name = nil, path = nil, &block)
click to toggle source
Initialize the project.
# File lib/take/project.rb, line 36 def initialize(name = nil, path = nil, &block) @block = block @name = name @groups = {} @files = {} @targets = [] if path @_path = Pathname.new(path) end end
Public Instance Methods
call()
click to toggle source
# File lib/take/project.rb, line 59 def call @definition = Definition.new(self) @definition.instance_exec(&@block) p @definition @definition end
env()
click to toggle source
# File lib/take/project.rb, line 81 def env { cc: "gcc" } end
file(name)
click to toggle source
# File lib/take/project.rb, line 76 def file(name) index = File.normalize(name, path) @files[index] ||= File.new(index) end
path()
click to toggle source
The path to the project.
@return [Pathname]
# File lib/take/project.rb, line 55 def path @_path ||= Pathname.new("/home/homer/projects/dash") end
project(name)
click to toggle source
Set the project name.
# File lib/take/project.rb, line 48 def project(name) @name = name end
to_makefile()
click to toggle source
Creates a Makefile syntax-based string of the project.
@return [String]
# File lib/take/project.rb, line 69 def to_makefile out = "" out << @targets. map { |target| target.to_makefile(self) }.join("\n\n") out end