utils 0.36.0 → 0.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sync_dir +70 -0
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +5 -5
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97cf67a6009309a0e7568242eb255b1bc6a1749cfe03354429e800f5990a8570
|
4
|
+
data.tar.gz: '0538cf67ec12e9a1c1f33b829189d5af47ee1ad674396dd1518af711706fbe35'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e13d5840671a18702e4994f8c5743555b1eb7de5de86aa7e4c152ef6594c5b29ef9b8e02542d4a1687e4e570b56f44e12f93d88cba1ba6d2e84a49ad3265f874
|
7
|
+
data.tar.gz: 3af919524b67c462f6bc730681c8c1b5e06e97e066cd1422055054716e6fd5a020d7f49c4836c150a552d2017b7bea3ca3ff24ab6c41eaacb9408907dfd1cc84
|
data/bin/sync_dir
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
require 'tins/xt'
|
5
|
+
require 'fileutils'
|
6
|
+
include FileUtils::Verbose
|
7
|
+
|
8
|
+
def local_path(path)
|
9
|
+
Pathname.new(path).expand_path.relative_path_from(
|
10
|
+
Pathname.new(?.).expand_path
|
11
|
+
).to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
def diff_dir
|
15
|
+
`diff -rq #{$src.inspect} #{$dst.inspect}`
|
16
|
+
end
|
17
|
+
|
18
|
+
def ask?(prompt:)
|
19
|
+
print prompt
|
20
|
+
answer = gets.chomp
|
21
|
+
end
|
22
|
+
|
23
|
+
$src = ARGV.shift or fail "need source directory as first argument"
|
24
|
+
$src = local_path $src
|
25
|
+
$dst = ARGV.shift || ?.
|
26
|
+
$dst = local_path $dst
|
27
|
+
|
28
|
+
puts diff_dir
|
29
|
+
|
30
|
+
diff_dir.each_line do |line|
|
31
|
+
case line
|
32
|
+
when /^Only in (.*?): (.*?)$/
|
33
|
+
sd = local_path($1)
|
34
|
+
s = local_path(File.join(sd, $2))
|
35
|
+
dd = [ $src, $dst ].find { _1 != sd }
|
36
|
+
d = local_path(File.join(dd, $2))
|
37
|
+
if File.file?(s) and File.ascii?(s)
|
38
|
+
puts File.read(s)
|
39
|
+
end
|
40
|
+
puts " Only found in #{s.inspect} ".center(Tins::Terminal.cols, ?*)
|
41
|
+
puts <<~end
|
42
|
+
(C)opy #{s.inspect} to #{d.inspect}
|
43
|
+
(E)dit #{s.inspect}
|
44
|
+
(D)elete #{s.inspect}
|
45
|
+
(S)kip
|
46
|
+
end
|
47
|
+
case ask?(prompt: 'action? ')
|
48
|
+
when /\Ac/i
|
49
|
+
cp s, d
|
50
|
+
when /\Ae/i
|
51
|
+
system "vim #{s.inspect}"
|
52
|
+
redo
|
53
|
+
when /\Ad/i
|
54
|
+
rm s
|
55
|
+
end
|
56
|
+
when /^Files (.*?) and (.*?) differ$/
|
57
|
+
s = local_path($1)
|
58
|
+
d = local_path($2)
|
59
|
+
puts `diff --color=always -u #{s.inspect} #{d.inspect}`
|
60
|
+
puts " Difference found #{s.inspect} #{d.inspect} ".center(Tins::Terminal.cols, ?*)
|
61
|
+
puts <<~end
|
62
|
+
(V)imdiff
|
63
|
+
(S)kip
|
64
|
+
end
|
65
|
+
ask?(prompt: 'action? ') =~ /\Av/i or next
|
66
|
+
system "vimdiff #{s.inspect} #{d.inspect}"
|
67
|
+
end
|
68
|
+
rescue Interrupt
|
69
|
+
exit
|
70
|
+
end
|
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: utils 0.
|
2
|
+
# stub: utils 0.37.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "utils".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.37.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "2023-
|
11
|
+
s.date = "2023-08-11"
|
12
12
|
s.description = "This ruby gem provides some useful command line utilities".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
|
-
s.executables = ["ascii7".freeze, "blameline".freeze, "check-yaml".freeze, "classify".freeze, "create_cstags".freeze, "create_tags".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "fix-brew".freeze, "git-empty".freeze, "git-versions".freeze, "irb_connect".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "number_files".freeze, "on_change".freeze, "path".freeze, "probe".freeze, "rd2md".freeze, "search".freeze, "sedit".freeze, "serve".freeze, "ssh-tunnel".freeze, "strip_spaces".freeze, "untest".freeze, "utils-utilsrc".freeze, "vcf2alias".freeze]
|
14
|
+
s.executables = ["ascii7".freeze, "blameline".freeze, "check-yaml".freeze, "classify".freeze, "create_cstags".freeze, "create_tags".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "fix-brew".freeze, "git-empty".freeze, "git-versions".freeze, "irb_connect".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "number_files".freeze, "on_change".freeze, "path".freeze, "probe".freeze, "rd2md".freeze, "search".freeze, "sedit".freeze, "serve".freeze, "ssh-tunnel".freeze, "strip_spaces".freeze, "sync_dir".freeze, "untest".freeze, "utils-utilsrc".freeze, "vcf2alias".freeze]
|
15
15
|
s.extra_rdoc_files = ["README.md".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
|
16
|
-
s.files = [".github/dependabot.yml".freeze, ".github/workflows/codeql-analysis.yml".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/check-yaml".freeze, "bin/classify".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/fix-brew".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_connect".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/probe".freeze, "bin/rd2md".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "utils.gemspec".freeze]
|
16
|
+
s.files = [".github/dependabot.yml".freeze, ".github/workflows/codeql-analysis.yml".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/check-yaml".freeze, "bin/classify".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/fix-brew".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_connect".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/probe".freeze, "bin/rd2md".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/sync_dir".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "utils.gemspec".freeze]
|
17
17
|
s.homepage = "http://github.com/flori/utils".freeze
|
18
18
|
s.licenses = ["GPL-2.0".freeze]
|
19
19
|
s.rdoc_options = ["--title".freeze, "Utils - Some useful command line utilities".freeze, "--main".freeze, "README.md".freeze]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.37.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -166,6 +166,7 @@ executables:
|
|
166
166
|
- serve
|
167
167
|
- ssh-tunnel
|
168
168
|
- strip_spaces
|
169
|
+
- sync_dir
|
169
170
|
- untest
|
170
171
|
- utils-utilsrc
|
171
172
|
- vcf2alias
|
@@ -222,6 +223,7 @@ files:
|
|
222
223
|
- bin/serve
|
223
224
|
- bin/ssh-tunnel
|
224
225
|
- bin/strip_spaces
|
226
|
+
- bin/sync_dir
|
225
227
|
- bin/untest
|
226
228
|
- bin/utils-utilsrc
|
227
229
|
- bin/vcf2alias
|