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 +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/lib/journal-cli/checkin.rb +22 -7
- data/lib/journal-cli/version.rb +1 -1
- data/src/_README.md +3 -2
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c9552de8da086f7b0f989037ed511bf3a3b8bfd1caa6a14fa30699fd0ee50023
         | 
| 4 | 
            +
              data.tar.gz: 6983e3f0822f29dc68963bc20708a437173fd35235334aeabe7473250d731979
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: fddcd96db70769cada2847010d847aea3373c813378e24d2013be39629735c45ad2935951183d21f56c5d1f7a0646d41c3b67b6596e5ad5ccdd81571c92331e5
         | 
| 7 | 
            +
              data.tar.gz: e7aead96f200fb34603acf24486b9c45f7a72f6922e56b13fee71b52ad18a0baa6436dcec9743ff353231769230ab9d6f19541ae04fc3d40cce1efbe97a10be4
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,4 +1,6 @@ | |
| 1 1 |  | 
| 2 | 
            +
            [](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] | 
| 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 |  | 
    
        data/lib/journal-cli/checkin.rb
    CHANGED
    
    | @@ -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 | 
            -
                           | 
| 220 | 
            -
             | 
| 221 | 
            -
             | 
| 222 | 
            -
             | 
| 223 | 
            -
             | 
| 224 | 
            -
             | 
| 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
         | 
    
        data/lib/journal-cli/version.rb
    CHANGED
    
    
    
        data/src/_README.md
    CHANGED
    
    | @@ -1,8 +1,9 @@ | |
| 1 1 | 
             
            # journal
         | 
| 2 2 |  | 
| 3 | 
            -
            [](https://rubygems.org/gems/journal-cli)
         | 
| 4 3 |  | 
| 5 4 | 
             
            <!--README-->
         | 
| 5 | 
            +
            [](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] | 
| 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 |  |