Method: MTBuild::Workspace#initialize
- Defined in:
- lib/mtbuild/workspace.rb
#initialize(workspace_name, workspace_folder, &configuration_block) ⇒ Workspace
Returns a new instance of Workspace.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/mtbuild/workspace.rb', line 32 def initialize(workspace_name, workspace_folder, &configuration_block) @workspace_folder = File.(workspace_folder) @output_folder = File.(File.join(@workspace_folder, MTBuild.default_output_folder)) @projects = [] @workspaces = [] @default_tasks = [] @configuration_defaults = {} @child_workspaces = {} @push_configuration_defaults = [] @workspace_name, @parent_workspace = MTBuild::BuildRegistry.enter_workspace(workspace_name, self) unless @parent_workspace.nil? pull_configuration_defaults(@parent_workspace, @parent_workspace.push_configuration_defaults) end configuration_block.call(self) if configuration_block # If there's a parent workspace, use its output folder. # Don't use the current workspace's output folder. @output_folder = @parent_workspace.output_folder unless @parent_workspace.nil? @workspaces.each do |workspace| MTBuild::BuildRegistry.expect_workspace @push_configuration_defaults = workspace[:push_cfg] require workspace[:build_file] last_workspace = MTBuild::BuildRegistry.reenter_workspace(self) unless last_workspace.nil? pull_configuration_defaults(last_workspace, workspace[:pull_cfg]) @default_tasks+=last_workspace.default_tasks if workspace[:pull_tasks] end end @projects.each do |project| MTBuild::BuildRegistry.expect_project require project end Cleaner.global_clean_list.include(@output_folder) # Only register default tasks and generate global clean if we're the top-level workspace. if @parent_workspace.nil? task Rake.application.default_task_name => @default_tasks Cleaner.generate_global_clean_task end MTBuild::BuildRegistry.exit_workspace end |