jirametrics 2.7.2 → 2.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b747372b77be9d3ec514c09b57f479741a47688dd6e634e6823aa9feefe3154e
4
- data.tar.gz: df7b9bdc06211d7d2fd89df18af5aa8ab4b780aa58f798c29c45ca8033c1986f
3
+ metadata.gz: ed5733b75d3ab3091973a5919269c467e6657a1a7699a6e5e4acb4139f9a292b
4
+ data.tar.gz: 3e750fe3a053fe9d8b5c30099afc42d1c50187c1d749f922d29bd91eb2f60241
5
5
  SHA512:
6
- metadata.gz: 7f4873e816019b7b2903b7b2a5c905484a6e1ef5d2601f9bb8dd0cec78a306646a4d145a6bb76981a4bd3ce46d884e5e7b8e8e3ccef4f179a2a7067e26b58a43
7
- data.tar.gz: 40790878004dd12d1aa362cbe72988a2c6ed13152066b48ab1f38855a74bf89f8aae926d13d3e721990ca568c20f5adbd1c99d0ce5b81aaece19d04701b8eddd
6
+ metadata.gz: 9f97b93668b57a3f5876979daa14631c1f75f6d6294b49ae58f57b2d60e21b36020c64aef8d7affa59e03796e8c7b3e5480546e3a540372d20c3152764d8a6a0
7
+ data.tar.gz: ed479b302392340ca02a7f58d4ac0e5f27178ff23fc35956ebeb8659af91454ca8d7e752aacbcad3bef942c49bc24f03dca332760b582b23c782cb5824681651
@@ -6,14 +6,18 @@ class FileSystem
6
6
  attr_accessor :logfile, :logfile_name
7
7
 
8
8
  # Effectively the same as File.read except it forces the encoding to UTF-8
9
- def load filename
9
+ def load filename, supress_deprecation: false
10
+ if filename.end_with?('.json') && !supress_deprecation
11
+ deprecated(message: 'call load_json instead', date: '2024-11-13')
12
+ end
13
+
10
14
  File.read filename, encoding: 'UTF-8'
11
15
  end
12
16
 
13
17
  def load_json filename, fail_on_error: true
14
18
  return nil if fail_on_error == false && File.exist?(filename) == false
15
19
 
16
- JSON.parse load(filename)
20
+ JSON.parse load(filename, supress_deprecation: true)
17
21
  end
18
22
 
19
23
  def save_json json:, filename:
@@ -43,4 +47,8 @@ class FileSystem
43
47
  end
44
48
  node
45
49
  end
50
+
51
+ def foreach root, &block
52
+ Dir.foreach root, &block
53
+ end
46
54
  end
@@ -63,7 +63,8 @@ class ProjectConfig
63
63
  end
64
64
 
65
65
  def load_settings
66
- JSON.parse(file_system.load(File.join(__dir__, 'settings.json')))
66
+ # This is the wierd exception that we don't ever want mocked out so we skip FileSystem entirely.
67
+ JSON.parse(File.read(File.join(__dir__, 'settings.json'), encoding: 'UTF-8'))
67
68
  end
68
69
 
69
70
  def guess_project_id
@@ -136,7 +137,7 @@ class ProjectConfig
136
137
 
137
138
  def load_board board_id:, filename:
138
139
  board = Board.new(
139
- raw: JSON.parse(file_system.load(filename)), possible_statuses: @possible_statuses
140
+ raw: file_system.load_json(filename), possible_statuses: @possible_statuses
140
141
  )
141
142
  board.project_config = self
142
143
  @all_boards[board_id] = board
@@ -178,7 +179,7 @@ class ProjectConfig
178
179
  # We may not always have this file. Load it if we can.
179
180
  return unless File.exist? filename
180
181
 
181
- statuses = JSON.parse(file_system.load(filename))
182
+ statuses = file_system.load_json(filename)
182
183
  .map { |snippet| Status.new(raw: snippet) }
183
184
  statuses
184
185
  .find_all { |status| status.global? }
@@ -189,13 +190,22 @@ class ProjectConfig
189
190
  end
190
191
 
191
192
  def load_sprints
192
- Dir.foreach(@target_path) do |file|
193
- next unless file =~ /#{file_prefix}_board_(\d+)_sprints_\d+/
193
+ file_system.foreach(@target_path) do |file|
194
+ next unless file =~ /^#{file_prefix}_board_(\d+)_sprints_\d+.json$/
195
+
196
+ file_path = File.join(@target_path, file)
197
+ board = @all_boards[$1.to_i]
198
+ unless board
199
+ @exporter.file_system.log(
200
+ 'Found sprint data but can\'t find a matching board in config. ' \
201
+ "File: #{file_path}, Boards: #{@all_boards.keys.sort}"
202
+ )
203
+ next
204
+ end
194
205
 
195
- board_id = $1.to_i
196
206
  timezone_offset = exporter.timezone_offset
197
- JSON.parse(file_system.load("#{target_path}#{file}"))['values']&.each do |json|
198
- @all_boards[board_id].sprints << Sprint.new(raw: json, timezone_offset: timezone_offset)
207
+ file_system.load_json(file_path)['values']&.each do |json|
208
+ board.sprints << Sprint.new(raw: json, timezone_offset: timezone_offset)
199
209
  end
200
210
  end
201
211
 
@@ -247,7 +257,7 @@ class ProjectConfig
247
257
 
248
258
  def load_project_metadata
249
259
  filename = File.join @target_path, "#{file_prefix}_meta.json"
250
- json = JSON.parse(file_system.load(filename))
260
+ json = file_system.load_json(filename)
251
261
 
252
262
  @data_version = json['version'] || 1
253
263
 
@@ -380,7 +390,7 @@ class ProjectConfig
380
390
  default_board = nil
381
391
 
382
392
  group_filenames_and_board_ids(path: path).each do |filename, board_ids|
383
- content = file_system.load(File.join(path, filename))
393
+ content = file_system.load_json(File.join(path, filename))
384
394
  if board_ids == :unknown
385
395
  boards = [(default_board ||= find_default_board)]
386
396
  else
@@ -388,7 +398,7 @@ class ProjectConfig
388
398
  end
389
399
 
390
400
  boards.each do |board|
391
- issues << Issue.new(raw: JSON.parse(content), timezone_offset: timezone_offset, board: board)
401
+ issues << Issue.new(raw: content, timezone_offset: timezone_offset, board: board)
392
402
  end
393
403
  end
394
404
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jirametrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.2
4
+ version: 2.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Bowler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-11 00:00:00.000000000 Z
11
+ date: 2024-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: random-word