mpp_reader 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/mpp_reader/cli.rb +1 -0
- data/lib/mpp_reader/decode.rb +22 -0
- data/lib/mpp_reader/reader14.rb +2 -0
- data/lib/mpp_reader/task.rb +10 -1
- data/lib/mpp_reader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79fc0475a02a9939c575f98ca6c506ae74436d58970289a1a4c6ebb6e47e405f
|
|
4
|
+
data.tar.gz: 32413a159e6a27bbdde5d7b3b16ce6dd8027cce50fa19d364ea9a56c79486321
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18eb284975774c0cda977674705cdcd5af130c330109e8cd64e9f4e44e1194a696e4778e729804d7c159a52edd48ba74a77a6b1d5458fce24e1b194b73425d31
|
|
7
|
+
data.tar.gz: e4966d1da31dfb46776926d88118e9ee91212f73f487ac9846eac25b9e7c48ce186f09423c4c18a2f06b57cf97cf5cfc0eacdb560a5235e34d4ce44a836a0625
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
- Constraints: `Task#constraint_type` and `#constraint_date` expose the
|
|
6
|
+
scheduling constraint MS Project writes when a task is pinned or an
|
|
7
|
+
auto-scheduled task is dragged. `Task#constrained?` is true only for the
|
|
8
|
+
six types that carry a date - `as_soon_as_possible` and
|
|
9
|
+
`as_late_as_possible` express a preference, not a fixed point. Unknown
|
|
10
|
+
constraint codes read as `nil` rather than being guessed at.
|
|
11
|
+
|
|
12
|
+
## [0.1.0] - 2026-06-12
|
|
13
|
+
|
|
5
14
|
- CLI: `mpp_reader FILE...` prints a task tree (with notes), `--json` emits
|
|
6
15
|
a structured dump of tasks, resources, assignments and calendars.
|
|
7
16
|
- CI workflow (GitHub Actions, Ruby 3.1-4.0) and gem metadata for the
|
data/lib/mpp_reader/cli.rb
CHANGED
|
@@ -76,6 +76,7 @@ module MppReader
|
|
|
76
76
|
percent_complete: t.percent_complete,
|
|
77
77
|
milestone: t.milestone?, summary: t.summary?,
|
|
78
78
|
active: t.active, manually_scheduled: t.manual,
|
|
79
|
+
constraint_type: t.constraint_type, constraint_date: iso(t.constraint_date),
|
|
79
80
|
parent_unique_id: t.parent&.unique_id,
|
|
80
81
|
predecessors: t.predecessors.map do |r|
|
|
81
82
|
{ predecessor_task_unique_id: r.predecessor_task_unique_id,
|
data/lib/mpp_reader/decode.rb
CHANGED
|
@@ -28,6 +28,17 @@ module MppReader
|
|
|
28
28
|
20 => :elapsed_percent
|
|
29
29
|
}.freeze
|
|
30
30
|
|
|
31
|
+
CONSTRAINT_TYPES = {
|
|
32
|
+
0 => :as_soon_as_possible,
|
|
33
|
+
1 => :as_late_as_possible,
|
|
34
|
+
2 => :must_start_on,
|
|
35
|
+
3 => :must_finish_on,
|
|
36
|
+
4 => :start_no_earlier_than,
|
|
37
|
+
5 => :start_no_later_than,
|
|
38
|
+
6 => :finish_no_earlier_than,
|
|
39
|
+
7 => :finish_no_later_than
|
|
40
|
+
}.freeze
|
|
41
|
+
|
|
31
42
|
# Divisors converting tenths-of-minutes to each unit, assuming MS
|
|
32
43
|
# Project's defaults (8h days, 40h weeks, 20-day months).
|
|
33
44
|
TENTHS_PER_UNIT = {
|
|
@@ -76,6 +87,17 @@ module MppReader
|
|
|
76
87
|
DURATION_UNITS.fetch(code, :days)
|
|
77
88
|
end
|
|
78
89
|
|
|
90
|
+
# A task's scheduling constraint. Codes match MPXJ's ConstraintType enum,
|
|
91
|
+
# which is the order MS Project writes them in.
|
|
92
|
+
#
|
|
93
|
+
# as_soon_as_possible is the default and the overwhelming majority; only
|
|
94
|
+
# the four "no earlier/later than" variants and the two "must" ones carry
|
|
95
|
+
# a meaningful constraint_date. An unknown code yields nil rather than a
|
|
96
|
+
# guess, because acting on a misread constraint moves real dates.
|
|
97
|
+
def constraint_type(code)
|
|
98
|
+
CONSTRAINT_TYPES[code]
|
|
99
|
+
end
|
|
100
|
+
|
|
79
101
|
# value is in tenths of a minute; converts using MS Project's default
|
|
80
102
|
# hours-per-day assumptions.
|
|
81
103
|
def duration(value, units)
|
data/lib/mpp_reader/reader14.rb
CHANGED
|
@@ -399,6 +399,8 @@ module MppReader
|
|
|
399
399
|
task.milestone = meta_bit?(meta_record, MILESTONE_FLAG)
|
|
400
400
|
task.active = meta_bit?(meta2_record, ACTIVE_FLAG)
|
|
401
401
|
task.manual = meta_bit?(meta2_record, MANUALLY_SCHEDULED_FLAG)
|
|
402
|
+
task.constraint_type = Decode.constraint_type(read.call(:constraint_type))
|
|
403
|
+
task.constraint_date = read.call(:constraint_date)
|
|
402
404
|
|
|
403
405
|
# In MPP14 the start/finish/duration slots hold manually-scheduled
|
|
404
406
|
# values; auto-scheduled tasks carry theirs in the scheduled_* fields
|
data/lib/mpp_reader/task.rb
CHANGED
|
@@ -2,7 +2,8 @@ module MppReader
|
|
|
2
2
|
class Task
|
|
3
3
|
attr_accessor :unique_id, :id, :name, :start, :finish, :duration,
|
|
4
4
|
:outline_level, :percent_complete, :milestone, :parent,
|
|
5
|
-
:active, :manual, :notes
|
|
5
|
+
:active, :manual, :notes,
|
|
6
|
+
:constraint_type, :constraint_date
|
|
6
7
|
attr_reader :children, :predecessors, :successors
|
|
7
8
|
|
|
8
9
|
def initialize
|
|
@@ -13,6 +14,14 @@ module MppReader
|
|
|
13
14
|
|
|
14
15
|
def milestone? = !!@milestone
|
|
15
16
|
|
|
17
|
+
# True when the constraint actually pins the task somewhere. The default
|
|
18
|
+
# (as_soon_as_possible) and as_late_as_possible carry no date and express
|
|
19
|
+
# a scheduling preference, not a fixed point; the other six do.
|
|
20
|
+
def constrained?
|
|
21
|
+
!constraint_date.nil? &&
|
|
22
|
+
!%i[as_soon_as_possible as_late_as_possible].include?(constraint_type)
|
|
23
|
+
end
|
|
24
|
+
|
|
16
25
|
# A summary task is one with subtasks (MS Project derives this the
|
|
17
26
|
# same way).
|
|
18
27
|
def summary = !@children.empty?
|
data/lib/mpp_reader/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mpp_reader
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bart Duchesne
|
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
72
|
version: '0'
|
|
73
73
|
requirements: []
|
|
74
|
-
rubygems_version: 4.0.
|
|
74
|
+
rubygems_version: 4.0.10
|
|
75
75
|
specification_version: 4
|
|
76
76
|
summary: Pure Ruby reader for Microsoft Project .mpp files
|
|
77
77
|
test_files: []
|