ebooks_renamer 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 928fb2f4c1b7431e5b8f87efabd702fc7823fb41
4
- data.tar.gz: 6311e8943f094565dc999fece255f1bfe7b56870
3
+ metadata.gz: e9e270dd18edb25346badcb75bb5e7b45abe42c9
4
+ data.tar.gz: 474853d02787a9e64f8d4259145a82106aee0b2f
5
5
  SHA512:
6
- metadata.gz: 980f52e329373bf81565f7c45acbe5431a04b3cc8e673d96bc31c1648d59f0ee300f3eac5ef8982cc7905188a3c8bf7c4934105c457e4c0c5392b0337510011f
7
- data.tar.gz: fe1574b78794f4ebd4badaa409baf1f6c2511b8696d9d635f815ac0d00ea14c2db270270b357c7d38d35e966a6b554fb4b56b8322b5a4d53a68aee45fd872b89
6
+ metadata.gz: 79ac4c29ceec9bed3ef163a5302022b34232535fa2f5c4c57b9c80e9de9667eb6581e35062cd8240b8ce0eca18423f9802f9228ecae38a093bf0e74ddc7cb56f
7
+ data.tar.gz: 6cfaa16ab0fe43d1e13161460fb2e347d4c7397e194926a2480507ad3be99237f502cc050d784019e4ea0715c0902aa1bed5be4387ff1d624dd2ed40dc2ab4f6
@@ -14,13 +14,20 @@ module EbooksRenamer
14
14
  def rename(options = {})
15
15
  files = CodeLister.files(options)
16
16
  files.each_with_index do |file, index|
17
- new_name = formatted_name(file, options[:sep_string])
18
- if file != new_name
19
- puts "#{index + 1} of #{files.length}: Old name: '#{file}'"
20
- puts "#{index + 1} of #{files.length}: New name: '#{new_name}'"
21
- FileUtils.mv(file, new_name) if options[:commit]
22
- else
23
- puts "#{index + 1} of #{files.length}: Result : '#{file}' is identical so no action taken."
17
+ # process as many files as possible
18
+ begin
19
+ new_name = formatted_name(file, options[:sep_string])
20
+ if file != new_name
21
+ puts "#{index + 1} of #{files.length}: Old name: '#{file}'"
22
+ puts "#{index + 1} of #{files.length}: New name: '#{new_name}'"
23
+ FileUtils.mv(file, new_name) if options[:commit]
24
+ else
25
+ puts "#{index + 1} of #{files.length}: Result : '#{file}' is identical so no action taken."
26
+ end
27
+ rescue Exception => e
28
+ puts "Skip file '#{file}'"
29
+ puts "Due to the unexpected error: #{e.message}"
30
+ next
24
31
  end
25
32
  end
26
33
  unless options[:commit]
@@ -1,3 +1,3 @@
1
1
  module EbooksRenamer
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ebooks_renamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burin Choomnuan