journal-cli 1.0.13 → 1.0.15

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: 7b3fcf300bf3f002d81aacd0bd78709bdb874a93168602658dce0de8d1cee285
4
- data.tar.gz: 2a11aec3c0e3cd415905fd1c792d3e8117d110f5560b2e1491364712409fc2f4
3
+ metadata.gz: c9552de8da086f7b0f989037ed511bf3a3b8bfd1caa6a14fa30699fd0ee50023
4
+ data.tar.gz: 6983e3f0822f29dc68963bc20708a437173fd35235334aeabe7473250d731979
5
5
  SHA512:
6
- metadata.gz: 46a7d1397dc22078541d608dd0ba2147487bc9159cde1c051a0a8c09c24acb3890948ff1e1ae9dd8daa569e5ea5e0f600768302f67caffe193712aede07706e4
7
- data.tar.gz: 53535dcc8d0c59cf64252d7725a1775cf6a29d64d89b22bd0838917dd8c08e3f5b817bfba72e6167ae55e7e2affe6764a38a44b5f5572e89ddaa1c0a8c585d1e
6
+ metadata.gz: fddcd96db70769cada2847010d847aea3373c813378e24d2013be39629735c45ad2935951183d21f56c5d1f7a0646d41c3b67b6596e5ad5ccdd81571c92331e5
7
+ data.tar.gz: e7aead96f200fb34603acf24486b9c45f7a72f6922e56b13fee71b52ad18a0baa6436dcec9743ff353231769230ab9d6f19541ae04fc3d40cce1efbe97a10be4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 1.0.15
2
+
3
+ 2023-09-07 07:57
4
+
5
+ #### FIXED
6
+
7
+ - Messed up the fix for nested keys
8
+
9
+ ### 1.0.14
10
+
11
+ 2023-09-07 07:35
12
+
13
+ #### FIXED
14
+
15
+ - Keys nested with dot syntax were doubling
16
+
1
17
  ### 1.0.13
2
18
 
3
19
  2023-09-07 06:57
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- journal-cli (1.0.13)
4
+ journal-cli (1.0.15)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ [![RubyGems.org](https://img.shields.io/gem/v/journal-cli)](https://rubygems.org/gems/journal-cli)
3
+
2
4
  A CLI for journaling to structured data, Markdown, and Day One
3
5
 
4
6
  ## Description
@@ -132,7 +134,7 @@ Once your configuration file is set up, you can just run `journal JOURNAL_KEY` t
132
134
 
133
135
  If a second argument contains a natural language date, the journal entry will be set to that date instead of the current time. For example, `journal mood "yesterday 5pm"` will create a new entry (in the journal configured for `mood`) for yesterday at 5pm.
134
136
 
135
- Answers will always be written to `~/.local/share/journal/[KEY]/[KEY].json` (where [KEY] is the journal key, one data file for each journal). If you've specified a top-level custom path with `entries_folder` in the config, entries will be written to `[top level folder]/[KEY]/entries`. If you've specified a custom path using `entries_folder` in the journal, entries will be written to `[custom folder]/entries`.
137
+ Answers will always be written to `~/.local/share/journal/[KEY].json` (where [KEY] is the journal key, one data file for each journal). If you've specified a top-level custom path with `entries_folder` in the config, entries will be written to `[top level folder]/[KEY].json`. If you've specified a custom path using `entries_folder` within the journal, entries will be written to `[custom folder]/[KEY].json`.
136
138
 
137
139
  If you've specified `daily` or `individual` Markdown formats, entries will be written to Markdown files in `~/.local/share/journal/[KEY]/entries`, either in a `[KEY]-%Y-%m-%d.md` file (daily), or in timestamped individual files. If `digest` is specified for the `markdown` key, a single file will be created at `~/.local/share/journal/[KEY]/entries/[KEY].md` (or a folder defined by `entries_folder`).
138
140
 
@@ -214,21 +214,36 @@ module Journal
214
214
  output[jk] = {}
215
215
  journal.answers.each do |k, v|
216
216
  if v.is_a? Hash
217
- output[jk][k] = {}
218
217
  v.each do |key, value|
219
- output[jk][k][key] = case value.class.to_s
220
- when /Weather/
221
- { 'high' => value.data[:high], 'low' => value.data[:low], 'condition' => value.data[:condition] }
222
- else
223
- value
224
- end
218
+ result = case value.class.to_s
219
+ when /Weather/
220
+ { 'high' => value.data[:high], 'low' => value.data[:low], 'condition' => value.data[:condition] }
221
+ else
222
+ value
223
+ end
224
+ if jk == k
225
+ output[jk][key] = result
226
+ else
227
+ output[jk][k][key] = result
228
+ end
225
229
  end
230
+ elsif jk == k
231
+ output[jk] = v
226
232
  else
227
233
  output[jk][k] = v
228
234
  end
229
235
  end
230
236
  end
231
237
  data << { 'date' => date, 'data' => output }
238
+ data.map! do |d|
239
+ {
240
+ 'date' => d['date'].is_a?(String) ? Time.parse(d['date']) : d['date'],
241
+ 'data' => d['data']
242
+ }
243
+ end
244
+
245
+ data.sort_by! { |e| e['date'] }
246
+
232
247
  File.open(db, 'w') { |f| f.puts JSON.pretty_generate(data) }
233
248
  end
234
249
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Journal
4
- VERSION = '1.0.13'
4
+ VERSION = '1.0.15'
5
5
  end
data/src/_README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # journal
2
2
 
3
- [![RubyGems.org](https://img.shields.io/gem/v/journal-cli)](https://rubygems.org/gems/journal-cli)
4
3
 
5
4
  <!--README-->
5
+ [![RubyGems.org](https://img.shields.io/gem/v/journal-cli)](https://rubygems.org/gems/journal-cli)
6
+
6
7
  A CLI for journaling to structured data, Markdown, and Day One
7
8
 
8
9
  ## Description
@@ -136,7 +137,7 @@ Once your configuration file is set up, you can just run `journal JOURNAL_KEY` t
136
137
 
137
138
  If a second argument contains a natural language date, the journal entry will be set to that date instead of the current time. For example, `journal mood "yesterday 5pm"` will create a new entry (in the journal configured for `mood`) for yesterday at 5pm.
138
139
 
139
- Answers will always be written to `~/.local/share/journal/[KEY]/[KEY].json` (where [KEY] is the journal key, one data file for each journal). If you've specified a top-level custom path with `entries_folder` in the config, entries will be written to `[top level folder]/[KEY]/entries`. If you've specified a custom path using `entries_folder` in the journal, entries will be written to `[custom folder]/entries`.
140
+ Answers will always be written to `~/.local/share/journal/[KEY].json` (where [KEY] is the journal key, one data file for each journal). If you've specified a top-level custom path with `entries_folder` in the config, entries will be written to `[top level folder]/[KEY].json`. If you've specified a custom path using `entries_folder` within the journal, entries will be written to `[custom folder]/[KEY].json`.
140
141
 
141
142
  If you've specified `daily` or `individual` Markdown formats, entries will be written to Markdown files in `~/.local/share/journal/[KEY]/entries`, either in a `[KEY]-%Y-%m-%d.md` file (daily), or in timestamped individual files. If `digest` is specified for the `markdown` key, a single file will be created at `~/.local/share/journal/[KEY]/entries/[KEY].md` (or a folder defined by `entries_folder`).
142
143
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journal-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra