sga_paperclippolymorph 0.2.4 → 0.2.6

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.6
data/lib/sga/asset.rb CHANGED
@@ -13,7 +13,10 @@ class Asset < ActiveRecord::Base
13
13
  :small => "176x112>",
14
14
  :medium => "630x630>",
15
15
  :large => "1024x1024>"
16
- }
16
+ },
17
+ :path => "/system/:attachment/asset/:id_partition/:style/:filename",
18
+ :url => "/system/:attachment/asset/:id_partition/:style/:filename"
19
+
17
20
 
18
21
  def url(*args)
19
22
  data.url(*args)
@@ -58,7 +61,7 @@ class Asset < ActiveRecord::Base
58
61
  end
59
62
 
60
63
  def file_md5sum
61
- IO.popen("md5sum #{path} | awk '{print $1}'"){|f| f.gets.strip}
64
+ IO.popen("md5sum '#{path}' | awk '{print $1}'"){|f| f.gets.strip}
62
65
  end
63
66
 
64
67
  def url_without_random format=:original
@@ -0,0 +1,10 @@
1
+ module Paperclip
2
+
3
+ module Interpolations
4
+ def id_partition attachment, style_name
5
+ ("%09d" % attachment.instance.id).scan(/\d{3}/).join("/")
6
+ end
7
+ end
8
+
9
+ end
10
+
@@ -2,3 +2,4 @@ require 'sga/acts_as_polymorphic_paperclip'
2
2
  ActiveRecord::Base.send(:include, LocusFocus::Acts::PolymorphicPaperclip)
3
3
  require 'sga/asset'
4
4
  require 'sga/attaching'
5
+ require 'sga/paperclip_hack'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sga_paperclippolymorph}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tim.teng"]
12
- s.date = %q{2010-11-30}
12
+ s.date = %q{2011-05-16}
13
13
  s.description = %q{gem version of paperclippolymorph for sga company}
14
14
  s.email = %q{tim.rubist@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
  "lib/sga/acts_as_polymorphic_paperclip.rb",
30
30
  "lib/sga/asset.rb",
31
31
  "lib/sga/attaching.rb",
32
+ "lib/sga/paperclip_hack.rb",
32
33
  "lib/sga_paperclippolymorph.rb",
33
34
  "sga_paperclippolymorph.gemspec",
34
35
  "test/helper.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 4
9
- version: 0.2.4
8
+ - 6
9
+ version: 0.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - tim.teng
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-30 00:00:00 +08:00
17
+ date: 2011-05-16 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -53,6 +53,7 @@ files:
53
53
  - lib/sga/acts_as_polymorphic_paperclip.rb
54
54
  - lib/sga/asset.rb
55
55
  - lib/sga/attaching.rb
56
+ - lib/sga/paperclip_hack.rb
56
57
  - lib/sga_paperclippolymorph.rb
57
58
  - sga_paperclippolymorph.gemspec
58
59
  - test/helper.rb