file_column_with_s3 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/file_column.rb CHANGED
@@ -716,12 +716,14 @@ module FileColumn # :nodoc:
716
716
  end
717
717
 
718
718
  define_method "#{attr}_download_url" do |context_path, *args|
719
+ subpath, store_url_for_option = args
719
720
  state = send(state_method)
720
- relative_path = state.relative_path(*args)
721
+ relative_path = state.relative_path(subpath)
722
+
721
723
  return nil unless relative_path
722
724
 
723
725
  store = state.store
724
- return store.url_for(relative_path) if store && store.respond_to?(:url_for)
726
+ return store.url_for(relative_path, store_url_for_option) if store && store.respond_to?(:url_for)
725
727
 
726
728
  url = ""
727
729
  url << context_path if context_path
@@ -53,7 +53,7 @@ module FileColumnHelper
53
53
  #
54
54
  # If there is currently no uploaded file stored in the object's column this method will
55
55
  # return +nil+.
56
- def url_for_file_column(object, method, options=nil)
56
+ def url_for_file_column(object, method, options=nil, store_url_for_options={})
57
57
  case object
58
58
  when String, Symbol
59
59
  object = instance_variable_get("@#{object.to_s}")
@@ -73,7 +73,7 @@ module FileColumnHelper
73
73
  end
74
74
 
75
75
  context_path = absolute ? ActionController::Base.relative_url_root.to_s : nil
76
- object.send("#{method}_download_url", context_path, subdir)
76
+ object.send("#{method}_download_url", context_path, subdir, store_url_for_options)
77
77
 
78
78
  end
79
79
 
@@ -127,7 +127,7 @@ module FileColumnHelper
127
127
  # absolute URL automatically.
128
128
  # If there is currently no image uploaded, or there is a problem while loading
129
129
  # the image this method will return +nil+.
130
- def url_for_image_column(object, method, options=nil)
130
+ def url_for_image_column(object, method, options=nil, store_url_for_options={})
131
131
  case object
132
132
  when String, Symbol
133
133
  object = instance_variable_get("@#{object.to_s}")
@@ -139,7 +139,7 @@ module FileColumnHelper
139
139
  if subdir.nil?
140
140
  nil
141
141
  else
142
- url_for_file_column(object, method, subdir)
142
+ url_for_file_column(object, method, subdir, store_url_for_options)
143
143
  end
144
144
  end
145
145
  end
@@ -85,7 +85,7 @@ class InMemoryWithUrlStorageStore
85
85
  File.key?(path)
86
86
  end
87
87
 
88
- def url_for(path)
88
+ def url_for(path, options={})
89
89
  "store generated url for #{path}"
90
90
  end
91
91
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file_column_with_s3
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 17
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 4
9
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - Mingle SaaS team
@@ -14,30 +15,33 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2014-02-04 00:00:00 -08:00
18
- default_executable:
18
+ date: 2014-03-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: mingle-storage
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ~>
26
27
  - !ruby/object:Gem::Version
28
+ hash: 15
27
29
  segments:
28
30
  - 0
29
31
  - 0
30
- - 1
31
- version: 0.0.1
32
+ - 8
33
+ version: 0.0.8
32
34
  type: :runtime
33
35
  version_requirements: *id001
34
36
  - !ruby/object:Gem::Dependency
35
37
  name: rails
36
38
  prerelease: false
37
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
38
41
  requirements:
39
42
  - - ~>
40
43
  - !ruby/object:Gem::Version
44
+ hash: 19
41
45
  segments:
42
46
  - 2
43
47
  - 3
@@ -49,9 +53,11 @@ dependencies:
49
53
  name: sqlite3
50
54
  prerelease: false
51
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
52
57
  requirements:
53
58
  - - ">="
54
59
  - !ruby/object:Gem::Version
60
+ hash: 3
55
61
  segments:
56
62
  - 0
57
63
  version: "0"
@@ -61,9 +67,11 @@ dependencies:
61
67
  name: rmagick
62
68
  prerelease: false
63
69
  requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
64
71
  requirements:
65
72
  - - ">="
66
73
  - !ruby/object:Gem::Version
74
+ hash: 3
67
75
  segments:
68
76
  - 0
69
77
  version: "0"
@@ -73,9 +81,11 @@ dependencies:
73
81
  name: aws-sdk
74
82
  prerelease: false
75
83
  requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
76
85
  requirements:
77
86
  - - ">="
78
87
  - !ruby/object:Gem::Version
88
+ hash: 3
79
89
  segments:
80
90
  - 0
81
91
  version: "0"
@@ -113,7 +123,6 @@ files:
113
123
  - README
114
124
  - CHANGELOG
115
125
  - s3_env.example
116
- has_rdoc: true
117
126
  homepage: https://github.com/ThoughtWorksStudios/file_column
118
127
  licenses: []
119
128
 
@@ -123,23 +132,27 @@ rdoc_options: []
123
132
  require_paths:
124
133
  - lib
125
134
  required_ruby_version: !ruby/object:Gem::Requirement
135
+ none: false
126
136
  requirements:
127
137
  - - ">="
128
138
  - !ruby/object:Gem::Version
139
+ hash: 3
129
140
  segments:
130
141
  - 0
131
142
  version: "0"
132
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
+ none: false
133
145
  requirements:
134
146
  - - ">="
135
147
  - !ruby/object:Gem::Version
148
+ hash: 3
136
149
  segments:
137
150
  - 0
138
151
  version: "0"
139
152
  requirements: []
140
153
 
141
154
  rubyforge_project:
142
- rubygems_version: 1.3.6
155
+ rubygems_version: 1.8.25
143
156
  signing_key:
144
157
  specification_version: 3
145
158
  summary: File attachment library for ruby