muck-engine 3.3.11 → 3.3.12
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/config/locales/en.yml +1 -0
- data/lib/muck-engine/remote_photo_methods.rb +33 -0
- data/lib/muck-engine.rb +1 -0
- data/muck-engine.gemspec +3 -2
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.12
|
data/config/locales/en.yml
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Adapted from http://trevorturk.com/2008/12/11/easy-upload-via-url-with-paperclip/
|
2
|
+
module MuckEngine
|
3
|
+
module RemotePhotoMethods
|
4
|
+
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
before_validation :download_remote_photo, :if => :photo_url_provided?
|
9
|
+
validates_presence_of :photo_remote_url, :if => :photo_url_provided?, :message => I18n.translate('muck.engine.invalid_photo_url')
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :photo_url
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def photo_url_provided?
|
17
|
+
!self.photo_url.blank?
|
18
|
+
end
|
19
|
+
|
20
|
+
def download_remote_photo
|
21
|
+
self.photo = do_download_remote_photo
|
22
|
+
self.photo_remote_url = photo_url
|
23
|
+
end
|
24
|
+
|
25
|
+
def do_download_remote_photo
|
26
|
+
io = open(URI.parse(photo_url))
|
27
|
+
def io.original_filename; base_uri.path.split('/').last; end
|
28
|
+
io.original_filename.blank? ? nil : io
|
29
|
+
#rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/lib/muck-engine.rb
CHANGED
@@ -10,6 +10,7 @@ require 'muck-engine/models/country'
|
|
10
10
|
require 'muck-engine/models/language'
|
11
11
|
require 'muck-engine/models/state'
|
12
12
|
require 'muck-engine/models/general'
|
13
|
+
require 'muck-engine/remote_photo_methods'
|
13
14
|
require 'muck-engine/mailers/general'
|
14
15
|
require 'muck-engine/controllers/application'
|
15
16
|
require 'muck-engine/controllers/ssl_requirement'
|
data/muck-engine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-engine}
|
8
|
-
s.version = "3.3.
|
8
|
+
s.version = "3.3.12"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball", "Joel Duffin"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-07-12}
|
13
13
|
s.description = %q{The base engine for the muck system. Contains common tables, custom for, css and javascript.}
|
14
14
|
s.email = %q{justin@tatemae.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -125,6 +125,7 @@ Gem::Specification.new do |s|
|
|
125
125
|
"lib/muck-engine/models/language.rb",
|
126
126
|
"lib/muck-engine/models/state.rb",
|
127
127
|
"lib/muck-engine/populate.rb",
|
128
|
+
"lib/muck-engine/remote_photo_methods.rb",
|
128
129
|
"lib/muck-engine/rspec2.rb",
|
129
130
|
"lib/muck-engine/test/controllers/matchers.rb",
|
130
131
|
"lib/muck-engine/test/controllers/matchers/login_matcher.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muck-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 3.3.
|
9
|
+
- 12
|
10
|
+
version: 3.3.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Ball
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-07-12 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -392,6 +392,7 @@ files:
|
|
392
392
|
- lib/muck-engine/models/language.rb
|
393
393
|
- lib/muck-engine/models/state.rb
|
394
394
|
- lib/muck-engine/populate.rb
|
395
|
+
- lib/muck-engine/remote_photo_methods.rb
|
395
396
|
- lib/muck-engine/rspec2.rb
|
396
397
|
- lib/muck-engine/test/controllers/matchers.rb
|
397
398
|
- lib/muck-engine/test/controllers/matchers/login_matcher.rb
|