media_archiver 0.0.6.1 → 0.0.7.2

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: a47c41d15757cd2ae1cb9ae2e705d27a4118313a
4
- data.tar.gz: d6c86c035c13a3a4072e33f48e094f30cf695a09
3
+ metadata.gz: 3ee1e4c4954520e6625b43ef3b6ef00857d8421d
4
+ data.tar.gz: 29e1ee9e659e35ec580e37cd4ed719e01bb469af
5
5
  SHA512:
6
- metadata.gz: d4029e8c6513556f8ca2e7cc1d457f7ddbda8422949f4e125c16c17834a1219e25dc9013326223059e99369c366af539f511daff87315b1dba28ad4513fdfe35
7
- data.tar.gz: 2a0d03dfdf5479b6559725e0597872acbd2e2398589fceaa9370e25868b2ec12a97aa14ed1dbb2cf8eecb9ca1f459abe6ae8a7e622b97d6ee52800684f611919
6
+ metadata.gz: daa9a0f3d5b03d322730dc2692197d631c79959cfdd584e1e180ee35b29bda9ab0bbb1dc7183bca3e611b3a6b2352a09b6b2f493a973503f47d33b87f246f7d3
7
+ data.tar.gz: 970a5afee928e71f102aae166053187e229cbab8789ff0631ce22581506025a9258c6041922ca9bfbfd11ccb83ddfbfc7acc2a30e0518b33b8b72a0d935f1ab0
data/.gitignore CHANGED
@@ -46,3 +46,4 @@ build/
46
46
 
47
47
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
48
48
  .rvmrc
49
+ .byebug_history
@@ -4,13 +4,19 @@ require 'yaml'
4
4
 
5
5
  module MediaArchiver
6
6
  class CLI < Thor
7
+ package_name "MediaArchiver"
8
+ map "-R" => :recursive
9
+ map "-O" => :output_dir
10
+ map "-C" => :configuration_file
11
+
7
12
  DEFAULT_OUTPUT_TEMPLATE = ':DateTimeOriginal/:Make/:Model'
8
13
 
9
- desc 'copy [DIR] [OUTPUT_DIR]', 'Scans a folder and archives media files'
10
- option :output_dir, aliases: :o
11
- option :recursive, aliases: :r, type: :boolean, default: true
12
- option :output_template
13
- option :configuration_file, aliases: :c
14
+ desc 'copy [DIR]', 'Scans a folder and archives media files'
15
+ method_option :output_dir, aliases: :o, desc: 'Output folder where the files should be copied into'
16
+ method_option :recursive, aliases: :r, type: :boolean, default: true, desc: "Recursivelly scan input folder"
17
+ method_option :output_template
18
+ method_option :configuration_file, aliases: :c
19
+ method_option :overwrite_extensions, type: :array
14
20
  def copy(path = Dir.pwd)
15
21
  config = configurations(options)
16
22
 
@@ -22,7 +28,12 @@ module MediaArchiver
22
28
 
23
29
  output = ["File: #{dest}"]
24
30
  output << if File.exist?(dest)
25
- '[SKIP]'
31
+ if config[:overwrite_extensions].empty? || !config[:overwrite_extensions].include?(dest.split('.').last.downcase)
32
+ '[SKIP]'
33
+ else
34
+ FileUtils.cp(file.path, dest)
35
+ '[OVERWRITE]'
36
+ end
26
37
  else
27
38
  FileUtils.cp(file.path, dest)
28
39
  '[OK]'
@@ -1,3 +1,3 @@
1
1
  module MediaArchiver
2
- VERSION = '0.0.6.1'
2
+ VERSION = "0.0.7.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: media_archiver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.1
4
+ version: 0.0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ramalho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-13 00:00:00.000000000 Z
11
+ date: 2016-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler