ebook_renamer 0.1.12 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -10
- data/CHANGELOG.md +5 -0
- data/README.md +45 -40
- data/Rakefile +0 -3
- data/ebook_renamer.gemspec +13 -13
- data/lib/ebook_renamer/cli.rb +3 -1
- data/lib/ebook_renamer/version.rb +1 -1
- metadata +30 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 984d40f8f75497e23af8e38cbe890f7677d4ace1
|
4
|
+
data.tar.gz: 0dbec0f3ce367616c3d2590e70e399d5c289be21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcffe1929a309553c068af946567305f782609e8056cf773e17e43932ec779b6a34a65fb0b030cf21c2752a16003ba0d996b4a1a4882dc857bf716b83e48d4c2
|
7
|
+
data.tar.gz: e5ac5fe5ec9cc12e9c8f3ad1b72e1584172d49f349e0ad24ac456eb8569e1351016efd056a7ef708903bbd39736eed86f13f88c6650a1e4281a7f275faf9f02c
|
data/.rubocop.yml
CHANGED
@@ -27,12 +27,6 @@ CollectionMethods:
|
|
27
27
|
find: 'detect'
|
28
28
|
find_all: 'select'
|
29
29
|
|
30
|
-
# Do not force public/protected/private keyword to be indented at the same
|
31
|
-
# level as the def keyword. My personal preference is to outdent these keywords
|
32
|
-
# because I think when scanning code it makes it easier to identify the
|
33
|
-
# sections of code and visually separate them. When the keyword is at the same
|
34
|
-
# level I think it sort of blends in with the def keywords and makes it harder
|
35
|
-
# to scan the code and see where the sections are.
|
36
30
|
AccessModifierIndentation:
|
37
31
|
Enabled: false
|
38
32
|
|
@@ -60,10 +54,6 @@ DotPosition:
|
|
60
54
|
Encoding:
|
61
55
|
Enabled: false
|
62
56
|
|
63
|
-
# Enforce outdenting of access modifiers (i.e. public, private, protected)
|
64
|
-
AccessModifierIndentation:
|
65
|
-
EnforcedStyle: outdent
|
66
|
-
|
67
57
|
EmptyLinesAroundAccessModifier:
|
68
58
|
Enabled: true
|
69
59
|
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -9,36 +9,44 @@ ebook_renamer
|
|
9
9
|
[gemnasium]: https://gemnasium.com/agilecreativity/ebook_renamer
|
10
10
|
[codeclimate]: https://codeclimate.com/github/agilecreativity/ebook_renamer
|
11
11
|
|
12
|
-
|
12
|
+
Bulk rename of ebook files (epub,mobi,pdf) using embedded meta-data (title, author(s)).
|
13
13
|
This version depends on the opensource software called [Calibre][] that comes
|
14
14
|
with [Calibre CLI][] which is very easy to install on OSX or Linux system.
|
15
15
|
|
16
|
-
|
16
|
+
Release based on [Semantic Versioning][] version.
|
17
17
|
|
18
18
|
### How the file is renamed
|
19
19
|
|
20
20
|
The file will be renamed using the following format `<title>.by.<author(s)>`.`<extension>`
|
21
21
|
|
22
22
|
Also the final file name will be sanitized e.g. any multiple occurence of special characters will be
|
23
|
-
replace by
|
23
|
+
replace by given separator char (default to dot) .
|
24
24
|
|
25
25
|
For example if the ebook contain the title `Start with Why: How Grate Leader Inspire Everyone to Take Action`
|
26
26
|
and the author is `Simon Sinek` then the default output will be
|
27
27
|
`Start.with.Why.How.Great.Leader.Inspire.Everyone.to.Take.Action.by.Simon.Sinek.pdf`
|
28
|
-
Note that the `:` and one space before the word `How` is replaced
|
28
|
+
Note that the `:` and one space before the word `How` is replaced by one dot string.
|
29
29
|
|
30
|
-
|
30
|
+
If the `--sep-string _` is used then the above output will be
|
31
31
|
`Start_with_Why_How_Great_Leader_Inspire_Everyone_to_Take_Action_by_Simon_Sinek.pdf`.
|
32
32
|
|
33
33
|
### What you will need
|
34
34
|
|
35
|
-
|
36
|
-
[Calibre CLI][] on your OS.
|
35
|
+
- You will need to install [Calibre][] and
|
36
|
+
[Calibre CLI][] on your OS. Please download Calibre binary from [http://calibre-ebook.com/download](http://calibre-ebook.com/download)
|
37
37
|
|
38
|
-
|
39
|
-
If this is not installed the error will be raised.
|
38
|
+
Alternatively if Ubuntu Linux:
|
40
39
|
|
41
|
-
|
40
|
+
```shell
|
41
|
+
sudo apt-get install calibre calibre-bin
|
42
|
+
# check your installation
|
43
|
+
which ebook-meta #=> /usr/bin/ebook-meta
|
44
|
+
```
|
45
|
+
|
46
|
+
In particular the gem is looking for the `ebook-meta` binary in a path.
|
47
|
+
If this is not installed the error will be raised.
|
48
|
+
|
49
|
+
- Tested on Ruby 1.9.3 and newer
|
42
50
|
|
43
51
|
### Installation and Usage:
|
44
52
|
|
@@ -49,6 +57,30 @@ gem install ebook_renamer
|
|
49
57
|
ebook_renamer
|
50
58
|
```
|
51
59
|
|
60
|
+
### Usage/Synopsis
|
61
|
+
|
62
|
+
```
|
63
|
+
Usage:
|
64
|
+
ebook_renamer
|
65
|
+
|
66
|
+
Options:
|
67
|
+
-b, [--base-dir=BASE_DIR] # Base directory
|
68
|
+
# Default: . (current directory)
|
69
|
+
-r, [--recursive], [--no-recursive] # Search for files recursively
|
70
|
+
# Default: --recursive
|
71
|
+
-s, [--sep-string=SEP_STRING] # Separator string between each word in output filename
|
72
|
+
# Default: '.' (dot string)
|
73
|
+
-d, [--downcase], [--no-downcase] # Convert each word in the output filename to lowercase
|
74
|
+
# Default: --no-downcase
|
75
|
+
-t, [--capitalize], [--no-capitalize] # Capitalize each word in the output filename
|
76
|
+
# Default: --no-capitalize
|
77
|
+
-c, [--commit], [--no-commit] # Make your changes permanent
|
78
|
+
# Default: --no-commit
|
79
|
+
-v, [--version], [--no-version] # Display version information
|
80
|
+
|
81
|
+
Rename multiple ebook files (pdf,epub,mobi) from a given directory
|
82
|
+
```
|
83
|
+
|
52
84
|
### Quick Usage
|
53
85
|
|
54
86
|
The shortest command that you can run to rename files is
|
@@ -60,7 +92,7 @@ cd ~/Dropbox/ebooks
|
|
60
92
|
ebook_renamer --commit
|
61
93
|
```
|
62
94
|
|
63
|
-
To see what the result would be like without making any changes
|
95
|
+
To see what the result would be like without making any changes (dry-run)
|
64
96
|
|
65
97
|
```sh
|
66
98
|
cd ~/Dropbox/ebooks/
|
@@ -90,7 +122,7 @@ cd ~/Dropbox/ebooks/
|
|
90
122
|
ebook_renamer --base-dir . --sep-string _
|
91
123
|
```
|
92
124
|
|
93
|
-
|
125
|
+
should result in something like
|
94
126
|
|
95
127
|
```
|
96
128
|
-----------------------------------------------------------
|
@@ -119,9 +151,6 @@ cd ~/Dropbox/ebooks/
|
|
119
151
|
# version of ruby (e.g. rbenv local 2.1.1 or rvm use 2.1.1)
|
120
152
|
ebook_renamer --base-dir ~/Dropbox/ebooks/samples
|
121
153
|
|
122
|
-
# For help on how to use the gem just type without any options.
|
123
|
-
ebook_renamer
|
124
|
-
|
125
154
|
# Run the command without making any changes to the files (dry-run) in the current directory
|
126
155
|
ebook_renamer --base-dir . --recursive
|
127
156
|
|
@@ -133,6 +162,7 @@ ebook_renamer -b . -r -c
|
|
133
162
|
```
|
134
163
|
|
135
164
|
### Misc Options
|
165
|
+
|
136
166
|
In addition to the above usage, you can also use the two new flags `--downcase` or
|
137
167
|
`--capitalize`
|
138
168
|
|
@@ -144,31 +174,6 @@ ebook_renamer --base-dir . --recursive --downcase --commit
|
|
144
174
|
ebook_renamer --base-dir . --recursive --capitalize --commit
|
145
175
|
```
|
146
176
|
|
147
|
-
### Usage/Synopsis
|
148
|
-
|
149
|
-
```
|
150
|
-
Usage:
|
151
|
-
ebook_renamer
|
152
|
-
|
153
|
-
Options:
|
154
|
-
-b, [--base-dir=BASE_DIR] # Base directory
|
155
|
-
# Default: . (current directory)
|
156
|
-
-r, [--recursive], [--no-recursive] # Search for files recursively
|
157
|
-
# Default: --recursive
|
158
|
-
-s, [--sep-string=SEP_STRING] # Separator string between words in output filename
|
159
|
-
# Default: . (dot string)
|
160
|
-
-d, [--downcase], [--no-downcase] # Convert each word in the filename to lowercase
|
161
|
-
# Default: --no-downcase
|
162
|
-
-t, [--capitalize], [--no-capitalize] # Capitalize each word in the filename
|
163
|
-
# Default: --no-capitalize
|
164
|
-
-c, [--commit], [--no-commit] # Make change permanent
|
165
|
-
# Default: --no-commit
|
166
|
-
-v, [--version], [--no-version] # Display version information
|
167
|
-
|
168
|
-
Rename multiple ebook files (pdf,epub,mobi) from a given directory
|
169
|
-
|
170
|
-
```
|
171
|
-
|
172
177
|
### Contributing
|
173
178
|
|
174
179
|
1. Fork it
|
data/Rakefile
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
|
-
|
4
3
|
Rake::TestTask.new do |t|
|
5
4
|
t.libs << "lib/ebook_renamer"
|
6
5
|
t.test_files = FileList["test/lib/ebook_renamer/test_*.rb"]
|
7
6
|
t.verbose = true
|
8
7
|
end
|
9
|
-
|
10
8
|
task default: :test
|
11
|
-
|
12
9
|
task :pry do
|
13
10
|
require "pry"
|
14
11
|
require "awesome_print"
|
data/ebook_renamer.gemspec
CHANGED
@@ -24,18 +24,18 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
27
|
-
spec.add_runtime_dependency "agile_utils", "~> 0.
|
28
|
-
spec.add_runtime_dependency "code_lister", "~> 0.
|
29
|
-
spec.add_runtime_dependency "filename_cleaner", "~> 0.
|
30
|
-
spec.add_development_dependency "bundler", "~> 1.
|
31
|
-
spec.add_development_dependency "rake"
|
32
|
-
spec.add_development_dependency "awesome_print", "~> 1.2"
|
27
|
+
spec.add_runtime_dependency "agile_utils", "~> 0.2.0"
|
28
|
+
spec.add_runtime_dependency "code_lister", "~> 0.2.0"
|
29
|
+
spec.add_runtime_dependency "filename_cleaner", "~> 0.4.0"
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.6.2"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.3.2"
|
32
|
+
spec.add_development_dependency "awesome_print", "~> 1.2.0"
|
33
33
|
spec.add_development_dependency "minitest-spec-context", "~> 0.0.3"
|
34
|
-
spec.add_development_dependency "guard-minitest", "~> 2.
|
35
|
-
spec.add_development_dependency "minitest", "~> 5.
|
36
|
-
spec.add_development_dependency "guard", "~> 2.6"
|
37
|
-
spec.add_development_dependency "pry", "~> 0.
|
38
|
-
spec.add_development_dependency "gem-ctags", "~> 1.0"
|
39
|
-
spec.add_development_dependency "yard", "~> 0.8"
|
40
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
34
|
+
spec.add_development_dependency "guard-minitest", "~> 2.3.1"
|
35
|
+
spec.add_development_dependency "minitest", "~> 5.4.0"
|
36
|
+
spec.add_development_dependency "guard", "~> 2.6.1"
|
37
|
+
spec.add_development_dependency "pry", "~> 0.10.0"
|
38
|
+
spec.add_development_dependency "gem-ctags", "~> 1.0.6"
|
39
|
+
spec.add_development_dependency "yard", "~> 0.8.7"
|
40
|
+
spec.add_development_dependency "rubocop", "~> 0.24.1"
|
41
41
|
end
|
data/lib/ebook_renamer/cli.rb
CHANGED
@@ -5,6 +5,8 @@ require "fileutils"
|
|
5
5
|
require_relative "../ebook_renamer"
|
6
6
|
module EbookRenamer
|
7
7
|
class CLI < Thor
|
8
|
+
using AgileUtils::HashExt
|
9
|
+
|
8
10
|
desc "rename", "Rename multiple ebook files (pdf,epub,mobi) from a given directory"
|
9
11
|
method_option *AgileUtils::Options::BASE_DIR
|
10
12
|
method_option *AgileUtils::Options::RECURSIVE
|
@@ -68,7 +70,7 @@ Rename multiple ebook files (pdf,epub,mobi) from a given directory
|
|
68
70
|
|
69
71
|
default_task :usage
|
70
72
|
|
71
|
-
|
73
|
+
private
|
72
74
|
|
73
75
|
# Rename the file from the given directory
|
74
76
|
def execute(options = {})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebook_renamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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-
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -30,84 +30,84 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.2.0
|
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:
|
40
|
+
version: 0.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: code_lister
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: filename_cleaner
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.4.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.4.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.6.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
|
-
version:
|
82
|
+
version: 1.6.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 10.3.2
|
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
|
-
version:
|
96
|
+
version: 10.3.2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: awesome_print
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 1.2.0
|
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
|
-
version:
|
110
|
+
version: 1.2.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest-spec-context
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,98 +128,98 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 2.3.1
|
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
|
-
version:
|
138
|
+
version: 2.3.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: minitest
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 5.4.0
|
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
|
-
version:
|
152
|
+
version: 5.4.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: guard
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 2.6.1
|
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
|
-
version:
|
166
|
+
version: 2.6.1
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: pry
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 0.10.0
|
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
|
-
version:
|
180
|
+
version: 0.10.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: gem-ctags
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: 1.0.6
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: 1.0.6
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: yard
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: 0.8.7
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 0.8.7
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: rubocop
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
215
|
+
version: 0.24.1
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
222
|
+
version: 0.24.1
|
223
223
|
description: Bulk rename of ebook files (pdf, epub, mobi) based on embedded metadata
|
224
224
|
email:
|
225
225
|
- agilecreativity@gmail.com
|