AbsoluteRenamer 0.9.0.2 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/AbsoluteRenamer.gemspec +63 -20
- data/LICENSE +20 -0
- data/README.rdoc +34 -0
- data/Rakefile +53 -15
- data/VERSION +1 -0
- data/conf/absrenamer/absrenamer.conf +0 -0
- data/lib/absolute_renamer.rb +1 -1
- data/lib/absolute_renamer/config.rb +0 -0
- data/lib/absolute_renamer/external.rb +0 -0
- data/lib/absolute_renamer/external/modules/core/case/module.rb +0 -0
- data/lib/absolute_renamer/external/modules/core/general/module.rb +0 -0
- data/lib/absolute_renamer/external/parsers/core/general/parser.rb +1 -1
- data/lib/absolute_renamer/external/parsers/interactive/parser.rb +0 -0
- data/lib/absolute_renamer/external/parsers/listing/parser.rb +0 -0
- data/lib/absolute_renamer/external/plugins/interactive/plugin.rb +0 -0
- data/lib/absolute_renamer/external/plugins/listing/plugin.rb +0 -0
- data/lib/absolute_renamer/file_info.rb +0 -0
- data/lib/absolute_renamer/imodule.rb +0 -0
- data/lib/absolute_renamer/iparser.rb +0 -0
- data/lib/absolute_renamer/iplugin.rb +0 -0
- data/lib/absolute_renamer/libs/file.rb +0 -0
- data/lib/absolute_renamer/libs/string.rb +0 -0
- data/lib/absolute_renamer/parser.rb +0 -0
- data/lib/absolute_renamer/use_config.rb +0 -0
- data/lib/absolute_renamer/with_children.rb +0 -0
- data/test/absolute_renamer_test.rb +7 -0
- data/test/config_test.rb +45 -0
- data/test/file_info_test.rb +71 -0
- data/test/file_test.rb +33 -0
- data/test/test_helper.rb +10 -0
- metadata +31 -46
- data/COPYING +0 -340
- data/ChangeLog +0 -7
- data/LICENCE +0 -17
- data/Manifest.txt +0 -42
- data/README +0 -34
- data/man/man8/absrenamer.8 +0 -67
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/setup.rb +0 -1585
- data/test/unit/features/test_absrenamer.conf +0 -34
- data/test/unit/tc_config.rb +0 -28
- data/test/unit/tc_file.rb +0 -16
- data/test/unit/tc_fileinfo.rb +0 -17
- data/test/unit/tc_imodule.rb +0 -29
- data/test/unit/tc_iplugin.rb +0 -8
- data/test/unit/tc_parser.rb +0 -13
- data/test/unit/tc_string.rb +0 -24
- data/test/unit/test_suite.rb +0 -28
@@ -1,34 +0,0 @@
|
|
1
|
-
:debug: false
|
2
|
-
|
3
|
-
:options:
|
4
|
-
# Prompt :never, :once or :always before renaming
|
5
|
-
:interactive: :never
|
6
|
-
:format: '$'
|
7
|
-
:ext_format: '$'
|
8
|
-
|
9
|
-
# Renaming mode: :rename, :copy, :move, :link
|
10
|
-
:mode: :rename
|
11
|
-
:maxdepth: 0
|
12
|
-
|
13
|
-
# used when a value is not available (pdfAuthor for a PNG file, ...)
|
14
|
-
:default_string: '---'
|
15
|
-
|
16
|
-
# Word separator, regular expression statements can be used
|
17
|
-
# default: '\W_'
|
18
|
-
# This string will be used in AbsoluteRenamer just like this :
|
19
|
-
# [^WORD_SEPARATOR]
|
20
|
-
# Then, \W_ => [^\W_]
|
21
|
-
:word_separator: '\W_'
|
22
|
-
|
23
|
-
:path:
|
24
|
-
:modules: absolute_renamer/external/modules
|
25
|
-
:parsers: absolute_renamer/external/parsers
|
26
|
-
:plugins: absolute_renamer/external/plugins
|
27
|
-
|
28
|
-
:parsers:
|
29
|
-
- listing
|
30
|
-
- interactive
|
31
|
-
|
32
|
-
:plugins:
|
33
|
-
- listing
|
34
|
-
- interactive
|
data/test/unit/tc_config.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'absolute_renamer/config'
|
3
|
-
|
4
|
-
class TC_ConfigTest < Test::Unit::TestCase
|
5
|
-
def test_load
|
6
|
-
p $:
|
7
|
-
assert_raise(Errno::ENOENT) do
|
8
|
-
AbsoluteRenamer::Config.load('a file that must not be found')
|
9
|
-
end
|
10
|
-
|
11
|
-
assert_nothing_raised(Errno::ENOENT) do
|
12
|
-
AbsoluteRenamer::Config.load(TEST_CONF_FILE)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_set_and_get
|
17
|
-
AbsoluteRenamer::Config.set(:test_key, :test_val)
|
18
|
-
assert_equal(:test_val, AbsoluteRenamer::Config.get(:test_key))
|
19
|
-
|
20
|
-
AbsoluteRenamer::Config.set(nil, :test_val)
|
21
|
-
assert_equal(:test_val, AbsoluteRenamer::Config.get(nil))
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_set_and_get_2
|
25
|
-
AbsoluteRenamer::Config[:test_key] = :test_val
|
26
|
-
assert_equal(:test_val, AbsoluteRenamer::Config[:test_key])
|
27
|
-
end
|
28
|
-
end
|
data/test/unit/tc_file.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'absolute_renamer/libs/file'
|
3
|
-
|
4
|
-
class TC_FileTest < Test::Unit::TestCase
|
5
|
-
def test_extname
|
6
|
-
assert_equal("txt", File.extname('a_file.txt'))
|
7
|
-
assert_equal("", File.extname('a_file'))
|
8
|
-
|
9
|
-
assert_equal("tar.gz", File.extname('archive.tar.gz', 2))
|
10
|
-
assert_not_equal("tar.gz", File.extname('archive.tar.gz'))
|
11
|
-
|
12
|
-
assert_equal("", File.extname('.'))
|
13
|
-
assert_equal("", File.extname('fichier.'))
|
14
|
-
assert_equal("test", File.extname('.test'))
|
15
|
-
end
|
16
|
-
end
|
data/test/unit/tc_fileinfo.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'absolute_renamer/use_config'
|
3
|
-
require 'absolute_renamer/file_info'
|
4
|
-
|
5
|
-
class TC_FileInfoTest < Test::Unit::TestCase
|
6
|
-
def test_initialize
|
7
|
-
pwd = Dir.pwd
|
8
|
-
fi = AbsoluteRenamer::FileInfo.new('some/path/to/a_file.txt')
|
9
|
-
|
10
|
-
assert_equal('a_file', fi.name)
|
11
|
-
assert_equal(pwd + '/some/path/to', fi.dir_path)
|
12
|
-
assert_equal('some/path/to/a_file.txt', fi.path)
|
13
|
-
assert_equal(pwd + '/some/path/to/a_file.txt', fi.real_path)
|
14
|
-
assert_equal('txt', fi.ext)
|
15
|
-
assert_equal(false, fi.dir)
|
16
|
-
end
|
17
|
-
end
|
data/test/unit/tc_imodule.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'absolute_renamer/file_info'
|
3
|
-
require 'absolute_renamer/imodule'
|
4
|
-
|
5
|
-
class TC_IModuleTest < Test::Unit::TestCase
|
6
|
-
def test_symbol
|
7
|
-
assert_equal(:"AbsoluteRenamer::IModule", AbsoluteRenamer::IModule.symbol)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_process
|
11
|
-
mod = AbsoluteRenamer::IModule.new
|
12
|
-
file = AbsoluteRenamer::FileInfo.new('/some/path/to/a_file.txt')
|
13
|
-
|
14
|
-
assert_equal('format', mod.process(file, 'format', :name))
|
15
|
-
assert_equal('format', mod.process(file, 'format', :ext))
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_interpret
|
19
|
-
AbsoluteRenamer::Config.load(TEST_CONF_FILE)
|
20
|
-
mod = AbsoluteRenamer::IModule.new
|
21
|
-
file = AbsoluteRenamer::FileInfo.new('/some/path/to/a_file.txt')
|
22
|
-
|
23
|
-
def_str = AbsoluteRenamer::Config[:options][:default_string]
|
24
|
-
infos = [nil, nil, '', 'matched']
|
25
|
-
|
26
|
-
assert_equal(def_str, mod.interpret(file, infos, :name))
|
27
|
-
assert_equal(def_str, mod.interpret(file, infos, :ext))
|
28
|
-
end
|
29
|
-
end
|
data/test/unit/tc_iplugin.rb
DELETED
data/test/unit/tc_parser.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'absolute_renamer/parser'
|
3
|
-
|
4
|
-
class TC_ParserTest < Test::Unit::TestCase
|
5
|
-
def test_parse_cmd_line
|
6
|
-
AbsoluteRenamer::Config.load(TEST_CONF_FILE)
|
7
|
-
ARGV << '-f'
|
8
|
-
ARGV << 'format'
|
9
|
-
|
10
|
-
AbsoluteRenamer::Parser.parse_cmd_line
|
11
|
-
assert_equal('format', AbsoluteRenamer::Config[:options][:format])
|
12
|
-
end
|
13
|
-
end
|
data/test/unit/tc_string.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'absolute_renamer/libs/string'
|
3
|
-
|
4
|
-
class TC_StringTest < Test::Unit::TestCase
|
5
|
-
def test_simple_camelize
|
6
|
-
assert_equal("Hello World", "hello world".camelize)
|
7
|
-
assert_equal("Hello.World", "hello.world".camelize)
|
8
|
-
|
9
|
-
assert_equal("Hello The.World", "hello THE.world".camelize)
|
10
|
-
|
11
|
-
assert_equal("Hello..World", "hello..world".camelize)
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_parametred_camelize
|
15
|
-
assert_equal("Hello.World", "hello.world".camelize(/\./))
|
16
|
-
assert_equal("Hello The.world", "hello THE.world".camelize(/ /))
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_camelize!
|
20
|
-
str = "hello world"
|
21
|
-
assert_equal("Hello World", str.camelize!)
|
22
|
-
assert_equal("Hello World", str)
|
23
|
-
end
|
24
|
-
end
|
data/test/unit/test_suite.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
|
-
lib_path = File.dirname(__FILE__) << '/lib/absolute_renamer'
|
3
|
-
$:.unshift(lib_path) unless $:.include?(lib_path) || $:.include?(File.expand_path(lib_path))
|
4
|
-
|
5
|
-
require 'test/unit/testsuite'
|
6
|
-
|
7
|
-
require 'tc_config'
|
8
|
-
require 'tc_file'
|
9
|
-
require 'tc_fileinfo'
|
10
|
-
require 'tc_imodule'
|
11
|
-
require 'tc_iplugin'
|
12
|
-
require 'tc_parser'
|
13
|
-
require 'tc_string'
|
14
|
-
|
15
|
-
TEST_CONF_FILE = File.dirname(__FILE__) << '/features/test_absrenamer.conf'
|
16
|
-
|
17
|
-
class TS_AbsoluteRenamer
|
18
|
-
def self.suite
|
19
|
-
absrenamer_suite = Test::Unit::TestSuite.new
|
20
|
-
absrenamer_suite << TC_FileTest.suite
|
21
|
-
absrenamer_suite << TC_FileInfoTest.suite
|
22
|
-
absrenamer_suite << TS_IModuleTest.suite
|
23
|
-
absrenamer_suite << TS_IPluginTest.suite
|
24
|
-
absrenamer_suite << TS_ParserTest.suite
|
25
|
-
absrenamer_suite << TS_StringTest.suite
|
26
|
-
return absrenamer_suite
|
27
|
-
end
|
28
|
-
end
|