ebooks_renamer 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -18
- data/Rakefile +2 -2
- data/ebooks_renamer.gemspec +1 -1
- data/lib/ebooks_renamer/cli.rb +5 -18
- data/lib/ebooks_renamer/core_ext/hash/keys.rb +3 -3
- data/lib/ebooks_renamer/version.rb +1 -1
- data/rubocop-todo.yml +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b26e766e43a944e345a5c30f859df39a635725ab
|
4
|
+
data.tar.gz: 7beb1a0ffd7d6f3efa45daebb8c93f5c8300b8a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 109a3bc65164d4397127916e4777dd02ffbec6f2ed0f59186e40f44706a8a56f3aedb0267f0c8ac515255c827bf01935a9e846ece77aa3a6ee3769d68ba20218
|
7
|
+
data.tar.gz: 68ed62a40d482943e90aae376d3a39f7f7ba29dc3cd015c36bc8e3db7df9d97090ee1f25975420ccb19fba2879286fd733b293cb018744a15232c2496463f750
|
data/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
-
##
|
1
|
+
## ebooks_renamer
|
2
2
|
|
3
|
-
[]
|
4
|
-
[]
|
5
|
-
[]
|
6
|
-
|
3
|
+
[][gem]
|
4
|
+
[][gemnasium]
|
5
|
+
[][codeclimate]
|
6
|
+
|
7
|
+
[gem]: http://badge.fury.io/rb/ebooks_renamer
|
8
|
+
[gemnasium]: https://gemnasium.com/agilecreativity/ebooks_renamer
|
9
|
+
[codeclimate]: https://codeclimate.com/github/agilecreativity/ebooks_renamer
|
7
10
|
|
8
11
|
Rename multiple ebook files using the power of ruby.
|
9
12
|
This is the alternate version of my [ebook_renamer][] gem that implemented in
|
@@ -62,10 +65,6 @@ Usage:
|
|
62
65
|
Options:
|
63
66
|
-b, [--base-dir=BASE_DIR] # Base directory
|
64
67
|
# Default: . (current directory)
|
65
|
-
-n, [--inc-words=one two three] # List of words to be included in the result if any
|
66
|
-
-x, [--exc-words=one two three] # List of words to be excluded from the result if any
|
67
|
-
-i, [--ignore-case], [--no-ignore-case] # Match case insensitively
|
68
|
-
# Default: true
|
69
68
|
-r, [--recursive], [--no-recursive] # Search for files recursively
|
70
69
|
# Default: true
|
71
70
|
-v, [--version], [--no-version] # Display version information
|
@@ -84,8 +83,8 @@ Here is your typical usage of the gem
|
|
84
83
|
# change to the directory that contain your ebook files
|
85
84
|
cd ~/Dropbox/ebooks
|
86
85
|
|
87
|
-
# set version of your ruby
|
88
|
-
rbenv local 2.1.
|
86
|
+
# set version of your ruby to a recent version
|
87
|
+
rbenv local 2.1.2 # or any version after 1.9+
|
89
88
|
|
90
89
|
# install the gem
|
91
90
|
gem install ebooks_renamer
|
@@ -100,13 +99,6 @@ ebooks_renamer rename --base-dir . --recursive --commit
|
|
100
99
|
# To change the default separator string `sep_string` (default to '.' - dot string)
|
101
100
|
# e.g. this will use the '_' (underscore) to separate each word in the output
|
102
101
|
ebooks_renamer rename --base-dir . --sep-string '_' --recursive --commit
|
103
|
-
|
104
|
-
# To only include/exclude certain files in the result you can use the
|
105
|
-
# `--exc-words` or `--exc-words` etc
|
106
|
-
# e.g. The following will perform the rename only on the files that contain the word 'android' or 'iphone'
|
107
|
-
# in the title.
|
108
|
-
|
109
|
-
ebooks_renamer rename --base-dir . --sep-string '-' --recursive --inc-words android iphone --commit
|
110
102
|
```
|
111
103
|
|
112
104
|
### Contributing
|
data/Rakefile
CHANGED
data/ebooks_renamer.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.description = %q{Bulk rename multiple ebook files (pdf, epub, mobi) using embedded metadata if available (pure ruby implementation)}
|
12
12
|
spec.homepage = 'https://github.com/agilecreativity/ebooks_renamer'
|
13
13
|
spec.license = 'MIT'
|
14
|
-
spec.files = Dir.glob(
|
14
|
+
spec.files = Dir.glob('{bin,lib,templates}/**/*') + %w(Gemfile
|
15
15
|
Rakefile
|
16
16
|
ebooks_renamer.gemspec
|
17
17
|
README.md
|
data/lib/ebooks_renamer/cli.rb
CHANGED
@@ -5,20 +5,17 @@ module EbooksRenamer
|
|
5
5
|
class CLI < Thor
|
6
6
|
desc 'rename', 'Rename ebooks based on given criteria'
|
7
7
|
method_option *AgileUtils::Options::BASE_DIR
|
8
|
-
method_option *AgileUtils::Options::INC_WORDS
|
9
|
-
method_option *AgileUtils::Options::EXC_WORDS
|
10
|
-
method_option *AgileUtils::Options::IGNORE_CASE
|
11
8
|
method_option *AgileUtils::Options::RECURSIVE
|
12
9
|
method_option *AgileUtils::Options::VERSION
|
13
10
|
|
14
11
|
method_option :sep_string,
|
15
|
-
aliases:
|
16
|
-
desc:
|
17
|
-
default:
|
12
|
+
aliases: '-s',
|
13
|
+
desc: 'Separator string between words in filename',
|
14
|
+
default: '.'
|
18
15
|
|
19
16
|
method_option :commit,
|
20
|
-
aliases:
|
21
|
-
desc:
|
17
|
+
aliases: '-c',
|
18
|
+
desc: 'Make change permanent',
|
22
19
|
type: :boolean,
|
23
20
|
default: false
|
24
21
|
|
@@ -44,10 +41,6 @@ Usage:
|
|
44
41
|
Options:
|
45
42
|
-b, [--base-dir=BASE_DIR] # Base directory
|
46
43
|
# Default: . (current directory)
|
47
|
-
-n, [--inc-words=one two three] # List of words to be included in the result if any
|
48
|
-
-x, [--exc-words=one two three] # List of words to be excluded from the result if any
|
49
|
-
-i, [--ignore-case], [--no-ignore-case] # Match case insensitively
|
50
|
-
# Default: true
|
51
44
|
-r, [--recursive], [--no-recursive] # Search for files recursively
|
52
45
|
# Default: true
|
53
46
|
-v, [--version], [--no-version] # Display version information
|
@@ -60,11 +53,5 @@ Rename ebooks based on given criteria
|
|
60
53
|
end
|
61
54
|
|
62
55
|
default_task :usage
|
63
|
-
|
64
|
-
# private
|
65
|
-
#
|
66
|
-
# def process(opts = {})
|
67
|
-
# puts "Your options #{opts}"
|
68
|
-
# end
|
69
56
|
end
|
70
57
|
end
|
@@ -25,12 +25,12 @@ class Hash
|
|
25
25
|
# hash.symbolize_keys
|
26
26
|
# => { name: "Rob", age: "28" }
|
27
27
|
def symbolize_keys
|
28
|
-
transform_keys{ |key| key.to_sym rescue key }
|
28
|
+
transform_keys { |key| key.to_sym rescue key }
|
29
29
|
end
|
30
30
|
|
31
31
|
# File activesupport/lib/active_support/core_ext/hash/keys.rb, line 135
|
32
32
|
def symbolize_keys!
|
33
|
-
transform_keys!{ |key| key.to_sym rescue key }
|
33
|
+
transform_keys! { |key| key.to_sym rescue key }
|
34
34
|
end
|
35
35
|
|
36
36
|
# Merges the caller into +other_hash+. For example,
|
@@ -50,6 +50,6 @@ class Hash
|
|
50
50
|
# Destructive +reverse_merge+.
|
51
51
|
def reverse_merge!(other_hash)
|
52
52
|
# right wins if there is no left
|
53
|
-
merge!(other_hash) { |key,left,right| left }
|
53
|
+
merge!(other_hash) { |key, left, right| left }
|
54
54
|
end
|
55
55
|
end
|
data/rubocop-todo.yml
CHANGED
@@ -67,13 +67,13 @@ RescueModifier:
|
|
67
67
|
# Offense count: 2
|
68
68
|
# Cop supports --auto-correct.
|
69
69
|
SpaceAfterComma:
|
70
|
-
Enabled:
|
70
|
+
Enabled: true
|
71
71
|
|
72
72
|
# Offense count: 2
|
73
73
|
# Cop supports --auto-correct.
|
74
74
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
75
75
|
SpaceBeforeBlockBraces:
|
76
|
-
Enabled:
|
76
|
+
Enabled: true
|
77
77
|
|
78
78
|
# Offense count: 1
|
79
79
|
# Cop supports --auto-correct.
|
@@ -85,7 +85,7 @@ SpaceInsideBlockBraces:
|
|
85
85
|
# Cop supports --auto-correct.
|
86
86
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
87
87
|
StringLiterals:
|
88
|
-
Enabled:
|
88
|
+
Enabled: true
|
89
89
|
|
90
90
|
# Offense count: 2
|
91
91
|
UselessAssignment:
|