mpxj 5.1.4 → 5.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa50a528b318b58c6f5cb10947b9f09104683365
4
- data.tar.gz: 5bb863de2da647861cce6f4aea5152358a36205d
3
+ metadata.gz: 0c0e87a47f2bc034ae61e4b12a179d886ab91669
4
+ data.tar.gz: 1c52ba2b1f7ebae4d71012835c74dc99f69fda60
5
5
  SHA512:
6
- metadata.gz: a18498f76954ef98f1d5e97ecbe11d2c8ea22435dc44304a91324574bd818d3852438eac471d0e8190cb689e6d8dfcb7419b09716207ffc04a00ecf18690e562
7
- data.tar.gz: 77a2bbdd0fb8c12cbb2cdfcede80ef3ca4dc82d719903e3661400bfa2eb99a15eaeacc7da858dfbc689b1d774e3624391e41d813e896992e5b09ad172eeb618b
6
+ metadata.gz: 1859ce007798e9aaa4531795d8390d9f3faf18babceadd4de7b3787da703d6970d09691844867790bebeeed250860a294ddc4ef377036900bb80d31cb4f7d0fe
7
+ data.tar.gz: bfa39261df30d3856c4d502620b1ca0b3e700d271b5e2bc26d8bbe87e85a1112483df2c1a46903f78e6d4c8e2ccbe8a89d3725a763f6939777d36381b7645850
@@ -62,7 +62,7 @@ module MPXJ
62
62
  if attribute_value.nil?
63
63
  nil
64
64
  else
65
- Time.parse(attribute_value)
65
+ @parent_project.zone.parse(attribute_value)
66
66
  end
67
67
  end
68
68
 
Binary file
@@ -8,7 +8,9 @@ module MPXJ
8
8
  attr_reader :all_tasks
9
9
  attr_reader :child_tasks
10
10
  attr_reader :all_assignments
11
- def initialize(file_name)
11
+ attr_reader :zone
12
+
13
+ def initialize(file_name, zone)
12
14
  @resources_by_unique_id = {}
13
15
  @tasks_by_unique_id = {}
14
16
 
@@ -20,6 +22,8 @@ module MPXJ
20
22
  @all_assignments = []
21
23
  @child_tasks = []
22
24
 
25
+ @zone = zone
26
+
23
27
  file = File.read(file_name)
24
28
  json_data = JSON.parse(file)
25
29
  process_properties(json_data)
@@ -1,23 +1,29 @@
1
1
  require 'tempfile'
2
+ require 'active_support/core_ext/time/calculations'
2
3
 
3
4
  module MPXJ
4
5
  # Used to read a project plan from a file
5
6
  class Reader
6
7
  # Reads a project plan from a file, and returns a Project instance
7
- # which provides access to the structure and attributes of the project data.
8
+ # which provides access to the structure and attributes of the project data.
9
+ # Note that an optional timezone can be supplied to ensue that all date-time
10
+ # values returned are in the specified timezone.
8
11
  #
9
12
  # @param file_name [String] the name of the file to read
13
+ # @param zone [ActiveSupport::TimeZone] an optional timezone
10
14
  # @return [Project] new Project instance
11
- def self.read(file_name)
15
+ def self.read(file_name, zone = nil)
12
16
  project = nil
13
17
  json_file = Tempfile.new([File.basename(file_name, ".*"), '.json'])
18
+ tz = zone || Time.zone || ActiveSupport::TimeZone["UTC"]
19
+
14
20
  begin
15
21
  classpath = Dir["#{File.dirname(__FILE__)}/*.jar"].join(path_separator)
16
22
  java_output = `java -cp \"#{classpath}\" net.sf.mpxj.sample.MpxjConvert \"#{file_name}\" \"#{json_file.path}\"`
17
23
  if $?.exitstatus != 0
18
24
  raise "Failed to read file: #{java_output}"
19
25
  end
20
- project = Project.new(json_file)
26
+ project = Project.new(json_file, tz)
21
27
  ensure
22
28
  json_file.close
23
29
  json_file.unlink
@@ -1,5 +1,5 @@
1
1
  # MPXJ gem module
2
2
  module MPXJ
3
3
  # MPXJ gem version number
4
- VERSION = "5.1.4"
4
+ VERSION = "5.1.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpxj
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.4
4
+ version: 5.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Iles
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tzinfo-data
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description:
84
112
  email:
85
113
  - jon.iles@bcs.org.uk