AbsoluteRenamer 0.10.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,15 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
- # -*- encoding: utf-8 -*-
5
-
6
4
  Gem::Specification.new do |s|
7
5
  s.name = %q{AbsoluteRenamer}
8
- s.version = "0.10.1"
6
+ s.version = "1.0.0"
9
7
 
10
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
9
  s.authors = ["Simon COURTOIS"]
12
- s.date = %q{2009-10-01}
10
+ s.date = %q{2009-10-04}
13
11
  s.default_executable = %q{absrenamer}
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.}
12
+ s.description = %q{AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax. Unlike many batch renaming tools, AbsoluteRenamer is able to rename folders. AbsoluteRenamer is modular and can be extended to adapt itself to any kind of file or to add new options and features.}
17
13
  s.email = %q{happynoff@free.fr}
18
14
  s.executables = ["absrenamer"]
19
15
  s.extra_rdoc_files = [
@@ -32,14 +28,15 @@ Gem::Specification.new do |s|
32
28
  "conf/absrenamer/absrenamer.conf",
33
29
  "lib/absolute_renamer.rb",
34
30
  "lib/absolute_renamer/config.rb",
31
+ "lib/absolute_renamer/core-packages/core-case/module.rb",
32
+ "lib/absolute_renamer/core-packages/core-general/module.rb",
33
+ "lib/absolute_renamer/core-packages/core-general/parser.rb",
34
+ "lib/absolute_renamer/core-packages/core-interactive/parser.rb",
35
+ "lib/absolute_renamer/core-packages/core-interactive/plugin.rb",
36
+ "lib/absolute_renamer/core-packages/core-listing/parser.rb",
37
+ "lib/absolute_renamer/core-packages/core-listing/plugin.rb",
38
+ "lib/absolute_renamer/core-packages/core-packages.rb",
35
39
  "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
40
  "lib/absolute_renamer/file_info.rb",
44
41
  "lib/absolute_renamer/imodule.rb",
45
42
  "lib/absolute_renamer/iparser.rb",
@@ -61,30 +58,31 @@ Gem::Specification.new do |s|
61
58
  "test/string_test.rb",
62
59
  "test/test_helper.rb"
63
60
  ]
61
+ s.has_rdoc = true
64
62
  s.homepage = %q{http://github.com/simonc/AbsoluteRenamer}
65
63
  s.rdoc_options = ["--charset=UTF-8"]
66
64
  s.require_paths = ["lib"]
67
65
  s.rubyforge_project = %q{absrenamer}
68
- s.rubygems_version = %q{1.3.5}
66
+ s.rubygems_version = %q{1.2.0}
69
67
  s.summary = %q{AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax.}
70
68
  s.test_files = [
71
- "test/absolute_renamer_test.rb",
72
- "test/config_test.rb",
73
- "test/file_info_test.rb",
69
+ "test/string_test.rb",
74
70
  "test/file_test.rb",
71
+ "test/iplugin_test.rb",
72
+ "test/absolute_renamer_test.rb",
73
+ "test/test_helper.rb",
74
+ "test/config_test.rb",
75
75
  "test/hash_test.rb",
76
76
  "test/imodule_test.rb",
77
- "test/iplugin_test.rb",
78
77
  "test/parser_test.rb",
79
- "test/string_test.rb",
80
- "test/test_helper.rb"
78
+ "test/file_info_test.rb"
81
79
  ]
82
80
 
83
81
  if s.respond_to? :specification_version then
84
82
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
85
- s.specification_version = 3
83
+ s.specification_version = 2
86
84
 
87
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
85
+ if current_version >= 3 then
88
86
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
89
87
  else
90
88
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
data/Rakefile CHANGED
@@ -6,9 +6,9 @@ begin
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "AbsoluteRenamer"
8
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.}
9
+ gem.description = %Q{AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax. \
10
+ Unlike many batch renaming tools, AbsoluteRenamer is able to rename folders. \
11
+ AbsoluteRenamer is modular and can be extended to adapt itself to any kind of file or to add new options and features.}
12
12
  gem.email = "happynoff@free.fr"
13
13
  gem.homepage = "http://github.com/simonc/AbsoluteRenamer"
14
14
  gem.authors = ["Simon COURTOIS"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.1
1
+ 1.0.0
data/bin/absrenamer CHANGED
@@ -51,10 +51,10 @@ AbsoluteRenamer::Config.load(config_path)
51
51
  AbsoluteRenamer::Config.load(global_conf) if File.exists? global_conf
52
52
  AbsoluteRenamer::Config.load(custom_conf) if File.exists? custom_conf
53
53
 
54
- AbsoluteRenamer::Parser.parse_cmd_line
54
+ AbsoluteRenamer::External.load_gems
55
+ AbsoluteRenamer::External.load_core
55
56
 
56
- AbsoluteRenamer::External.load_modules
57
- AbsoluteRenamer::External.load_plugins
57
+ AbsoluteRenamer::Parser.parse_cmd_line
58
58
 
59
59
  AbsoluteRenamer::Processor.load_plugins
60
60
  AbsoluteRenamer::Processor.create_names_list
@@ -19,16 +19,3 @@
19
19
  # [^WORD_SEPARATOR]
20
20
  # Then, \W_ => [^\W_]
21
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
@@ -21,13 +21,13 @@ module AbsoluteRenamer
21
21
  # Returns a configuration value identified by +key+.
22
22
  # If +key+ is ignored, returns the +@conf+ hash.
23
23
  def get(key = nil)
24
- return @conf[key] if @conf.has_key?(key)
25
- return @conf
24
+ return @conf[key] if (key and @conf.has_key?(key))
25
+ return @conf if key.nil?
26
26
  end
27
27
 
28
28
  # Sets a configuration value in the +@conf+ variable.
29
29
  def set(key, value = '')
30
- @conf[key] = value
30
+ @conf[key] = value unless key.nil?
31
31
  end
32
32
 
33
33
  # Returns a configuration value identified by +key+.
@@ -0,0 +1,20 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ # CORE - Case
4
+
5
+ require 'core-case/module'
6
+
7
+ # CORE - General
8
+
9
+ require 'core-general/module'
10
+ require 'core-general/parser'
11
+
12
+ # CORE - Interactive
13
+
14
+ require 'core-interactive/parser'
15
+ require 'core-interactive/plugin'
16
+
17
+ # CORE - Listing
18
+
19
+ require 'core-listing/parser'
20
+ require 'core-listing/plugin'
@@ -2,55 +2,51 @@ require 'absolute_renamer/imodule'
2
2
  require 'absolute_renamer/iplugin'
3
3
  require 'absolute_renamer/use_config'
4
4
 
5
+ begin
6
+ require 'rubygems'
7
+ rescue LoadError
8
+ end
9
+
5
10
  module AbsoluteRenamer
6
- # Class in charge of loading +modules+ and +plugins+.
11
+ # Class in charge of loading external modules.
7
12
  class External
8
13
  class << self
9
14
  include AbsoluteRenamer::UseConfig
10
15
 
11
- # Loads the additional and core modules.
12
- # The modules list is get from the conf[:modules] variable.
13
- # The core modules are loaded after the additional ones.
14
- #
15
- # See also load
16
- def load_modules
17
- puts "[Loading modules]" if conf[:debug]
16
+ def load_gems
17
+ if Gem
18
+ @gems = {}
18
19
 
19
- modules = conf[:modules]
20
- load(modules, :modules, 'module.rb') unless modules.nil?
20
+ find_gems
21
+ find_gems_from_conf
21
22
 
22
- core_modules = ['case', 'general'].map! { |core_module| File.join('core', core_module) }
23
- load(core_modules, :modules, 'module.rb')
23
+ @gems.each do |gem_name, gem_infos|
24
+ gem gem_name, gem_infos[:version]
25
+ require gem_infos[:lib]
26
+ end
27
+ end
24
28
  end
25
29
 
26
- # Loads the plugins.
27
- # The plugins list is get from the conf[:plugins] variable.
28
- #
29
- # See also load
30
- def load_plugins
31
- puts "[Loading plugins]" if conf[:debug]
32
-
33
- load(conf[:plugins], :plugins, 'plugin.rb')
30
+ def find_gems
31
+ installed_gems = Gem.source_index.find_name(/.*AbsoluteRenamer-.*/).map(&:name).uniq || []
32
+ installed_gems.each do |gem_name|
33
+ @gems[gem_name] = { :lib => gem_name, :version => '>= 0' }
34
+ end
34
35
  end
35
36
 
36
- # Loads an external list (+modules+ or +plugins+)
37
- # externals: a list of +externals+ names to load.
38
- # type: a symbol defining which type of external to load
39
- # file: the filename to require to load the +externals+
40
- def load(externals, type, file)
41
- ext_dir = conf[:path][type]
42
-
43
- externals.each do |external|
44
- ext_to_load = File.join(ext_dir, external, file)
45
- begin
46
- if require ext_to_load
47
- puts "Loaded: #{ext_to_load}" if conf[:debug]
48
- end
49
- rescue LoadError => e
50
- STDERR.puts(e)
37
+ def find_gems_from_conf
38
+ if conf[:gems]
39
+ conf[:gems].each do |gem_name, gem_infos|
40
+ @gems[gem_name] = gem_infos ||= {}
41
+ @gems[gem_name][:lib] ||= gem_name
42
+ @gems[gem_name][:version] ||= ">= 0"
51
43
  end
52
44
  end
53
45
  end
46
+
47
+ def load_core
48
+ require 'absolute_renamer/core-packages/core-packages'
49
+ end
54
50
  end
55
51
  end
56
52
  end
@@ -13,24 +13,6 @@ module AbsoluteRenamer
13
13
  # The parsers are written in configuration files.
14
14
  # The core parsers are automaticaly added.
15
15
  def parse_cmd_line
16
- parsers_dir = conf[:path][:parsers]
17
- parsers = conf[:parsers]
18
-
19
- core_parsers = ['general']
20
-
21
- parsers += core_parsers.map! { |core_parser| File.join('core', core_parser) }
22
-
23
- parsers.each do |parser|
24
- parser_file = File.join(parsers_dir, parser, 'parser.rb')
25
- begin
26
- if require parser_file
27
- puts "Loaded: #{parser_file}" if conf[:debug]
28
- end
29
- rescue LoadError => e
30
- STDERR.puts(e)
31
- end
32
- end
33
-
34
16
  ARGV.options do |parser|
35
17
  begin
36
18
  list = AbsoluteRenamer::IParser.children
@@ -13,8 +13,11 @@ require 'absolute_renamer/use_config'
13
13
 
14
14
  # top level module of AbsoluteRenamer.
15
15
  module AbsoluteRenamer
16
- VERSION = "0.9.1"
17
-
16
+ version_file_path = File.join(File.dirname(__FILE__), '/../VERSION')
17
+ File.open(version_file_path) do |f|
18
+ VERSION = f.read
19
+ end
20
+
18
21
  # The main class of AbsoluteRenamer.
19
22
  #
20
23
  # Organizes the files and directories renaming process.
data/test/config_test.rb CHANGED
@@ -29,9 +29,9 @@ class ConfigTest < Test::Unit::TestCase
29
29
  assert_equal(:test_val, AbsoluteRenamer::Config.get(:test_key))
30
30
  end
31
31
 
32
- should "be able to set and get a config option with the nil key" do
32
+ should "return the whole configuration if the getting key is nil" do
33
33
  AbsoluteRenamer::Config.set(nil, :test_val)
34
- assert_equal(:test_val, AbsoluteRenamer::Config.get(nil))
34
+ assert_equal(AbsoluteRenamer::Config.get, AbsoluteRenamer::Config.get(nil))
35
35
  end
36
36
 
37
37
  should "be able to set config options using []" do
data/test/parser_test.rb CHANGED
@@ -3,9 +3,11 @@ require 'test_helper'
3
3
  class ParserTest < Test::Unit::TestCase
4
4
  context "A Parser instance" do
5
5
 
6
- context "with config file loaded and the -f'format' option set" do
6
+ context "with config file and core-externals loaded and the -f'format' option set" do
7
7
 
8
8
  setup do
9
+ AbsoluteRenamer::External.load_core
10
+
9
11
  AbsoluteRenamer::Config.load('conf/absrenamer/absrenamer.conf')
10
12
  ARGV << '-f'
11
13
  ARGV << 'format'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: AbsoluteRenamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon COURTOIS
@@ -9,12 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-01 00:00:00 +02:00
12
+ date: 2009-10-04 00:00:00 +02:00
13
13
  default_executable: absrenamer
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thoughtbot-shoulda
17
- type: :development
17
+ type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
@@ -22,10 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
- description: |-
26
- Unlike many batch renaming tools, AbsoluteRenamer is able to rename folders.
27
- AbsoluteRenamer is modular and can be extended to adapt itself to any kind of file
28
- or to add new options and features.
25
+ description: AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax. Unlike many batch renaming tools, AbsoluteRenamer is able to rename folders. AbsoluteRenamer is modular and can be extended to adapt itself to any kind of file or to add new options and features.
29
26
  email: happynoff@free.fr
30
27
  executables:
31
28
  - absrenamer
@@ -46,14 +43,15 @@ files:
46
43
  - conf/absrenamer/absrenamer.conf
47
44
  - lib/absolute_renamer.rb
48
45
  - lib/absolute_renamer/config.rb
46
+ - lib/absolute_renamer/core-packages/core-case/module.rb
47
+ - lib/absolute_renamer/core-packages/core-general/module.rb
48
+ - lib/absolute_renamer/core-packages/core-general/parser.rb
49
+ - lib/absolute_renamer/core-packages/core-interactive/parser.rb
50
+ - lib/absolute_renamer/core-packages/core-interactive/plugin.rb
51
+ - lib/absolute_renamer/core-packages/core-listing/parser.rb
52
+ - lib/absolute_renamer/core-packages/core-listing/plugin.rb
53
+ - lib/absolute_renamer/core-packages/core-packages.rb
49
54
  - lib/absolute_renamer/external.rb
50
- - lib/absolute_renamer/external/modules/core/case/module.rb
51
- - lib/absolute_renamer/external/modules/core/general/module.rb
52
- - lib/absolute_renamer/external/parsers/core/general/parser.rb
53
- - lib/absolute_renamer/external/parsers/interactive/parser.rb
54
- - lib/absolute_renamer/external/parsers/listing/parser.rb
55
- - lib/absolute_renamer/external/plugins/interactive/plugin.rb
56
- - lib/absolute_renamer/external/plugins/listing/plugin.rb
57
55
  - lib/absolute_renamer/file_info.rb
58
56
  - lib/absolute_renamer/imodule.rb
59
57
  - lib/absolute_renamer/iparser.rb
@@ -76,8 +74,6 @@ files:
76
74
  - test/test_helper.rb
77
75
  has_rdoc: true
78
76
  homepage: http://github.com/simonc/AbsoluteRenamer
79
- licenses: []
80
-
81
77
  post_install_message:
82
78
  rdoc_options:
83
79
  - --charset=UTF-8
@@ -98,18 +94,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
94
  requirements: []
99
95
 
100
96
  rubyforge_project: absrenamer
101
- rubygems_version: 1.3.5
97
+ rubygems_version: 1.2.0
102
98
  signing_key:
103
- specification_version: 3
99
+ specification_version: 2
104
100
  summary: AbsoluteRenamer is a very powerful tool that helps files and directories renaming using the Krename syntax.
105
101
  test_files:
102
+ - test/string_test.rb
103
+ - test/file_test.rb
104
+ - test/iplugin_test.rb
106
105
  - test/absolute_renamer_test.rb
106
+ - test/test_helper.rb
107
107
  - test/config_test.rb
108
- - test/file_info_test.rb
109
- - test/file_test.rb
110
108
  - test/hash_test.rb
111
109
  - test/imodule_test.rb
112
- - test/iplugin_test.rb
113
110
  - test/parser_test.rb
114
- - test/string_test.rb
115
- - test/test_helper.rb
111
+ - test/file_info_test.rb