deblank 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 39b5293f35eba93c2a7b59401af1484d9959df73
4
- data.tar.gz: d9e64611e4839b69a0fe1cfc5fa238156dbddfac
2
+ SHA256:
3
+ metadata.gz: 64eb6816ecca78f248def7e3d9defa6627616337b86a9b67ffb6cd12ade098ab
4
+ data.tar.gz: 5ae0b56dcf338b04bbc34eb36f678008db547ae57d75f343dd28c24fa9c205f7
5
5
  SHA512:
6
- metadata.gz: 9c2f513577c3047515d67525590729e8f47d493592a6a5888e0b53b309cd7c04486df92bb7db510e9ac5222bba9709461e813329bf692a4af2abcc746712211a
7
- data.tar.gz: a02f35e87252e960c005b035bfe7a5949ad790b55d6cec21d12a5896dabc86009c44bc98b825c6433e39d3e0d3bb1462ca2ba52fd841a8418d3c4ca3ea0b4925
6
+ metadata.gz: 06ab50f7edbaa7f9b121913382aa3f9a4a7b4ef4f21ccae9fee7e0d9d4b8e28f8fe0de5e45b820054a7f4b937d73033084936e4b17b34e3f0cb29ac054383565
7
+ data.tar.gz: e10c7f3ab901c07daf07b70253136da314417fa6651350e618bc122ced915ab36e747c43c32fe7688f96c841481b5f16eaf739172e17c31639bf389a2bf3cf24
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "minitest"
6
+ gem "rake"
data/README.md CHANGED
@@ -51,7 +51,7 @@ Requirements
51
51
 
52
52
  - No additional Ruby gems are needed to run `deblank`.
53
53
 
54
- - `deblank` has been tested with Ruby 1.9.3 and Ruby 2.0.0
54
+ - `deblank` has been tested with Ruby 3.1 or higher
55
55
  on Linux and on Windows (command prompt with code page 850).
56
56
 
57
57
  Documentation
@@ -77,7 +77,7 @@ Report bugs on the `deblank` home page: <https://github.com/stomar/deblank/>
77
77
  License
78
78
  -------
79
79
 
80
- Copyright &copy; 2012-2013 Marcus Stollsteimer
80
+ Copyright &copy; 2012-2024 Marcus Stollsteimer
81
81
 
82
82
  `deblank` is free software: you can redistribute it and/or modify
83
83
  it under the terms of the GNU General Public License version 3 or later (GPLv3+),
data/Rakefile CHANGED
@@ -1,52 +1,49 @@
1
- # rakefile for the deblank script.
2
- #
3
- # Copyright (C) 2012-2013 Marcus Stollsteimer
1
+ # frozen_string_literal: true
4
2
 
5
- require 'rake/testtask'
3
+ require "rake/testtask"
6
4
 
7
- require './lib/deblank'
5
+ require "./lib/deblank"
8
6
 
9
7
  PROGNAME = Deblank::PROGNAME
10
8
  HOMEPAGE = Deblank::HOMEPAGE
11
9
  TAGLINE = Deblank::TAGLINE
12
10
 
13
- BINDIR = '/usr/local/bin'
14
- MANDIR = '/usr/local/man/man1'
11
+ BINDIR = "/usr/local/bin"
12
+ MANDIR = "/usr/local/man/man1"
15
13
 
16
- HELP2MAN = 'help2man'
17
- SED = 'sed'
14
+ HELP2MAN = "help2man"
15
+ SED = "sed"
18
16
 
19
- BINARY = 'lib/deblank.rb'
20
- BINARYNAME = 'deblank' # install using this name
21
- MANPAGE = 'man/deblank.1'
22
- H2MFILE = 'deblank.h2m'
17
+ BINARY = "lib/deblank.rb"
18
+ BINARYNAME = "deblank" # install using this name
19
+ MANPAGE = "man/deblank.1"
20
+ H2MFILE = "deblank.h2m"
23
21
 
24
22
 
25
23
  def gemspec_file
26
- 'deblank.gemspec'
24
+ "deblank.gemspec"
27
25
  end
28
26
 
29
27
 
30
- task :default => [:test]
28
+ task default: [:test]
31
29
 
32
30
  Rake::TestTask.new do |t|
33
- t.pattern = 'test/**/test_*.rb'
34
- t.ruby_opts << '-rubygems'
31
+ t.pattern = "test/**/test_*.rb"
35
32
  t.verbose = true
36
33
  t.warning = true
37
34
  end
38
35
 
39
36
 
40
- desc 'Install binary and man page'
41
- task :install => [BINARY, MANPAGE] do
37
+ desc "Install binary and man page"
38
+ task install: [BINARY, MANPAGE] do
42
39
  mkdir_p BINDIR
43
40
  install(BINARY, "#{BINDIR}/#{BINARYNAME}")
44
41
  mkdir_p MANDIR
45
- install(MANPAGE, MANDIR, :mode => 0644)
42
+ install(MANPAGE, MANDIR, mode: 0o644)
46
43
  end
47
44
 
48
45
 
49
- desc 'Uninstall binary and man page'
46
+ desc "Uninstall binary and man page"
50
47
  task :uninstall do
51
48
  rm "#{BINDIR}/#{BINARYNAME}"
52
49
  manfile = File.basename(MANPAGE)
@@ -54,19 +51,18 @@ task :uninstall do
54
51
  end
55
52
 
56
53
 
57
- desc 'Create man page'
58
- task :man => [MANPAGE]
54
+ desc "Create man page"
55
+ task man: [MANPAGE]
59
56
 
60
57
  file MANPAGE => [BINARY, H2MFILE] do
61
58
  sh "#{HELP2MAN} --no-info --name='#{TAGLINE}' --include=#{H2MFILE} -o #{MANPAGE} ./#{BINARY}"
62
- sh "#{SED} -i '/\.PP/{N;s/\.PP\\nOptions/.SH OPTIONS/}' #{MANPAGE}"
63
59
  sh "#{SED} -i 's/^License GPL/.br\\nLicense GPL/;s/There is NO WARRANTY/.br\\nThere is NO WARRANTY/' #{MANPAGE}"
64
60
  sh "#{SED} -i 's!%HOMEPAGE%!#{HOMEPAGE}!g' #{MANPAGE}"
65
61
  sh "#{SED} -i 's!%PROGNAME%!#{PROGNAME}!g' #{MANPAGE}"
66
62
  end
67
63
 
68
64
 
69
- desc 'Build gem'
70
- task :build => [MANPAGE] do
65
+ desc "Build gem"
66
+ task build: [MANPAGE] do
71
67
  sh "gem build #{gemspec_file}"
72
68
  end
data/bin/deblank CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require 'deblank'
4
+ require "deblank"
4
5
 
5
6
  Deblank::Application.new.run!
data/deblank.gemspec CHANGED
@@ -1,4 +1,6 @@
1
- require './lib/deblank'
1
+ # frozen_string_literal: true
2
+
3
+ require "./lib/deblank"
2
4
 
3
5
  version = Deblank::VERSION
4
6
  date = Deblank::DATE
@@ -6,39 +8,39 @@ homepage = Deblank::HOMEPAGE
6
8
  tagline = Deblank::TAGLINE
7
9
 
8
10
  Gem::Specification.new do |s|
9
- s.name = 'deblank'
11
+ s.name = "deblank"
10
12
  s.version = version
11
13
  s.date = date
12
14
 
13
- s.description = 'deblank is a command line tool that ' +
14
- 'renames files and replaces or removes special characters ' +
15
- 'like spaces, parentheses, or umlauts.'
15
+ s.description = "deblank is a command line tool that " \
16
+ "renames files and replaces or removes special characters " \
17
+ "like spaces, parentheses, or umlauts."
16
18
  s.summary = "deblank - #{tagline}"
17
19
 
18
- s.authors = ['Marcus Stollsteimer']
19
- s.email = 'sto.mar@web.de'
20
+ s.authors = ["Marcus Stollsteimer"]
21
+ s.email = "sto.mar@web.de"
20
22
  s.homepage = homepage
21
23
 
22
- s.license = 'GPL-3'
23
-
24
- s.required_ruby_version = '>=1.9.2'
24
+ s.license = "GPL-3.0"
25
25
 
26
- s.add_development_dependency('rake')
26
+ s.required_ruby_version = ">= 3.1.0"
27
27
 
28
- s.executables = ['deblank']
29
- s.bindir = 'bin'
28
+ s.executables = ["deblank"]
29
+ s.bindir = "bin"
30
30
 
31
- s.require_path = 'lib'
31
+ s.require_paths = ["lib"]
32
32
 
33
- s.test_files = Dir.glob('test/**/test_*.rb')
33
+ s.test_files = Dir.glob("test/**/test_*.rb")
34
34
 
35
- s.files = %w{
35
+ s.files =
36
+ %w[
36
37
  README.md
37
38
  Rakefile
39
+ Gemfile
38
40
  deblank.gemspec
39
41
  deblank.h2m
40
- } +
41
- Dir.glob('{bin,lib,man,test}/**/*')
42
+ ] +
43
+ Dir.glob("{bin,lib,man,test}/**/*")
42
44
 
43
- s.rdoc_options = ['--charset=UTF-8']
45
+ s.rdoc_options = ["--charset=UTF-8"]
44
46
  end
data/lib/deblank.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
3
4
  # == Name
4
5
  #
5
6
  # deblank - remove special characters from filenames
@@ -15,27 +16,27 @@
15
16
  #
16
17
  # == Author
17
18
  #
18
- # Copyright (C) 2012-2013 Marcus Stollsteimer
19
+ # Copyright (C) 2012-2024 Marcus Stollsteimer
19
20
  #
20
21
  # License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
21
22
 
22
- require 'optparse'
23
+ require "optparse"
23
24
 
24
25
  # This module contains the classes for the +deblank+ tool.
25
26
  module Deblank
26
27
 
27
- PROGNAME = 'deblank'
28
- VERSION = '0.1.0'
29
- DATE = '2013-10-27'
30
- HOMEPAGE = 'https://github.com/stomar/deblank'
31
- TAGLINE = 'remove special characters from filenames'
28
+ PROGNAME = "deblank"
29
+ VERSION = "0.2.0"
30
+ DATE = "2024-01-05"
31
+ HOMEPAGE = "https://github.com/stomar/deblank"
32
+ TAGLINE = "remove special characters from filenames"
32
33
 
33
- COPYRIGHT = <<-copyright.gsub(/^ +/, '')
34
- Copyright (C) 2012-2013 Marcus Stollsteimer.
34
+ COPYRIGHT = <<~TEXT
35
+ Copyright (C) 2012-2024 Marcus Stollsteimer.
35
36
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
36
37
  This is free software: you are free to change and redistribute it.
37
38
  There is NO WARRANTY, to the extent permitted by law.
38
- copyright
39
+ TEXT
39
40
 
40
41
  # Parser for the command line options.
41
42
  # The class method parse! does the job.
@@ -49,62 +50,62 @@ module Deblank
49
50
  #
50
51
  # Returns a hash containing the option parameters.
51
52
  def self.parse!(argv)
52
-
53
53
  options = {
54
- :files => nil,
55
- :simulate => false
54
+ files: nil,
55
+ simulate: false
56
56
  }
57
57
 
58
58
  opt_parser = OptionParser.new do |opt|
59
59
  opt.banner = "Usage: #{PROGNAME} [options] file[s]"
60
- opt.separator %Q{
60
+ opt.separator ""
61
+ opt.separator <<~DESCRIPTION
61
62
  deblank renames files and replaces or removes special characters
62
63
  like spaces, parentheses, or umlauts.
63
64
  The new filename will only contain the following characters:
64
65
 
65
- ____#{NameConverter.default_valid_chars_to_s}
66
+ #{NameConverter.default_valid_chars_to_s}
66
67
 
67
68
  Spaces are replaced by underscores, German umlauts and eszett are
68
69
  transliterated, all other invalid characters are removed.
69
70
 
70
- Options
71
- }.gsub(/^ +/, '').gsub(/^____/, ' ')
71
+ Options:
72
+ DESCRIPTION
72
73
 
73
74
  # process --version and --help first,
74
75
  # exit successfully (GNU Coding Standards)
75
- opt.on_tail('-h', '--help', 'Print a brief help message and exit.') do
76
+ opt.on_tail("-h", "--help", "Print a brief help message and exit.") do
76
77
  puts opt_parser
77
78
  puts "\nReport bugs on the #{PROGNAME} home page: <#{HOMEPAGE}>"
78
79
  exit
79
80
  end
80
81
 
81
- opt.on_tail('-v', '--version',
82
- 'Print a brief version information and exit.') do
82
+ opt.on_tail("-v", "--version",
83
+ "Print a brief version information and exit.") do
83
84
  puts "#{PROGNAME} #{VERSION}"
84
85
  puts COPYRIGHT
85
86
  exit
86
87
  end
87
88
 
88
- opt.on('-l', '--list',
89
- 'List the used character substitutions.') do
89
+ opt.on("-l", "--list",
90
+ "List the used character substitutions.") do
90
91
  puts NameConverter.default_substitutions_to_s
91
92
  exit
92
93
  end
93
94
 
94
- opt.on('-n', '--no-act',
95
- 'Do not rename files, only display what would happen.') do
95
+ opt.on("-n", "--no-act",
96
+ "Do not rename files, only display what would happen.") do
96
97
  options[:simulate] = true
97
98
  end
98
99
 
99
- opt.separator ''
100
+ opt.separator ""
100
101
  end
101
102
  opt_parser.parse!(argv)
102
103
 
103
104
  # only file[s] should be left (at least 1 argument)
104
- raise(ArgumentError, 'wrong number of arguments') if argv.size < 1
105
+ raise(ArgumentError, "wrong number of arguments") if argv.empty?
105
106
 
106
107
  options[:files] = Array.new(argv).map do |filename|
107
- correct_encoding(filename).encode('UTF-8')
108
+ correct_encoding(filename).encode("UTF-8")
108
109
  end
109
110
  argv.clear
110
111
 
@@ -122,7 +123,7 @@ module Deblank
122
123
  def self.correct_encoding(string)
123
124
  return string unless string.encoding == Encoding::CP850
124
125
 
125
- string.dup.force_encoding('Windows-1252')
126
+ string.dup.force_encoding("Windows-1252")
126
127
  end
127
128
  end
128
129
 
@@ -130,18 +131,18 @@ module Deblank
130
131
  # (only the base name is modified).
131
132
  class NameConverter
132
133
 
133
- VALID_CHARS = 'A-Za-z0-9._-' # `-' must be last
134
+ VALID_CHARS = "A-Za-z0-9._-" # `-' must be last
134
135
 
135
136
  SUBSTITUTIONS = {
136
- ' ' => '_',
137
- 'ä' => 'ae',
138
- 'ö' => 'oe',
139
- 'ü' => 'ue',
140
- 'Ä' => 'Ae',
141
- 'Ö' => 'Oe',
142
- 'Ü' => 'Ue',
143
- 'ß' => 'ss'
144
- }
137
+ " " => "_",
138
+ "ä" => "ae",
139
+ "ö" => "oe",
140
+ "ü" => "ue",
141
+ "Ä" => "Ae",
142
+ "Ö" => "Oe",
143
+ "Ü" => "Ue",
144
+ "ß" => "ss"
145
+ }.freeze
145
146
 
146
147
  def initialize
147
148
  @valid_characters = VALID_CHARS
@@ -152,17 +153,17 @@ module Deblank
152
153
  dir, basename = File.dirname(filename), File.basename(filename)
153
154
 
154
155
  @substitutions.each {|from, to| basename.gsub!(/#{from}/, to) }
155
- basename.gsub!(invalid_characters, '')
156
+ basename.gsub!(invalid_characters, "")
156
157
 
157
- dir == '.' ? basename : "#{dir}/#{basename}"
158
+ dir == "." ? basename : "#{dir}/#{basename}"
158
159
  end
159
160
 
160
161
  def invalid?(filename)
161
- invalid_characters === filename
162
+ filename.match?(invalid_characters)
162
163
  end
163
164
 
164
165
  def self.default_valid_chars_to_s
165
- VALID_CHARS.scan(/.-.|./).join(' ')
166
+ VALID_CHARS.scan(/.-.|./).join(" ")
166
167
  end
167
168
 
168
169
  def self.default_substitutions_to_s
@@ -181,12 +182,12 @@ module Deblank
181
182
  # It parses the command line arguments and renames the files.
182
183
  class Application
183
184
 
184
- ERRORCODE = {:general => 1, :usage => 2}
185
+ ERRORCODE = { general: 1, usage: 2 }.freeze
185
186
 
186
187
  def initialize
187
188
  begin
188
189
  options = Optionparser.parse!(ARGV)
189
- rescue => e
190
+ rescue StandardError => e
190
191
  usage_fail(e.message)
191
192
  end
192
193
  @files = options[:files]
@@ -217,13 +218,13 @@ module Deblank
217
218
  def file_exist?(filename)
218
219
  fail_message = "There is no file `#{filename}'."
219
220
 
220
- File.exist?(filename) or skip_warn(fail_message)
221
+ File.exist?(filename) or skip_warn(fail_message)
221
222
  end
222
223
 
223
224
  def invalid?(filename)
224
225
  fail_message = "`#{filename}' already is a valid filename."
225
226
 
226
- @converter.invalid?(filename) or skip_warn(fail_message)
227
+ @converter.invalid?(filename) or skip_warn(fail_message)
227
228
  end
228
229
 
229
230
  def secure_rename(old_filename, new_filename)
@@ -246,7 +247,8 @@ module Deblank
246
247
  loop do
247
248
  $stderr.print "#{question} [y/n] "
248
249
  reply = $stdin.gets.chomp.downcase # $stdin avoids gets/ARGV problem
249
- return reply == 'y' if /\A[yn]\Z/ =~ reply
250
+ return reply == "y" if reply.match?(/\A[yn]\z/)
251
+
250
252
  warn "Please answer `y' or `n'."
251
253
  end
252
254
  end
@@ -258,10 +260,8 @@ module Deblank
258
260
  exit ERRORCODE[:usage]
259
261
  end
260
262
  end
261
- end # module
263
+ end
262
264
 
263
265
  ### call main method only if called on command line
264
266
 
265
- if __FILE__ == $0
266
- Deblank::Application.new.run!
267
- end
267
+ Deblank::Application.new.run! if __FILE__ == $PROGRAM_NAME
data/man/deblank.1 CHANGED
@@ -1,10 +1,10 @@
1
- .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4.
2
- .TH DEBLANK "1" "October 2013" "deblank 0.1.0" "User Commands"
1
+ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
2
+ .TH DEBLANK "1" "January 2024" "deblank 0.2.0" "User Commands"
3
3
  .SH NAME
4
4
  deblank \- remove special characters from filenames
5
5
  .SH SYNOPSIS
6
6
  .B deblank
7
- [\fIoptions\fR] \fIfile\fR[\fIs\fR]
7
+ [\fI\,options\/\fR] \fI\,file\/\fR[\fI\,s\/\fR]
8
8
  .SH DESCRIPTION
9
9
  deblank renames files and replaces or removes special characters
10
10
  like spaces, parentheses, or umlauts.
@@ -30,7 +30,7 @@ Print a brief version information and exit.
30
30
  .SH "REPORTING BUGS"
31
31
  Report bugs on the deblank home page: <https://github.com/stomar/deblank>
32
32
  .SH COPYRIGHT
33
- Copyright \(co 2012\-2013 Marcus Stollsteimer.
33
+ Copyright \(co 2012\-2024 Marcus Stollsteimer.
34
34
  .br
35
35
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
36
36
  .br
@@ -1,12 +1,7 @@
1
- # encoding: UTF-8
2
- #
3
- # test_nameconverter.rb: Unit tests for the deblank script.
4
- #
5
- # Copyright (C) 2012-2013 Marcus Stollsteimer
1
+ # frozen_string_literal: true
6
2
 
7
- require 'minitest/spec'
8
- require 'minitest/autorun'
9
- require 'deblank'
3
+ require "minitest/autorun"
4
+ require "deblank"
10
5
 
11
6
 
12
7
  describe Deblank::NameConverter do
@@ -15,33 +10,33 @@ describe Deblank::NameConverter do
15
10
  @nc = Deblank::NameConverter.new
16
11
  end
17
12
 
18
- it 'recognizes invalid filenames' do
19
- @nc.invalid?('path/to/filename with spaces.txt').must_equal true
20
- @nc.invalid?('filename_with_ä.txt').must_equal true
21
- @nc.invalid?('Valid_filename-1.txt').must_equal false
13
+ it "recognizes invalid filenames" do
14
+ _(@nc.invalid?("path/to/filename with spaces.txt")).must_equal true
15
+ _(@nc.invalid?("filename_with_ä.txt")).must_equal true
16
+ _(@nc.invalid?("Valid_filename-1.txt")).must_equal false
22
17
  end
23
18
 
24
- it 'does not change the path name' do
25
- @nc.convert('path with spaces/file.txt').must_equal 'path with spaces/file.txt'
19
+ it "does not change the path name" do
20
+ _(@nc.convert("path with spaces/file.txt")).must_equal "path with spaces/file.txt"
26
21
  end
27
22
 
28
- it 'replaces spaces by underscores' do
29
- @nc.convert('file with spaces.txt').must_equal 'file_with_spaces.txt'
23
+ it "replaces spaces by underscores" do
24
+ _(@nc.convert("file with spaces.txt")).must_equal "file_with_spaces.txt"
30
25
  end
31
26
 
32
- it 'removes parentheses' do
33
- @nc.convert('file_(another).txt').must_equal 'file_another.txt'
27
+ it "removes parentheses" do
28
+ _(@nc.convert("file_(another).txt")).must_equal "file_another.txt"
34
29
  end
35
30
 
36
- it 'transliterates umlauts and eszett' do
37
- @nc.convert('Ä_Ö_Ü_ä_ö_ü_ß.txt').must_equal 'Ae_Oe_Ue_ae_oe_ue_ss.txt'
31
+ it "transliterates umlauts and eszett" do
32
+ _(@nc.convert("Ä_Ö_Ü_ä_ö_ü_ß.txt")).must_equal "Ae_Oe_Ue_ae_oe_ue_ss.txt"
38
33
  end
39
34
 
40
- it 'can return the default valid characters as string' do
41
- Deblank::NameConverter.default_valid_chars_to_s.must_equal 'A-Z a-z 0-9 . _ -'
35
+ it "can return the default valid characters as string" do
36
+ _(Deblank::NameConverter.default_valid_chars_to_s).must_equal "A-Z a-z 0-9 . _ -"
42
37
  end
43
38
 
44
- it 'can return the default substitutions as string' do
45
- Deblank::NameConverter.default_substitutions_to_s.split("\n")[0].must_equal ' => _'
39
+ it "can return the default substitutions as string" do
40
+ _(Deblank::NameConverter.default_substitutions_to_s.split("\n")[0]).must_equal " => _"
46
41
  end
47
42
  end
@@ -1,12 +1,7 @@
1
- # encoding: UTF-8
2
- #
3
- # test_optionparser.rb: Unit tests for the deblank script.
4
- #
5
- # Copyright (C) 2012-2013 Marcus Stollsteimer
1
+ # frozen_string_literal: true
6
2
 
7
- require 'minitest/spec'
8
- require 'minitest/autorun'
9
- require 'deblank'
3
+ require "minitest/autorun"
4
+ require "deblank"
10
5
 
11
6
 
12
7
  describe Deblank::Optionparser do
@@ -14,35 +9,35 @@ describe Deblank::Optionparser do
14
9
  before do
15
10
  @parser = Deblank::Optionparser
16
11
  @arg = "test_ä.txt"
17
- @arg_Win_1252_labeled_as_CP850 = "test_\xE4.txt".force_encoding('CP850')
18
- @arg_Win_1252 = "test_\xE4.txt".force_encoding('Windows-1252')
12
+ @arg_win1252_labeled_as_cp850 = (+"test_\xE4.txt").force_encoding("CP850")
13
+ @arg_win1252 = (+"test_\xE4.txt").force_encoding("Windows-1252")
19
14
  end
20
15
 
21
- it 'can correct encoding from (seemingly) CP850 to Windows-1252' do
22
- arg = @arg_Win_1252_labeled_as_CP850
23
- arg.encoding.must_equal Encoding::CP850
16
+ it "can correct encoding from (seemingly) CP850 to Windows-1252" do
17
+ arg = @arg_win1252_labeled_as_cp850
18
+ _(arg.encoding).must_equal Encoding::CP850
24
19
  corrected_arg = @parser.correct_encoding(arg)
25
- corrected_arg.encoding.must_equal Encoding::Windows_1252
20
+ _(corrected_arg.encoding).must_equal Encoding::Windows_1252
26
21
  end
27
22
 
28
- it 'encodes (seemingly) CP850 encoded filenames into UTF-8' do
29
- options = @parser.parse!([@arg_Win_1252_labeled_as_CP850])
23
+ it "encodes (seemingly) CP850 encoded filenames into UTF-8" do
24
+ options = @parser.parse!([@arg_win1252_labeled_as_cp850])
30
25
  filename = options[:files].first
31
- filename.encoding.must_equal Encoding::UTF_8
32
- filename.must_equal @arg
26
+ _(filename.encoding).must_equal Encoding::UTF_8
27
+ _(filename).must_equal @arg
33
28
  end
34
29
 
35
- it 'encodes Windows-1252 encoded filenames into UTF-8' do
36
- options = @parser.parse!([@arg_Win_1252])
30
+ it "encodes Windows-1252 encoded filenames into UTF-8" do
31
+ options = @parser.parse!([@arg_win1252])
37
32
  filename = options[:files].first
38
- filename.encoding.must_equal Encoding::UTF_8
39
- filename.must_equal @arg
33
+ _(filename.encoding).must_equal Encoding::UTF_8
34
+ _(filename).must_equal @arg
40
35
  end
41
36
 
42
- it 'encodes UTF-8 encoded filenames into UTF-8' do
37
+ it "encodes UTF-8 encoded filenames into UTF-8" do
43
38
  options = @parser.parse!([@arg])
44
39
  filename = options[:files].first
45
- filename.encoding.must_equal Encoding::UTF_8
46
- filename.must_equal @arg
40
+ _(filename.encoding).must_equal Encoding::UTF_8
41
+ _(filename).must_equal @arg
47
42
  end
48
43
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deblank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Stollsteimer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-27 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
11
+ date: 2024-01-05 00:00:00.000000000 Z
12
+ dependencies: []
27
13
  description: deblank is a command line tool that renames files and replaces or removes
28
14
  special characters like spaces, parentheses, or umlauts.
29
15
  email: sto.mar@web.de
@@ -32,37 +18,37 @@ executables:
32
18
  extensions: []
33
19
  extra_rdoc_files: []
34
20
  files:
21
+ - Gemfile
35
22
  - README.md
36
23
  - Rakefile
24
+ - bin/deblank
37
25
  - deblank.gemspec
38
26
  - deblank.h2m
39
- - bin/deblank
40
27
  - lib/deblank.rb
41
28
  - man/deblank.1
42
29
  - test/test_nameconverter.rb
43
30
  - test/test_optionparser.rb
44
31
  homepage: https://github.com/stomar/deblank
45
32
  licenses:
46
- - GPL-3
33
+ - GPL-3.0
47
34
  metadata: {}
48
35
  post_install_message:
49
36
  rdoc_options:
50
- - --charset=UTF-8
37
+ - "--charset=UTF-8"
51
38
  require_paths:
52
39
  - lib
53
40
  required_ruby_version: !ruby/object:Gem::Requirement
54
41
  requirements:
55
- - - '>='
42
+ - - ">="
56
43
  - !ruby/object:Gem::Version
57
- version: 1.9.2
44
+ version: 3.1.0
58
45
  required_rubygems_version: !ruby/object:Gem::Requirement
59
46
  requirements:
60
- - - '>='
47
+ - - ">="
61
48
  - !ruby/object:Gem::Version
62
49
  version: '0'
63
50
  requirements: []
64
- rubyforge_project:
65
- rubygems_version: 2.1.9
51
+ rubygems_version: 3.5.3
66
52
  signing_key:
67
53
  specification_version: 4
68
54
  summary: deblank - remove special characters from filenames