utils 0.27.0 → 0.30.0

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: e0a695d4074ac4053773c97491cc160ee37439ab05fef58e3905f83ba5629b85
4
- data.tar.gz: 1efe92716015195fa04402b046dc13eb9a22460f94400b284a4735ca659941a0
3
+ metadata.gz: 2575be12b2687c0a44ff009c5a67dd1471bf2765f73fc3c16277e0b88c902169
4
+ data.tar.gz: 07ed52d1ec8ad9e22fe50e2ba47f5ccd52584604279f4bc2ff246dc2971843dd
5
5
  SHA512:
6
- metadata.gz: c3c354e67b143c6a237258c5feb4f8bbe04c6a295dcdc03bda36f144814e862d6a1c1e966f89fd976519b036866b5fd2fc84139f8b58ee6868c169a26f56ba93
7
- data.tar.gz: 911fdec36192ffb28405b913ff2f1625dd92bd4daf4c957dd330efdc3aab18ccdad8fbf65ce565be881d5cf8ff6eaad8bdc4646133698d8d913843983a10234b
6
+ metadata.gz: ef17b8234600c00003aa8ab3fc892041f2cabd9efc53c8aa859955e791984353d6a4f736f67f5adeeb3db3ef71efd4706a0b1d2b3c5b7f8cc8c72113ace3ef55
7
+ data.tar.gz: 4c7680b9daad7cc6b04c6b9396b1ddb5f6cca9cf334faaa023b6e814ae6f3abcba9b0f4f15b58c8d2f72905c371013612002b443ae218646313273d336b1586a
data/Rakefile CHANGED
@@ -24,6 +24,7 @@ GemHadar do
24
24
  dependency 'infobar'
25
25
  dependency 'mize'
26
26
  dependency 'search_ui'
27
+ dependency 'all_images'
27
28
 
28
29
  install_library do
29
30
  libdir = CONFIG["sitelibdir"]
data/bin/check-yaml ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yaml'
4
+
5
+ format = -> s {
6
+ if /^\((?<f>[^)]+)\):\ (?<m>.*?) at line (?<l>\d+) column (?<c>\d+)/ =~ s
7
+ [ f, l, c, m ] * ?:
8
+ else
9
+ s
10
+ end
11
+ }
12
+
13
+ if filename = ARGV.first
14
+ begin
15
+ yaml = YAML.load_file(filename).to_yaml
16
+ ENV['DEBUG'].to_i == 1 and puts yaml
17
+ puts 'ok'
18
+ rescue => e
19
+ STDERR.puts format.(e.message)
20
+ puts 'nak'
21
+ exit 1
22
+ end
23
+ else
24
+ string = STDIN.read
25
+ begin
26
+ yaml = YAML.load(string).to_yaml
27
+ ENV['DEBUG'].to_i == 1 and puts yaml
28
+ puts 'ok'
29
+ rescue => e
30
+ STDERR.puts format.(e.message)
31
+ puts 'nak'
32
+ exit 1
33
+ end
34
+ end
data/bin/search CHANGED
@@ -116,6 +116,7 @@ Options are
116
116
  -B NUMBER displays NUMBER lines of context before the match
117
117
  -C NUMBER displays NUMBER lines of context around the match
118
118
  -f just list the paths of the files that would be searched
119
+ -F just consider real files when searching
119
120
  -l just list the paths of the files with matches
120
121
  -L list only the path:linenumber of the files with matches
121
122
  -pX interpret PATTERN argument as X=f fuzzy or X=r for regexp
@@ -136,7 +137,7 @@ Version is #{File.basename($0)} #{Utils::VERSION}.
136
137
  exit 1
137
138
  end
138
139
 
139
- args = go 'r:p:I:A:B:C:s:S:n:N:a:i:cflLeEvbgh'
140
+ args = go 'r:p:I:A:B:C:s:S:n:N:a:i:cfFlLeEvbgh'
140
141
  args[?h] and usage
141
142
  pattern = ARGV.shift or usage
142
143
  roots = (ARGV.empty? ? [ Dir.pwd ] : ARGV).map { |f| File.expand_path(f) }
data/lib/utils/grepper.rb CHANGED
@@ -156,11 +156,12 @@ class Utils::Grepper
156
156
  def search
157
157
  suffixes = Array(@args[?I])
158
158
  visit = -> filename {
159
- s = filename.stat
159
+ s = filename.lstat
160
160
  bn = filename.pathname.basename
161
161
  if !s ||
162
162
  s.directory? && @config.search.prune?(bn) ||
163
- s.file? && @config.search.skip?(bn)
163
+ (s.file? || s.symlink?) && @config.search.skip?(bn) ||
164
+ @args[?F] && s.symlink?
164
165
  then
165
166
  @args[?v] and warn "Pruning #{filename.inspect}."
166
167
  prune
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.27.0'
3
+ VERSION = '0.30.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/utils.gemspec CHANGED
@@ -1,23 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.27.0 ruby lib
2
+ # stub: utils 0.30.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils".freeze
6
- s.version = "0.27.0"
6
+ s.version = "0.30.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 = "2022-05-14"
11
+ s.date = "2022-06-16"
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 = ["all_images".freeze, "ascii7".freeze, "blameline".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, "ssl_cert_info".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, "ssl_cert_info".freeze, "strip_spaces".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/workflows/codeql-analysis.yml".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/all_images".freeze, "bin/ascii7".freeze, "bin/blameline".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/ssl_cert_info".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/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/ssl_cert_info".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]
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.3.13".freeze
20
+ s.rubygems_version = "3.3.14".freeze
21
21
  s.summary = "Some useful command line utilities".freeze
22
22
 
23
23
  if s.respond_to? :specification_version then
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_runtime_dependency(%q<infobar>.freeze, [">= 0"])
33
33
  s.add_runtime_dependency(%q<mize>.freeze, [">= 0"])
34
34
  s.add_runtime_dependency(%q<search_ui>.freeze, [">= 0"])
35
+ s.add_runtime_dependency(%q<all_images>.freeze, [">= 0"])
35
36
  else
36
37
  s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0"])
37
38
  s.add_dependency(%q<tins>.freeze, ["~> 1.14"])
@@ -40,5 +41,6 @@ Gem::Specification.new do |s|
40
41
  s.add_dependency(%q<infobar>.freeze, [">= 0"])
41
42
  s.add_dependency(%q<mize>.freeze, [">= 0"])
42
43
  s.add_dependency(%q<search_ui>.freeze, [">= 0"])
44
+ s.add_dependency(%q<all_images>.freeze, [">= 0"])
43
45
  end
44
46
  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.27.0
4
+ version: 0.30.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: 2022-05-14 00:00:00.000000000 Z
11
+ date: 2022-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -108,12 +108,26 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: all_images
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: This ruby gem provides some useful command line utilities
112
126
  email: flori@ping.de
113
127
  executables:
114
- - all_images
115
128
  - ascii7
116
129
  - blameline
130
+ - check-yaml
117
131
  - classify
118
132
  - create_cstags
119
133
  - create_tags
@@ -167,9 +181,9 @@ files:
167
181
  - Gemfile
168
182
  - README.md
169
183
  - Rakefile
170
- - bin/all_images
171
184
  - bin/ascii7
172
185
  - bin/blameline
186
+ - bin/check-yaml
173
187
  - bin/classify
174
188
  - bin/create_cstags
175
189
  - bin/create_tags
@@ -238,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
252
  - !ruby/object:Gem::Version
239
253
  version: '0'
240
254
  requirements: []
241
- rubygems_version: 3.3.13
255
+ rubygems_version: 3.3.14
242
256
  signing_key:
243
257
  specification_version: 4
244
258
  summary: Some useful command line utilities
data/bin/all_images DELETED
@@ -1,72 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Configure like so:
3
- #dockerfile: |-
4
- # RUN apk add --no-cache build-base git
5
- # RUN gem update --system
6
- # RUN gem install gem_hadar bundler
7
- #
8
- #script: &script |-
9
- # echo -e "\e[1m"
10
- # ruby -v
11
- # bundle
12
- # echo -e "\e[0m"
13
- # if rake test
14
- #
15
- #images:
16
- # ruby:3.0-alpine: *script
17
- # ruby:2.7-alpine: *script
18
- # ruby:2.6-alpine: *script
19
- # ruby:2.5-alpine: *script
20
- # ruby:2.4-alpine: *script
21
- # ruby:2.3-alpine: *script
22
-
23
- require 'yaml'
24
- require 'tmpdir'
25
- require 'fileutils'
26
- include FileUtils
27
-
28
- alias sh system
29
-
30
- def provide_image(image, dockerfile)
31
- prefix = $config.fetch('prefix', File.basename(Dir.pwd))
32
- tag = "#{prefix}/all_images/#{image}"
33
- sh "docker pull '#{image}'"
34
- build_dir = File.join(Dir.tmpdir, 'build')
35
- mkdir_p build_dir
36
- cd build_dir do
37
- File.open('Dockerfile', 'w') do |t|
38
- t.puts <<~end
39
- FROM #{image}
40
-
41
- WORKDIR /work
42
-
43
- #{dockerfile}
44
- end
45
- end
46
- sh "docker build --pull -t '#{tag}' ."
47
- end
48
- tag
49
- ensure
50
- rm_rf File.join(Dir.tmpdir, 'build')
51
- end
52
-
53
- def red(string)
54
- "\e[31m#{string}\e[0m"
55
- end
56
-
57
- def green(string)
58
- "\e[32m#{string}\e[0m"
59
- end
60
-
61
- $config = YAML.load_file(ARGV.shift || '.all_images.yml')
62
- dockerfile = $config['dockerfile'].to_s
63
- Array($config['images']).each do |image, script|
64
- tag = provide_image image, dockerfile
65
- if sh "docker run --name all_images -v `pwd`:/work '#{tag}' sh -c '#{script}'"
66
- puts green('SUCCESS')
67
- else
68
- puts red('FAILURE')
69
- end
70
- ensure
71
- sh 'docker rm -f all_images >/dev/null'
72
- end