serienrenamer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +0 -1
- data/Rakefile +2 -1
- data/bin/serienrenamer +8 -0
- data/lib/serienrenamer.rb +1 -30
- data/serienrenamer.gemspec +11 -8
- metadata +21 -8
- data/.gemtest +0 -0
- data/test/test_hash.rb +0 -54
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -12,11 +12,12 @@ Hoe.plugin :newgem
|
|
12
12
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
13
|
$hoe = Hoe.spec 'serienrenamer' do
|
14
14
|
self.developer 'Philipp Boehm', 'philipp@i77i.de'
|
15
|
-
self.rubyforge_name
|
15
|
+
self.rubyforge_name = self.name
|
16
16
|
self.dependency('wlapi', '>= 0.8.4')
|
17
17
|
self.dependency('mediawiki-gateway', '>= 0.4.4')
|
18
18
|
self.dependency('mechanize', '>= 2.3')
|
19
19
|
self.dependency('highline', '>= 1.6.11')
|
20
|
+
self.dependency('hashconfig', '>= 0.0.1')
|
20
21
|
end
|
21
22
|
|
22
23
|
require 'newgem/tasks'
|
data/bin/serienrenamer
CHANGED
@@ -8,6 +8,8 @@ require 'serienrenamer'
|
|
8
8
|
require 'plugin'
|
9
9
|
require 'optparse'
|
10
10
|
require 'fileutils'
|
11
|
+
require 'hashconfig'
|
12
|
+
require 'yaml'
|
11
13
|
require "highline/system_extensions"
|
12
14
|
include HighLine::SystemExtensions
|
13
15
|
|
@@ -63,6 +65,12 @@ opts.on( "-a", "--[no-]all",
|
|
63
65
|
options[:process_all_files] = opt
|
64
66
|
end
|
65
67
|
|
68
|
+
opts.on( "--showconfig", "Prints the current configuration.") do |opt|
|
69
|
+
puts "loaded configuration options:"
|
70
|
+
puts config.to_yaml
|
71
|
+
exit(0)
|
72
|
+
end
|
73
|
+
|
66
74
|
opts.on( "-v", "--version",
|
67
75
|
"Prints the version number.") do |opt|
|
68
76
|
puts Serienrenamer::VERSION
|
data/lib/serienrenamer.rb
CHANGED
@@ -3,7 +3,7 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
3
3
|
|
4
4
|
|
5
5
|
module Serienrenamer
|
6
|
-
VERSION = '0.0.
|
6
|
+
VERSION = '0.0.7'
|
7
7
|
|
8
8
|
require 'serienrenamer/episode.rb'
|
9
9
|
require 'serienrenamer/information_store.rb'
|
@@ -25,33 +25,4 @@ module Serienrenamer
|
|
25
25
|
self.plugin_name
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
29
|
-
# reopening Hash class and added a persistence method
|
30
|
-
require 'yaml'
|
31
|
-
|
32
|
-
class ::Hash
|
33
|
-
|
34
|
-
# this method merges a YAML-serialized hash-instance
|
35
|
-
# with self. if the given File is not exisiting this will write
|
36
|
-
# a serialized version of self to this file.
|
37
|
-
#
|
38
|
-
# if the given yaml file does not contain a serialized hash than it
|
39
|
-
# merges with an empty hash that returns self unchanged.
|
40
|
-
#
|
41
|
-
# returns a new Hash merged with deserialized version from the file
|
42
|
-
def merge_with_serialized(yaml_file)
|
43
|
-
|
44
|
-
unless File.file? yaml_file
|
45
|
-
File.open(yaml_file, 'w') {|f| f.write(self.to_yaml) }
|
46
|
-
end
|
47
|
-
|
48
|
-
persistent_config = YAML.load(File.new(yaml_file, "rb").read)
|
49
|
-
persistent_config = Hash.new unless persistent_config.is_a? Hash
|
50
|
-
|
51
|
-
config = self.merge(persistent_config)
|
52
|
-
File.open(yaml_file, 'w') {|f| f.write(config.to_yaml) }
|
53
|
-
|
54
|
-
return config
|
55
|
-
end
|
56
|
-
end
|
57
28
|
end
|
data/serienrenamer.gemspec
CHANGED
@@ -2,23 +2,23 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "serienrenamer"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.7"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Philipp Boehm"]
|
9
|
-
s.date = "2012-03-
|
9
|
+
s.date = "2012-03-23"
|
10
10
|
s.description = "Ruby Script that brings your series into an appropriate format\nlike \"S01E01 - Episodename.avi\""
|
11
11
|
s.email = ["philipp@i77i.de"]
|
12
12
|
s.executables = ["serienrenamer"]
|
13
13
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
|
14
|
-
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "bin/serienrenamer", "lib/plugin.rb", "lib/plugin/serienjunkies_de.rb", "lib/plugin/serienjunkies_feed.rb", "lib/plugin/textfile.rb", "lib/plugin/wikipedia.rb", "lib/serienrenamer.rb", "lib/serienrenamer/episode.rb", "script/console", "script/destroy", "script/generate", "serienrenamer.gemspec", "test/serienjunkies_feed_sample.xml", "test/test_episode.rb", "test/test_helper.rb", "test/
|
14
|
+
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "bin/serienrenamer", "lib/plugin.rb", "lib/plugin/serienjunkies_de.rb", "lib/plugin/serienjunkies_feed.rb", "lib/plugin/textfile.rb", "lib/plugin/wikipedia.rb", "lib/serienrenamer.rb", "lib/serienrenamer/episode.rb", "lib/serienrenamer/information_store.rb", "script/console", "script/destroy", "script/generate", "serienrenamer.gemspec", "test/serienjunkies_feed_sample.xml", "test/test_episode.rb", "test/test_helper.rb", "test/test_information_store.rb", "test/test_plugin_serienjunkies_de.rb", "test/test_plugin_serienjunkies_feed.rb", "test/test_plugin_textfile.rb", "test/test_plugin_wikipedia.rb"]
|
15
15
|
s.homepage = "http://github.com/pboehm/serienrenamer"
|
16
16
|
s.rdoc_options = ["--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = "serienrenamer"
|
19
|
-
s.rubygems_version = "1.8.
|
19
|
+
s.rubygems_version = "1.8.19"
|
20
20
|
s.summary = "Ruby Script that brings your series into an appropriate format like \"S01E01 - Episodename.avi\""
|
21
|
-
s.test_files = ["test/test_plugin_serienjunkies_de.rb", "test/test_plugin_wikipedia.rb", "test/test_plugin_serienjunkies_feed.rb", "test/test_plugin_textfile.rb", "test/test_helper.rb", "test/test_episode.rb"]
|
21
|
+
s.test_files = ["test/test_plugin_serienjunkies_de.rb", "test/test_information_store.rb", "test/test_plugin_wikipedia.rb", "test/test_plugin_serienjunkies_feed.rb", "test/test_plugin_textfile.rb", "test/test_helper.rb", "test/test_episode.rb"]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
s.specification_version = 3
|
@@ -28,25 +28,28 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_runtime_dependency(%q<mediawiki-gateway>, [">= 0.4.4"])
|
29
29
|
s.add_runtime_dependency(%q<mechanize>, [">= 2.3"])
|
30
30
|
s.add_runtime_dependency(%q<highline>, [">= 1.6.11"])
|
31
|
+
s.add_runtime_dependency(%q<hashconfig>, [">= 0.0.1"])
|
31
32
|
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
32
33
|
s.add_development_dependency(%q<newgem>, [">= 1.5.3"])
|
33
|
-
s.add_development_dependency(%q<hoe>, ["~>
|
34
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.0"])
|
34
35
|
else
|
35
36
|
s.add_dependency(%q<wlapi>, [">= 0.8.4"])
|
36
37
|
s.add_dependency(%q<mediawiki-gateway>, [">= 0.4.4"])
|
37
38
|
s.add_dependency(%q<mechanize>, [">= 2.3"])
|
38
39
|
s.add_dependency(%q<highline>, [">= 1.6.11"])
|
40
|
+
s.add_dependency(%q<hashconfig>, [">= 0.0.1"])
|
39
41
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
40
42
|
s.add_dependency(%q<newgem>, [">= 1.5.3"])
|
41
|
-
s.add_dependency(%q<hoe>, ["~>
|
43
|
+
s.add_dependency(%q<hoe>, ["~> 3.0"])
|
42
44
|
end
|
43
45
|
else
|
44
46
|
s.add_dependency(%q<wlapi>, [">= 0.8.4"])
|
45
47
|
s.add_dependency(%q<mediawiki-gateway>, [">= 0.4.4"])
|
46
48
|
s.add_dependency(%q<mechanize>, [">= 2.3"])
|
47
49
|
s.add_dependency(%q<highline>, [">= 1.6.11"])
|
50
|
+
s.add_dependency(%q<hashconfig>, [">= 0.0.1"])
|
48
51
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
49
52
|
s.add_dependency(%q<newgem>, [">= 1.5.3"])
|
50
|
-
s.add_dependency(%q<hoe>, ["~>
|
53
|
+
s.add_dependency(%q<hoe>, ["~> 3.0"])
|
51
54
|
end
|
52
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serienrenamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: wlapi
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 1.6.11
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: hashconfig
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.0.1
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.0.1
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
95
|
name: rdoc
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +130,7 @@ dependencies:
|
|
114
130
|
requirements:
|
115
131
|
- - ~>
|
116
132
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
133
|
+
version: '3.0'
|
118
134
|
type: :development
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,7 +138,7 @@ dependencies:
|
|
122
138
|
requirements:
|
123
139
|
- - ~>
|
124
140
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
141
|
+
version: '3.0'
|
126
142
|
description: ! 'Ruby Script that brings your series into an appropriate format
|
127
143
|
|
128
144
|
like "S01E01 - Episodename.avi"'
|
@@ -155,14 +171,12 @@ files:
|
|
155
171
|
- serienrenamer.gemspec
|
156
172
|
- test/serienjunkies_feed_sample.xml
|
157
173
|
- test/test_episode.rb
|
158
|
-
- test/test_hash.rb
|
159
174
|
- test/test_helper.rb
|
160
175
|
- test/test_information_store.rb
|
161
176
|
- test/test_plugin_serienjunkies_de.rb
|
162
177
|
- test/test_plugin_serienjunkies_feed.rb
|
163
178
|
- test/test_plugin_textfile.rb
|
164
179
|
- test/test_plugin_wikipedia.rb
|
165
|
-
- .gemtest
|
166
180
|
homepage: http://github.com/pboehm/serienrenamer
|
167
181
|
licenses: []
|
168
182
|
post_install_message:
|
@@ -185,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
199
|
version: '0'
|
186
200
|
requirements: []
|
187
201
|
rubyforge_project: serienrenamer
|
188
|
-
rubygems_version: 1.8.
|
202
|
+
rubygems_version: 1.8.21
|
189
203
|
signing_key:
|
190
204
|
specification_version: 3
|
191
205
|
summary: Ruby Script that brings your series into an appropriate format like "S01E01
|
@@ -198,4 +212,3 @@ test_files:
|
|
198
212
|
- test/test_plugin_textfile.rb
|
199
213
|
- test/test_helper.rb
|
200
214
|
- test/test_episode.rb
|
201
|
-
- test/test_hash.rb
|
data/.gemtest
DELETED
File without changes
|
data/test/test_hash.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
# test class for the merge_with_serialized option of the Hash class
|
6
|
-
# which is added to the class of the standard library
|
7
|
-
class TestHash < Test::Unit::TestCase
|
8
|
-
|
9
|
-
@@TEST_DATA = {
|
10
|
-
:first => "first parameter",
|
11
|
-
:second => "second parameter",
|
12
|
-
:third => "third parameter"
|
13
|
-
}
|
14
|
-
|
15
|
-
@@TEST_CONFIG_FILE =
|
16
|
-
File.join(TestHelper::TESTFILE_DIRECTORY, "config.yml")
|
17
|
-
@@TEST_EMPTY_CONFIG_FILE =
|
18
|
-
File.join(TestHelper::TESTFILE_DIRECTORY, "empty.yml")
|
19
|
-
@@TEST_INVALID_CONFIG_FILE =
|
20
|
-
File.join(TestHelper::TESTFILE_DIRECTORY, "invalid.yml")
|
21
|
-
@@TEST_NOT_EXISTING =
|
22
|
-
File.join(TestHelper::TESTFILE_DIRECTORY, "not_exisiting.yml")
|
23
|
-
|
24
|
-
def setup
|
25
|
-
TestHelper.create_test_files([])
|
26
|
-
@modified = @@TEST_DATA.merge({:third => "modified third parameter"})
|
27
|
-
|
28
|
-
File.open(@@TEST_CONFIG_FILE, 'w') {|f| f.write(@modified.to_yaml) }
|
29
|
-
File.open(@@TEST_EMPTY_CONFIG_FILE, 'w') {|f| f.write(Hash.new.to_yaml) }
|
30
|
-
File.open(@@TEST_EMPTY_CONFIG_FILE, 'w') {|f| f.write("invalid") }
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def teardown
|
35
|
-
TestHelper.clean
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_merge_valid_yaml_file
|
39
|
-
merged = @@TEST_DATA.merge_with_serialized(@@TEST_CONFIG_FILE)
|
40
|
-
assert_equal("modified third parameter", merged[:third])
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_merge_invalid_empty_and_not_exisiting_yaml_file
|
44
|
-
merged = @@TEST_DATA.merge_with_serialized(@@TEST_EMPTY_CONFIG_FILE)
|
45
|
-
assert_equal("third parameter", merged[:third])
|
46
|
-
|
47
|
-
merged = @@TEST_DATA.merge_with_serialized(@@TEST_INVALID_CONFIG_FILE)
|
48
|
-
assert_equal("third parameter", merged[:third])
|
49
|
-
|
50
|
-
merged = @@TEST_DATA.merge_with_serialized(@@TEST_NOT_EXISTING)
|
51
|
-
assert_equal("third parameter", merged[:third])
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|