public
Description: read ( + write ) gantt project xml charts
Homepage: http://ardekantur.lighthouseapp.com/projects/20357-gantty/
Clone URL: git://github.com/ardekantur/gantty.git
gantty /
name age message
file .gitignore Thu Nov 13 09:16:57 -0800 2008 ignore generated documentation directory [ardekantur]
file LICENSE Sat Nov 22 21:43:14 -0800 2008 License [ardekantur]
file Rakefile Sat Nov 22 22:18:25 -0800 2008 switched to hanna rdoc template, readme: markdo... [ardekantur]
file gantty.gemspec Loading commit data...
directory lib/
file readme.rdoc
directory spec/
readme.rdoc

gantty

gantty is a Ruby parser for GanttProject ( ganttproject.biz/ ) XML files.

creating from scratch

creating a chart

    @gantt = Gantty::create do
      name    "Project Alpha Gantt Chart"
      company "Awesomeco, Inc."
      website "http://example.com"
      details "This is the description of the project."
    end

creating a task

    @task = Gantty::create_task "Complete this task" do
      start Date.new(2009, 1, 1)
      duration 34
    end

creating a chart, and tasks in it

    @gantt = Gantty::create do
      name    "Project Alpha Gantt Chart"
      company "Awesomeco, Inc."
      website "http://example.com"
      details "This is the description of the project."

      task "Complete this task" do
        start Date.new(2009, 1, 12)
        duration 30
      end

    end

reading files

open a file

    @gantt = Gantty::Open '~/CorporateProject.gan'

tasks

    @gantt.tasks.first.name         # "Research and Development"
    @gantt.tasks.first.start.to_s   # "2008-01-01"
    @gantt.tasks.first.end.to_s     # "2008-01-15"
    @gantt.tasks.first.duration     # 15

active tasks

    @gantt.tasks.size                               # 30

    # See tasks that are active today
    @gantt.current_tasks.size                       # 5

    # Specify which date to see tasks from
    @gantt.current_tasks(Date.new(2008,1,6)).size   # 8

task dependencies

    @task = @gantt.task_where :name => "Acceptance Test Plan"
    @task.starts_with.first.name    # "Requirements Document"

the four different dependency types for tasks are as follows:

  * `Start->Start`: both tasks start at the same time. accessed as `#starts_with`.
  * `Start->Finish`: the current task finishes as the referenced task begins. accessed as `#finishes_before`.
  * `Finish->Start`: the current task starts as the referenced task ends. accessed as `#starts_after`.
  * `Finish->Finish`: both tasks end at the same time. accessed as `#finishes_with`.

finding tasks

finding a single task in a project

    task = @gantt.task_where :name => "Chunky Bacon"
    task = @gantt.task_where :id => 13
    task = @gantt.task_where :start => Date.today

finding a bunch of tasks in a project

    array = @gantt.all_tasks.select { |t| t.name =~ /secret/ }

resources

    @gantt.resources.first.name     # "Bob the Builder"
    @gantt.resources.first.email    # "bob.the.builder@example.com"
    @gantt.resources.first.phone    # "555-1234"

editing things

    t = Gantty::Task :name => "Licensing Acquisition"
    t.start = Date.new(2008, 1, 1)
    t.duration = 10
    t.end                          # "2008-01-11"

adding task dependencies

    t.add_starts_with other_task
    t.add_starts_after another_task
    ...

easy. just put `add_` before the names of the arrays that hold task dependencies.

misc

licensed under the gpl. enjoy.