hammer_cli 3.19.1 → 5.0.0
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/doc/release_notes.md +5 -0
- data/lib/hammer_cli/utils.rb +1 -3
- data/lib/hammer_cli/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/cs_CZ/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/de/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/en/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/es/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/fr/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/it/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ja/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ka/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ko/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/ru/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli.mo +0 -0
- data/man/hammer.1.gz +0 -0
- data/test/unit/utils_test.rb +0 -35
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27faa46ea907e19dfe6c29420a5d355909a84c59a817e4bcde0f197a17d5c368
|
|
4
|
+
data.tar.gz: 8f5982c563ce5b2b4d3028d882f85fb627d5d840246a9e35f172a3fbb1a2ff48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad512c4ee9d15c567efde990f5c904f084c577239a1eb4b74c2440ef6000bc87982f1df6fe423a554137114e60078224faa157768cb794e5a6901f0e41de491c
|
|
7
|
+
data.tar.gz: c92b48e9eecc4b3ece82e782720766535c48d671b194d12e8e46be6f03df89fb58a2d20a79ada4a7b1519f77938f9b3596cc88ca833ae1c7286a351d0896ecf0
|
data/doc/release_notes.md
CHANGED
data/lib/hammer_cli/utils.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'highline'
|
|
2
|
-
require 'shellwords'
|
|
3
2
|
require 'tempfile'
|
|
4
3
|
|
|
5
4
|
class String
|
|
@@ -92,8 +91,7 @@ module HammerCLI
|
|
|
92
91
|
Tempfile.open([content_type, suffix], tempdir) do |f|
|
|
93
92
|
f.write(content)
|
|
94
93
|
f.rewind
|
|
95
|
-
|
|
96
|
-
system(*editor, f.path)
|
|
94
|
+
system("#{ENV['EDITOR'] || 'vi'} #{f.path}")
|
|
97
95
|
result = f.read
|
|
98
96
|
end
|
|
99
97
|
result
|
data/lib/hammer_cli/version.rb
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/man/hammer.1.gz
CHANGED
|
Binary file
|
data/test/unit/utils_test.rb
CHANGED
|
@@ -195,39 +195,4 @@ describe HammerCLI do
|
|
|
195
195
|
assert_equal(arr, [:a, 1, 2, 3, :b, :c])
|
|
196
196
|
end
|
|
197
197
|
end
|
|
198
|
-
|
|
199
|
-
describe 'open_in_editor' do
|
|
200
|
-
it 'uses array-based system call to prevent shell injection' do
|
|
201
|
-
ENV.stubs(:[]).with('EDITOR').returns('vi')
|
|
202
|
-
HammerCLI.expects(:system).with('vi', anything).once.returns(true)
|
|
203
|
-
HammerCLI.open_in_editor('test content')
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
it 'splits EDITOR with arguments into array form' do
|
|
207
|
-
ENV.stubs(:[]).with('EDITOR').returns('code --wait')
|
|
208
|
-
HammerCLI.expects(:system).with('code', '--wait', anything).once.returns(true)
|
|
209
|
-
HammerCLI.open_in_editor('test content')
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
it 'falls back to vi when EDITOR is not set' do
|
|
213
|
-
ENV.stubs(:[]).with('EDITOR').returns(nil)
|
|
214
|
-
HammerCLI.expects(:system).with('vi', anything).once.returns(true)
|
|
215
|
-
HammerCLI.open_in_editor('test content')
|
|
216
|
-
end
|
|
217
|
-
|
|
218
|
-
it 'does not pass shell metacharacters to a shell interpreter' do
|
|
219
|
-
ENV.stubs(:[]).with('EDITOR').returns('vi; echo INJECTED')
|
|
220
|
-
# Shellwords.split treats the semicolon as a literal character,
|
|
221
|
-
# producing ["vi;", "echo", "INJECTED"] - no shell is invoked
|
|
222
|
-
HammerCLI.expects(:system).with('vi;', 'echo', 'INJECTED', anything).once.returns(true)
|
|
223
|
-
HammerCLI.open_in_editor('test content')
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
it 'returns original content when editor does not modify the file' do
|
|
227
|
-
ENV.stubs(:[]).with('EDITOR').returns('true')
|
|
228
|
-
HammerCLI.stubs(:system).returns(true)
|
|
229
|
-
result = HammerCLI.open_in_editor('original content')
|
|
230
|
-
assert_equal 'original content', result
|
|
231
|
-
end
|
|
232
|
-
end
|
|
233
198
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hammer_cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Bačovský
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-08-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: amazing_print
|