ebooks_renamer 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +1 -4
- data/ebooks_renamer.gemspec +5 -4
- data/lib/ebooks_renamer.rb +0 -2
- data/lib/ebooks_renamer/pdf_parser.rb +0 -1
- data/lib/ebooks_renamer/version.rb +1 -1
- metadata +24 -12
- data/lib/ebooks_renamer/core_ext/hash/keys.rb +0 -54
- data/lib/ebooks_renamer/core_ext/object/blank.rb +0 -105
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9f7257c21f8c55e896e09e42e99e7b49b6888f5
|
4
|
+
data.tar.gz: df8529d5805e298935a986addfac63ce008183bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed69bff7b8c73342a6d56e9ee1d51dfbc26f414a27a134b91f81eda3ce22e46ad76a5c77a4f0f745ff64ccf8e0b100ae6bd6e31d7278bf68fad182194de5916d
|
7
|
+
data.tar.gz: 6e21b5ac61b418a48f4cee814ed6c7bb8d34ef7ed3ff1c841dc0bc4786193ac861fdc2fc667a75c79ac68011a019daf78d5451955a569e22bda7597f17e1fead
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
3
|
project_name = "ebooks_renamer"
|
4
|
-
|
5
4
|
Rake::TestTask.new do |t|
|
6
5
|
t.libs << "lib/#{project_name}"
|
7
6
|
t.test_files = FileList["test/lib/#{project_name}/test_*.rb"]
|
8
7
|
t.verbose = true
|
9
8
|
end
|
10
|
-
|
11
9
|
task default: [:test, :rubocop]
|
12
10
|
task :pry do
|
13
11
|
require "pry"
|
@@ -17,10 +15,9 @@ task :pry do
|
|
17
15
|
ARGV.clear
|
18
16
|
Pry.start
|
19
17
|
end
|
20
|
-
|
21
18
|
require "rubocop/rake_task"
|
22
19
|
desc "Run RuboCop on the lib directory"
|
23
|
-
|
20
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
24
21
|
task.patterns = ["lib/**/*.rb"]
|
25
22
|
# only show the files with failures
|
26
23
|
task.formatters = ["files"]
|
data/ebooks_renamer.gemspec
CHANGED
@@ -26,16 +26,17 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_runtime_dependency 'mobi', '~> 1.0.0'
|
27
27
|
spec.add_runtime_dependency 'epubinfo', '~> 0.4.3'
|
28
28
|
spec.add_runtime_dependency 'filename_cleaner', '~> 0.3'
|
29
|
-
spec.add_runtime_dependency '
|
29
|
+
spec.add_runtime_dependency 'agile_utils', '~> 0.1.5'
|
30
|
+
spec.add_runtime_dependency 'code_lister', '~> 0.1.7'
|
30
31
|
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
31
32
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
32
33
|
spec.add_development_dependency 'gem-ctags', '~> 1.0'
|
33
|
-
spec.add_development_dependency 'guard', '~> 2.6'
|
34
|
+
spec.add_development_dependency 'guard', '~> 2.6.1'
|
34
35
|
spec.add_development_dependency 'guard-minitest', '~> 2.2'
|
35
36
|
spec.add_development_dependency 'minitest', '~> 5.3'
|
36
37
|
spec.add_development_dependency 'minitest-spec-context', '~> 0.0.3'
|
37
|
-
spec.add_development_dependency 'pry', '~> 0.9'
|
38
|
+
spec.add_development_dependency 'pry', '~> 0.9.12'
|
38
39
|
spec.add_development_dependency 'rake', '~> 10.1'
|
39
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
40
|
+
spec.add_development_dependency 'rubocop', '~> 0.23'
|
40
41
|
spec.add_development_dependency 'yard', '~> 0.8'
|
41
42
|
end
|
data/lib/ebooks_renamer.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
require_relative "ebooks_renamer/version"
|
2
2
|
require_relative "ebooks_renamer/logger"
|
3
3
|
require_relative "ebooks_renamer/cli"
|
4
|
-
require_relative "ebooks_renamer/core_ext/hash/keys"
|
5
|
-
require_relative "ebooks_renamer/core_ext/object/blank"
|
6
4
|
require_relative "ebooks_renamer/ebooks_renamer"
|
7
5
|
include EbooksRenamer
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebooks_renamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
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-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -80,20 +80,34 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: agile_utils
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.1.5
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.1.5
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: code_lister
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 0.1.7
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 0.1.7
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: awesome_print
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +156,14 @@ dependencies:
|
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
159
|
+
version: 2.6.1
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
166
|
+
version: 2.6.1
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: guard-minitest
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +212,14 @@ dependencies:
|
|
198
212
|
requirements:
|
199
213
|
- - "~>"
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
215
|
+
version: 0.9.12
|
202
216
|
type: :development
|
203
217
|
prerelease: false
|
204
218
|
version_requirements: !ruby/object:Gem::Requirement
|
205
219
|
requirements:
|
206
220
|
- - "~>"
|
207
221
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
222
|
+
version: 0.9.12
|
209
223
|
- !ruby/object:Gem::Dependency
|
210
224
|
name: rake
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,14 +240,14 @@ dependencies:
|
|
226
240
|
requirements:
|
227
241
|
- - "~>"
|
228
242
|
- !ruby/object:Gem::Version
|
229
|
-
version: '0.
|
243
|
+
version: '0.23'
|
230
244
|
type: :development
|
231
245
|
prerelease: false
|
232
246
|
version_requirements: !ruby/object:Gem::Requirement
|
233
247
|
requirements:
|
234
248
|
- - "~>"
|
235
249
|
- !ruby/object:Gem::Version
|
236
|
-
version: '0.
|
250
|
+
version: '0.23'
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
252
|
name: yard
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -267,8 +281,6 @@ files:
|
|
267
281
|
- ebooks_renamer.gemspec
|
268
282
|
- lib/ebooks_renamer.rb
|
269
283
|
- lib/ebooks_renamer/cli.rb
|
270
|
-
- lib/ebooks_renamer/core_ext/hash/keys.rb
|
271
|
-
- lib/ebooks_renamer/core_ext/object/blank.rb
|
272
284
|
- lib/ebooks_renamer/ebooks_renamer.rb
|
273
285
|
- lib/ebooks_renamer/epub_parser.rb
|
274
286
|
- lib/ebooks_renamer/logger.rb
|
@@ -1,54 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
# File activesupport/lib/active_support/core_ext/hash/keys.rb
|
3
|
-
#
|
4
|
-
# hash = { name: 'Rob', age: '28' }
|
5
|
-
# hash.transform_keys{ |key| key.to_s.upcase }
|
6
|
-
# => { "NAME" => "Rob", "AGE" => "28" }
|
7
|
-
def transform_keys
|
8
|
-
result = {}
|
9
|
-
each_key do |key|
|
10
|
-
result[yield(key)] = self[key]
|
11
|
-
end
|
12
|
-
result
|
13
|
-
end
|
14
|
-
|
15
|
-
def transform_keys!(&block)
|
16
|
-
keys.each do |key|
|
17
|
-
value = delete(key)
|
18
|
-
self[yield(key)] = value.is_a?(Hash) ? value.transform_keys!(&block) : value
|
19
|
-
end
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
# hash = { 'name' => 'Rob', 'age' => '28' }
|
24
|
-
# hash.symbolize_keys
|
25
|
-
# => { name: "Rob", age: "28" }
|
26
|
-
def symbolize_keys
|
27
|
-
transform_keys { |key| key.to_sym rescue key }
|
28
|
-
end
|
29
|
-
|
30
|
-
# File activesupport/lib/active_support/core_ext/hash/keys.rb, line 135
|
31
|
-
def symbolize_keys!
|
32
|
-
transform_keys! { |key| key.to_sym rescue key }
|
33
|
-
end
|
34
|
-
|
35
|
-
# Merges the caller into +other_hash+. For example,
|
36
|
-
#
|
37
|
-
# options = options.reverse_merge(size: 25, velocity: 10)
|
38
|
-
#
|
39
|
-
# is equivalent to
|
40
|
-
#
|
41
|
-
# options = { size: 25, velocity: 10 }.merge(options)
|
42
|
-
#
|
43
|
-
# This is particularly useful for initializing an options hash
|
44
|
-
# with default values.
|
45
|
-
def reverse_merge(other_hash)
|
46
|
-
other_hash.merge(self)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Destructive +reverse_merge+.
|
50
|
-
def reverse_merge!(other_hash)
|
51
|
-
# right wins if there is no left
|
52
|
-
merge!(other_hash) { |key, left, right| left }
|
53
|
-
end
|
54
|
-
end
|
@@ -1,105 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# from: active_support/core_ext/object/blank.rb
|
3
|
-
class Object
|
4
|
-
# An object is blank if it's false, empty, or a whitespace string.
|
5
|
-
# For example, '', ' ', +nil+, [], and {} are all blank.
|
6
|
-
#
|
7
|
-
# This simplifies:
|
8
|
-
#
|
9
|
-
# if address.nil? || address.empty?
|
10
|
-
#
|
11
|
-
# ...to:
|
12
|
-
#
|
13
|
-
# if address.blank?
|
14
|
-
def blank?
|
15
|
-
respond_to?(:empty?) ? empty? : !self
|
16
|
-
end
|
17
|
-
|
18
|
-
# An object is present if it's not <tt>blank?</tt>.
|
19
|
-
def present?
|
20
|
-
!blank?
|
21
|
-
end
|
22
|
-
|
23
|
-
# Returns object if it's <tt>present?</tt> otherwise returns +nil+.
|
24
|
-
# <tt>object.presence</tt> is equivalent to <tt>object.present? ? object : nil</tt>.
|
25
|
-
#
|
26
|
-
# This is handy for any representation of objects where blank is the same
|
27
|
-
# as not present at all. For example, this simplifies a common check for
|
28
|
-
# HTTP POST/query parameters:
|
29
|
-
#
|
30
|
-
# state = params[:state] if params[:state].present?
|
31
|
-
# country = params[:country] if params[:country].present?
|
32
|
-
# region = state || country || 'US'
|
33
|
-
#
|
34
|
-
# ...becomes:
|
35
|
-
#
|
36
|
-
# region = params[:state].presence || params[:country].presence || 'US'
|
37
|
-
def presence
|
38
|
-
self if present?
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class NilClass
|
43
|
-
# +nil+ is blank:
|
44
|
-
#
|
45
|
-
# nil.blank? # => true
|
46
|
-
def blank?
|
47
|
-
true
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class FalseClass
|
52
|
-
# +false+ is blank:
|
53
|
-
#
|
54
|
-
# false.blank? # => true
|
55
|
-
def blank?
|
56
|
-
true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
class TrueClass
|
61
|
-
# +true+ is not blank:
|
62
|
-
#
|
63
|
-
# true.blank? # => false
|
64
|
-
def blank?
|
65
|
-
false
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
class Array
|
70
|
-
# An array is blank if it's empty:
|
71
|
-
#
|
72
|
-
# [].blank? # => true
|
73
|
-
# [1,2,3].blank? # => false
|
74
|
-
alias_method :blank?, :empty?
|
75
|
-
end
|
76
|
-
|
77
|
-
class Hash
|
78
|
-
# A hash is blank if it's empty:
|
79
|
-
#
|
80
|
-
# {}.blank? # => true
|
81
|
-
# { key: 'value' }.blank? # => false
|
82
|
-
alias_method :blank?, :empty?
|
83
|
-
end
|
84
|
-
|
85
|
-
class String
|
86
|
-
# A string is blank if it's empty or contains whitespaces only:
|
87
|
-
#
|
88
|
-
# ''.blank? # => true
|
89
|
-
# ' '.blank? # => true
|
90
|
-
# ' '.blank? # => true
|
91
|
-
# ' something here '.blank? # => false
|
92
|
-
def blank?
|
93
|
-
self !~ /[^[:space:]]/
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
class Numeric #:nodoc:
|
98
|
-
# No number is blank:
|
99
|
-
#
|
100
|
-
# 1.blank? # => false
|
101
|
-
# 0.blank? # => false
|
102
|
-
def blank?
|
103
|
-
false
|
104
|
-
end
|
105
|
-
end
|