desoto-photoapp 0.3.6 → 0.3.7

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: 0c787135c0a663ba5705df7f6f3a85a24a6381f6
4
- data.tar.gz: a6e51179a4ff3e65729e0fbb3bbdb7b1e27cdf9b
3
+ metadata.gz: 1b0486f840c909e8b401293cfbfb9a7a981cb555
4
+ data.tar.gz: ea42e1c39af0905fd43c32b50a2cf990c4e5ceba
5
5
  SHA512:
6
- metadata.gz: 5580048daae9338910a4ededf26b01819ee0c6148cf3033cd5fee86f70ec87c943bc79a066d2157dd67cc880e9d44807c8bea2ceece5d026b9af732d26990fd6
7
- data.tar.gz: 2924de7333afaed8bbb0a66c6e8eefa9fb4538cb203479e3de4a2c4e07ebb8d99fc434a1ae83bc2ecd8c440934c42bb8be519f0b1829e086941e8df7e6bca345
6
+ metadata.gz: 67b0f859dfb7a3109b2ddd24e7806c9ecca2364e8d6b86732e64c308ca6ab015b670fcf3947a09fb67c9fba431cb760cd9da64d78959d79ad343455b5b39ccc2
7
+ data.tar.gz: 284e81ea4016edf1c03b1a4cd015ea56c260344fcae7dea5d1a8fb27c1518050ee0db32eddbd2f7d37c7d7aaee82aaa2b2446754d079076b382baadcaab81965
@@ -52,7 +52,12 @@ if options['version']
52
52
  abort
53
53
  end
54
54
 
55
- if ARGV.first == 'setup'
55
+ if ARGV.first == 'test'
56
+ ARGV.shift
57
+ path = ARGV.join('')
58
+ session = Photoapp::Session.new(options)
59
+ session.test_image(path)
60
+ elsif ARGV.first == 'setup'
56
61
  ARGV.shift
57
62
  setup
58
63
  elsif ARGV.first == 'update'
@@ -26,7 +26,6 @@ module Photoapp
26
26
  UPLOAD = 'upload'
27
27
  PRINT = 'print'
28
28
 
29
-
30
29
  def initialize(options={})
31
30
  @photos = []
32
31
  @config = config(options)
@@ -62,12 +61,15 @@ module Photoapp
62
61
 
63
62
  end
64
63
 
64
+ def logo
65
+ @logo ||= Magick::Image.read(config['watermark']).first
66
+ end
67
+
65
68
  def root(path='')
66
69
  File.expand_path(File.join(ROOT, path))
67
70
  end
68
71
 
69
72
  def process
70
- logo = Magick::Image.read(config['watermark']).first
71
73
  photos = []
72
74
  tmp = root('.tmp')
73
75
  FileUtils.mkdir_p tmp
@@ -77,18 +79,12 @@ module Photoapp
77
79
  end
78
80
 
79
81
  load_photos.each do |f|
80
- path = File.join(tmp, File.basename(f))
81
- FileUtils.mv f, path
82
- `automator -i #{path} #{Photoapp.gem_dir("lib/adjust-image.workflow")}`
83
- photos << Photo.new(path, logo, self)
82
+ photos << process_image(f, tmp)
84
83
  end
85
84
 
86
85
  photos.each do |p|
87
86
  p.write
88
87
  p.add_to_photos
89
- end
90
-
91
- photos.each do |p|
92
88
  Photoapp.print(p.print_dest)
93
89
  end
94
90
 
@@ -97,6 +93,14 @@ module Photoapp
97
93
  FileUtils.rm_rf tmp
98
94
  end
99
95
 
96
+ def process_image(photo, destination)
97
+ path = File.join(destination, File.basename(photo))
98
+ FileUtils.mv photo, path
99
+ `automator -i #{path} #{Photoapp.gem_dir("lib/adjust-image.workflow")}`
100
+ Photo.new(path, logo, self)
101
+ end
102
+
103
+
100
104
  def load_photos
101
105
  files = ['*.jpg', '*.JPG', '*.JPEG', '*.jpeg'].map! { |f| File.join(config['source'], f) }
102
106
 
@@ -115,5 +119,17 @@ module Photoapp
115
119
  S3.new(@config).push
116
120
  FileUtils.rm_rf config['upload']
117
121
  end
122
+
123
+ # For processing a single image for testing purposes
124
+ #
125
+ def test_image(photo)
126
+ photo = File.expand_path(photo)
127
+ path = photo.sub(/\.jpe?g/i, '.copy.jpg')
128
+ FileUtils.cp photo, path
129
+ `automator -i #{path} #{Photoapp.gem_dir("lib/adjust-image.workflow")}`
130
+
131
+ Photo.new(path, logo, self).write(path)
132
+ end
133
+
118
134
  end
119
135
  end
@@ -21,7 +21,7 @@ module Photoapp
21
21
  end
22
22
 
23
23
  def watermark
24
- @watermarked ||= image.composite(logo, SouthWestGravity, OverCompositeOp)
24
+ @watermarked ||= image.composite(logo, SouthWestGravity, 40, 40, OverCompositeOp)
25
25
  end
26
26
 
27
27
  def with_url
@@ -29,8 +29,8 @@ module Photoapp
29
29
  light_url = add_url("#fff")
30
30
  dark_url = add_url("#000", true).blur_image(radius=6.0, sigma=2.0)
31
31
  watermark.dup
32
- .composite(dark_url, SouthEastGravity, OverCompositeOp)
33
- .composite(light_url, SouthEastGravity, OverCompositeOp)
32
+ .composite(dark_url, SouthEastGravity, 40, 40, OverCompositeOp)
33
+ .composite(light_url, SouthEastGravity, 40, 40, OverCompositeOp)
34
34
  end
35
35
  end
36
36
 
@@ -50,14 +50,20 @@ module Photoapp
50
50
  image
51
51
  end
52
52
 
53
- def write
54
- puts "writing #{upload_dest}"
55
- puts "writing #{print_dest}"
56
- FileUtils.mkdir_p(File.dirname(upload_dest))
57
- FileUtils.mkdir_p(File.dirname(print_dest))
58
- watermark.write upload_dest
59
- with_url.write print_dest
60
- cleanup
53
+ def write(path=nil)
54
+ if path
55
+ FileUtils.mkdir_p(File.dirname(path))
56
+ with_url.write path
57
+ cleanup
58
+ else
59
+ puts "writing #{upload_dest}"
60
+ puts "writing #{print_dest}"
61
+ FileUtils.mkdir_p(File.dirname(upload_dest))
62
+ FileUtils.mkdir_p(File.dirname(print_dest))
63
+ watermark.write upload_dest
64
+ with_url.write print_dest
65
+ cleanup
66
+ end
61
67
  end
62
68
 
63
69
  def add_to_photos
@@ -1,3 +1,3 @@
1
1
  module Photoapp
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: desoto-photoapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis