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.
Files changed (52) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/AbsoluteRenamer.gemspec +63 -20
  4. data/LICENSE +20 -0
  5. data/README.rdoc +34 -0
  6. data/Rakefile +53 -15
  7. data/VERSION +1 -0
  8. data/conf/absrenamer/absrenamer.conf +0 -0
  9. data/lib/absolute_renamer.rb +1 -1
  10. data/lib/absolute_renamer/config.rb +0 -0
  11. data/lib/absolute_renamer/external.rb +0 -0
  12. data/lib/absolute_renamer/external/modules/core/case/module.rb +0 -0
  13. data/lib/absolute_renamer/external/modules/core/general/module.rb +0 -0
  14. data/lib/absolute_renamer/external/parsers/core/general/parser.rb +1 -1
  15. data/lib/absolute_renamer/external/parsers/interactive/parser.rb +0 -0
  16. data/lib/absolute_renamer/external/parsers/listing/parser.rb +0 -0
  17. data/lib/absolute_renamer/external/plugins/interactive/plugin.rb +0 -0
  18. data/lib/absolute_renamer/external/plugins/listing/plugin.rb +0 -0
  19. data/lib/absolute_renamer/file_info.rb +0 -0
  20. data/lib/absolute_renamer/imodule.rb +0 -0
  21. data/lib/absolute_renamer/iparser.rb +0 -0
  22. data/lib/absolute_renamer/iplugin.rb +0 -0
  23. data/lib/absolute_renamer/libs/file.rb +0 -0
  24. data/lib/absolute_renamer/libs/string.rb +0 -0
  25. data/lib/absolute_renamer/parser.rb +0 -0
  26. data/lib/absolute_renamer/use_config.rb +0 -0
  27. data/lib/absolute_renamer/with_children.rb +0 -0
  28. data/test/absolute_renamer_test.rb +7 -0
  29. data/test/config_test.rb +45 -0
  30. data/test/file_info_test.rb +71 -0
  31. data/test/file_test.rb +33 -0
  32. data/test/test_helper.rb +10 -0
  33. metadata +31 -46
  34. data/COPYING +0 -340
  35. data/ChangeLog +0 -7
  36. data/LICENCE +0 -17
  37. data/Manifest.txt +0 -42
  38. data/README +0 -34
  39. data/man/man8/absrenamer.8 +0 -67
  40. data/script/console +0 -10
  41. data/script/destroy +0 -14
  42. data/script/generate +0 -14
  43. data/setup.rb +0 -1585
  44. data/test/unit/features/test_absrenamer.conf +0 -34
  45. data/test/unit/tc_config.rb +0 -28
  46. data/test/unit/tc_file.rb +0 -16
  47. data/test/unit/tc_fileinfo.rb +0 -17
  48. data/test/unit/tc_imodule.rb +0 -29
  49. data/test/unit/tc_iplugin.rb +0 -8
  50. data/test/unit/tc_parser.rb +0 -13
  51. data/test/unit/tc_string.rb +0 -24
  52. data/test/unit/test_suite.rb +0 -28
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
@@ -1,40 +1,83 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{AbsoluteRenamer}
5
- s.version = "0.9.0"
8
+ s.version = "0.9.1"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Simon COURTOIS"]
9
- s.date = %q{2009-04-08}
12
+ s.date = %q{2009-09-22}
10
13
  s.default_executable = %q{absrenamer}
11
- s.description = %q{AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax. Documentation can be found at http://absrenamer.happynoff.fr}
12
- s.email = ["happynoff@free.fr"]
14
+ s.description = %q{Unlike many batch renaming tools, AbsoluteRenamer is able to rename folders.
15
+ AbsoluteRenamer is modular and can be extended to adapt itself to any kind of file
16
+ or to add new options and features.}
17
+ s.email = %q{happynoff@free.fr}
13
18
  s.executables = ["absrenamer"]
14
- s.extra_rdoc_files = ["Manifest.txt"]
15
- s.files = ["AbsoluteRenamer.gemspec", "COPYING", "ChangeLog", "LICENCE", "Manifest.txt", "README", "Rakefile", "bin/absrenamer", "conf/absrenamer/absrenamer.conf", "lib/absolute_renamer.rb", "lib/absolute_renamer/config.rb", "lib/absolute_renamer/external.rb", "lib/absolute_renamer/external/modules/core/case/module.rb", "lib/absolute_renamer/external/modules/core/general/module.rb", "lib/absolute_renamer/external/parsers/core/general/parser.rb", "lib/absolute_renamer/external/parsers/interactive/parser.rb", "lib/absolute_renamer/external/parsers/listing/parser.rb", "lib/absolute_renamer/external/plugins/interactive/plugin.rb", "lib/absolute_renamer/external/plugins/listing/plugin.rb", "lib/absolute_renamer/file_info.rb", "lib/absolute_renamer/imodule.rb", "lib/absolute_renamer/iparser.rb", "lib/absolute_renamer/iplugin.rb", "lib/absolute_renamer/libs/file.rb", "lib/absolute_renamer/libs/string.rb", "lib/absolute_renamer/parser.rb", "lib/absolute_renamer/use_config.rb", "lib/absolute_renamer/with_children.rb", "man/man8/absrenamer.8", "script/console", "script/destroy", "script/generate", "setup.rb", "test/unit/features/test_absrenamer.conf", "test/unit/tc_config.rb", "test/unit/tc_file.rb", "test/unit/tc_fileinfo.rb", "test/unit/tc_imodule.rb", "test/unit/tc_iplugin.rb", "test/unit/tc_parser.rb", "test/unit/tc_string.rb", "test/unit/test_suite.rb"]
16
- s.has_rdoc = true
17
- s.homepage = %q{http://absrenamer.happynoff.fr}
18
- s.rdoc_options = ["--main", "README"]
19
+ s.extra_rdoc_files = [
20
+ "LICENSE",
21
+ "README.rdoc"
22
+ ]
23
+ s.files = [
24
+ ".document",
25
+ ".gitignore",
26
+ "AbsoluteRenamer.gemspec",
27
+ "LICENSE",
28
+ "README.rdoc",
29
+ "Rakefile",
30
+ "VERSION",
31
+ "bin/absrenamer",
32
+ "conf/absrenamer/absrenamer.conf",
33
+ "lib/absolute_renamer.rb",
34
+ "lib/absolute_renamer/config.rb",
35
+ "lib/absolute_renamer/external.rb",
36
+ "lib/absolute_renamer/external/modules/core/case/module.rb",
37
+ "lib/absolute_renamer/external/modules/core/general/module.rb",
38
+ "lib/absolute_renamer/external/parsers/core/general/parser.rb",
39
+ "lib/absolute_renamer/external/parsers/interactive/parser.rb",
40
+ "lib/absolute_renamer/external/parsers/listing/parser.rb",
41
+ "lib/absolute_renamer/external/plugins/interactive/plugin.rb",
42
+ "lib/absolute_renamer/external/plugins/listing/plugin.rb",
43
+ "lib/absolute_renamer/file_info.rb",
44
+ "lib/absolute_renamer/imodule.rb",
45
+ "lib/absolute_renamer/iparser.rb",
46
+ "lib/absolute_renamer/iplugin.rb",
47
+ "lib/absolute_renamer/libs/file.rb",
48
+ "lib/absolute_renamer/libs/string.rb",
49
+ "lib/absolute_renamer/parser.rb",
50
+ "lib/absolute_renamer/use_config.rb",
51
+ "lib/absolute_renamer/with_children.rb",
52
+ "test/absolute_renamer_test.rb",
53
+ "test/config_test.rb",
54
+ "test/file_info_test.rb",
55
+ "test/file_test.rb",
56
+ "test/test_helper.rb"
57
+ ]
58
+ s.homepage = %q{http://github.com/simonc/AbsoluteRenamer}
59
+ s.rdoc_options = ["--charset=UTF-8"]
19
60
  s.require_paths = ["lib"]
20
- s.rubyforge_project = %q{AbsoluteRenamer}
21
- s.rubygems_version = %q{1.3.1}
22
- s.summary = %q{AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax}
23
- s.test_files = ["test/unit/test_suite.rb"]
61
+ s.rubygems_version = %q{1.3.5}
62
+ s.summary = %q{AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax.}
63
+ s.test_files = [
64
+ "test/absolute_renamer_test.rb",
65
+ "test/config_test.rb",
66
+ "test/file_info_test.rb",
67
+ "test/file_test.rb",
68
+ "test/test_helper.rb"
69
+ ]
24
70
 
25
71
  if s.respond_to? :specification_version then
26
72
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
27
- s.specification_version = 2
73
+ s.specification_version = 3
28
74
 
29
75
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
30
- s.add_development_dependency(%q<newgem>, [">= 1.3.0"])
31
- s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
76
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
32
77
  else
33
- s.add_dependency(%q<newgem>, [">= 1.3.0"])
34
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
78
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
35
79
  end
36
80
  else
37
- s.add_dependency(%q<newgem>, [">= 1.3.0"])
38
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
81
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
39
82
  end
40
83
  end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Simon COURTOIS
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,34 @@
1
+ = AbsoluteRenamer
2
+
3
+ AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax.
4
+
5
+ = SYNOPSIS:
6
+
7
+ absrenamer[OPTION]... [FILE]...
8
+
9
+ absrenamer-f 'photo_##' -x '%' IMG*.JPG
10
+
11
+ = REQUIREMENTS:
12
+
13
+ * Ruby >= 1.8.7 (earlier releases will not work)
14
+
15
+ = INSTALL:
16
+
17
+ You can simply install AbsoluteRenamer with gem :
18
+
19
+ sudo gem install simonc-AbsoluteRenamer
20
+
21
+ == Note on Patches/Pull Requests
22
+
23
+ * Fork the project.
24
+ * Make your feature addition or bug fix.
25
+ * Add tests for it. This is important so I don't break it in a
26
+ future version unintentionally.
27
+ * Commit, do not mess with rakefile, version, or history.
28
+ (if you want to have your own version, that is fine but
29
+ bump version in a commit by itself I can ignore when I pull)
30
+ * Send me a pull request. Bonus points for topic branches.
31
+
32
+ == Copyright
33
+
34
+ Copyright (c) 2009 Simon COURTOIS. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,20 +1,58 @@
1
- %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
- require File.dirname(__FILE__) + '/lib/absolute_renamer'
1
+ require 'rubygems'
2
+ require 'rake'
3
3
 
4
- $hoe = Hoe.new('AbsoluteRenamer', AbsoluteRenamer::VERSION) do |p|
5
- p.developer('Simon COURTOIS', 'happynoff@free.fr')
6
- p.changes = p.paragraphs_of("ChangeLog", 0..1).join("\n\n")
7
- p.rubyforge_name = p.name
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "AbsoluteRenamer"
8
+ gem.summary = %Q{AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax.}
9
+ gem.description = %Q{Unlike many batch renaming tools, AbsoluteRenamer is able to rename folders.
10
+ AbsoluteRenamer is modular and can be extended to adapt itself to any kind of file
11
+ or to add new options and features.}
12
+ gem.email = "happynoff@free.fr"
13
+ gem.homepage = "http://github.com/simonc/AbsoluteRenamer"
14
+ gem.authors = ["Simon COURTOIS"]
15
+ gem.add_development_dependency "thoughtbot-shoulda"
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
+ end
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
20
+ end
8
21
 
9
- p.extra_dev_deps = [
10
- ['newgem', ">= #{::Newgem::VERSION}"]
11
- ]
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/*_test.rb'
26
+ test.verbose = true
27
+ end
12
28
 
13
- p.clean_globs |= %w[**/.DS_Store tmp *.log]
14
- path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
15
- p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
16
- p.rsync_args = '-av --delete --ignore-errors'
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/*_test.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
17
40
  end
18
41
 
19
- require 'newgem/tasks' # load /tasks/*.rake
20
- Dir['tasks/**/*.rake'].each { |t| load t }
42
+ task :test => :check_dependencies
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ if File.exist?('VERSION')
49
+ version = File.read('VERSION')
50
+ else
51
+ version = ""
52
+ end
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "AbsoluteRenamer #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.9.1
File without changes
@@ -12,7 +12,7 @@ require 'absolute_renamer/use_config'
12
12
 
13
13
  # top level module of AbsoluteRenamer.
14
14
  module AbsoluteRenamer
15
- VERSION = "0.9.0.2"
15
+ VERSION = "0.9.1"
16
16
 
17
17
  # The main class of AbsoluteRenamer.
18
18
  #
File without changes
File without changes
@@ -9,7 +9,7 @@ module AbsoluteRenamer
9
9
  end
10
10
 
11
11
  parser.on('-r', '--replace PATTERN,REPLACEMENT', Array,
12
- 'String replacement ex:"pattern/replacement" ') do |data|
12
+ 'String replacement ex:"pattern,replacement" ') do |data|
13
13
  self.add_replacement(data, options)
14
14
  end
15
15
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class AbsoluterenamerTest < Test::Unit::TestCase
4
+ should "be true" do
5
+ assert true
6
+ end
7
+ end
@@ -0,0 +1,45 @@
1
+ require 'test_helper'
2
+
3
+ class ConfigTest < Test::Unit::TestCase
4
+ context "The Config instance" do
5
+
6
+ should "exist" do
7
+ assert_not_nil AbsoluteRenamer::Config
8
+ end
9
+
10
+ should "raise ENOENT if config file not found" do
11
+ assert_raise(Errno::ENOENT) do
12
+ AbsoluteRenamer::Config.load('a file that must not be found')
13
+ end
14
+ end
15
+
16
+ should "not raise ENOENT if config file is found" do
17
+ assert_nothing_raised(Errno::ENOENT) do
18
+ AbsoluteRenamer::Config.load('conf/absrenamer/absrenamer.conf')
19
+ end
20
+ end
21
+
22
+ context "with a loaded config file" do
23
+ setup do
24
+ AbsoluteRenamer::Config.load('conf/absrenamer/absrenamer.conf')
25
+ end
26
+
27
+ should "be able to set and get config options" do
28
+ AbsoluteRenamer::Config.set(:test_key, :test_val)
29
+ assert_equal(:test_val, AbsoluteRenamer::Config.get(:test_key))
30
+ end
31
+
32
+ should "be able to set and get a config option with the nil key" do
33
+ AbsoluteRenamer::Config.set(nil, :test_val)
34
+ assert_equal(:test_val, AbsoluteRenamer::Config.get(nil))
35
+ end
36
+
37
+ should "be able to set config options using []" do
38
+ AbsoluteRenamer::Config[:test_key] = :test_val
39
+ assert_equal(:test_val, AbsoluteRenamer::Config[:test_key])
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,71 @@
1
+ require 'test_helper'
2
+
3
+ class FileInfoTest < Test::Unit::TestCase
4
+ context "A FileInfo instance" do
5
+ context "loaded with some/path/to/a_file.txt" do
6
+
7
+ setup do
8
+ @pwd = Dir.pwd
9
+ @fileinfo = AbsoluteRenamer::FileInfo.new('some/path/to/a_file.txt')
10
+ end
11
+
12
+ should "have as name : a_file" do
13
+ assert_equal('a_file', @fileinfo.name)
14
+ end
15
+
16
+ should "have as dir_path : pwd/some/path/to" do
17
+ assert_equal(@pwd + '/some/path/to', @fileinfo.dir_path)
18
+ end
19
+
20
+ should "have as path : some/path/to/a_file.txt" do
21
+ assert_equal('some/path/to/a_file.txt', @fileinfo.path)
22
+ end
23
+
24
+ should "have as real_path : pwd/some/path/to/a_file.txt" do
25
+ assert_equal(@pwd + '/some/path/to/a_file.txt', @fileinfo.real_path)
26
+ end
27
+
28
+ should "have as ext : txt" do
29
+ assert_equal('txt', @fileinfo.ext)
30
+ end
31
+
32
+ should "have as dir : false" do
33
+ assert_equal(false, @fileinfo.dir)
34
+ end
35
+
36
+ end
37
+
38
+ context "loaded with lib/absolute_renamer" do
39
+
40
+ setup do
41
+ @pwd = Dir.pwd
42
+ @fileinfo = AbsoluteRenamer::FileInfo.new('lib/absolute_renamer')
43
+ end
44
+
45
+ should "have as name : absolute_renamer" do
46
+ assert_equal('absolute_renamer', @fileinfo.name)
47
+ end
48
+
49
+ should "have as dir_path : pwd/lib" do
50
+ assert_equal(@pwd + '/lib', @fileinfo.dir_path)
51
+ end
52
+
53
+ should "have as path : lib/absolute_renamer" do
54
+ assert_equal('lib/absolute_renamer', @fileinfo.path)
55
+ end
56
+
57
+ should "have as real_path : pwd/lib/absolute_renamer" do
58
+ assert_equal(@pwd + '/lib/absolute_renamer', @fileinfo.real_path)
59
+ end
60
+
61
+ should "have as ext : nil" do
62
+ assert_nil @fileinfo.ext
63
+ end
64
+
65
+ should "have as dir : true" do
66
+ assert_equal(true, @fileinfo.dir)
67
+ end
68
+
69
+ end
70
+ end
71
+ end