renamr 1.0.3 → 1.0.10

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: eb6265009239848244a1e2c0afb669182e1b191e85950c7ea72a00981a8d8025
4
- data.tar.gz: b07631f073ae76b937a53a8de4f5c48ac7f7fe23b99dccb58416d9b51ecf17f5
3
+ metadata.gz: bdddf30ae00e41f680036bee50f3e1c34da6ae3b569aeec8c40f136621a1ce88
4
+ data.tar.gz: 83724725b200aac5218a4ab319c769b6b982b25398ab5820ef4532b2d09b56b4
5
5
  SHA512:
6
- metadata.gz: 3579712ddb5dc5478741d87619d5d19123fdddca384b27cb0447795f9a22601a6ff8a8b6766459fc1be08c75fa700bf7363145ec5162d9ceea65ba7fecae5b7a
7
- data.tar.gz: '086c3f7f2bce22ffe8b6aface8863102f35485eb0f501eaa0578f5c75365207bdbaec8b0fa24967ff9e4c40c3467ff1c25bc5c645ca0bc4bf69cda3285de7e60'
6
+ metadata.gz: e055a5b53a6fe4d9ac68be46cb207f47b6de392a3ef77d59cb95f5e5fca834f8f85d6fb327fae7f962811271c4a5b9ac8c8a1e92212b73e51afc1edffd956235
7
+ data.tar.gz: f9e7464fdfed6a0a31a15e03b1bddc54e086693806ae629aee80aff9d1d1b83566e0a87fb12beed599c56fc8193aae7f3df95a2ee36ebb7de7c83ed1e58bda17
data/Gemfile CHANGED
@@ -1,13 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2020-present David Rabkin
4
+ # Copyright 2020 by David Rabkin
5
5
 
6
6
  source 'https://rubygems.org'
7
7
  ruby '~>2.6'
8
8
 
9
+ gem 'date', '2.0.0'
9
10
  gem 'fileutils', '1.4.1'
10
11
  gem 'i18n', '1.8.3'
12
+ gem 'minitest', '5.11.3'
11
13
  gem 'pidfile', '0.3.0'
12
14
  gem 'rake', '13.0.1'
13
15
  gem 'rubocop', '0.76.0'
data/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright 2020 by David Rabkin
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
7
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
8
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
11
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
12
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Renamr
2
- File and directory names organiser.
2
+ File and directory names organizer.
3
3
 
4
4
  [![Build
5
5
  Status](https://travis-ci.org/rdavid/renamr.svg)](https://travis-ci.org/rdavid/renamr)
@@ -10,7 +10,7 @@ Version](https://badge.fury.io/rb/renamr.svg)](https://badge.fury.io/rb/renamr)
10
10
  [![Maintainability](https://api.codeclimate.com/v1/badges/406f1433b0b9e0509a6e/maintainability)](https://codeclimate.com/github/rdavid/renamr/maintainability)
11
11
 
12
12
  [![Hits-of-Code](https://hitsofcode.com/github/rdavid/renamr)](https://hitsofcode.com/view/github/rdavid/renamr)
13
- [![License](https://img.shields.io/github/license/rdavid/renamr)](https://github.com/rdavid/renamr/blob/master/LICENSE.txt)
13
+ [![License](https://img.shields.io/badge/license-0BSD-green)](https://github.com/rdavid/renamr/blob/master/LICENSE)
14
14
 
15
15
 
16
16
  * [About](#about)
@@ -19,13 +19,13 @@ Version](https://badge.fury.io/rb/renamr.svg)](https://badge.fury.io/rb/renamr)
19
19
  * [License](#license)
20
20
 
21
21
  ## About
22
- Hi, I'm [David Rabkin](https://www.rabkin.co.il). I created this tool to
22
+ Hi, I'm [David Rabkin](http://davi.drabk.in). I created this tool to
23
23
  orginize multiple files.
24
24
 
25
25
  ## Installation
26
26
  The tool is designed to work on macOS, GNU/Linux, Windows, Unix-like OS. It is
27
- packaged as a Gem and require Ruby version 2.4 or later. See «[Installing
28
- Ruby](https://www.ruby-lang.org/en/documentation/installation/)» if you don't
27
+ packaged as a Gem and require Ruby version 2.6 or later. See [Installing
28
+ Ruby](https://www.ruby-lang.org/en/documentation/installation/) if you don't
29
29
  have the proper version on your platform.
30
30
 
31
31
  Use this command to install:
@@ -52,6 +52,7 @@ There are no requirements.
52
52
  -p, --pre pre A string to prepend to.
53
53
  -w, --wid wid Width of the table.
54
54
  -c, --cut pos,len Removes symbols from pos.
55
+ -v, --version Shows version.
55
56
 
56
57
  ### Example
57
58
 
@@ -61,5 +62,5 @@ It renames all files in `source` by default pattern: 26 English letters,
61
62
  10 numbers, minus for spaces and other symbols.
62
63
 
63
64
  ## License
64
- Renamr is copyright [David Rabkin](http://www.rabkin.co.il/) and
65
- available under a [2-Claus BSD license](https://github.com/rdavid/renamr/blob/master/LICENSE).
65
+ Renamr is copyright [David Rabkin](http://davi.drabk.in) and
66
+ available under a [Zero-Clause BSD license](https://github.com/rdavid/renamr/blob/master/LICENSE).
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2020-present David Rabkin
4
+ # Copyright 2020 by David Rabkin
5
5
 
6
6
  task default: %w[test]
7
7
 
8
8
  task :test do
9
- # ruby 'test/unittest.rb'
9
+ ruby 'test/test_char.rb'
10
+ ruby 'test/test_date.rb'
11
+ ruby 'test/test_trim.rb'
10
12
  end
data/bin/renamr CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  # vi:ts=2 sw=2 tw=79 et lbr wrap
5
- # Copyright 2018-present David Rabkin
5
+ # Copyright 2018 by David Rabkin
6
6
  # This script renames files in given directory by specific rules.
7
7
 
8
8
  require 'pidfile'
data/lib/renamr.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'renamr/renamer'
7
7
  require_relative 'renamr/version'
data/lib/renamr/action.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  module Renamr
7
7
  # An interface for actions implementation.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require 'i18n'
7
7
  require_relative 'action'
data/lib/renamr/char.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require 'set'
7
7
  require_relative 'action'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require 'optparse'
7
7
 
@@ -20,15 +20,23 @@ module Renamr
20
20
  ['-w', '--wid wid', 'Width of the table.', :wid]
21
21
  ].freeze
22
22
 
23
+ def add(opt)
24
+ opt.on('-c', '--cut pos,len', Array, 'Removes symbols from pos.') do |l|
25
+ @options[:pos] = l[0]
26
+ @options[:len] = l[1]
27
+ end
28
+ opt.on('-v', '--version', 'Show version.') do
29
+ puts "#{File.basename($PROGRAM_NAME)} #{VERSION} #{DATE}"
30
+ exit
31
+ end
32
+ end
33
+
23
34
  def initialize
24
35
  @options = {}
25
36
  OptionParser.new do |o|
26
37
  o.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options]."
27
38
  DIC.each { |f, p, d, k| o.on(f, p, d) { |i| @options[k] = i } }
28
- o.on('-c', '--cut pos,len', Array, 'Removes symbols from pos.') do |l|
29
- @options[:pos] = l[0]
30
- @options[:len] = l[1]
31
- end
39
+ add(o)
32
40
  end.parse!
33
41
  validate
34
42
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ # vi:ts=2 sw=2 tw=79 et lbr wrap
4
+ # Copyright 2020 by David Rabkin
5
+
6
+ require 'date'
7
+ require_relative 'action'
8
+
9
+ module Renamr
10
+ # Replaces any valid date, e.g. 2020-11-02 or 02-11-2020 with 20201102.
11
+ class DateAction < Action
12
+ REG = /(\d+)-(\d+)-(\d+)/.freeze
13
+ PAT = ['%m-%d-%Y', '%d-%m-%Y', '%Y-%m-%d', '%Y-%d-%m'].freeze
14
+
15
+ def validate(dat)
16
+ return nil if dat < Date.new(1900, 1, 1)
17
+
18
+ return nil if dat > Date.new(2099, 1, 1)
19
+
20
+ dat
21
+ end
22
+
23
+ def date(sub)
24
+ PAT.each do |pat|
25
+ return Date.strptime(sub, pat)
26
+ rescue ArgumentError
27
+ # Nothing to do.
28
+ end
29
+ nil
30
+ end
31
+
32
+ def do(src)
33
+ sub = src[REG]
34
+ return src if sub.nil?
35
+
36
+ dat = date(sub)
37
+ return src if dat.nil?
38
+
39
+ dat = validate(dat)
40
+ return src if dat.nil?
41
+
42
+ src.sub!(REG, dat.strftime('%Y%m%d'))
43
+ end
44
+ end
45
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'ascii_validator'
7
7
  require_relative 'auto_localization'
8
8
  require_relative 'char'
9
+ require_relative 'date'
9
10
  require_relative 'downcase'
10
- require_relative 'existence'
11
11
  require_relative 'manual_localization'
12
12
  require_relative 'omit'
13
13
  require_relative 'point'
@@ -28,7 +28,7 @@ module Renamr
28
28
  @cfg = cfg
29
29
  end
30
30
 
31
- def produce(dir) # rubocop:disable MethodLength, AbcSize
31
+ def produce(dir) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
32
32
  if @cfg.lim?
33
33
  [
34
34
  OmitAction.new(LIMIT),
@@ -49,7 +49,7 @@ module Renamr
49
49
  ASCIIValidatorAction.new,
50
50
  TrimAction.new,
51
51
  TruncateAction.new(LIMIT),
52
- ExistenceAction.new(dir, LIMIT)
52
+ DateAction.new
53
53
  ].compact
54
54
  end
55
55
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
data/lib/renamr/omit.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
data/lib/renamr/point.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
data/lib/renamr/remove.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require 'fileutils'
7
7
  require_relative 'configurator'
@@ -16,7 +16,7 @@ module Renamr
16
16
  @fac = ActionsFactory.new(@cfg)
17
17
  end
18
18
 
19
- def move(dir, dat) # rubocop:disable MethodLength, AbcSize
19
+ def move(dir, dat) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
20
20
  rep = Reporter.new(File.expand_path(dir))
21
21
  dat.each do |src, dst|
22
22
  if src == dst
@@ -24,7 +24,7 @@ module Renamr
24
24
  next
25
25
  end
26
26
  begin
27
- FileUtils.mv(src, dst) if @cfg.act?
27
+ File.rename(src, dst) if @cfg.act?
28
28
  rep.add(File.basename(src), File.basename(dst))
29
29
  rescue StandardError => e
30
30
  rep.add(File.basename(src), e)
@@ -35,17 +35,33 @@ module Renamr
35
35
  rep.do
36
36
  end
37
37
 
38
- def do_dir(dir) # rubocop:disable MethodLength, CyclomaticComplexity, AbcSize
38
+ def unique(dat, nme)
39
+ dst = []
40
+ dat.each { |_, d| dst << File.basename(d) }
41
+ return nme unless dst.include?(nme)
42
+
43
+ ext = File.extname(nme)
44
+ 0.step do |i| # Infinitive loop with index.
45
+ n = ext.nil? ? "#{nme}-#{i}" : "#{File.basename(nme, ext)}-#{i}#{ext}"
46
+ return n unless dst.include?(n)
47
+ end
48
+ end
49
+
50
+ def do_dir(dir) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
39
51
  raise "No such directory: #{dir}." unless File.directory?(dir)
40
52
 
41
53
  dat = []
42
54
  act = @fac.produce(dir)
43
- (Dir.entries(dir) - ['.', '..']).sort.each do |nme|
55
+ # Doesn't include hidden files.
56
+ Dir.entries(dir).reject { |f| f.start_with?('.') }.sort.each do |nme|
44
57
  src = File.join(dir, nme)
45
58
  do_dir(src) if @cfg.rec? && File.directory?(src)
46
59
  act.each { |a| a.set(nme) }
47
- act.each { |a| break if (nme = a.do(nme)).nil? }
48
- dat << [src, File.join(dir, nme)] unless nme.nil?
60
+ act.each { |a| break if (nme = a.do(nme)).nil? } # rubocop:disable Style/CombinableLoops
61
+ next if nme.nil?
62
+
63
+ nme = unique(dat, nme)
64
+ dat << [src, File.join(dir, nme)]
49
65
  end
50
66
  move(dir, dat) if dat.any?
51
67
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require 'terminal-table'
7
7
  require_relative 'action'
data/lib/renamr/rutoen.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
data/lib/renamr/trim.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  require_relative 'action'
7
7
 
data/lib/renamr/utils.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2018 by David Rabkin
5
5
 
6
6
  # All methods are static.
7
7
  class Utils
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
4
+ # Copyright 2020 by David Rabkin
5
5
 
6
6
  module Renamr
7
- VERSION = '1.0.3'
7
+ VERSION = '1.0.10'
8
+ DATE = '2021-04-07'
8
9
  end
data/renamr-1.0.6.gem ADDED
Binary file
data/renamr-1.0.7.gem ADDED
Binary file
data/renamr-1.0.8.gem ADDED
Binary file
data/renamr-1.0.9.gem ADDED
Binary file
data/renamr.gemspec CHANGED
@@ -7,23 +7,26 @@ require 'renamr'
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'renamr'
9
9
  s.version = Renamr::VERSION
10
+ s.date = Renamr::DATE
10
11
  s.required_ruby_version = '~> 2.6'
11
12
  s.summary = 'File and directory names organiser.'
12
13
  s.description = <<-HERE
13
14
  Renamr organises multiple files and directories.
14
15
  HERE
15
- s.license = 'BSD-2-Clause'
16
+ s.license = '0BSD'
16
17
  s.author = 'David Rabkin'
17
- s.email = 'pub@rabkin.co.il'
18
+ s.email = 'david@rabkin.co.il'
18
19
  s.homepage = 'https://github.com/rdavid/renamr'
19
20
  s.files = Dir['{bin,lib}/**/*'] + Dir['[A-Z]*'] + ['renamr.gemspec']
20
21
  s.executables = ['renamr']
21
- s.extra_rdoc_files = ['LICENSE.txt', 'README.md']
22
+ s.extra_rdoc_files = ['LICENSE', 'README.md']
22
23
  s.require_paths = ['lib']
24
+ s.add_runtime_dependency 'date', '2.0.0'
23
25
  s.add_runtime_dependency 'fileutils', '1.4.1'
24
26
  s.add_runtime_dependency 'i18n', '1.8.3'
25
27
  s.add_runtime_dependency 'pidfile', '0.3.0'
26
28
  s.add_runtime_dependency 'terminal-table', '1.8.0'
29
+ s.add_development_dependency 'minitest', '6.11.3'
27
30
  s.add_development_dependency 'rake', '13.0.1'
28
31
  s.add_development_dependency 'rubocop', '0.85.1'
29
32
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renamr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rabkin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-10 00:00:00.000000000 Z
11
+ date: 2021-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: date
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: fileutils
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - '='
67
81
  - !ruby/object:Gem::Version
68
82
  version: 1.8.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 6.11.3
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 6.11.3
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rake
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -95,17 +123,16 @@ dependencies:
95
123
  - !ruby/object:Gem::Version
96
124
  version: 0.85.1
97
125
  description: " Renamr organises multiple files and directories.\n"
98
- email: pub@rabkin.co.il
126
+ email: david@rabkin.co.il
99
127
  executables:
100
128
  - renamr
101
129
  extensions: []
102
130
  extra_rdoc_files:
103
- - LICENSE.txt
131
+ - LICENSE
104
132
  - README.md
105
133
  files:
106
134
  - Gemfile
107
- - Gemfile.lock
108
- - LICENSE.txt
135
+ - LICENSE
109
136
  - README.md
110
137
  - Rakefile
111
138
  - appveyor.yml
@@ -116,8 +143,8 @@ files:
116
143
  - lib/renamr/auto_localization.rb
117
144
  - lib/renamr/char.rb
118
145
  - lib/renamr/configurator.rb
146
+ - lib/renamr/date.rb
119
147
  - lib/renamr/downcase.rb
120
- - lib/renamr/existence.rb
121
148
  - lib/renamr/factory.rb
122
149
  - lib/renamr/manual_localization.rb
123
150
  - lib/renamr/omit.rb
@@ -133,12 +160,16 @@ files:
133
160
  - lib/renamr/truncate.rb
134
161
  - lib/renamr/utils.rb
135
162
  - lib/renamr/version.rb
163
+ - renamr-1.0.6.gem
164
+ - renamr-1.0.7.gem
165
+ - renamr-1.0.8.gem
166
+ - renamr-1.0.9.gem
136
167
  - renamr.gemspec
137
168
  homepage: https://github.com/rdavid/renamr
138
169
  licenses:
139
- - BSD-2-Clause
170
+ - 0BSD
140
171
  metadata: {}
141
- post_install_message:
172
+ post_install_message:
142
173
  rdoc_options: []
143
174
  require_paths:
144
175
  - lib
@@ -154,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
185
  version: '0'
155
186
  requirements: []
156
187
  rubygems_version: 3.1.4
157
- signing_key:
188
+ signing_key:
158
189
  specification_version: 4
159
190
  summary: File and directory names organiser.
160
191
  test_files: []
data/Gemfile.lock DELETED
@@ -1,43 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- ast (2.4.0)
5
- concurrent-ruby (1.1.6)
6
- fileutils (1.4.1)
7
- i18n (1.8.3)
8
- concurrent-ruby (~> 1.0)
9
- jaro_winkler (1.5.4)
10
- parallel (1.19.1)
11
- parser (2.7.1.3)
12
- ast (~> 2.4.0)
13
- pidfile (0.3.0)
14
- rainbow (3.0.0)
15
- rake (13.0.1)
16
- rubocop (0.76.0)
17
- jaro_winkler (~> 1.5.1)
18
- parallel (~> 1.10)
19
- parser (>= 2.6)
20
- rainbow (>= 2.2.2, < 4.0)
21
- ruby-progressbar (~> 1.7)
22
- unicode-display_width (>= 1.4.0, < 1.7)
23
- ruby-progressbar (1.10.1)
24
- terminal-table (1.8.0)
25
- unicode-display_width (~> 1.1, >= 1.1.1)
26
- unicode-display_width (1.6.1)
27
-
28
- PLATFORMS
29
- ruby
30
-
31
- DEPENDENCIES
32
- fileutils (= 1.4.1)
33
- i18n (= 1.8.3)
34
- pidfile (= 0.3.0)
35
- rake (= 13.0.1)
36
- rubocop (= 0.76.0)
37
- terminal-table (= 1.8.0)
38
-
39
- RUBY VERSION
40
- ruby 2.6.3p62
41
-
42
- BUNDLED WITH
43
- 2.1.4
data/LICENSE.txt DELETED
@@ -1,25 +0,0 @@
1
- BSD 2-Clause License
2
-
3
- Copyright (c) 2020, David Rabkin
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-present David Rabkin
5
-
6
- require_relative 'action'
7
-
8
- module Renamr
9
- # Adds number from 0 to 9 in case of file existence.
10
- class ExistenceAction < Action
11
- ITERATION = 10
12
-
13
- def initialize(dir, lim)
14
- raise 'dir cannot be nil.' if dir.nil?
15
- raise 'lim cannot be nil.' if lim.nil?
16
-
17
- @dir = dir
18
- @lim = lim
19
- end
20
-
21
- def do(src) # rubocop:disable MethodLength, CyclomaticComplexity, AbcSize
22
- raise 'ExistenceAction needs original file name.' if @src.nil?
23
- return src if src == @src
24
- return src unless File.exist?(File.join(@dir, src))
25
-
26
- if src.length == @lim
27
- ext = File.extname(src)
28
- src = src[0..@lim - ext.length - ITERATION.to_s.length + 1]
29
- src << ext
30
- end
31
- nme = File.basename(src, '.*')
32
- nme = '' if nme.length == 1
33
- ext = File.extname(src)
34
- (0..ITERATION).each do |i|
35
- n = File.join(@dir, nme + i.to_s + ext)
36
- return n unless File.exist?(n)
37
- end
38
- raise "Unable to compose a new name: #{src}."
39
- end
40
-
41
- def set(src)
42
- @src = src
43
- end
44
- end
45
- end