kelredd-pruview 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kelredd-pruview might be problematic. Click here for more details.

@@ -2,12 +2,15 @@ module Pruview
2
2
 
3
3
  class Document
4
4
 
5
- def initialize(source, target_dir)
5
+ TMP_DIR = '/tmp'
6
+
7
+ def initialize(source, target_dir, target_permission=0666)
6
8
  raise Pruview::Exceptions::InvalidError, "Invalid source file: #{source.to_s}" if !File.file?(source)
7
9
  raise Pruview::Exceptions::InvalidError, "Invalid target directory: #{target_dir.to_s}" if !File.directory?(target_dir)
8
10
  raise Pruview::Exceptions::InvalidError, "Document not supported - file extension: " + file_extension(source) if !format_supported?(source)
9
11
  @source = source
10
12
  @target_dir = target_dir
13
+ @target_permission = target_permission
11
14
  @image = process_image(get_image(source))
12
15
  @tempfile = nil
13
16
  end
@@ -19,8 +22,11 @@ module Pruview
19
22
  img.quality '90'
20
23
  img.interlace 'plane'
21
24
  end
25
+ tmp_target = File.join(TMP_DIR, name.to_s + '.jpg')
26
+ scale_img.write(tmp_target)
27
+ FileUtils.chmod(@target_permission, tmp_target)
22
28
  target = File.join(@target_dir, name.to_s + '.jpg')
23
- scale_img.write(target)
29
+ FileUtils.mv(tmp_target, target)
24
30
  return target
25
31
  end
26
32
 
@@ -3,7 +3,7 @@ module Pruview
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 2
6
+ TINY = 3
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kelredd-pruview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-21 00:00:00 -06:00
12
+ date: 2010-01-19 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency