ebook_renamer 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +0 -2
- data/Guardfile +0 -2
- data/LICENSE +1 -1
- data/README.md +8 -8
- data/TODOs.md +3 -0
- data/ebook_renamer.gemspec +20 -22
- data/lib/ebook_renamer.rb +1 -0
- data/lib/ebook_renamer/cli.rb +9 -2
- data/lib/ebook_renamer/helper.rb +6 -4
- data/lib/ebook_renamer/version.rb +1 -1
- metadata +39 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e424aaf924da59dd5d6b1d753190e5ca6620c843
|
4
|
+
data.tar.gz: 493c6f7a8516d592b5eff936949d8275d0483e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 598d4d1a58f1b5ba9e4e9d7bf7bd6d9d13a08fe715ec1a9eddfe5949b60423dc022ad81a6550300ea2456f2db80eef5edf92ec9e0d64dd1d35864a7addd88462
|
7
|
+
data.tar.gz: 6adfee3ab04652a9f403424c7030fc63ff89f023325484816a610cd51e02677a088901949ad198b59d32a11fb6cb00aef1854e20c3a9d842b623753933d26d1e
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.1
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# A sample Guardfile
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
guard 'minitest' do
|
4
|
-
|
5
4
|
# with Minitest::Unit
|
6
5
|
watch(%r|^test/(.*)\/?test_(.*)\.rb|)
|
7
6
|
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
@@ -11,5 +10,4 @@ guard 'minitest' do
|
|
11
10
|
# watch(%r|^spec/(.*)_spec\.rb|)
|
12
11
|
# watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
13
12
|
# watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
14
|
-
|
15
13
|
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -154,31 +154,28 @@ Rename multiple ebook files (pdf,epub,mobi)
|
|
154
154
|
|
155
155
|
### Changelog
|
156
156
|
|
157
|
-
#### 0.1.
|
157
|
+
#### 0.1.2
|
158
|
+
- Make use of [agile_utils] gem
|
159
|
+
- Add TODOs.md
|
158
160
|
|
159
|
-
|
160
|
-
-
|
161
|
+
#### 0.1.1
|
162
|
+
- Make use of the [code_lister][] gem
|
161
163
|
|
162
164
|
#### 0.1.0
|
163
|
-
|
164
165
|
- Add link to the version badge to link to latest gem.
|
165
166
|
- Implicitly set the default value for extension to `pdf,epub,mobi` if
|
166
167
|
not explicitly set by the user at the command line.
|
167
168
|
|
168
169
|
#### 0.0.9
|
169
|
-
|
170
170
|
- Make sure the gemspec include the proper dependencies.
|
171
171
|
|
172
172
|
#### 0.0.8
|
173
|
-
|
174
173
|
- Use Thor instead of OptionParser for parsing of options
|
175
174
|
|
176
175
|
#### 0.0.2 - 0.0.7
|
177
|
-
|
178
176
|
- Improvement of code and fix a few bugs a long the way
|
179
177
|
|
180
178
|
#### 0.0.1
|
181
|
-
|
182
179
|
- Initial release
|
183
180
|
|
184
181
|
### Contributing
|
@@ -189,3 +186,6 @@ Rename multiple ebook files (pdf,epub,mobi)
|
|
189
186
|
4. Make sure that you add the tests and ensure that all tests are passed
|
190
187
|
5. Push to the branch (`git push origin my-new-feature`)
|
191
188
|
6. Create new Pull Request
|
189
|
+
|
190
|
+
[agile_utils]: https://rubygems.org/gems/agile_utils
|
191
|
+
[code_lister]: https://rubygems.org/gems/code_lister
|
data/TODOs.md
ADDED
data/ebook_renamer.gemspec
CHANGED
@@ -4,30 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'ebook_renamer/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'ebook_renamer'
|
8
8
|
spec.version = EbookRenamer::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.description = %q{Bulk rename of ebook files (pdf, epub, mobi) based on embedded
|
12
|
-
spec.summary = %q{Rename multiple ebook files (pdf, epub, mobi) based on existing
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['Burin Choomnuan']
|
10
|
+
spec.email = ['agilecreativity@gmail.com']
|
11
|
+
spec.description = %q{Bulk rename of ebook files (pdf, epub, mobi) based on embedded metadata}
|
12
|
+
spec.summary = %q{Rename multiple ebook files (pdf, epub, mobi) based on existing metadata if available}
|
13
|
+
spec.homepage = 'https://github.com/agilecreativity/ebook_renamer'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
spec.files = `git ls-files`.split($/)
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = [
|
19
|
-
|
20
|
-
spec.add_runtime_dependency
|
21
|
-
spec.
|
22
|
-
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency "gem-ctags", "~> 1.0"
|
32
|
-
spec.add_development_dependency "yard", "~> 0.8"
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
spec.add_runtime_dependency 'thor', '~> 0.18'
|
20
|
+
spec.add_runtime_dependency 'code_lister', '~> 0.0.7'
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
24
|
+
spec.add_development_dependency 'minitest-spec-context', '~> 0.0.3'
|
25
|
+
spec.add_development_dependency 'guard-minitest', '~> 2.2'
|
26
|
+
spec.add_development_dependency 'minitest', '~> 4.2'
|
27
|
+
spec.add_development_dependency 'guard', '~> 2.6'
|
28
|
+
spec.add_development_dependency 'pry', '~> 0.9'
|
29
|
+
spec.add_development_dependency 'gem-ctags', '~> 1.0'
|
30
|
+
spec.add_development_dependency 'yard', '~> 0.8'
|
33
31
|
end
|
data/lib/ebook_renamer.rb
CHANGED
data/lib/ebook_renamer/cli.rb
CHANGED
@@ -2,10 +2,17 @@ require 'code_lister'
|
|
2
2
|
require_relative '../ebook_renamer'
|
3
3
|
|
4
4
|
module EbookRenamer
|
5
|
-
class CLI <
|
5
|
+
class CLI < Thor
|
6
6
|
desc 'rename', 'Rename multiple ebook files (pdf,epub,mobi)'
|
7
7
|
|
8
|
-
|
8
|
+
method_option *AgileUtils::Options::BASE_DIR
|
9
|
+
method_option *AgileUtils::Options::EXTS
|
10
|
+
method_option *AgileUtils::Options::NON_EXTS
|
11
|
+
method_option *AgileUtils::Options::INC_WORDS
|
12
|
+
method_option *AgileUtils::Options::EXC_WORDS
|
13
|
+
method_option *AgileUtils::Options::IGNORE_CASE
|
14
|
+
method_option *AgileUtils::Options::RECURSIVE
|
15
|
+
method_option *AgileUtils::Options::VERSION
|
9
16
|
|
10
17
|
method_option :sep_string,
|
11
18
|
aliases: "-s",
|
data/lib/ebook_renamer/helper.rb
CHANGED
@@ -63,7 +63,7 @@ module EbookRenamer
|
|
63
63
|
filename.gsub!(/[^0-9A-Za-z\-_ ]/, dot)
|
64
64
|
|
65
65
|
# replace multiple occurrences of a given char with a dot
|
66
|
-
['-','_',' '].each do |c|
|
66
|
+
['-', '_', ' '].each do |c|
|
67
67
|
filename.gsub!(/#{Regexp.quote(c)}+/, dot)
|
68
68
|
end
|
69
69
|
|
@@ -112,8 +112,10 @@ module EbookRenamer
|
|
112
112
|
|
113
113
|
# The keys that we get from the 'mdls' or 'exiftool'
|
114
114
|
args = {
|
115
|
-
keys: [
|
116
|
-
|
115
|
+
keys: [
|
116
|
+
'title',
|
117
|
+
'author(s)'
|
118
|
+
],
|
117
119
|
sep_char: ' '
|
118
120
|
}.merge(fields)
|
119
121
|
|
@@ -133,7 +135,7 @@ module EbookRenamer
|
|
133
135
|
return result.join(sep_char)
|
134
136
|
end
|
135
137
|
# Note: if no title we choose to return empty value for result
|
136
|
-
|
138
|
+
""
|
137
139
|
end
|
138
140
|
|
139
141
|
# Ensure that the values in hash are sanitized
|
metadata
CHANGED
@@ -1,184 +1,184 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebook_renamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burin Choomnuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.18'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.18'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: code_lister
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: awesome_print
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.2'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest-spec-context
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.0.3
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.0.3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: guard-minitest
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '2.2'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.2'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '4.2'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '4.2'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: guard
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '2.6'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '2.6'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: pry
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0.9'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.9'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: gem-ctags
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - ~>
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '1.0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - ~>
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '1.0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: yard
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - ~>
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0.8'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - ~>
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0.8'
|
181
|
-
description: Bulk rename of ebook files (pdf, epub, mobi) based on embedded
|
181
|
+
description: Bulk rename of ebook files (pdf, epub, mobi) based on embedded metadata
|
182
182
|
email:
|
183
183
|
- agilecreativity@gmail.com
|
184
184
|
executables:
|
@@ -186,15 +186,16 @@ executables:
|
|
186
186
|
extensions: []
|
187
187
|
extra_rdoc_files: []
|
188
188
|
files:
|
189
|
-
- .gitignore
|
190
|
-
- .ruby-version
|
191
|
-
- .travis.yml
|
192
|
-
- .yardopts
|
189
|
+
- ".gitignore"
|
190
|
+
- ".ruby-version"
|
191
|
+
- ".travis.yml"
|
192
|
+
- ".yardopts"
|
193
193
|
- Gemfile
|
194
194
|
- Guardfile
|
195
195
|
- LICENSE
|
196
196
|
- README.md
|
197
197
|
- Rakefile
|
198
|
+
- TODOs.md
|
198
199
|
- bin/ebook_renamer
|
199
200
|
- ebook_renamer.gemspec
|
200
201
|
- lib/ebook_renamer.rb
|
@@ -219,21 +220,21 @@ require_paths:
|
|
219
220
|
- lib
|
220
221
|
required_ruby_version: !ruby/object:Gem::Requirement
|
221
222
|
requirements:
|
222
|
-
- -
|
223
|
+
- - ">="
|
223
224
|
- !ruby/object:Gem::Version
|
224
225
|
version: '0'
|
225
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
227
|
requirements:
|
227
|
-
- -
|
228
|
+
- - ">="
|
228
229
|
- !ruby/object:Gem::Version
|
229
230
|
version: '0'
|
230
231
|
requirements: []
|
231
232
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
233
|
+
rubygems_version: 2.2.2
|
233
234
|
signing_key:
|
234
235
|
specification_version: 4
|
235
|
-
summary: Rename multiple ebook files (pdf, epub, mobi) based on existing
|
236
|
-
|
236
|
+
summary: Rename multiple ebook files (pdf, epub, mobi) based on existing metadata
|
237
|
+
if available
|
237
238
|
test_files:
|
238
239
|
- test/fixtures/ebooks/demo1.pdf
|
239
240
|
- test/fixtures/ebooks/demo2.epub
|