toys-core 0.14.5 → 0.14.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/toys/core.rb +1 -1
- data/lib/toys/standard_mixins/git_cache.rb +8 -8
- data/lib/toys/utils/git_cache.rb +6 -6
- data/lib/toys/utils/terminal.rb +7 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af0d0ca4cb5ad8e29460fbb43a4a2d1466375c5346a4e5ea311075650945b83b
|
4
|
+
data.tar.gz: a2ee5cff31d49d7c028add28d8c64520e2dba5633d4cc01f8b97c5b26b2667d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fdc394813c50de79636b0146f9c163de53479212555d5a34e0b7138fe5d385b08c531419677f1e8bbf3174b01b4c23e9413eaa826e0528173e207ef4babb304
|
7
|
+
data.tar.gz: 6d31d318b0a910c61a61ef1eccf4ca0086aaa67f6d8ed085096cd18b1f1a483fa0dcf9e9386d7260ec5dd94b27e1af55ffaa816a22c345ec99d7cb4c6598ef9c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### v0.14.7 / 2023-07-19
|
4
|
+
|
5
|
+
* FIXED: Fixed an exception when passing a non-string to puts in the terminal mixin
|
6
|
+
|
7
|
+
### v0.14.6 / 2023-06-29
|
8
|
+
|
9
|
+
* FIXED: Fixed a GitCache exception when loading a repository containing a broken symlink
|
10
|
+
|
3
11
|
### v0.14.5 / 2023-03-20
|
4
12
|
|
5
13
|
* FIXED: Rescue broken pipe errors by default when running a pager
|
data/lib/toys/core.rb
CHANGED
@@ -8,16 +8,16 @@ module Toys
|
|
8
8
|
# This mixin provides an instance of {Toys::Utils::GitCache}, providing
|
9
9
|
# cached access to files from a remote git repo.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# @example
|
12
12
|
#
|
13
|
-
#
|
13
|
+
# include :git_cache
|
14
14
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
15
|
+
# def run
|
16
|
+
# # Pull and cache the HEAD commit from the Toys repo.
|
17
|
+
# dir = git_cache.get("https://github.com/dazuma/toys.git")
|
18
|
+
# # Display the contents of the readme file.
|
19
|
+
# puts File.read(File.join(dir, "README.md"))
|
20
|
+
# end
|
21
21
|
#
|
22
22
|
module GitCache
|
23
23
|
include Mixin
|
data/lib/toys/utils/git_cache.rb
CHANGED
@@ -402,7 +402,7 @@ module Toys
|
|
402
402
|
Array(remotes).map do |remote|
|
403
403
|
dir = repo_base_dir_for(remote)
|
404
404
|
if ::File.directory?(dir)
|
405
|
-
::FileUtils.chmod_R("u+w", dir)
|
405
|
+
::FileUtils.chmod_R("u+w", dir, force: true)
|
406
406
|
::FileUtils.rm_rf(dir)
|
407
407
|
remote
|
408
408
|
end
|
@@ -568,9 +568,9 @@ module Toys
|
|
568
568
|
source_path = ::File.join(dir, sha)
|
569
569
|
unless repo_lock.source_exists?(sha, path)
|
570
570
|
::FileUtils.mkdir_p(source_path)
|
571
|
-
::FileUtils.chmod_R("u+w", source_path)
|
571
|
+
::FileUtils.chmod_R("u+w", source_path, force: true)
|
572
572
|
copy_from_repo(repo_path, source_path, sha, path)
|
573
|
-
::FileUtils.chmod_R("a-w", source_path)
|
573
|
+
::FileUtils.chmod_R("a-w", source_path, force: true)
|
574
574
|
end
|
575
575
|
repo_lock.access_source!(sha, path)
|
576
576
|
path == "." ? source_path : ::File.join(source_path, path)
|
@@ -579,7 +579,7 @@ module Toys
|
|
579
579
|
def copy_files(dir, sha, path, repo_lock, into)
|
580
580
|
repo_path = ::File.join(dir, REPO_DIR_NAME)
|
581
581
|
::FileUtils.mkdir_p(into)
|
582
|
-
::FileUtils.chmod_R("u+w", into)
|
582
|
+
::FileUtils.chmod_R("u+w", into, force: true)
|
583
583
|
Compat.dir_children(into).each { |child| ::FileUtils.rm_rf(::File.join(into, child)) }
|
584
584
|
result = copy_from_repo(repo_path, into, sha, path)
|
585
585
|
repo_lock.access_repo!
|
@@ -594,7 +594,7 @@ module Toys
|
|
594
594
|
to_path = ::File.join(into, entry)
|
595
595
|
unless ::File.exist?(to_path)
|
596
596
|
from_path = ::File.join(repo_dir, entry)
|
597
|
-
::FileUtils.
|
597
|
+
::FileUtils.copy_entry(from_path, to_path)
|
598
598
|
end
|
599
599
|
end
|
600
600
|
into
|
@@ -603,7 +603,7 @@ module Toys
|
|
603
603
|
unless ::File.exist?(to_path)
|
604
604
|
from_path = ::File.join(repo_dir, path)
|
605
605
|
::FileUtils.mkdir_p(::File.dirname(to_path))
|
606
|
-
::FileUtils.
|
606
|
+
::FileUtils.copy_entry(from_path, to_path)
|
607
607
|
end
|
608
608
|
to_path
|
609
609
|
end
|
data/lib/toys/utils/terminal.rb
CHANGED
@@ -104,7 +104,7 @@ module Toys
|
|
104
104
|
# @return [String] String with styles removed
|
105
105
|
#
|
106
106
|
def self.remove_style_escapes(str)
|
107
|
-
str.gsub(/\e\[\d+(;\d+)*m/, "")
|
107
|
+
str.to_s.gsub(/\e\[\d+(;\d+)*m/, "")
|
108
108
|
end
|
109
109
|
|
110
110
|
##
|
@@ -158,7 +158,7 @@ module Toys
|
|
158
158
|
def write(str = "", *styles)
|
159
159
|
@output_mutex.synchronize do
|
160
160
|
begin
|
161
|
-
output&.write(apply_styles(str, *styles))
|
161
|
+
output&.write(apply_styles(str.to_s, *styles))
|
162
162
|
output&.flush
|
163
163
|
rescue ::IOError
|
164
164
|
nil
|
@@ -200,7 +200,7 @@ module Toys
|
|
200
200
|
# @return [self]
|
201
201
|
#
|
202
202
|
def puts(str = "", *styles)
|
203
|
-
str = "#{str}\n" unless str.end_with?("\n")
|
203
|
+
str = "#{str}\n" unless str.to_s.end_with?("\n")
|
204
204
|
write(str, *styles)
|
205
205
|
end
|
206
206
|
alias say puts
|
@@ -240,7 +240,7 @@ module Toys
|
|
240
240
|
trailing_text = default.nil? ? nil : "[#{default}]"
|
241
241
|
end
|
242
242
|
if trailing_text
|
243
|
-
ptext, pspaces, = prompt.partition(/\s+$/)
|
243
|
+
ptext, pspaces, = prompt.to_s.partition(/\s+$/)
|
244
244
|
prompt = "#{ptext} #{trailing_text}#{pspaces}"
|
245
245
|
end
|
246
246
|
write(prompt, *styles)
|
@@ -307,13 +307,13 @@ module Toys
|
|
307
307
|
return nil unless block_given?
|
308
308
|
frame_length ||= DEFAULT_SPINNER_FRAME_LENGTH
|
309
309
|
frames ||= DEFAULT_SPINNER_FRAMES
|
310
|
-
write(leading_text) unless leading_text.empty?
|
310
|
+
write(leading_text) unless leading_text.to_s.empty?
|
311
311
|
spin = SpinDriver.new(self, frames, Array(style), frame_length)
|
312
312
|
begin
|
313
313
|
yield
|
314
314
|
ensure
|
315
315
|
spin.stop
|
316
|
-
write(final_text) unless final_text.empty?
|
316
|
+
write(final_text) unless final_text.to_s.empty?
|
317
317
|
end
|
318
318
|
end
|
319
319
|
|
@@ -377,7 +377,7 @@ module Toys
|
|
377
377
|
def apply_styles(str, *styles)
|
378
378
|
if styled
|
379
379
|
prefix = escape_styles(*styles)
|
380
|
-
suffix = prefix.empty? || str.end_with?(CLEAR_CODE) ? "" : CLEAR_CODE
|
380
|
+
suffix = prefix.empty? || str.to_s.end_with?(CLEAR_CODE) ? "" : CLEAR_CODE
|
381
381
|
"#{prefix}#{str}#{suffix}"
|
382
382
|
else
|
383
383
|
Terminal.remove_style_escapes(str)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toys-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Toys-Core is the command line tool framework underlying Toys. It can
|
14
14
|
be used to create command line executables using the Toys DSL and classes.
|
@@ -78,10 +78,10 @@ homepage: https://github.com/dazuma/toys
|
|
78
78
|
licenses:
|
79
79
|
- MIT
|
80
80
|
metadata:
|
81
|
-
changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.14.
|
81
|
+
changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.14.7/file.CHANGELOG.html
|
82
82
|
source_code_uri: https://github.com/dazuma/toys/tree/main/toys-core
|
83
83
|
bug_tracker_uri: https://github.com/dazuma/toys/issues
|
84
|
-
documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.14.
|
84
|
+
documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.14.7
|
85
85
|
post_install_message:
|
86
86
|
rdoc_options: []
|
87
87
|
require_paths:
|