parker 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/parker +15 -15
  3. data/lib/parker/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cd902662b45a16cbbd0b8f5bda79c3f3b6e99fc
4
- data.tar.gz: 4ef14f6dadba01f33d9cf8c07a83f429d41bf70f
3
+ metadata.gz: 4de533ca51093b5ae208b415f9f5f17ffb2cd3f6
4
+ data.tar.gz: aebb29fd5cbe81af657be6bd05a9a18db564c2a6
5
5
  SHA512:
6
- metadata.gz: e0e8108fe20ee8fbb345fef47bcc080aa7dc1c7583748164495a5da7d94b81cb290c8638f4fd16886bc2a31f2b37596ff9f07bd70fa0e0964f11d853dabad292
7
- data.tar.gz: d6b98d4e9fec385979f863d0abc6a68ec6b3ddf595fa1a1f9b98e4a015422ba5d07fa7aff87b01953429f0e613aef4f7ce7a6265057b7612b18d5cc72f01df60
6
+ metadata.gz: 55502b335bb5d3b8c1363f8a4dad73c2b3223b59d76c62f5431795c908bbe965c62a1ce36dc3d5e98e2c6c801cb1487993109a8bb87622fb9682450e3f3b1e30
7
+ data.tar.gz: 179ad0483ad2dd9117b56a0965ecbf8895d668ae6d067c7b2d34ac2e098a689af41c9aa16b75f1c32e31b7d69f06aaeabdc9e61e6e5976eefbe99200e3b00b24
data/bin/parker CHANGED
@@ -15,15 +15,20 @@ end
15
15
 
16
16
  source_directory = File.expand_path(File.join('~/', '.config', 'parker'))
17
17
 
18
- Optimist.options do
18
+ options = Optimist.options do
19
19
  version "parker v#{Parker::VERSION}"
20
20
  banner <<-BANNER
21
21
  A ridiculous tool for organising game screenshots.
22
22
 
23
23
  Usage:
24
- parker [output directory]
24
+ parker
25
25
  Options:
26
- BANNER
26
+ BANNER
27
+
28
+ opt :destination,
29
+ 'Screenshot destination path',
30
+ type: :string,
31
+ default: '~/Pictures/Screenshots'
27
32
  end
28
33
 
29
34
  unless Dir.exist?(source_directory)
@@ -32,11 +37,9 @@ unless Dir.exist?(source_directory)
32
37
  exit
33
38
  end
34
39
 
35
- Optimist.educate if ARGV.empty?
36
-
37
40
  platforms = []
38
41
 
39
- Dir.glob(File.join(source_directory, 'platforms', '*.json')).each do |path|
42
+ Dir[File.join(source_directory, 'platforms', '*.json')].each do |path|
40
43
  klass = case File.basename(path, File.extname(path)).to_sym
41
44
  when :ps4
42
45
  'PS4'
@@ -62,7 +65,7 @@ if platforms.empty?
62
65
  exit
63
66
  end
64
67
 
65
- output_path = File.expand_path(ARGV[0])
68
+ output_path = File.expand_path(options[:destination])
66
69
  FileUtils.mkdir_p(output_path) unless Dir.exist?(output_path)
67
70
 
68
71
  puts 'Scanning...'
@@ -71,16 +74,13 @@ platforms.each do |platform|
71
74
  platform.games.each_value do |game|
72
75
  next unless game.screenshots.count.positive?
73
76
 
74
- print "- #{game.name} (#{platform.name}): "
75
-
76
77
  platform_path = File.join(output_path, platform.name)
77
- copied_count = game.copy_screenshots(platform_path)
78
+ copied = game.copy_screenshots(platform_path)
79
+
80
+ next unless copied.positive?
78
81
 
79
- if copied_count.positive?
80
- puts "Copied #{copied_count} new screenshot#{'s' if copied_count != 1}."
81
- else
82
- puts '✓'
83
- end
82
+ print "- #{game.name} (#{platform.name}): "
83
+ puts "Copied #{copied} new screenshot#{'s' if copied != 1}."
84
84
  end
85
85
  end
86
86
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parker
4
- VERSION = '0.2.3'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-24 00:00:00.000000000 Z
11
+ date: 2018-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: optimist