journal-cli 1.0.13 → 1.0.14

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: 10242acbf794f1f5e37dc3a2048c248d15c3b478e6e07ef715bb9805e7d76422
4
+ data.tar.gz: 68e6a0adce0a131e1d23d2e8ab0e513f1c4e609f18cd7e1d9ca5a8e8916c3352
5
5
  SHA512:
6
- metadata.gz: 46a7d1397dc22078541d608dd0ba2147487bc9159cde1c051a0a8c09c24acb3890948ff1e1ae9dd8daa569e5ea5e0f600768302f67caffe193712aede07706e4
7
- data.tar.gz: 53535dcc8d0c59cf64252d7725a1775cf6a29d64d89b22bd0838917dd8c08e3f5b817bfba72e6167ae55e7e2affe6764a38a44b5f5572e89ddaa1c0a8c585d1e
6
+ metadata.gz: 406045f38a8ba65d1d5bbec21f49dbb6024a0934a143b9968f00884b2f7d42b812ece2cfab320adc953174f4b8960d7c480b99f4866f00761f1eab7760baae56
7
+ data.tar.gz: ab3b5d5a3bf95420048bc0109b6f5cb6926c3ec10d4dc51e5eeeea852d0cf241ea88ff3253bdb2603e8af71585d2ea89f0dec9e44e11a752eb1cf4866a078080
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 1.0.14
2
+
3
+ 2023-09-07 07:35
4
+
5
+ #### FIXED
6
+
7
+ - Keys nested with dot syntax were doubling
8
+
1
9
  ### 1.0.13
2
10
 
3
11
  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.14)
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
 
@@ -215,20 +215,39 @@ module Journal
215
215
  journal.answers.each do |k, v|
216
216
  if v.is_a? Hash
217
217
  output[jk][k] = {}
218
+
218
219
  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
220
+ result = case value.class.to_s
221
+ when /Weather/
222
+ { 'high' => value.data[:high], 'low' => value.data[:low], 'condition' => value.data[:condition] }
223
+ else
224
+ value
225
+ end
226
+ if jk == k
227
+ output[jk] = result
228
+ else
229
+ output[jk][k] = result
230
+ end
225
231
  end
226
232
  else
227
- output[jk][k] = v
233
+ if jk == k
234
+ output[jk] = v
235
+ else
236
+ output[jk][k] = v
237
+ end
228
238
  end
229
239
  end
230
240
  end
231
241
  data << { 'date' => date, 'data' => output }
242
+ data.map! do |d|
243
+ {
244
+ 'date' => d['date'].is_a?(String) ? Time.parse(d['date']) : d['date'],
245
+ 'data' => d['data']
246
+ }
247
+ end
248
+
249
+ data.sort_by! { |e| e['date'] }
250
+
232
251
  File.open(db, 'w') { |f| f.puts JSON.pretty_generate(data) }
233
252
  end
234
253
  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.14'
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.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra