ykxutils 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/lib/ykxutils/version.rb +1 -1
- data/lib/ykxutils.rb +0 -2
- data/ykxutils.gemspec +2 -2
- metadata +35 -13
- data/lib/ykxutils/fileop.rb +0 -51
- data/lib/ykxutils/htmlparsex.rb +0 -30
- data/test_data/a.txt +0 -0
- data/test_data/fileop/in.html +0 -1
- data/test_data/fileop/out.html +0 -1
- data/test_data/fileop/out_0.html +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 167c4be663f6870f3b32073e6cf4d31d697d112054653915c5a29f2ce202fd1f
|
4
|
+
data.tar.gz: 12214c5815e3bc0c6fdf4c89f4b211097e4bd270fb6dd9fabca1ed65ed1d7fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e6b44e3fce399d7901b1ab2383449a58126a63bc5b1b3c6fea0c166cb4ad4eb41398ba40ae442ee05677b3525df579b44e3fb765e0d671eb9eb8de9233338d1
|
7
|
+
data.tar.gz: d98737567d4c85da02084275c5db7a0570792f968b6ab27ffa5e4cb9e0de8a60bdd68cd26f7a06a29d2d44458dbd98cb94cb2fcd3f98ef31a8346e40922a92f4
|
data/Gemfile.lock
CHANGED
data/lib/ykxutils/version.rb
CHANGED
data/lib/ykxutils.rb
CHANGED
@@ -8,8 +8,6 @@ require_relative "ykxutils/gitcmd"
|
|
8
8
|
require_relative "ykxutils/nginxconfig"
|
9
9
|
require_relative "ykxutils/nginxconfigfiles"
|
10
10
|
require_relative "ykxutils/gridlist"
|
11
|
-
require_relative "ykxutils/fileop"
|
12
|
-
require_relative "ykxutils/htmlparsex"
|
13
11
|
|
14
12
|
module Ykxutils
|
15
13
|
class Error < StandardError; end
|
data/ykxutils.gemspec
CHANGED
@@ -33,9 +33,9 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
# spec.add_runtime_dependency "bundler"
|
35
35
|
# spec.add_runtime_dependency 'debug'
|
36
|
-
|
36
|
+
spec.add_runtime_dependency "erubi"
|
37
37
|
# spec.add_runtime_dependency "rake", "~> 13.0"
|
38
|
-
|
38
|
+
spec.add_runtime_dependency "tilt"
|
39
39
|
|
40
40
|
# spec.add_development_dependency "rspec", "~> 3.0"
|
41
41
|
# spec.add_development_dependency "rubocop"
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ykxutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ykominami
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: erubi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tilt
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description: New version of utilty function created by yk.
|
14
42
|
email:
|
15
43
|
- ykominami@gmail.com
|
@@ -31,20 +59,14 @@ files:
|
|
31
59
|
- a.northern-cross.net.conf
|
32
60
|
- lib/ykxutils.rb
|
33
61
|
- lib/ykxutils/erubyx.rb
|
34
|
-
- lib/ykxutils/fileop.rb
|
35
62
|
- lib/ykxutils/gitcmd.rb
|
36
63
|
- lib/ykxutils/gridlist.rb
|
37
|
-
- lib/ykxutils/htmlparsex.rb
|
38
64
|
- lib/ykxutils/nginxconfig.rb
|
39
65
|
- lib/ykxutils/nginxconfigfiles.rb
|
40
66
|
- lib/ykxutils/pstorex.rb
|
41
67
|
- lib/ykxutils/version.rb
|
42
68
|
- lib/ykxutils/yamlx.rb
|
43
69
|
- test_data/4servers.erb
|
44
|
-
- test_data/a.txt
|
45
|
-
- test_data/fileop/in.html
|
46
|
-
- test_data/fileop/out.html
|
47
|
-
- test_data/fileop/out_0.html
|
48
70
|
- test_data/test.yaml
|
49
71
|
- test_data/v103-3-189-127/4servers.erb
|
50
72
|
- test_data/v103-3-189-127/a.northern-cross.net/base.yml
|
@@ -80,7 +102,7 @@ metadata:
|
|
80
102
|
homepage_uri: https://ykominami.github.io/ykxutils
|
81
103
|
source_code_uri: https://github.com/ykominami/ykxutils
|
82
104
|
rubygems_mfa_required: 'true'
|
83
|
-
post_install_message:
|
105
|
+
post_install_message:
|
84
106
|
rdoc_options: []
|
85
107
|
require_paths:
|
86
108
|
- lib
|
@@ -95,8 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
117
|
- !ruby/object:Gem::Version
|
96
118
|
version: '0'
|
97
119
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
99
|
-
signing_key:
|
120
|
+
rubygems_version: 3.5.11
|
121
|
+
signing_key:
|
100
122
|
specification_version: 4
|
101
123
|
summary: New version of utilty function created by yk.
|
102
124
|
test_files: []
|
data/lib/ykxutils/fileop.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
require "pathname"
|
3
|
-
|
4
|
-
module Ykxutils
|
5
|
-
module_function
|
6
|
-
|
7
|
-
def make_output_filename(prefix, basename, postfix, extname, extname_pn)
|
8
|
-
if extname == nil
|
9
|
-
if extname_pn.size <= 1
|
10
|
-
extname = ""
|
11
|
-
else
|
12
|
-
extname = extname_pn.to_s
|
13
|
-
end
|
14
|
-
end
|
15
|
-
"#{prefix}#{basename}#{postfix}#{extname}"
|
16
|
-
end
|
17
|
-
|
18
|
-
def make_output_file_pn(out_dir, ofname, input_pn)
|
19
|
-
case out_dir
|
20
|
-
when nil
|
21
|
-
Pathname.new(ofname)
|
22
|
-
when :SAME
|
23
|
-
parent = input_pn.parent
|
24
|
-
parent + ofname
|
25
|
-
else
|
26
|
-
out_dir_pn = Pathname.new(out_dir)
|
27
|
-
out_dir_pn + ofname
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def make_output_path( input_path:, out_dir: nil, prefix: "", postfix: "", extname: nil)
|
32
|
-
input_pn = Pathname.new(input_path)
|
33
|
-
basename = input_pn.basename(".*")
|
34
|
-
extname_pn = input_pn.extname
|
35
|
-
ofname = make_output_filename(prefix, basename, postfix, extname, extname_pn)
|
36
|
-
output_pn = make_output_file_pn(out_dir, ofname, input_pn)
|
37
|
-
if input_pn.expand_path('/') === output_pn.expand_path('/')
|
38
|
-
nil
|
39
|
-
else
|
40
|
-
output_pn.to_s
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def file_convert(infile, outfile, &block)
|
45
|
-
if block
|
46
|
-
block.call(infile, outfile)
|
47
|
-
else
|
48
|
-
false
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/ykxutils/htmlparsex.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
|
3
|
-
module Ykxutils
|
4
|
-
module_function
|
5
|
-
|
6
|
-
def complemente_dt_tag(line)
|
7
|
-
if line =~ /<DT>/
|
8
|
-
# p "complemente_dt_tag T"
|
9
|
-
line + "</DT>"
|
10
|
-
elsif line =~ /<dt>/
|
11
|
-
line + "</dt>"
|
12
|
-
else
|
13
|
-
# p "complemente_dt_tag F"
|
14
|
-
line
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def reform_dt_tag(infilename, outfilename)
|
19
|
-
infile = File.open(infilename)
|
20
|
-
outfile = File.open(outfilename, 'w')
|
21
|
-
|
22
|
-
Ykxutils::file_convert(infile, outfile){ |infile, outfile|
|
23
|
-
while line = infile.gets
|
24
|
-
line.chomp!
|
25
|
-
oline = Ykxutils.complemente_dt_tag(line)
|
26
|
-
outfile.write( oline + "\n" )
|
27
|
-
end
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|
data/test_data/a.txt
DELETED
File without changes
|
data/test_data/fileop/in.html
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<dt>abc
|
data/test_data/fileop/out.html
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<dt>abc</dt>
|
data/test_data/fileop/out_0.html
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<dt>abc</dt>
|