fedux_org-stdlib 0.0.37 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile
CHANGED
@@ -15,10 +15,23 @@ module FeduxOrg
|
|
15
15
|
class Taskjuggler
|
16
16
|
def generate_report( directory, plan_file )
|
17
17
|
FeduxOrg::Stdlib::Project.logger.debug "Start generating report."
|
18
|
-
|
18
|
+
|
19
|
+
begin
|
20
|
+
command = CommandExec::Command.new(:tj3 ,
|
21
|
+
:parameter => "-o #{directory} #{plan_file}",
|
22
|
+
:error_detection_on => [:return_code],
|
23
|
+
:error_indicators => {
|
24
|
+
:allowed_return_code => [0],
|
25
|
+
},
|
26
|
+
:on_error_do => :raise_error,
|
27
|
+
)
|
28
|
+
command.run
|
29
|
+
rescue CommandExec::Exceptions::CommandExecutionFailed
|
30
|
+
FeduxOrg::Stdlib::Project.logger.fatal "Failed to generate report:\n\n#{ command.result.stderr.join( "\n" ) }"
|
31
|
+
exit 1
|
32
|
+
end
|
33
|
+
|
19
34
|
FeduxOrg::Stdlib::Project.logger.info "Generating report succeeded."
|
20
|
-
rescue Exception => e
|
21
|
-
FeduxOrg::Stdlib::Project.logger.fatal "Generating report failed. Maybe you forgot to install \"the taskjuggler\"-gem or it is not available in PATH? The error message was: #{e.message}"
|
22
35
|
end
|
23
36
|
end
|
24
37
|
|
@@ -0,0 +1,337 @@
|
|
1
|
+
/*
|
2
|
+
* This file contains a project skeletton. It is part of the
|
3
|
+
* TaskJuggler project management tool. You can use this as a basis to
|
4
|
+
* start you own project file.
|
5
|
+
*/
|
6
|
+
project your_project_id "Your Project Title" 2011-11-11-0:00--0500 +4m {
|
7
|
+
# Set the default time zone for the project. If not specified, UTC
|
8
|
+
# is used.
|
9
|
+
timezone "America/New_York"
|
10
|
+
# Hide the clock time. Only show the date.
|
11
|
+
timeformat "%Y-%m-%d"
|
12
|
+
# Use US format for numbers
|
13
|
+
numberformat "-" "" "," "." 1
|
14
|
+
# Use US financial format for currency values. Don't show cents.
|
15
|
+
currencyformat "(" ")" "," "." 0
|
16
|
+
# Pick a day during the project that will be reported as 'today' in
|
17
|
+
# the project reports. If not specified, the current day will be
|
18
|
+
# used, but this will likely be outside of the project range, so it
|
19
|
+
# can't be seen in the reports.
|
20
|
+
now 2011-12-24
|
21
|
+
# The currency for all money values is the Euro.
|
22
|
+
currency "USD"
|
23
|
+
|
24
|
+
# You can define multiple scenarios here if you need them.
|
25
|
+
#scenario plan "Plan" {
|
26
|
+
# scenario actual "Actual"
|
27
|
+
#}
|
28
|
+
|
29
|
+
# You can define your own attributes for tasks and resources. This
|
30
|
+
# is handy to capture additonal information about the project that
|
31
|
+
# is not directly impacting the project schedule but you like to
|
32
|
+
# keep in one place.
|
33
|
+
#extend task {
|
34
|
+
# reference spec "Link to Wiki page"
|
35
|
+
#}
|
36
|
+
#extend resource {
|
37
|
+
# text Phone "Phone"
|
38
|
+
#}
|
39
|
+
}
|
40
|
+
|
41
|
+
copyright "Claim your rights here"
|
42
|
+
|
43
|
+
# If you have any text block that you need multiple times to describe
|
44
|
+
# your project, you should define a macro for it. Macros can even have
|
45
|
+
# variable segments that you can set upon calling the macro.
|
46
|
+
#
|
47
|
+
# macro Task [
|
48
|
+
# task "A ${1} task" {
|
49
|
+
# }
|
50
|
+
# ]
|
51
|
+
#
|
52
|
+
# Can be called as
|
53
|
+
# ${Task "big"}
|
54
|
+
# to generate
|
55
|
+
# task "A big task" {
|
56
|
+
# }
|
57
|
+
|
58
|
+
# You can attach flags to accounts, resources and tasks. These can be
|
59
|
+
# used to filter out subsets of them during reporting.
|
60
|
+
flags important, hidden
|
61
|
+
|
62
|
+
# If you want to do budget planning for you project, you need to
|
63
|
+
# define some accounts.
|
64
|
+
account cost "Project Cost" {
|
65
|
+
account dev "Development"
|
66
|
+
account doc "Documentation"
|
67
|
+
}
|
68
|
+
account rev "Customer Payments"
|
69
|
+
|
70
|
+
# The Profit&Loss analysis should be rev - cost accounts.
|
71
|
+
balance cost rev
|
72
|
+
|
73
|
+
# Define you public holidays here.
|
74
|
+
vacation "New Year's Day" 2012-01-02
|
75
|
+
vacation "Birthday of Martin Luther King, Jr." 2012-01-16
|
76
|
+
vacation "Washington's Birthday" 2012-02-20
|
77
|
+
vacation "Memorial Day" 2012-05-28
|
78
|
+
vacation "Independence Day" 2012-07-04
|
79
|
+
vacation "Labor Day" 2012-09-03
|
80
|
+
vacation "Columbus Day" 2012-10-08
|
81
|
+
vacation "Veterans Day" 2012-11-12
|
82
|
+
vacation "Thanksgiving Day" 2012-11-22
|
83
|
+
vacation "Christmas Day" 2012-12-25
|
84
|
+
|
85
|
+
# The daily default rate of all resources. This can be overridden for each
|
86
|
+
# resource. We specify this, so that we can do a good calculation of
|
87
|
+
# the costs of the project.
|
88
|
+
rate 400.0
|
89
|
+
|
90
|
+
# This is a set of example resources.
|
91
|
+
resource r1 "Resource 1"
|
92
|
+
resource t1 "Team 1" {
|
93
|
+
managers r1
|
94
|
+
resource r2 "Resource 2"
|
95
|
+
resource r3 "Resource 3"
|
96
|
+
}
|
97
|
+
|
98
|
+
# This is a resource that does not do any work.
|
99
|
+
resource s1 "System 1" {
|
100
|
+
efficiency 0.0
|
101
|
+
rate 600.0
|
102
|
+
}
|
103
|
+
|
104
|
+
task project "Project" {
|
105
|
+
task wp1 "Workpackage 1" {
|
106
|
+
task t1 "Task 1"
|
107
|
+
task t2 "Task 2"
|
108
|
+
}
|
109
|
+
task wp2 "Work package 2" {
|
110
|
+
depends !wp1
|
111
|
+
task t1 "Task 1"
|
112
|
+
task t2 "Task 2"
|
113
|
+
}
|
114
|
+
task deliveries "Deliveries" {
|
115
|
+
task "Item 1" {
|
116
|
+
depends !!wp1
|
117
|
+
}
|
118
|
+
task "Item 2" {
|
119
|
+
depends !!wp2
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
# Now the project has been specified completely. Stopping here would
|
125
|
+
# result in a valid TaskJuggler file that could be processed and
|
126
|
+
# scheduled. But no reports would be generated to visualize the
|
127
|
+
# results.
|
128
|
+
|
129
|
+
navigator navbar {
|
130
|
+
hidereport 0
|
131
|
+
}
|
132
|
+
|
133
|
+
macro TaskTip [
|
134
|
+
tooltip istask() -8<-
|
135
|
+
'''Start: ''' <-query attribute='start'->
|
136
|
+
'''End: ''' <-query attribute='end'->
|
137
|
+
----
|
138
|
+
'''Resources:'''
|
139
|
+
|
140
|
+
<-query attribute='resources'->
|
141
|
+
----
|
142
|
+
'''Precursors: '''
|
143
|
+
|
144
|
+
<-query attribute='precursors'->
|
145
|
+
----
|
146
|
+
'''Followers: '''
|
147
|
+
|
148
|
+
<-query attribute='followers'->
|
149
|
+
->8-
|
150
|
+
]
|
151
|
+
|
152
|
+
textreport frame "" {
|
153
|
+
header -8<-
|
154
|
+
== TaskJuggler Project Template ==
|
155
|
+
<[navigator id="navbar"]>
|
156
|
+
->8-
|
157
|
+
footer "----"
|
158
|
+
textreport index "Overview" {
|
159
|
+
formats html
|
160
|
+
center '<[report id="overview"]>'
|
161
|
+
}
|
162
|
+
|
163
|
+
textreport "Status" {
|
164
|
+
formats html
|
165
|
+
center -8<-
|
166
|
+
<[report id="status.dashboard"]>
|
167
|
+
----
|
168
|
+
<[report id="status.completed"]>
|
169
|
+
----
|
170
|
+
<[report id="status.ongoing"]>
|
171
|
+
----
|
172
|
+
<[report id="status.future"]>
|
173
|
+
->8-
|
174
|
+
}
|
175
|
+
|
176
|
+
textreport wps "Work packages" {
|
177
|
+
textreport wp1 "Work package 1" {
|
178
|
+
formats html
|
179
|
+
center '<[report id="wp1"]>'
|
180
|
+
}
|
181
|
+
|
182
|
+
textreport wp2 "Work package 2" {
|
183
|
+
formats html
|
184
|
+
center '<[report id="wp2"]>'
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
textreport "Deliveries" {
|
189
|
+
formats html
|
190
|
+
center '<[report id="deliveries"]>'
|
191
|
+
}
|
192
|
+
|
193
|
+
textreport "ContactList" {
|
194
|
+
formats html
|
195
|
+
title "Contact List"
|
196
|
+
center '<[report id="contactList"]>'
|
197
|
+
}
|
198
|
+
textreport "ResourceGraph" {
|
199
|
+
formats html
|
200
|
+
title "Resource Graph"
|
201
|
+
center '<[report id="resourceGraph"]>'
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
# A traditional Gantt chart with a project overview.
|
206
|
+
taskreport overview "" {
|
207
|
+
header -8<-
|
208
|
+
=== Project Overview ===
|
209
|
+
|
210
|
+
The project is structured into 2 work packages.
|
211
|
+
|
212
|
+
# Specification
|
213
|
+
# <-reportlink id='frame.wps.wp1'->
|
214
|
+
# <-reportlink id='frame.wps.wp2'->
|
215
|
+
# Testing
|
216
|
+
|
217
|
+
=== Original Project Plan ===
|
218
|
+
->8-
|
219
|
+
columns bsi { title 'WBS' },
|
220
|
+
name, start, end, effort, cost,
|
221
|
+
revenue, chart { ${TaskTip} }
|
222
|
+
# For this report we like to have the abbreviated weekday in front
|
223
|
+
# of the date. %a is the tag for this.
|
224
|
+
timeformat "%a %Y-%m-%d"
|
225
|
+
loadunit days
|
226
|
+
hideresource 1
|
227
|
+
balance cost rev
|
228
|
+
caption 'All effort values are in man days.'
|
229
|
+
|
230
|
+
footer -8<-
|
231
|
+
=== Staffing ===
|
232
|
+
|
233
|
+
All project phases are properly staffed. See [[ResourceGraph]] for
|
234
|
+
detailed resource allocations.
|
235
|
+
|
236
|
+
=== Current Status ===
|
237
|
+
|
238
|
+
Some blurb about the current situation.
|
239
|
+
->8-
|
240
|
+
}
|
241
|
+
|
242
|
+
# Macro to set the background color of a cell according to the alert
|
243
|
+
# level of the task.
|
244
|
+
macro AlertColor [
|
245
|
+
cellcolor plan.alert = 0 "#00D000" # green
|
246
|
+
cellcolor plan.alert = 1 "#D0D000" # yellow
|
247
|
+
cellcolor plan.alert = 2 "#D00000" # red
|
248
|
+
]
|
249
|
+
|
250
|
+
taskreport status "" {
|
251
|
+
columns bsi { width 50 title 'WBS' }, name { width 150 },
|
252
|
+
start { width 100 }, end { width 100 },
|
253
|
+
effort { width 100 },
|
254
|
+
alert { tooltip plan.journal
|
255
|
+
!= '' "<-query attribute='journal'->" width 150 },
|
256
|
+
status { width 150 }
|
257
|
+
|
258
|
+
taskreport dashboard "" {
|
259
|
+
headline "Project Dashboard (<-query attribute='now'->)"
|
260
|
+
columns name { title "Task" ${AlertColor} width 200},
|
261
|
+
resources { width 200 ${AlertColor}
|
262
|
+
listtype bullets
|
263
|
+
listitem "<-query attribute='name'->"
|
264
|
+
start ${projectstart} end ${projectend} },
|
265
|
+
alerttrend { title "Trend" ${AlertColor} width 50 },
|
266
|
+
journal { width 350 ${AlertColor} }
|
267
|
+
journalmode status_up
|
268
|
+
journalattributes headline, author, date, summary, details
|
269
|
+
hidetask ~hasalert(0)
|
270
|
+
sorttasks alert.down, plan.end.up
|
271
|
+
period %{${now} - 1w} +1w
|
272
|
+
}
|
273
|
+
taskreport completed "" {
|
274
|
+
headline "Already completed tasks"
|
275
|
+
hidetask ~(plan.end <= ${now})
|
276
|
+
}
|
277
|
+
taskreport ongoing "" {
|
278
|
+
headline "Ongoing tasks"
|
279
|
+
hidetask ~((plan.start <= ${now}) & (plan.end > ${now}))
|
280
|
+
}
|
281
|
+
taskreport future "" {
|
282
|
+
headline "Future tasks"
|
283
|
+
hidetask ~(plan.start > ${now})
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
# A list of tasks showing the resources assigned to each task.
|
288
|
+
taskreport wp1 "" {
|
289
|
+
headline "Work package 1 - Resource Allocation Report"
|
290
|
+
columns bsi { title 'WBS' }, name, start, end, effort { title "Work" },
|
291
|
+
duration, chart { ${TaskTip} scale day width 500 }
|
292
|
+
timeformat "%Y-%m-%d"
|
293
|
+
hideresource ~(isleaf() & isleaf_())
|
294
|
+
sortresources name.up
|
295
|
+
taskroot project.wp1
|
296
|
+
}
|
297
|
+
# A list of tasks showing the resources assigned to each task.
|
298
|
+
taskreport wp2 "" {
|
299
|
+
headline "Work package 2 - Resource Allocation Report"
|
300
|
+
columns bsi { title 'WBS' }, name, start, end, effort { title "Work" },
|
301
|
+
duration, chart { ${TaskTip} scale day width 500 }
|
302
|
+
timeformat "%Y-%m-%d"
|
303
|
+
hideresource ~(isleaf() & isleaf_())
|
304
|
+
sortresources name.up
|
305
|
+
taskroot project.wp2
|
306
|
+
}
|
307
|
+
|
308
|
+
# A list of all tasks with the percentage completed for each task
|
309
|
+
taskreport deliveries "" {
|
310
|
+
headline "Project Deliverables"
|
311
|
+
columns bsi { title 'WBS' }, name, start, end, note { width 150 }, complete,
|
312
|
+
chart { ${TaskTip} }
|
313
|
+
taskroot project.deliveries
|
314
|
+
hideresource 1
|
315
|
+
}
|
316
|
+
# A list of all employees with their contact details.
|
317
|
+
resourcereport contactList "" {
|
318
|
+
headline "Contact list and duty plan"
|
319
|
+
columns name,
|
320
|
+
email { celltext 1 "[mailto:<-email-> <-email->]" },
|
321
|
+
managers { title "Manager" },
|
322
|
+
chart { scale day }
|
323
|
+
hideresource ~isleaf()
|
324
|
+
sortresources name.up
|
325
|
+
hidetask 1
|
326
|
+
}
|
327
|
+
|
328
|
+
# A graph showing resource allocation. It identifies whether each
|
329
|
+
# resource is under- or over-allocated for.
|
330
|
+
resourcereport resourceGraph "" {
|
331
|
+
headline "Resource Allocation Graph"
|
332
|
+
columns no, name, effort, rate, weekly { ${TaskTip} }
|
333
|
+
loadunit shortauto
|
334
|
+
# We only like to show leaf tasks for leaf resources.
|
335
|
+
hidetask ~(isleaf() & isleaf_())
|
336
|
+
sorttasks plan.start.up
|
337
|
+
}
|
@@ -2,4 +2,35 @@ require 'spec_helper'
|
|
2
2
|
require 'fedux_org/stdlib/project/generators/taskjuggler'
|
3
3
|
|
4
4
|
describe FeduxOrg::Stdlib::Project::Generators::Taskjuggler do
|
5
|
+
context '#generate_report' do
|
6
|
+
it "generates a report using taskjuggler" do
|
7
|
+
directory = create_directory( 'projects' )
|
8
|
+
plan_file = File.join( examples_directory, 'project', 'plan.tjp' )
|
9
|
+
|
10
|
+
generator = FeduxOrg::Stdlib::Project::Generators::Taskjuggler.new
|
11
|
+
|
12
|
+
switch_to_working_directory do
|
13
|
+
silence( :stderr ) do
|
14
|
+
generator.generate_report( directory, plan_file )
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "fails if an error occured while generating the report" do
|
20
|
+
directory = create_directory( 'projects' )
|
21
|
+
plan_file = File.join( examples_directory, 'project', 'plan_does_not_exist.tjp' )
|
22
|
+
|
23
|
+
generator = FeduxOrg::Stdlib::Project::Generators::Taskjuggler.new
|
24
|
+
|
25
|
+
expect {
|
26
|
+
switch_to_working_directory do
|
27
|
+
silence( :stderr) do
|
28
|
+
generator.generate_report( directory, plan_file )
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
}.to raise_error SystemExit
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
5
36
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedux_org-stdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.38
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- spec/examples/models/filesystem_based/find_files/abc.rb
|
148
148
|
- spec/examples/models/filesystem_based/find_files/abc.rb.swp
|
149
149
|
- spec/examples/models/filesystem_based/find_files/cde.rb
|
150
|
+
- spec/examples/project/plan.tjp
|
150
151
|
- spec/logic_converters/on_off_converter_spec.rb
|
151
152
|
- spec/logic_converters/true_false_converter_spec.rb
|
152
153
|
- spec/logic_converters/y_n_converter_spec.rb
|
@@ -198,6 +199,7 @@ test_files:
|
|
198
199
|
- spec/examples/models/filesystem_based/find_files/abc.rb
|
199
200
|
- spec/examples/models/filesystem_based/find_files/abc.rb.swp
|
200
201
|
- spec/examples/models/filesystem_based/find_files/cde.rb
|
202
|
+
- spec/examples/project/plan.tjp
|
201
203
|
- spec/logic_converters/on_off_converter_spec.rb
|
202
204
|
- spec/logic_converters/true_false_converter_spec.rb
|
203
205
|
- spec/logic_converters/y_n_converter_spec.rb
|