journal-cli 1.0.31 → 1.0.32

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.
data/lib/journal-cli.rb CHANGED
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'time'
4
- require 'shellwords'
5
- require 'json'
6
- require 'yaml'
7
- require 'chronic'
8
- require 'fileutils'
3
+ require "time"
4
+ require "shellwords"
5
+ require "json"
6
+ require "yaml"
7
+ require "chronic"
8
+ require "fileutils"
9
9
 
10
- require 'tty-which'
11
- require 'tty-reader'
12
- require_relative 'journal-cli/version'
13
- require_relative 'journal-cli/color'
14
- require_relative 'journal-cli/string'
15
- require_relative 'journal-cli/data'
16
- require_relative 'journal-cli/weather'
17
- require_relative 'journal-cli/checkin'
18
- require_relative 'journal-cli/sections'
19
- require_relative 'journal-cli/section'
20
- require_relative 'journal-cli/question'
10
+ require "tty-which"
11
+ require "tty-reader"
12
+ require_relative "journal-cli/version"
13
+ require_relative "journal-cli/color"
14
+ require_relative "journal-cli/string"
15
+ require_relative "journal-cli/data"
16
+ require_relative "journal-cli/weather"
17
+ require_relative "journal-cli/checkin"
18
+ require_relative "journal-cli/sections"
19
+ require_relative "journal-cli/section"
20
+ require_relative "journal-cli/question"
21
21
 
22
22
  # Main Journal module
23
23
  module Journal
@@ -26,9 +26,9 @@ module Journal
26
26
 
27
27
  def notify(string, debug: false, exit_code: nil)
28
28
  if debug
29
- $stderr.puts "{dw}#{string}{x}".x
29
+ warn "{dw}#{string}{x}".x
30
30
  else
31
- $stderr.puts "#{string}{x}".x
31
+ warn "#{string}{x}".x
32
32
  end
33
33
 
34
34
  Process.exit exit_code unless exit_code.nil?
@@ -36,35 +36,35 @@ module Journal
36
36
 
37
37
  def config
38
38
  unless @config
39
- config = File.expand_path('~/.config/journal/journals.yaml')
39
+ config = File.expand_path("~/.config/journal/journals.yaml")
40
40
  unless File.exist?(config)
41
41
  default_config = {
42
- 'weather_api' => 'XXXXXXXXXXXXXXXXXx',
43
- 'zip' => 'XXXXX',
44
- 'entries_folder' => '~/.local/share/journal/',
45
- 'journals' => {
46
- 'demo' => {
47
- 'dayone' => false,
48
- 'markdown' => 'single',
49
- 'title' => '5-minute checkin',
50
- 'entries_folder' => '~/.local/share/journal/',
51
- 'sections' => [
52
- { 'title' => 'Quick checkin',
53
- 'key' => 'checkin',
54
- 'questions' => [
55
- { 'prompt' => 'What\'s happening?', 'key' => 'journal', 'type' => 'multiline' }
56
- ] }
42
+ "weather_api" => "XXXXXXXXXXXXXXXXXx",
43
+ "zip" => "XXXXX",
44
+ "entries_folder" => "~/.local/share/journal/",
45
+ "journals" => {
46
+ "demo" => {
47
+ "dayone" => false,
48
+ "markdown" => "single",
49
+ "title" => "5-minute checkin",
50
+ "entries_folder" => "~/.local/share/journal/",
51
+ "sections" => [
52
+ {"title" => "Quick checkin",
53
+ "key" => "checkin",
54
+ "questions" => [
55
+ {"prompt" => "What's happening?", "key" => "journal", "type" => "multiline"}
56
+ ]}
57
57
  ]
58
58
  }
59
59
  }
60
60
  }
61
- File.open(config, 'w') { |f| f.puts(YAML.dump(default_config)) }
61
+ File.open(config, "w") { |f| f.puts(YAML.dump(default_config)) }
62
62
  puts "New configuration written to #{config}, please edit."
63
63
  Process.exit 0
64
64
  end
65
65
  @config = YAML.load(IO.read(config))
66
66
 
67
- if @config['journals'].key?('demo')
67
+ if @config["journals"].key?("demo")
68
68
  Journal.notify("{br}Demo journal detected, please edit the configuration file at {bw}#{config}", exit_code: 1)
69
69
  end
70
70
  end
data/src/_README.md CHANGED
@@ -38,12 +38,6 @@ If you want to use Day One with Journal, you'll need to [install the Day One CLI
38
38
  $ sudo bash /Applications/Day\ One.app/Contents/Resources/install_cli.sh
39
39
  ```
40
40
 
41
- ## Usage
42
-
43
- ```
44
- @cli(bundle exec bin/journal -h)
45
- ```
46
-
47
41
  ## Configuration
48
42
 
49
43
  A config must be created at `~/.config/journal/journals.yaml`:
@@ -61,9 +55,13 @@ This file contains a YAML definition of your journal. Each journal gets a top-le
61
55
 
62
56
  You can include weather data automatically by setting a question type to 'weather'. In order for this to work, you'll need to define `zip` and `weather_api` keys. `zip` is just your zip code, and `weather_api` is a key from WeatherAPI.com. Sign up [here](https://www.weatherapi.com/) for a free plan, and then visit the [profile page](https://www.weatherapi.com/my/) to see your API key at the top.
63
57
 
58
+ > Zip codes beginning with zero (0) must be quoted. Use:
59
+ >
60
+ > zip: '01001'
61
+
64
62
  You can optionally set the key `temp_in:` to `f` or `c` to control what scale is used for temperatures.
65
63
 
66
- If a question type is set to `weather.forecast`, only the predicted condition, high, and low will be included in the JSON data for the question. A full printout of hourly temps will be included in the Markdown/Day One output.
64
+ If a question type is set to `weather.forecast`, the moon phase and predicted condition, high, and low will be included in the JSON data for the question. A full printout of hourly temps will be included in the Markdown/Day One output.
67
65
 
68
66
  If the question type is `weather.current`, only the current condition and temperature will be recorded to the JSON, and a string containing "[TEMP] and [CONDITION]" (e.g. "64 and Sunny") will be recorded to Markdown/Day One for the question.
69
67
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journal-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.31
4
+ version: 1.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-14 00:00:00.000000000 Z
11
+ date: 2024-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-which
@@ -221,6 +221,7 @@ files:
221
221
  - ".github/workflows/version.yml"
222
222
  - ".gitignore"
223
223
  - ".rspec"
224
+ - ".rubocop.yml"
224
225
  - ".ruby-version"
225
226
  - CHANGELOG.md
226
227
  - Gemfile