Class: Project
- Inherits:
-
Object
- Object
- Project
- Includes:
- PathHelper
- Defined in:
- lib/simple-make/project.rb
Instance Attribute Summary collapse
-
#app_path ⇒ Object
Returns the value of attribute app_path.
-
#compile_command_with_flag ⇒ Object
Returns the value of attribute compile_command_with_flag.
-
#dep_projects ⇒ Object
readonly
Returns the value of attribute dep_projects.
-
#link ⇒ Object
Returns the value of attribute link.
-
#makefile_name ⇒ Object
readonly
Returns the value of attribute makefile_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#prod_path ⇒ Object
Returns the value of attribute prod_path.
-
#source_folder_name ⇒ Object
Returns the value of attribute source_folder_name.
-
#src_suffix ⇒ Object
Returns the value of attribute src_suffix.
-
#test_path ⇒ Object
Returns the value of attribute test_path.
-
#workspace ⇒ Object
readonly
Returns the value of attribute workspace.
Instance Method Summary collapse
- #dep_projects_output_path ⇒ Object
- #depend_on(*deps) ⇒ Object
- #depend_on_project(*projects) ⇒ Object
- #generate_make_file ⇒ Object
- #header_search_path(*paths) ⇒ Object
-
#initialize(options = {}) ⇒ Project
constructor
A new instance of Project.
- #pack_dep_project_commands ⇒ Object
- #package_file ⇒ Object
- #package_part ⇒ Object
- #package_type=(type) ⇒ Object
- #root_project ⇒ Object
- #run_test_on_deps ⇒ Object
- #sub_folders_in_target_folder ⇒ Object
Methods included from PathHelper
Constructor Details
#initialize(options = {}) ⇒ Project
Returns a new instance of Project.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/simple-make/project.rb', line 17 def initialize( = {}) @workspace = [:workspace] || File.absolute_path(".") @name = @workspace.split("/").last @app_path = "app" @test_path = "test" @prod_path = "prod" @output_path = "build" @source_folder_name = "src" @deps = [] @dep_projects = [] @includes = [] @compile_command_with_flag = "g++ -O0 -g3 -Wall" @link_command_with_flag = "g++" @src_suffix = "cc" @path_mode = [:path_mode] || :absolute self.package_type = :executable @makefile_name = [:makefile] || "Makefile" @makefile_maker = NormalMakefileMaker.new(self, binding) end |
Instance Attribute Details
#app_path ⇒ Object
Returns the value of attribute app_path.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def app_path @app_path end |
#compile_command_with_flag ⇒ Object
Returns the value of attribute compile_command_with_flag.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def compile_command_with_flag @compile_command_with_flag end |
#dep_projects ⇒ Object (readonly)
Returns the value of attribute dep_projects.
15 16 17 |
# File 'lib/simple-make/project.rb', line 15 def dep_projects @dep_projects end |
#link ⇒ Object
Returns the value of attribute link.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def link @link end |
#makefile_name ⇒ Object (readonly)
Returns the value of attribute makefile_name.
15 16 17 |
# File 'lib/simple-make/project.rb', line 15 def makefile_name @makefile_name end |
#name ⇒ Object
Returns the value of attribute name.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def name @name end |
#output_path ⇒ Object
Returns the value of attribute output_path.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def output_path @output_path end |
#prod_path ⇒ Object
Returns the value of attribute prod_path.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def prod_path @prod_path end |
#source_folder_name ⇒ Object
Returns the value of attribute source_folder_name.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def source_folder_name @source_folder_name end |
#src_suffix ⇒ Object
Returns the value of attribute src_suffix.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def src_suffix @src_suffix end |
#test_path ⇒ Object
Returns the value of attribute test_path.
14 15 16 |
# File 'lib/simple-make/project.rb', line 14 def test_path @test_path end |
#workspace ⇒ Object (readonly)
Returns the value of attribute workspace.
15 16 17 |
# File 'lib/simple-make/project.rb', line 15 def workspace @workspace end |
Instance Method Details
#dep_projects_output_path ⇒ Object
113 114 115 |
# File 'lib/simple-make/project.rb', line 113 def dep_projects_output_path @dep_projects.map(&:output_path).join(" ") end |
#depend_on(*deps) ⇒ Object
45 46 47 48 49 |
# File 'lib/simple-make/project.rb', line 45 def depend_on(*deps) within_workspace do @deps += deps.map{|depHash| Dependency.new(depHash, @path_mode)} end end |
#depend_on_project(*projects) ⇒ Object
51 52 53 54 55 |
# File 'lib/simple-make/project.rb', line 51 def depend_on_project(*projects) within_workspace do @dep_projects += projects.map{|params| ProjectFactory.create_from_relative_path(params)} end end |
#generate_make_file ⇒ Object
71 72 73 |
# File 'lib/simple-make/project.rb', line 71 def generate_make_file @makefile_maker.generate_make_file end |
#header_search_path(*paths) ⇒ Object
57 58 59 60 61 |
# File 'lib/simple-make/project.rb', line 57 def header_search_path *paths within_workspace do @includes += paths.map{|path| SearchPath.new(path, @path_mode)} end end |
#pack_dep_project_commands ⇒ Object
79 80 81 |
# File 'lib/simple-make/project.rb', line 79 def pack_dep_project_commands @package.pack_dep_project_commands end |
#package_file ⇒ Object
75 76 77 |
# File 'lib/simple-make/project.rb', line 75 def package_file @package.package_file end |
#package_part ⇒ Object
83 84 85 |
# File 'lib/simple-make/project.rb', line 83 def package_part @package.pack_deps_command end |
#package_type=(type) ⇒ Object
41 42 43 |
# File 'lib/simple-make/project.rb', line 41 def package_type= type @package = PackageFactory.create_by_type(type, self) end |
#root_project ⇒ Object
37 38 39 |
# File 'lib/simple-make/project.rb', line 37 def root_project @makefile_maker = RootMakefileMaker.new(self, binding) end |
#run_test_on_deps ⇒ Object
87 88 89 |
# File 'lib/simple-make/project.rb', line 87 def run_test_on_deps @dep_projects.map(&:test_command).join("\n\t") end |
#sub_folders_in_target_folder ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/simple-make/project.rb', line 63 def sub_folders_in_target_folder folders = [] {"app" => @app_path, "prod" => @prod_path, "test" => @test_path}.each_pair do |k,v| folders += (k, v) end folders.map{|raw| "#{@output_path}/#{raw}"}.join(" \\\n") end |