desoto-photoapp 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce0627b6185d6ade6e13b1a7813614b59c5f0bcd
4
- data.tar.gz: f5af3ad97dd19aafa2c2084171ff15f74b6845d6
3
+ metadata.gz: 8d5955b79b2143eff1ecec4bff7478b6da4049d8
4
+ data.tar.gz: 5da6fc93e9392a66853fb79749f4fa448a9dd3af
5
5
  SHA512:
6
- metadata.gz: 56ee8f2c27d9069361b8fbb32ac41b416286e20b633a7752d1d5fd0f2f8ba9cd9c63dccff4fd369e87407d32158126b6dd098d3f22687155b2b656536cb6663e
7
- data.tar.gz: c44407c8181f833fbdcb30445cc9ad6d29dd59b322792ac008c2a6fce1d72615a60acd9bb116b0bc2e0a392f3b2aa2c153e9fc76fe63e83d4c99386773c0d5d0
6
+ metadata.gz: beb2530bdf77c3ddc89979b6cd4f043797382aaa3641a800ac025de2bb14bf90fe530f6db769fc12d16e926e564572793f45a44412cc3b8ca29334a65952521d
7
+ data.tar.gz: b45e45d136f52745caa107635ac8d2d1f4cb72eca3368e09afd1dc1f0b5e927df3b5fb3cda8cd392bc1a541116d329a49e04716c5e6f066407e2900e19e708ec
data/exe/photoapp CHANGED
@@ -3,7 +3,7 @@
3
3
  $LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
4
4
 
5
5
  require 'optparse'
6
- require "desoto-photoapp"
6
+ require 'desoto-photoapp'
7
7
 
8
8
  options = {}
9
9
 
@@ -11,10 +11,6 @@ OptionParser.new do |opts|
11
11
  opts.on("-c", "--config PATH", String, "Path to config file") do |config|
12
12
  options['config'] = config
13
13
  end
14
-
15
- opts.on("-s", "--source PATH", String, "Path to photos directory") do |source|
16
- options['source'] = source
17
- end
18
14
  end.parse!
19
15
 
20
16
  if ARGV.first == 'setup'
@@ -24,16 +20,15 @@ if ARGV.first == 'setup'
24
20
  end
25
21
  system "open #{Photoapp.gem_dir('assets/photos-action-installer.pkg')}"
26
22
  else
27
- p = Photoapp::Session.new(options)
28
23
 
29
24
  if ARGV.first == 'process'
30
25
  ARGV.shift
31
- p.process
26
+ options['source'] = ARGV.shift
27
+ Photoapp::Session.new(options).process
32
28
  elsif ARGV.first == 'upload'
29
+ Photoapp::Session.new(options).upload
30
+ elsif ARGV.first == 'reprint'
33
31
  ARGV.shift
34
- p.upload
35
- elsif ARGV.first == 'print'
36
- ARGV.shift
37
- p.print
32
+ Photoapp.print(ARGV.shift)
38
33
  end
39
34
  end
@@ -11,6 +11,12 @@ module Photoapp
11
11
  File.expand_path(File.join(File.dirname(__FILE__), '..', *paths))
12
12
  end
13
13
 
14
+ # Handle printing
15
+ def print(path)
16
+ system "lpr #{path}"
17
+ end
18
+
19
+
14
20
  class Session
15
21
  attr_accessor :photos, :print, :upload
16
22
 
@@ -65,15 +71,15 @@ module Photoapp
65
71
  logo = Magick::Image.read(config['watermark']).first
66
72
  photos = []
67
73
  tmp = root('.tmp')
68
- FileUtils.mkdir_p(tmp)
74
+ FileUtils.mkdir_p tmp
69
75
 
70
76
  if empty_print_queue?
71
77
  FileUtils.rm_rf(config['print'])
72
78
  end
73
79
 
74
80
  load_photos.each do |f|
75
- FileUtils.mv f, tmp
76
81
  path = File.join(tmp, File.basename(f))
82
+ FileUtils.mv f, path
77
83
  `automator -i #{path} #{Photoapp.gem_dir("lib/adjust-image.workflow")}`
78
84
  photos << Photo.new(path, logo, self)
79
85
  end
@@ -81,16 +87,18 @@ module Photoapp
81
87
  photos.each do |p|
82
88
  p.write
83
89
  p.add_to_photos
84
- p.print
90
+ Photoapp.print(p.print_dest)
85
91
  end
86
92
 
93
+ upload
94
+
87
95
  FileUtils.rm_rf tmp
88
96
  end
89
97
 
90
98
  def load_photos
91
99
  files = ['*.jpg', '*.JPG', '*.JPEG', '*.jpeg'].map! { |f| File.join(config['source'], f) }
92
100
 
93
- Dir[*files]
101
+ Dir[*files].uniq
94
102
  end
95
103
 
96
104
  def empty_print_queue?
@@ -60,11 +60,6 @@ module Photoapp
60
60
  cleanup
61
61
  end
62
62
 
63
- # Handle printing
64
- def print
65
- system "lpr #{print_dest}"
66
- end
67
-
68
63
  def add_to_photos
69
64
  `automator -i #{config['print']} #{Photoapp.gem_dir("lib/import-photos.workflow")}`
70
65
  end
@@ -1,3 +1,3 @@
1
1
  module Photoapp
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: desoto-photoapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-05 00:00:00.000000000 Z
11
+ date: 2015-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rmagick