attached 0.3.1 → 0.3.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.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Kevin Sylvestre
1
+ Copyright (c) 2010 - 2011 Kevin Sylvestre
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -111,4 +111,4 @@ View:
111
111
 
112
112
  == Copyright
113
113
 
114
- Copyright (c) 2010 Kevin Sylvestre. See LICENSE for details.
114
+ Copyright (c) 2010 - 2011 Kevin Sylvestre. See LICENSE for details.
data/lib/attached.rb CHANGED
@@ -149,7 +149,7 @@ module Attached
149
149
  def validates_attached_extension(name, options = {})
150
150
 
151
151
  message = options[:message]
152
- message ||= "extension is not valid"
152
+ message ||= "extension is invalid"
153
153
 
154
154
  range = options[:in].map { |element| ".#{element}" }
155
155
 
@@ -135,9 +135,6 @@ module Attached
135
135
  instance_set :identifier, identifier
136
136
 
137
137
  process
138
-
139
- ensure
140
- file.close if file.respond_to?(:close)
141
138
  end
142
139
 
143
140
 
@@ -34,6 +34,8 @@ module Attached
34
34
  @bucket = credentials[:bucket] || credentials['bucket']
35
35
  @access_key_id = credentials[:access_key_id] || credentials['access_key_id']
36
36
  @secret_access_key = credentials[:secret_access_key] || credentials['secret_access_key']
37
+
38
+ raise "'bucket' must be specified if using 'aws' for storage" unless @bucket
37
39
  end
38
40
 
39
41
 
@@ -34,6 +34,8 @@ module Attached
34
34
  @bucket = credentials[:bucket] || credentials['bucket']
35
35
  @access_key_id = credentials[:access_key_id] || credentials['access_key_id']
36
36
  @secret_access_key = credentials[:secret_access_key] || credentials['secret_access_key']
37
+
38
+ raise "'bucket' must be specified if using 'google' for storage" unless @bucket
37
39
  end
38
40
 
39
41
 
@@ -33,6 +33,8 @@ module Attached
33
33
  @container = credentials[:container] || credentials['container']
34
34
  @username = credentials[:username] || credentials['username']
35
35
  @api_key = credentials[:api_key] || credentials['api_key']
36
+
37
+ raise "'container' must be specified if using 'rackspace' for storage" unless @container
36
38
  end
37
39
 
38
40
 
@@ -55,8 +57,8 @@ module Attached
55
57
  # * path - The path to save.
56
58
 
57
59
  def save(file, path)
58
- directory = connection.directories.get(self.bucket)
59
- directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))
60
+ directory = connection.directories.get(self.container)
61
+ directory ||= connection.directories.create(self.permissions.merge(:key => self.container))
60
62
 
61
63
  directory.files.create(self.options(path).merge(self.permissions.merge(:key => path, :body => file.read)))
62
64
  end
@@ -1,3 +1,3 @@
1
1
  module Attached
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  namespace :attached do
2
2
 
3
- desc "Process a given 'model' and 'attachment'."
3
+ desc "Process a given 'model' and 'attachment'"
4
4
  task :process, :model, :attachment, :needs => :environment do |t, args|
5
5
 
6
6
  model = args[:model] or raise "must specify model"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: attached
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.1
5
+ version: 0.3.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kevin Sylvestre
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-03 00:00:00 -05:00
13
+ date: 2011-03-08 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency