ebook_renamer 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +10 -3
- data/ebook_renamer.gemspec +8 -11
- data/lib/ebook_renamer.rb +9 -4
- data/lib/ebook_renamer/cli.rb +2 -8
- data/lib/ebook_renamer/ebook_renamer.rb +1 -7
- data/lib/ebook_renamer/errors.rb +5 -0
- data/lib/ebook_renamer/version.rb +1 -1
- metadata +19 -18
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -33,9 +33,9 @@ If the `--sep-string _` is used then the above output will be
|
|
33
33
|
### What you will need
|
34
34
|
|
35
35
|
- You will need to install [Calibre][] and
|
36
|
-
[Calibre CLI][] on your OS. Please download Calibre binary from [http://calibre-ebook.com/download]
|
36
|
+
[Calibre CLI][] on your OS. Please download Calibre binary from [http://calibre-ebook.com/download][]
|
37
37
|
|
38
|
-
Alternatively if Ubuntu
|
38
|
+
Alternatively if you are using Ubuntu try:
|
39
39
|
|
40
40
|
```shell
|
41
41
|
sudo apt-get install calibre calibre-bin
|
@@ -67,7 +67,7 @@ Options:
|
|
67
67
|
-r, [--recursive], [--no-recursive] # Search for files recursively
|
68
68
|
# Default: --recursive
|
69
69
|
-s, [--sep-string=SEP_STRING] # Separator string between each word in output filename
|
70
|
-
# Default: '
|
70
|
+
# Default: '_' (underscore)
|
71
71
|
-d, [--downcase], [--no-downcase] # Convert each word in the output filename to lowercase
|
72
72
|
# Default: --no-downcase
|
73
73
|
-t, [--capitalize], [--no-capitalize] # Capitalize each word in the output filename
|
@@ -178,6 +178,11 @@ ebook_renamer --base-dir . --sep-string '_' --recursive --capitalize --commit
|
|
178
178
|
|
179
179
|
will produce the result filename like `Start_With_Why_How_Great_Leader_Inspire_Everyone_To_Take_Action_by_Simon_Sinek.pdf`.
|
180
180
|
|
181
|
+
### Alternative
|
182
|
+
|
183
|
+
- Check out my other gem called [ebooks_renamer][] which provides similar functionality but implemented in pure ruby.
|
184
|
+
- [ebooks_renamer][] does not rely on the external software like [Calibre CLI][] to be install before use!
|
185
|
+
|
181
186
|
### Contributing
|
182
187
|
|
183
188
|
1. Fork it
|
@@ -189,4 +194,6 @@ will produce the result filename like `Start_With_Why_How_Great_Leader_Inspire_E
|
|
189
194
|
|
190
195
|
[Calibre]: http://www.calibre-ebook.com/
|
191
196
|
[Calibre CLI]: http://manual.calibre-ebook.com/cli/cli-index.html
|
197
|
+
[http://calibre-ebook.com/download]: http://calibre-ebook.com/download
|
198
|
+
[ebooks_renamer]: http://rubygems.org/gems/ebooks_renamer
|
192
199
|
[Semantic Versioning]: http://semver.org
|
data/ebook_renamer.gemspec
CHANGED
@@ -2,14 +2,13 @@
|
|
2
2
|
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require "ebook_renamer/version"
|
5
|
-
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "ebook_renamer"
|
8
7
|
spec.version = EbookRenamer::VERSION
|
9
8
|
spec.authors = ["Burin Choomnuan"]
|
10
9
|
spec.email = ["agilecreativity@gmail.com"]
|
11
10
|
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
|
11
|
+
spec.summary = %q{Rename multiple ebook files (pdf, epub, mobi) based on embedded metadata (if available)}
|
13
12
|
spec.homepage = "https://github.com/agilecreativity/ebook_renamer"
|
14
13
|
spec.license = "MIT"
|
15
14
|
spec.required_ruby_version = ">= 1.9.3"
|
@@ -24,21 +23,19 @@ Gem::Specification.new do |spec|
|
|
24
23
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
25
24
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
26
25
|
spec.require_paths = ["lib"]
|
27
|
-
|
28
26
|
spec.add_runtime_dependency "thor", "~> 0.19.1"
|
29
|
-
spec.add_runtime_dependency "agile_utils", "~> 0.2.
|
30
|
-
spec.add_runtime_dependency "code_lister", "~> 0.2.
|
31
|
-
spec.add_runtime_dependency "filename_cleaner", "~> 0.4.
|
32
|
-
|
33
|
-
spec.add_development_dependency "bundler", "~> 1.7.0"
|
27
|
+
spec.add_runtime_dependency "agile_utils", "~> 0.2.3"
|
28
|
+
spec.add_runtime_dependency "code_lister", "~> 0.2.4"
|
29
|
+
spec.add_runtime_dependency "filename_cleaner", "~> 0.4.6"
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.7.3"
|
34
31
|
spec.add_development_dependency "rake", "~> 10.3.2"
|
35
32
|
spec.add_development_dependency "awesome_print", "~> 1.2.0"
|
36
33
|
spec.add_development_dependency "minitest-spec-context", "~> 0.0.3"
|
37
34
|
spec.add_development_dependency "guard-minitest", "~> 2.3.1"
|
38
|
-
spec.add_development_dependency "minitest", "~> 5.4.
|
35
|
+
spec.add_development_dependency "minitest", "~> 5.4.2"
|
39
36
|
spec.add_development_dependency "guard", "~> 2.6.1"
|
40
|
-
spec.add_development_dependency "pry", "~> 0.10.
|
37
|
+
spec.add_development_dependency "pry", "~> 0.10.1"
|
41
38
|
spec.add_development_dependency "gem-ctags", "~> 1.0.6"
|
42
39
|
spec.add_development_dependency "yard", "~> 0.8.7"
|
43
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
40
|
+
spec.add_development_dependency "rubocop", "~> 0.26.1"
|
44
41
|
end
|
data/lib/ebook_renamer.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require "thor"
|
2
|
-
require "
|
2
|
+
require "open3"
|
3
|
+
require "fileutils"
|
4
|
+
require "shellwords"
|
3
5
|
require "agile_utils"
|
4
|
-
|
5
|
-
|
6
|
-
|
6
|
+
require "filename_cleaner"
|
7
|
+
require "code_lister"
|
8
|
+
require "ebook_renamer/version"
|
9
|
+
require "ebook_renamer/errors"
|
10
|
+
require "ebook_renamer/ebook_renamer"
|
11
|
+
require "ebook_renamer/cli"
|
data/lib/ebook_renamer/cli.rb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
require "agile_utils"
|
2
|
-
require "code_lister"
|
3
|
-
require "filename_cleaner"
|
4
|
-
require "fileutils"
|
5
|
-
require_relative "../ebook_renamer"
|
6
1
|
module EbookRenamer
|
7
2
|
class CLI < Thor
|
8
3
|
desc "rename", "Rename multiple ebook files (pdf,epub,mobi) from a given directory"
|
@@ -11,7 +6,7 @@ module EbookRenamer
|
|
11
6
|
method_option :sep_string,
|
12
7
|
aliases: "-s",
|
13
8
|
desc: "Separator string between each word in output filename",
|
14
|
-
default: "
|
9
|
+
default: "_"
|
15
10
|
method_option :downcase,
|
16
11
|
aliases: "-d",
|
17
12
|
type: :boolean,
|
@@ -42,7 +37,6 @@ module EbookRenamer
|
|
42
37
|
desc "usage", "Display help screen"
|
43
38
|
def usage
|
44
39
|
puts <<-EOS
|
45
|
-
|
46
40
|
Usage:
|
47
41
|
ebook_renamer
|
48
42
|
|
@@ -52,7 +46,7 @@ Options:
|
|
52
46
|
-r, [--recursive], [--no-recursive] # Search for files recursively
|
53
47
|
# Default: --recursive
|
54
48
|
-s, [--sep-string=SEP_STRING] # Separator string between each word in output filename
|
55
|
-
# Default: '
|
49
|
+
# Default: '_' (underscore)
|
56
50
|
-d, [--downcase], [--no-downcase] # Convert each word in the output filename to lowercase
|
57
51
|
# Default: --no-downcase
|
58
52
|
-t, [--capitalize], [--no-capitalize] # Capitalize each word in the output filename
|
@@ -1,17 +1,11 @@
|
|
1
|
-
require "open3"
|
2
|
-
require "fileutils"
|
3
|
-
require "shellwords"
|
4
|
-
require_relative "../ebook_renamer"
|
5
1
|
module EbookRenamer
|
6
|
-
EbookMetaNotInstall = Class.new(StandardError)
|
7
|
-
|
8
2
|
# Extract meta data from the input file using the ebook-meta tool
|
9
3
|
#
|
10
4
|
# @param [String] filename the input file name
|
11
5
|
# @param [String] binary the executable for use to extract the metadata
|
12
6
|
# @return [String] result of the output from running the command
|
13
7
|
def meta(filename, binary = "ebook-meta")
|
14
|
-
fail EbookMetaNotInstall, "Need to install ebook-meta to use this gem" if AgileUtils::Helper.which(binary).nil?
|
8
|
+
fail Errors::EbookMetaNotInstall, "Need to install ebook-meta to use this gem" if AgileUtils::Helper.which(binary).nil?
|
15
9
|
command = [
|
16
10
|
binary,
|
17
11
|
Shellwords.escape(filename)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebook_renamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
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: 2014-
|
12
|
+
date: 2014-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.2.
|
37
|
+
version: 0.2.3
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.2.
|
45
|
+
version: 0.2.3
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: code_lister
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.2.
|
53
|
+
version: 0.2.4
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.2.
|
61
|
+
version: 0.2.4
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: filename_cleaner
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.4.
|
69
|
+
version: 0.4.6
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.4.
|
77
|
+
version: 0.4.6
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: bundler
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.7.
|
85
|
+
version: 1.7.3
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.7.
|
93
|
+
version: 1.7.3
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: rake
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +162,7 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - ~>
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: 5.4.
|
165
|
+
version: 5.4.2
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,7 +170,7 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 5.4.
|
173
|
+
version: 5.4.2
|
174
174
|
- !ruby/object:Gem::Dependency
|
175
175
|
name: guard
|
176
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,7 +194,7 @@ dependencies:
|
|
194
194
|
requirements:
|
195
195
|
- - ~>
|
196
196
|
- !ruby/object:Gem::Version
|
197
|
-
version: 0.10.
|
197
|
+
version: 0.10.1
|
198
198
|
type: :development
|
199
199
|
prerelease: false
|
200
200
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -202,7 +202,7 @@ dependencies:
|
|
202
202
|
requirements:
|
203
203
|
- - ~>
|
204
204
|
- !ruby/object:Gem::Version
|
205
|
-
version: 0.10.
|
205
|
+
version: 0.10.1
|
206
206
|
- !ruby/object:Gem::Dependency
|
207
207
|
name: gem-ctags
|
208
208
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,7 +242,7 @@ dependencies:
|
|
242
242
|
requirements:
|
243
243
|
- - ~>
|
244
244
|
- !ruby/object:Gem::Version
|
245
|
-
version: 0.
|
245
|
+
version: 0.26.1
|
246
246
|
type: :development
|
247
247
|
prerelease: false
|
248
248
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -250,7 +250,7 @@ dependencies:
|
|
250
250
|
requirements:
|
251
251
|
- - ~>
|
252
252
|
- !ruby/object:Gem::Version
|
253
|
-
version: 0.
|
253
|
+
version: 0.26.1
|
254
254
|
description: Bulk rename of ebook files (pdf, epub, mobi) based on embedded metadata
|
255
255
|
email:
|
256
256
|
- agilecreativity@gmail.com
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- bin/ebook_renamer
|
263
263
|
- lib/ebook_renamer/cli.rb
|
264
264
|
- lib/ebook_renamer/ebook_renamer.rb
|
265
|
+
- lib/ebook_renamer/errors.rb
|
265
266
|
- lib/ebook_renamer/version.rb
|
266
267
|
- lib/ebook_renamer.rb
|
267
268
|
- Gemfile
|
@@ -296,7 +297,7 @@ rubyforge_project:
|
|
296
297
|
rubygems_version: 1.8.23.2
|
297
298
|
signing_key:
|
298
299
|
specification_version: 3
|
299
|
-
summary: Rename multiple ebook files (pdf, epub, mobi) based on
|
300
|
-
if available
|
300
|
+
summary: Rename multiple ebook files (pdf, epub, mobi) based on embedded metadata
|
301
|
+
(if available)
|
301
302
|
test_files: []
|
302
303
|
has_rdoc:
|