ardekantur-gantty 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gantty.rb +56 -8
- metadata +2 -2
data/lib/gantty.rb
CHANGED
@@ -55,9 +55,10 @@ module Gantty
|
|
55
55
|
|
56
56
|
class GanttChart
|
57
57
|
|
58
|
-
attr_accessor :resources, :tasks
|
58
|
+
attr_accessor :resources, :tasks, :name
|
59
59
|
|
60
60
|
def initialize file = nil
|
61
|
+
@name = nil
|
61
62
|
@gantt = nil
|
62
63
|
@resources, @tasks = [], []
|
63
64
|
if file
|
@@ -158,7 +159,7 @@ module Gantty
|
|
158
159
|
|
159
160
|
x = Builder::XmlMarkup.new :indent => 2
|
160
161
|
x.instruct! :xml, :version => '1.0', :encoding => 'UTF-8'
|
161
|
-
xml = x.project( :name =>
|
162
|
+
xml = x.project( :name => @name) do
|
162
163
|
|
163
164
|
x.description ''
|
164
165
|
x.view( 'zooming-state' => 'default:7', 'id' => 'gantt-chart' )
|
@@ -256,14 +257,52 @@ module Gantty
|
|
256
257
|
end
|
257
258
|
|
258
259
|
end
|
259
|
-
|
260
|
+
|
261
|
+
# A Task is a single Gantt chart item. It has several editable properties, as well as relationships with other tasks.
|
262
|
+
# == Properties
|
263
|
+
# name:: The description of the task.
|
264
|
+
# start:: The start date of the task. Accepts DateTime objects.
|
265
|
+
# end:: The end date of the task. Accepts DateTime objects.
|
266
|
+
# duration:: The duration, in days, of the task.
|
267
|
+
# percent_complete:: The percentage complete of the task. Accepts integers from 0 to 100.
|
268
|
+
# priority:: The importance of the task. Accepts one of <tt>[:low, :medium, :high]</tt>.
|
269
|
+
# color:: The color of the task in GanttProject. Accepts RGB hex triplets (such as "#391204")
|
270
|
+
# notes:: Notes for the task.
|
271
|
+
# link:: A hyperlink related to the task.
|
272
|
+
#
|
273
|
+
# == Coordinators
|
274
|
+
# Coordinators are people working on a task. They are defined as instances of the Resource class.
|
275
|
+
# Coordinators are added to Tasks by specifying the instance, for now. This is done with #add_resource:
|
276
|
+
#
|
277
|
+
# @task.add_resource Gantty::Resource "Adam Alpha"
|
278
|
+
#
|
279
|
+
# == Dependencies
|
280
|
+
# A dependency is a relationship between one task and another. They are defined as follows:
|
281
|
+
#
|
282
|
+
# * Start->Start: Both tasks start at the same time. Accessed as #starts_with.
|
283
|
+
# * Start->Finish: The current task finishes as the referenced task begins. Accessed as #finishes_before.
|
284
|
+
# * Finish->Start: The current task starts as the referenced task ends. Accessed as #starts_after.
|
285
|
+
# * Finish->Finish: Both tasks end at the same time. Accessed as #finishes_with.
|
286
|
+
#
|
260
287
|
class Task
|
261
|
-
|
262
|
-
attr_accessor :
|
288
|
+
|
289
|
+
attr_accessor :start, :duration, :end
|
290
|
+
attr_accessor :name, :percent_complete, :coordinators, :priority, :color
|
291
|
+
|
292
|
+
# The dependency arrays of the task. Dependencies are defined at Task.
|
293
|
+
attr_accessor :starts_with, :starts_after, :finishes_with, :finishes_before
|
263
294
|
attr_accessor :tasks, :notes, :link
|
264
295
|
|
296
|
+
# The GanttProject internal +id+ field for the task.
|
265
297
|
attr_reader :id
|
266
298
|
|
299
|
+
# Create a new task. +t+ can be a hash of options, the +name+ of the task, or a Nokogiri node containing a task element of a GanttProject file.
|
300
|
+
# Most people will only use the first two options.
|
301
|
+
#
|
302
|
+
# task = Gantty::Task.new "Create chunky bacon"
|
303
|
+
# task = Gantty::Task.new :name => "Create chunky bacon"
|
304
|
+
#
|
305
|
+
# Right now, only specifying <tt>:name</tt> in the hash works.
|
267
306
|
def initialize t
|
268
307
|
@notes = nil
|
269
308
|
@starts_with, @starts_after, @finishes_with, @finishes_before, @tasks = [], [], [], [], []
|
@@ -342,14 +381,14 @@ module Gantty
|
|
342
381
|
return res
|
343
382
|
end
|
344
383
|
|
345
|
-
|
384
|
+
#--
|
346
385
|
# If Task B has predecessor Task A with relationship Finish->Start, task_b.before.include? task_a
|
347
386
|
# <task id="#{task_a.id}"...><depend id="#{task_b.id}" type="2" difference="1" hardness="Rubber"/></task>
|
348
387
|
# Start-Start: 1 => #starts_with
|
349
388
|
# Finish-Start: 2 => #starts_after
|
350
389
|
# Finish-Finish: 3 => #finishes_with
|
351
390
|
# Start-Finish: 4 => #finishes_before
|
352
|
-
|
391
|
+
#++
|
353
392
|
|
354
393
|
def add_starts_with t
|
355
394
|
@starts_with << t
|
@@ -370,7 +409,16 @@ module Gantty
|
|
370
409
|
end
|
371
410
|
|
372
411
|
class Resource
|
373
|
-
|
412
|
+
# The name of the resource. Cannot be empty.
|
413
|
+
attr_accessor :name
|
414
|
+
|
415
|
+
# The e-mail address of the resource.
|
416
|
+
attr_accessor :email
|
417
|
+
|
418
|
+
# The phone number of the resource.
|
419
|
+
attr_accessor :phone
|
420
|
+
|
421
|
+
# The GanttProject +id+ field of the resource.
|
374
422
|
attr_reader :id
|
375
423
|
|
376
424
|
def initialize r
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ardekantur-gantty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ardekantur
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-23 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|