utils 0.37.1 → 0.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/classify +0 -1
- data/bin/path +7 -0
- data/bin/sync_dir +16 -6
- data/lib/utils/config_file.rb +15 -0
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +14 -28
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d21eabda212cd2d178133548246be1b3fd52bc4992cbf0d535d2fcaf298389d
|
4
|
+
data.tar.gz: b0e578017838d061c23efb929a90fca47da7b7fb5428871e70f4499e222e891c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d044488cd56c34cc1904bab8de980e4fee5640145cb77f0490c976b6f600356447b7060b50bfc548231cfda9f8f1b8ada84410b8253ce959646b03ee58f689
|
7
|
+
data.tar.gz: daeb1eb2af3e77908ebd84889353cbfc9a85d9b3e8d0d31773d53a5edd2383e228a4059770f1cb9cc982aa1708e828d335ef4e0de6814c85d8863abedce90d8f
|
data/bin/classify
CHANGED
data/bin/path
CHANGED
@@ -21,6 +21,13 @@ when 'prefix', 'postfix'
|
|
21
21
|
else
|
22
22
|
path.push part
|
23
23
|
end
|
24
|
+
when 'list'
|
25
|
+
if path_argument = ARGV.first
|
26
|
+
path = path_argument.split(path_separator)
|
27
|
+
path.map! { |part| File.expand_path(part) }
|
28
|
+
end
|
29
|
+
puts path
|
30
|
+
exit
|
24
31
|
when 'edit'
|
25
32
|
if path_argument = ARGV.first
|
26
33
|
path = path_argument.split(path_separator)
|
data/bin/sync_dir
CHANGED
@@ -4,6 +4,12 @@ require 'pathname'
|
|
4
4
|
require 'tins/xt'
|
5
5
|
require 'fileutils'
|
6
6
|
include FileUtils::Verbose
|
7
|
+
require 'utils'
|
8
|
+
require 'term/ansicolor'
|
9
|
+
include Term::ANSIColor
|
10
|
+
|
11
|
+
$config = Utils::ConfigFile.new
|
12
|
+
$config.configure_from_paths
|
7
13
|
|
8
14
|
def local_path(path)
|
9
15
|
Pathname.new(path).expand_path.relative_path_from(
|
@@ -30,12 +36,14 @@ puts diff_dir
|
|
30
36
|
diff_dir.each_line do |line|
|
31
37
|
case line
|
32
38
|
when /^Only in (.*?): (.*?)$/
|
33
|
-
|
34
|
-
|
39
|
+
s, d = $~.captures
|
40
|
+
sd = local_path(s)
|
41
|
+
s = local_path(File.join(sd, d))
|
42
|
+
$config.sync_dir.skip?(s) and next
|
35
43
|
dd = [ $src, $dst ].find { _1 != sd }
|
36
|
-
d = local_path(File.join(dd,
|
44
|
+
d = local_path(File.join(dd, d))
|
37
45
|
if File.file?(s) and File.ascii?(s)
|
38
|
-
puts File.read(s)
|
46
|
+
puts color(214, File.read(s))
|
39
47
|
end
|
40
48
|
puts " Only found in #{s.inspect} ".center(Tins::Terminal.cols, ?*)
|
41
49
|
puts <<~end
|
@@ -54,8 +62,10 @@ diff_dir.each_line do |line|
|
|
54
62
|
rm s
|
55
63
|
end
|
56
64
|
when /^Files (.*?) and (.*?) differ$/
|
57
|
-
s =
|
58
|
-
|
65
|
+
s, d = $~.captures
|
66
|
+
s = local_path(s)
|
67
|
+
$config.sync_dir.skip?(s) and next
|
68
|
+
d = local_path(d)
|
59
69
|
puts `diff --color=always -u #{s.inspect} #{d.inspect}`
|
60
70
|
puts " Difference found #{s.inspect} #{d.inspect} ".center(Tins::Terminal.cols, ?*)
|
61
71
|
puts <<~end
|
data/lib/utils/config_file.rb
CHANGED
@@ -278,6 +278,21 @@ class Utils::ConfigFile
|
|
278
278
|
@classify ||= Classify.new
|
279
279
|
end
|
280
280
|
|
281
|
+
class SyncDir < BlockConfig
|
282
|
+
config :skip_path, %r((\A|/)\.\w)
|
283
|
+
|
284
|
+
def skip?(path)
|
285
|
+
path =~ skip_path
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def sync_dir(&block)
|
290
|
+
if block
|
291
|
+
@sync_dir = SyncDir.new(&block)
|
292
|
+
end
|
293
|
+
@sync_dir ||= SyncDir.new
|
294
|
+
end
|
295
|
+
|
281
296
|
def to_ruby
|
282
297
|
result = "# vim: set ft=ruby:\n"
|
283
298
|
for bc in %w[search discover strip_spaces probe ssh_tunnel edit classify]
|
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: utils 0.
|
2
|
+
# stub: utils 0.39.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.39.0".freeze
|
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-11-22"
|
12
12
|
s.description = "This ruby gem provides some useful command line utilities".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
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]
|
@@ -17,32 +17,18 @@ Gem::Specification.new do |s|
|
|
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]
|
20
|
-
s.rubygems_version = "3.
|
20
|
+
s.rubygems_version = "3.4.22".freeze
|
21
21
|
s.summary = "Some useful command line utilities".freeze
|
22
22
|
|
23
|
-
|
24
|
-
s.specification_version = 4
|
25
|
-
end
|
23
|
+
s.specification_version = 4
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
s.add_runtime_dependency(%q<all_images>.freeze, [">= 0.0.2"])
|
37
|
-
else
|
38
|
-
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0"])
|
39
|
-
s.add_dependency(%q<debug>.freeze, [">= 0"])
|
40
|
-
s.add_dependency(%q<tins>.freeze, ["~> 1.14"])
|
41
|
-
s.add_dependency(%q<term-ansicolor>.freeze, ["~> 1.3"])
|
42
|
-
s.add_dependency(%q<pstree>.freeze, ["~> 0.3"])
|
43
|
-
s.add_dependency(%q<infobar>.freeze, [">= 0"])
|
44
|
-
s.add_dependency(%q<mize>.freeze, [">= 0"])
|
45
|
-
s.add_dependency(%q<search_ui>.freeze, [">= 0"])
|
46
|
-
s.add_dependency(%q<all_images>.freeze, [">= 0.0.2"])
|
47
|
-
end
|
25
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0".freeze])
|
26
|
+
s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
|
27
|
+
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.14".freeze])
|
28
|
+
s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.3".freeze])
|
29
|
+
s.add_runtime_dependency(%q<pstree>.freeze, ["~> 0.3".freeze])
|
30
|
+
s.add_runtime_dependency(%q<infobar>.freeze, [">= 0".freeze])
|
31
|
+
s.add_runtime_dependency(%q<mize>.freeze, [">= 0".freeze])
|
32
|
+
s.add_runtime_dependency(%q<search_ui>.freeze, [">= 0".freeze])
|
33
|
+
s.add_runtime_dependency(%q<all_images>.freeze, [">= 0.0.2".freeze])
|
48
34
|
end
|
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.39.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-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
267
|
- !ruby/object:Gem::Version
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
|
-
rubygems_version: 3.
|
270
|
+
rubygems_version: 3.4.22
|
271
271
|
signing_key:
|
272
272
|
specification_version: 4
|
273
273
|
summary: Some useful command line utilities
|