Skip to content

Instantly share code, notes, and snippets.

@ricdeez
Created August 4, 2014 09:54
Show Gist options
  • Save ricdeez/fd808ab792f1158385c6 to your computer and use it in GitHub Desktop.
Save ricdeez/fd808ab792f1158385c6 to your computer and use it in GitHub Desktop.
Generate MSProject Schedule from YAML
#!/usr/bin/ruby
%w( yaml pp win32ole ).each { |dep| require dep }
class WIN32OLE
def self.get_project
begin
connect('MSProject.Application')
rescue WIN32OLERuntimeError => e
new('MSProject.Application')
end
end
end
class MicrosoftProject
attr_accessor :doc_file
def initialize(the_doc)
@doc_file = the_doc
@app = WIN32OLE::get_project
@app.Visible = true
@doc = @app.FileOpen(@doc_file)
@proj = @app.ActiveProject
@task_IDs = []
end
def add_new_task(args)
task_name = args[:task_name]
durn = args[:durn]
nesting = args[:nesting] + 1
tsk = @proj.Tasks.Add(Name: task_name)
tsk.Duration = durn if durn
tsk.Text1 = nesting
unless @task_IDs.size == 0 || @task_IDs[-1][1] != nesting
tsk.Predecessors = @task_IDs[-1][0]
end
tsk.OutlineIndent while tsk.OutlineLevel < nesting
tsk.OutlineOutdent while tsk.OutlineLevel > nesting
@task_IDs << [tsk.ID, nesting]
end
def generate_schedule_from_YAML(obj, nesting=0)
counter = 0
obj.each do | task, rest |
counter += 1
if rest.is_a? Hash
add_new_task( :task_name => task,
:nesting => nesting)
generate_schedule_from_YAML(rest, nesting+1)
else
add_new_task( :task_name => task,
:durn => rest,
:nesting => nesting)
end
end
end
end
def main(obj)
filename = 'F:\IM Methodology\Other Files\Newman PCN Remediation Schedule.mpp'
pj = MicrosoftProject.new(filename)
pj.generate_schedule_from_YAML(obj)
end
def test(o, nesting=0)
spaces = %q{ }
o.each do |task, rest|
if rest.is_a? Hash
puts spaces * nesting + task
test(rest, nesting+1)
else
puts [spaces * nesting + task, rest].join("|")
end
end
1
end
if __FILE__ == $0
obj = YAML::load(DATA)
test(obj) == 1 && main(obj)
end
__END__
---
<<Project Name>>:
Initiation:
Assessment Workshop:
MRA Completed: 0.0d
Risk Assessment Completed: 0.0d
OCM Assessment Completed: 0.0d
Commercial Assessment Completed: 1.0d
Documents Assessment Completed: 0.0d
Charter Developed: 0.0d
Charter Release for Review: 0.0d
Charter updated from feedback: 0.0d
Charter Approved: 0.0d
StageGate 0 Checklist Completed: 0.0d
Initiation Completed: 0.0d
Approval to proceed to Selection Phase Received: 0.0d
Selection:
Phase start: 0.0d
Program Management: 1.0d
Project Management: 1.0d
Project Phase Startup:
Engage Project Team: 1.0d
Create/Review Selection Phase Schedule and Financial Mode: 1.0d
Engage Business and IM: 1.0d
Review Lessons Learnt register and Similar Projects Learnings: 1.0d
Create Deliverables Register: 1.0d
Create Deliverables / Signoff matrix: 1.0d
High Level Business Requirements Documented:
Develop High Level Business Requirements: 1.0d
Create/update ARIS Business Process Models: 1.0d
Create/Update Business Requirements in Requisite Pro: 1.0d
Document High Level Business Requirements Spec (PGO40): 1.0d
High Level Solution Designed:
Validate SOW with EAO for Selection Phase: 1.0d
Create/Update Current State Architecture Models (Baseline - TOGAF B,C,D): 1.0d
Create/Update Future State Architecture Models (Target - TOGAF B,C,D): 1.0d
Perform Gap Analysis between Current and Future Architectures (TOGAF E): 1.0d
Assess Solution Options and Recommend Solutions: 1.0d
Prepare Architecture Feasability (PGO04): 1.0d
Approval of Architecture Feasability (TOGAF G): 1.0d
Update SOW with EAO for Definition Phase: 1.0d
Business Req & Solution Design Completed: 0.0d
MRA Review: 0.25d
STRA Completion: 1.0d
Project Plans Strategies Schedules Developed:
Project Execution Plan:
Develop Project Execution Plan : 1.0d
Change Management Strategy:
Develop Change Management Strategy : 1.0d
High Level Resource Plan:
Develop High Level Resource Plan : 1.0d
Project Schedule:
Develop High Level Project Schedule for Full Project : 1.0d
Build Detailed Project Schedule for Definition Phase : 1.0d
Project Financial Model:
Update Financial Model : 1.0d
High Level Quality Plan:
Develop High Level Quality Plan : 1.0d
Approval for Definition Phase:
Plans and Schedule Approved:
Review key project Documents : 3.0d
Approve all Documents: 1.0d
Plans and Schedule Approved: 0.0d
PEP Approved: 0.0d
Prepare Stagegate 1 Checklist: 1.0d
Complete Stakeholder Presentation: 1.0d
Stagegate 1:
Stagegate 1 Checklist Completed : 1.0d
Approval to proceed to Definition Phase Received: 0.0d
Submit to P3O : 1.0d
Definition:
Phase Start: 0.0d
Program Management: 1.0d
Project Management: 1.0d
Project Phase Startup:
Engage Project Team: 1.0d
Review Lessons Learnt register: 1.0d
Update Deliverables Register: 1.0d
Update Deliverables / Signoff matrix: 1.0d
Detailed Business Requirements :
Develop Detailed Business Requirements: 1.0d
Update ARIS Business Process Models: 1.0d
Update Business Requirements in Requisite Pro: 1.0d
Document Detailed Business Requirements : 1.0d
Detailed Business Requirements Spec Approved: 0.0d
Solution Design Finalised:
Functional Detailed Design Documented:
Develop Detailed Functional Design: 1.0d
Architecture Finalised:
Validate SOW with EAO: 1.0d
Validate Solutions against Functional Design (TOGAF B,C,D,E): 1.0d
Prioritise Work Packages (TOGAF F): 1.0d
Prepare Solution Architecture: 1.0d
Solution Architecture Approved (TOGAF G): 0.0d
Technical Detailed Design (If Infrastructure Project):
Develop Technical Detailed Design : 1.0d
Assessment Workshop:
MRA Review Completed: 1.0d
STRA Review Completed: 1.0d
IMTRA Completed: 1.0d
Risk & Contingency Completed: 1.0d
Detailed Project Execution Plans and Schedule:
Detailed Change Management Strategy:
Finalise Change Management Plans : 1.0d
Communications Plan:
Develop Communications Plan : 1.0d
Test Plan:
Develop Test Plan : 1.0d
Training Plan:
Develop Training Plan : 1.0d
Implementation Planning:
Develop Implementation Plan : 1.0d
Handover & Support Planning:
Develop Knowledge Transfer Training Plan: 1.0d
Develop Handover and Support Plan : 1.0d
Detailed Risk Assessment:
Perform Detailed Risk Assessment: 1.0d
Update Risk Register: 1.0d
Detailed Project Schedule for Full Project:
Develop Detailed Project Schedule for Full Project : 1.0d
Detailed Resource Plan:
Develop Detailed Resource Plan : 1.0d
Detailed Project Financial Model:
Develop Detailed Project Financial Model : 1.0d
Detailed Quality Plan:
Develop Detailed Quality Plan : 1.0d
Detailed Project Execution Plan:
Develop Detailed Project Execution Plan : 1.0d
Detailed Business Case:
Develop Detailed Business Case : 1.0d
Benefits Realisation Plan:
Develop Benefits Realisation Plan : 1.0d
Approval for Execution Phase:
Plans and Schedule Approved:
Review key project Documents : 3.0d
Approve all Documents: 1.0d
Plans and Schedule Approved: 0.0d
PEP Approved: 0.0d
Prepare Stagegate 1 Checklist: 1.0d
Complete Stakeholder Presentation: 1.0d
Initiate Supply process: 1.0d
Stagegate 1:
Stagegate 1 Checklist Completed : 1.0d
Approval to proceed to Execution Phase Received: 0.0d
Execution:
Phase Start: 1.0d
Project Management: 1.0d
Project Startup:
Engage Project Team: 1.0d
Perform Project Team Kickoff: 1.0d
Perform Supply process for Purchases and Maintenance: 1.0d
Project Plans and Schedule Reviewed:
Revise Project Schedule : 1.0d
Revise project Financial Model : 1.0d
Review Resource Plan : 1.0d
Review Change Management Strategy : 1.0d
Review Communications Plan : 1.0d
Review Implementation Plan : 1.0d
Review Handover Plan : 1.0d
Review Quality Plan : 1.0d
Revise Risk and Issues: 1.0d
Review Project Execution Plan : 1.0d
Obtain Business Approval for changes: 1.0d
Conduct Stakeholder kickoff: 1.0d
Solution Developed:
Build Configure and Unit Test:
Build Solution: 1.0d
Build Unit Test Plan : 1.0d
Conduct Unit Testing: 1.0d
Solution Complete: 0.0d
Finalise Solution Architecture with actual Architecture: 1.0d
Finalise Technical Detailed Design with actual Config: 1.0d
Update CIO Springboard with solution details: 1.0d
System and Integration Testing:
Build System Test Plans : 1.0d
Build Integration Test Plans : 1.0d
Conduct System Testing: 1.0d
Conduct Integration Testing: 1.0d
Prepare Test Report : 1.0d
User Acceptance:
Build UAT Plans : 1.0d
Conduct UAT Testing: 1.0d
Prepare UAT Test Report : 1.0d
Obtain UAT signoff: 1.0d
Finalise Implementation Plan : 1.0d
Finalise Handover Plan : 1.0d
Training Delivered:
Finalise Training Plan : 1.0d
Develop Training Content: 1.0d
Deliver Training: 1.0d
Manage and Deliver Knowledge Transfer Training: 1.0d
Assess Training Results: 1.0d
Organisational Changes Implemented:
Implement Communications Plan : 1.0d
Implement Organisational Changes: 1.0d
Approval for Go-Live:
Prepare Stagegate 3 Presentation Pack : 1.0d
Conduct Program Office Review of and other Docs: 1.0d
Plans and Schedule Approved: 0.0d
PEP Approved: 0.0d
As Built Review Completed: 2.0d
AAG Approved the "As Built Review": 2.0d
Prepare Stagegate 3 Checklist: 1.0d
Complete Stakeholder Presentation: 1.0d
Initiate Supply process: 1.0d
Stagegate 3:
Stagegate 3 Checklist Completed : 1.0d
Approval to proceed to Operations Phase Received: 0.0d
Operation:
Program Management: 1.0d
Project Management: 1.0d
Hand-Over Benefits Realisation Plan: 1.0d
Solution Implemented:
Prepare for Implementation: 1.0d
Conduct Implementation: 1.0d
Solution Live: 0.0d
Approval for Project Close-Out:
Project Close-Out Tasks:
Handover to Business and Support: 1.0d
Perform Project Review / Lessons Learnt Workshop: 1.0d
Prepare Project Close-Out Report : 1.0d
Prepare Close-Out documents : 1.0d
Archive Project Records: 1.0d
Finalise & Carry out Close out of Financials: 1.0d
Run Lessons Learnt Workshop: 1.0d
Update Lessons Learnt Database: 1.0d
Demobilise team: 1.0d
Vendor Evaluation Carried out: 1.0d
Syndicate Docs with IM and Key Business Stakeholders: 1.0d
Close Out Approved: 0.0d
Prepare Stagegate 4 Checklist: 1.0d
Complete Stakeholder Presentation: 1.0d
Initiate Coomercial process: 1.0d
Stagegate 4:
Stagegate 4 Checklist Completed : 1.0d
Approval to Close Down Project Received: 0.0d
Post Go-Live Support:
Post Go-Live Support: 1.0d
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment