trello_freestyler 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa39c91fbd96b7440ece2c909c958b796db196f72c825c0d43d5abd851306d67
4
- data.tar.gz: 872c3dd1f2096e9da023fd677c6dfd4aa6f8b6d175090cb195a22e01ec3f1e55
3
+ metadata.gz: 4954ed0ff60fcddd08c3446685dfc8d24581f36c5798c05435fb7f78bf9d7900
4
+ data.tar.gz: 95f212985ea8a2c0ab5fef1fc5dbc97823c9b4fa1aa4f75f30a7a25dbd0db2ef
5
5
  SHA512:
6
- metadata.gz: 391aac9234565350cccdc0ab422dd1d83fad271809fe3b8c37171e4e9d1a33ff7d9599b1f83f28d2c580cfb89c012be818d002235c08cb0b3846fe36a6b0c48c
7
- data.tar.gz: 26f39e427510cd629074f52145591efe5ff2ad965bf3e9ca3142b586d94e5555ce58142447371a84a99df7315015746af4277c112e9e5ad5aa13b870de0a601d
6
+ metadata.gz: 6cc6511d911141862caf2a815154103efe2097dd41eef726204031f003ca001c2088b51ba8d6d346b72af29133b3c81800194754f79630a7c6354f8b4a07b7f5
7
+ data.tar.gz: c264e485ff0a1e186086cb7a636bc6a48a56e6cdac19c938543b3a3bd00244e9422bf96395ca1bb37b272eb121bde35f1b168947d24c2502536f4b01f65bd97a
@@ -2,4 +2,8 @@
2
2
  ## Version 0.3.0
3
3
 
4
4
  - moved `TrelloFreestyler::Cli::Options` to `TrelloFreestyler::Options`
5
- - added instructions on how to use without the cli
5
+ - added instructions on how to use without the cli
6
+
7
+ ## Version 0.4.0
8
+
9
+ - add `execution_datetime` and `execution_local_date` field to each row of the data we export.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trello_freestyler (0.3.0)
4
+ trello_freestyler (0.4.0)
5
5
  rest-client (~> 2.1)
6
6
  tty-spinner (~> 0.9)
7
7
  tzinfo (~> 2.0)
@@ -13,6 +13,8 @@ module TrelloFreestyler
13
13
  # rubocop:disable Metrics/AbcSize
14
14
  def self.dump(options)
15
15
  client = TrelloFreestyler::Client.new(options.key, options.token, options.url)
16
+ execution_datetime = Time.now.getlocal(options.timezone.current_period.offset.utc_total_offset)
17
+ execution_date = Date.parse(execution_datetime.strftime('%Y/%m/%d')).to_s
16
18
 
17
19
  response_cards = client.cards(options.board_id)
18
20
  card_dump = parse_cards(response_cards.body)
@@ -26,26 +28,18 @@ module TrelloFreestyler
26
28
  end.flatten
27
29
  )
28
30
 
29
- basename = init_output_basename(options.output, options.timezone)
30
- export(card_dump.raw, basename.join('cards.jsonl').to_s)
31
- export(actions_dump.raw, basename.join('actions.jsonl').to_s)
31
+ basename = init_output_basename(options.output, execution_date)
32
+ export_with_stamp(card_dump.raw, basename.join('cards.jsonl').to_s, execution_datetime, execution_date)
33
+ export_with_stamp(actions_dump.raw, basename.join('actions.jsonl').to_s, execution_datetime, execution_date)
32
34
  end
33
35
  # rubocop:enable Metrics/AbcSize
34
36
 
35
- def self.init_output_basename(base, timezone)
36
- time = Time.now.getlocal(timezone.current_period.offset.utc_total_offset)
37
- date = Date.parse(time.strftime('%Y/%m/%d')).to_s
37
+ def self.init_output_basename(base, date)
38
38
  base = Pathname.new(base).join(date)
39
39
  Pathname.new(base).mkpath
40
40
  base
41
41
  end
42
42
 
43
- def self.full_filename(base, filename, timezone)
44
- time = Time.now.getlocal(timezone.current_period.offset.utc_total_offset)
45
- date = Date.parse(time.strftime('%Y/%m/%d')).to_s
46
- Pathname.new(base).join(date).join(filename).to_s
47
- end
48
-
49
43
  def self.parse_cards(raw_text)
50
44
  cards = JSON.parse(raw_text)
51
45
  cards.each_with_object(Struct::CardDump.new([], [])) do |card, all|
@@ -63,9 +57,13 @@ module TrelloFreestyler
63
57
  end
64
58
  end
65
59
 
66
- def self.export(dump, to)
60
+ def self.export_with_stamp(dump, to, execution_datetime, execution_date)
67
61
  File.open(to, 'w') do |f|
68
- dump.each { |row| f.puts row.to_json }
62
+ dump.each do |row|
63
+ row[:execution_datetime] = execution_datetime
64
+ row[:execution_local_date] = execution_date
65
+ f.puts row.to_json
66
+ end
69
67
  end
70
68
  end
71
69
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrelloFreestyler
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_freestyler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Hamman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-28 00:00:00.000000000 Z
11
+ date: 2020-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client