na 1.1.23 → 1.1.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8bee2cada1590cdc80fe9943947c719649d441ed15a6c51228fa0bebe4e94eb
4
- data.tar.gz: 3dfc5a53bb88952243388b86e853af744b76938cbc69ef3b6f6ac8e58c03a9fc
3
+ metadata.gz: 627281aeb89624e4b083114fe2247e459383a0a00517901003deb4d361e6b6ed
4
+ data.tar.gz: 4c811e25d7b2a882c058bc04465d08777ba6275192b4b4f262a6be05ff927d7f
5
5
  SHA512:
6
- metadata.gz: 0603c3187363e3c5895f9e49af6deab11779cbf47442f4f76b7b5ad2608e4676d0cb337368e2a0d6a5f9bad7f5aff957d63e986cefe1997c671a6b6b5193e3e4
7
- data.tar.gz: e570fe4a32d7e45b4bd2171c73bee68adb6017ae22901c92486ccbe1bdb2461a50dac988d8ed862aa85237c070ebb305d3b6c2c61afc920826568c628d630faf
6
+ metadata.gz: 3d8197e283363015d007cd04748f82452306724b172ea68a4928fe368c19ce842af4c16d0f1ed05d7e885a7f76f5757c1e95e58181a7b1e75295d146797d8a18
7
+ data.tar.gz: 216f752c87e8143f0332309a4c6a00cff3c6d53f0645d189bc03acfe2f68319618a9c4fa9bae0fbeca23a74a7fd555cef17cd612676fca1ebc263af75c378b8d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 1.1.24
2
+
3
+ 2022-10-12 08:27
4
+
5
+ #### FIXED
6
+
7
+ - Force utf-8 encoding when reading files, should fix invalid byte sequence errors
8
+
1
9
  ### 1.1.23
2
10
 
3
11
  2022-10-07 10:02
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.1.23)
4
+ na (1.1.24)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  gli (~> 2.21.0)
7
7
  tty-reader (~> 0.9, >= 0.9.0)
@@ -30,6 +30,7 @@ GEM
30
30
 
31
31
  PLATFORMS
32
32
  arm64-darwin-20
33
+ arm64-darwin-21
33
34
 
34
35
  DEPENDENCIES
35
36
  minitest (~> 5.14)
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  _If you're one of the rare people like me who find this useful, feel free to
10
10
  [buy me some coffee][donate]._
11
11
 
12
- The current version of `na` is 1.1.23
12
+ The current version of `na` is 1.1.24
13
13
  .
14
14
 
15
15
  `na` ("next action") is a command line tool designed to make it easy to see what your next actions are for any project, right from the command line. It works with TaskPaper-formatted files (but any plain text format will do), looking for `@na` tags (or whatever you specify) in todo files in your current folder.
@@ -59,7 +59,7 @@ SYNOPSIS
59
59
  na [global options] command [command options] [arguments...]
60
60
 
61
61
  VERSION
62
- 1.1.23
62
+ 1.1.24
63
63
 
64
64
  GLOBAL OPTIONS
65
65
  -a, --[no-]add - Add a next action (deprecated, for backwards compatibility)
@@ -144,7 +144,7 @@ module NA
144
144
  ## @param note [String] The note
145
145
  ##
146
146
  def add_action(file, project, action, note = nil)
147
- content = IO.read(file)
147
+ content = file.read_file
148
148
  # Insert the target project at the top if it doesn't exist
149
149
  unless content =~ /^[ \t]*#{project}:/i
150
150
  content = "#{project.cap_first}:\n#{content}"
@@ -255,7 +255,7 @@ module NA
255
255
 
256
256
  files.each do |file|
257
257
  save_working_dir(File.expand_path(file))
258
- content = IO.read(file)
258
+ content = file.read_file
259
259
  indent_level = 0
260
260
  parent = []
261
261
  content.split("\n").each do |line|
@@ -330,7 +330,7 @@ module NA
330
330
  db_file = 'tdlist.txt'
331
331
  file = File.join(db_dir, db_file)
332
332
  if File.exist?(file)
333
- dirs = IO.read(file).split("\n")
333
+ dirs = file.read_file.split("\n")
334
334
  dirs.delete_if { |f| !File.exist?(f) }
335
335
  File.open(file, 'w') { |f| f.puts dirs.join("\n") }
336
336
  end
@@ -341,7 +341,7 @@ module NA
341
341
  dirs = match_working_dir(query)
342
342
  else
343
343
  file = database_path
344
- content = File.exist?(file) ? IO.read(file).strip : ''
344
+ content = File.exist?(file) ? file.read_file.strip : ''
345
345
  notify('{br}Database empty', exit_code: 1) if content.empty?
346
346
 
347
347
  dirs = content.split(/\n/)
@@ -373,7 +373,7 @@ module NA
373
373
  def load_searches
374
374
  file = database_path(file: 'saved_searches.yml')
375
375
  if File.exist?(file)
376
- searches = YAML.safe_load(IO.read(file))
376
+ searches = YAML.safe_load(file.read_file)
377
377
  else
378
378
  searches = {
379
379
  'soon' => 'tagged "due<in 2 days,due>yesterday"',
@@ -459,7 +459,7 @@ module NA
459
459
  file = database_path
460
460
  notify('{r}No na database found', exit_code: 1) unless File.exist?(file)
461
461
 
462
- dirs = IO.read(file).split("\n")
462
+ dirs = file.read_file.split("\n")
463
463
 
464
464
  optional = search.map { |t| t[:token] }
465
465
  required = search.filter { |s| s[:required] }.map { |t| t[:token] }
@@ -478,7 +478,7 @@ module NA
478
478
  ##
479
479
  def save_working_dir(todo_file)
480
480
  file = database_path
481
- content = File.exist?(file) ? IO.read(file) : ''
481
+ content = File.exist?(file) ? file.read_file : ''
482
482
  dirs = content.split(/\n/)
483
483
  dirs.push(File.expand_path(todo_file))
484
484
  dirs.sort!.uniq!
data/lib/na/string.rb CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  # String helpers
4
4
  class ::String
5
+ def read_file
6
+ file = File.expand_path(self)
7
+ raise "Missing file #{file}" unless File.exist?(file)
8
+
9
+ # IO.read(file).force_encoding('ASCII-8BIT').encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
10
+ IO.read(file).force_encoding('utf-8')
11
+ end
12
+
5
13
  ##
6
14
  ## Determine indentation level of line
7
15
  ##
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.1.23'
2
+ VERSION = '1.1.24'
3
3
  end
data/src/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  _If you're one of the rare people like me who find this useful, feel free to
10
10
  [buy me some coffee][donate]._
11
11
 
12
- The current version of `na` is <!--VER-->1.1.22<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.1.23<!--END VER-->.
13
13
 
14
14
  `na` ("next action") is a command line tool designed to make it easy to see what your next actions are for any project, right from the command line. It works with TaskPaper-formatted files (but any plain text format will do), looking for `@na` tags (or whatever you specify) in todo files in your current folder.
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.23
4
+ version: 1.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -90,22 +90,22 @@ dependencies:
90
90
  name: tty-reader
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '0.9'
96
93
  - - ">="
97
94
  - !ruby/object:Gem::Version
98
95
  version: 0.9.0
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '0.9'
99
99
  type: :runtime
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - "~>"
104
- - !ruby/object:Gem::Version
105
- version: '0.9'
106
103
  - - ">="
107
104
  - !ruby/object:Gem::Version
108
105
  version: 0.9.0
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '0.9'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: tty-screen
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -130,22 +130,22 @@ dependencies:
130
130
  name: tty-which
131
131
  requirement: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - "~>"
134
- - !ruby/object:Gem::Version
135
- version: '0.5'
136
133
  - - ">="
137
134
  - !ruby/object:Gem::Version
138
135
  version: 0.5.0
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.5'
139
139
  type: :runtime
140
140
  prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '0.5'
146
143
  - - ">="
147
144
  - !ruby/object:Gem::Version
148
145
  version: 0.5.0
146
+ - - "~>"
147
+ - !ruby/object:Gem::Version
148
+ version: '0.5'
149
149
  - !ruby/object:Gem::Dependency
150
150
  name: chronic
151
151
  requirement: !ruby/object:Gem::Requirement
@@ -203,7 +203,7 @@ homepage: https://brettterpstra.com/projects/na/
203
203
  licenses:
204
204
  - MIT
205
205
  metadata: {}
206
- post_install_message:
206
+ post_install_message:
207
207
  rdoc_options:
208
208
  - "--title"
209
209
  - na
@@ -225,8 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  - !ruby/object:Gem::Version
226
226
  version: '0'
227
227
  requirements: []
228
- rubygems_version: 3.2.16
229
- signing_key:
228
+ rubygems_version: 3.0.3.1
229
+ signing_key:
230
230
  specification_version: 4
231
231
  summary: A command line tool for adding and listing project todos
232
232
  test_files: []