refinerycms-images 4.0.1 → 4.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a852545eacbc289403ee464b693e5fc136b28e4
4
- data.tar.gz: 41820ff7e1c88536ecb2a9d2ea94e7dccfdbfaf3
3
+ metadata.gz: e530f00ba3ed998c7f43c6d5486baa84c822101a
4
+ data.tar.gz: 7a93ee66b9add42f2972a6fbcc1cd9fdb13fb184
5
5
  SHA512:
6
- metadata.gz: 223b187cdb90200a6d708737401eadab3e27e8de7f986d77ee29b7e0679f195c7e4cc5ea519d15ef4dade384484d7a18be07a88b4ed4c9b0a3c6c9239edfa5a5
7
- data.tar.gz: edc8a2b997ae9df9a36a4fb1d3f75d7f60ff3f7b79e912bedaf7c6213e4313fcd16bd01d8df4ba86c547defabe636abf5e6b959af4b3932f9fd7c31d3dea3815
6
+ metadata.gz: 376c8d157b7d636cbda1f5099fd70b45b87cb78e647b18cc4930b0be08ac15eacba056f871b0c0eb7a575d6446a96dca53b0ba78bf6b259d83c96a85a2ff4edc
7
+ data.tar.gz: ff1d884d7ba504e0ca1c5abc1b0f4e829c9a3d0c2a49cccea06dea8ed9d7cf8a88b4df02295af12351997a7b661af3cbb459410abf03610ab450178e69d95ad9
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -116,6 +116,7 @@ module Refinery
116
116
  @app_dialog = params[:app_dialog].present?
117
117
  @field = params[:field]
118
118
  @update_image = params[:update_image]
119
+ @image_id = params[:selected_image].to_i if params[:selected_image].present?
119
120
  @thumbnail = params[:thumbnail]
120
121
  @callback = params[:callback]
121
122
  @multiple = params[:multiple]
@@ -148,7 +149,7 @@ module Refinery
148
149
 
149
150
  def permitted_image_params
150
151
  [
151
- { image: [] }, :image_size, :image_title, :image_alt
152
+ :image, :image_size, :image_title, :image_alt
152
153
  ]
153
154
  end
154
155
 
@@ -1,5 +1,8 @@
1
1
  # encoding: utf-8
2
2
  Refinery::Images.configure do |config|
3
+
4
+ # Refinery::Images configuration
5
+
3
6
  # Configures the maximum allowed upload size (in bytes) for an image
4
7
  # config.max_image_size = <%= Refinery::Images.max_image_size.inspect %>
5
8
 
@@ -25,24 +28,38 @@ Refinery::Images.configure do |config|
25
28
  # Configure default image view
26
29
  # config.preferred_image_view = <%= Refinery::Images.preferred_image_view.inspect %>
27
30
 
31
+ # Configure Dragonfly.
32
+ # Refer to config/initializers/refinery/dragonfly.rb for the full list of dragonfly configurations which can be used.
33
+ # This includes all dragonfly config for Dragonfly v 1.1.1
34
+
35
+ config.dragonfly_name = :refinery_images
36
+ # config.dragonfly_verify_urls = <%= Refinery::Images.dragonfly_verify_urls.inspect %>
37
+ # config.dragonfly_secret = <%= Refinery::Images.dragonfly_secret.inspect %>
38
+ # config.dragonfly_url_host = <%= Refinery::Images.dragonfly_url_host.inspect %>
39
+ # config.dragonfly_datastore_root_path = <%= Refinery::Images.dragonfly_datastore_root_path.inspect %>
40
+ # config.dragonfly_url_format = <%= Refinery::Images.dragonfly_url_format.inspect %>
41
+
42
+
43
+ # Configure Dragonfly custom datastore
44
+ # The custom_datastore setting by default defers to the Refinery::Images setting for this but can be set just for images.
45
+ # config.dragonfly_custom_datastore_class = <%= Refinery::Images.dragonfly_custom_datastore_class.inspect %>
46
+ # config.dragonfly_custom_datastore_opts = <%= Refinery::Images.dragonfly_custom_datastore_opts.inspect %>
47
+
28
48
  # Configure S3 (you can also use ENV for this)
29
- # The s3_backend setting by default defers to the core setting for this but can be set just for images.
30
- # config.s3_backend = Refinery::Core.s3_backend
49
+ # The s3_datastore setting by default defers to the Refinery::Dragonfly setting for this but can be set just for images.
50
+ # config.s3_datastore = Refinery::Dragonfly.s3_datastore
31
51
  # config.s3_bucket_name = ENV['S3_BUCKET']
32
52
  # config.s3_access_key_id = ENV['S3_KEY']
33
53
  # config.s3_secret_access_key = ENV['S3_SECRET']
34
54
  # config.s3_region = ENV['S3_REGION']
35
-
36
- # Configure Dragonfly
37
- # config.dragonfly_verify_urls = <%= Refinery::Images.dragonfly_verify_urls %>
38
- config.dragonfly_secret = <%= Refinery::Images.dragonfly_secret.inspect %>
39
- # config.dragonfly_url_format = <%= Refinery::Images.dragonfly_url_format.inspect %>
40
- # config.dragonfly_url_host = <%= Refinery::Images.dragonfly_url_host.inspect %>
41
- # config.datastore_root_path = <%= Refinery::Images.datastore_root_path.inspect %>
42
-
43
- # Configure Dragonfly custom storage backend
44
- # The custom_backend setting by default defers to the core setting for this but can be set just for images.
45
- # config.custom_backend_class = <%= Refinery::Images.custom_backend_class.inspect %>
46
- # config.custom_backend_opts = <%= Refinery::Images.custom_backend_opts.inspect %>
55
+ #
56
+ # further S3 configuration options
57
+ # config.s3_fog_storage_options = <%= Refinery::Images.s3_fog_storage_options.inspect %>
58
+ # config.s3_root_path = <%= Refinery::Images.s3_root_path.inspect %>
59
+ # config.s3_storage_path = <%= Refinery::Images.s3_storage_path.inspect %>
60
+ # config.s3_storage_headers = <%= Refinery::Images.s3_storage_headers.inspect %>
61
+ # config.s3_url_host = <%= Refinery::Images.s3_url_host.inspect %>
62
+ # config.s3_url_scheme = <%= Refinery::Images.s3_url_scheme.inspect %>
63
+ # config.s3_use_iam_profile = <%= Refinery::Images.s3_use_iam_profile.inspect %>
47
64
 
48
65
  end
@@ -1,14 +1,14 @@
1
1
  require 'refinerycms-core'
2
- require 'dragonfly'
2
+ require 'refinerycms-dragonfly'
3
3
 
4
4
  module Refinery
5
5
  autoload :ImagesGenerator, 'generators/refinery/images/images_generator'
6
6
 
7
7
  module Images
8
8
  require 'refinery/images/engine'
9
+ require 'refinery/dragonfly/extension_configuration'
9
10
  require 'refinery/images/configuration'
10
11
 
11
- autoload :Dragonfly, 'refinery/images/dragonfly'
12
12
  autoload :Validators, 'refinery/images/validators'
13
13
 
14
14
  class << self
@@ -25,4 +25,4 @@ end
25
25
 
26
26
  ActiveSupport.on_load(:active_record) do
27
27
  require 'globalize'
28
- end
28
+ end
@@ -1,20 +1,13 @@
1
1
  module Refinery
2
2
  module Images
3
+
4
+ extend Refinery::Dragonfly::ExtensionConfiguration
3
5
  include ActiveSupport::Configurable
4
6
 
5
- config_accessor :dragonfly_secret, :dragonfly_url_format, :dragonfly_url_host, :dragonfly_verify_urls,
6
- :max_image_size, :pages_per_dialog, :pages_per_admin_index,
7
+ config_accessor :max_image_size, :pages_per_dialog, :pages_per_admin_index,
7
8
  :pages_per_dialog_that_have_size_options, :user_image_sizes,
8
- :image_views, :preferred_image_view, :datastore_root_path,
9
- :s3_backend, :s3_bucket_name, :s3_region,
10
- :s3_access_key_id, :s3_secret_access_key,
11
- :whitelisted_mime_types,
12
- :custom_backend_class, :custom_backend_opts
13
-
14
- self.dragonfly_secret = Core.dragonfly_secret
15
- self.dragonfly_url_format = '/system/images/:job/:basename.:ext'
16
- self.dragonfly_url_host = ''
17
- self.dragonfly_verify_urls = true
9
+ :image_views, :preferred_image_view,
10
+ :whitelisted_mime_types
18
11
 
19
12
  self.max_image_size = 5_242_880
20
13
  self.pages_per_dialog = 18
@@ -25,51 +18,19 @@ module Refinery
25
18
  :medium => '225x255>',
26
19
  :large => '450x450>'
27
20
  }
28
-
29
21
  self.whitelisted_mime_types = %w[image/jpeg image/png image/gif image/tiff]
30
-
31
22
  self.image_views = [:grid, :list]
32
23
  self.preferred_image_view = :grid
33
24
 
34
- # We have to configure these settings after Rails is available.
35
- # But a non-nil custom option can still be provided
36
- class << self
37
- def datastore_root_path
38
- config.datastore_root_path || (Rails.root.join('public', 'system', 'refinery', 'images').to_s if Rails.root)
39
- end
40
-
41
- def s3_backend
42
- config.s3_backend.presence || Core.s3_backend
43
- end
44
-
45
- def s3_bucket_name
46
- config.s3_bucket_name.presence || Core.s3_bucket_name
47
- end
48
-
49
- def s3_access_key_id
50
- config.s3_access_key_id.presence || Core.s3_access_key_id
51
- end
52
-
53
- def s3_secret_access_key
54
- config.s3_secret_access_key.presence || Core.s3_secret_access_key
55
- end
56
-
57
- def s3_region
58
- config.s3_region.presence || Core.s3_region
59
- end
60
-
61
- def custom_backend?
62
- config.custom_backend_class.nil? ? Core.dragonfly_custom_backend? : config.custom_backend_class.present?
63
- end
64
-
65
- def custom_backend_class
66
- config.custom_backend_class.nil? ? Core.dragonfly_custom_backend_class : config.custom_backend_class.constantize
67
- end
25
+ # Images should always use these changes to the dragonfly defaults
26
+ self.dragonfly_name = :refinery_images
27
+ self.dragonfly_plugin = :imagemagick
68
28
 
69
- def custom_backend_opts
70
- config.custom_backend_opts.presence || Core.dragonfly_custom_backend_opts
71
- end
29
+ # Dragonfly processor to strip image of all profiles and comments (imagemagick conversion -strip)
30
+ self.dragonfly_processors = [{
31
+ name: :strip,
32
+ block: -> (content) { content.process!(:convert, '-strip') }
33
+ }]
72
34
 
73
- end
74
35
  end
75
36
  end
@@ -9,8 +9,8 @@ module Refinery
9
9
  config.autoload_paths += %W( #{config.root}/lib )
10
10
 
11
11
  initializer 'attach-refinery-images-with-dragonfly', :before => :finisher_hook do |app|
12
- ::Refinery::Images::Dragonfly.configure!
13
- ::Refinery::Images::Dragonfly.attach!(app)
12
+ ::Refinery::Dragonfly.configure!(::Refinery::Images)
13
+ ::Refinery::Dragonfly.attach!(app, ::Refinery::Images)
14
14
  end
15
15
 
16
16
  before_inclusion do
@@ -1 +1,2 @@
1
1
  require 'refinery/images'
2
+
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.summary = %q{Images extension for Refinery CMS}
11
11
  s.description = %q{Handles all image upload and processing functionality in Refinery CMS.}
12
12
  s.email = %q{refinerycms@p.arndt.io}
13
- s.homepage = %q{http://refinerycms.com}
13
+ s.homepage = %q{https://www.refinerycms.com}
14
14
  s.rubyforge_project = %q{refinerycms}
15
15
  s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski']
16
16
  s.license = %q{MIT}
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.files = `git ls-files`.split("\n")
20
20
  s.test_files = `git ls-files -- spec/*`.split("\n")
21
21
 
22
- s.add_dependency 'dragonfly', '~> 1.1', '>= 1.1.0'
22
+ s.add_dependency 'refinerycms-dragonfly', '~> 1.0'
23
23
  s.add_dependency 'globalize', ['>= 5.1.0.beta1', '< 5.2']
24
24
  s.add_dependency 'activemodel-serializers-xml', '~> 1.0', '>= 1.0.1'
25
25
  s.add_dependency 'refinerycms-core', version
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :image, :class => ::Refinery::Image do
3
3
  image Refinery.roots('refinery/images').join("spec/fixtures/beach.jpeg")
4
4
  end
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+
3
+ module Refinery
4
+ describe "dialog", :type => :feature do
5
+ refinery_login
6
+
7
+ context 'When there are many images' do
8
+ include_context 'many images'
9
+
10
+ it "does not have selected an image" do
11
+ visit refinery.insert_admin_images_path
12
+
13
+ expect(page).to_not have_selector("li[class='selected']")
14
+ end
15
+
16
+ it "only selects the provided image" do
17
+ visit refinery.insert_admin_images_path(selected_image: image.id)
18
+
19
+ expect(page).to have_selector("li[class='selected'] img[data-id='#{image.id}']")
20
+ expect(page).to_not have_selector("li[class='selected'] img[data-id='#{alt_image.id}']")
21
+ expect(page).to_not have_selector("li[class='selected'] img[data-id='#{another_image.id}']")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ module Refinery
4
+ describe Images do
5
+ it_has_behaviour 'Creates a dragonfly App:'
6
+ it_has_behaviour 'adds the dragonfly app to the middleware stack'
7
+ end
8
+ end
@@ -1,14 +1,15 @@
1
1
  require 'spec_helper'
2
+ require 'uri'
2
3
 
3
4
  module Refinery
4
5
  describe Image, :type => :model do
5
6
 
6
- let(:image) { FactoryGirl.build(:image) }
7
- let(:created_image) { FactoryGirl.create(:image) }
8
- let(:titled_image) { FactoryGirl.create(:image, image_title: 'Image Title')}
9
- let(:image_with_alt_text) { FactoryGirl.create(:image, image_alt: 'Alt Text')}
10
- let(:image_with_sha) {FactoryGirl.create(:image)}
11
- let(:image_without_sha) {FactoryGirl.create(:image)}
7
+ let(:image) { FactoryBot.build(:image) }
8
+ let(:created_image) { FactoryBot.create(:image) }
9
+ let(:titled_image) { FactoryBot.create(:image, image_title: 'Image Title')}
10
+ let(:image_with_alt_text) { FactoryBot.create(:image, image_alt: 'Alt Text')}
11
+ let(:image_with_sha) {FactoryBot.create(:image)}
12
+ let(:image_without_sha) {FactoryBot.create(:image)}
12
13
 
13
14
  describe "validations" do
14
15
  describe "valid #image" do
@@ -71,8 +72,8 @@ module Refinery
71
72
  expect(image).to respond_to(:thumbnail)
72
73
  end
73
74
 
74
- it "contains its filename at the end" do
75
- expect(created_image.url.split('/').last).to match(/\A#{created_image.image_name}/)
75
+ it "contains its filename" do
76
+ expect(File.basename(URI.parse(created_image.url).path)).to match(/\A#{created_image.image_name}/)
76
77
  end
77
78
 
78
79
  it "becomes different when supplying geometry" do
@@ -201,7 +202,7 @@ module Refinery
201
202
  end
202
203
 
203
204
  describe '#thumbnail_dimensions returns correctly with' do
204
- let(:created_alternate_image) { FactoryGirl.create(:alternate_image) }
205
+ let(:created_alternate_image) { FactoryBot.create(:alternate_image) }
205
206
 
206
207
  it 'nil' do
207
208
  expect(created_alternate_image.thumbnail_dimensions(nil)).to eq({ :width => 376, :height => 184 })
@@ -1,5 +1,5 @@
1
1
  shared_context 'many images' do
2
- let!(:image) { FactoryGirl.create(:image) }
3
- let!(:alt_image) { FactoryGirl.create(:alternate_image) }
4
- let!(:another_image) { FactoryGirl.create(:another_image) }
2
+ let!(:image) { FactoryBot.create(:image) }
3
+ let!(:alt_image) { FactoryBot.create(:alternate_image) }
4
+ let!(:another_image) { FactoryBot.create(:another_image) }
5
5
  end
@@ -1,3 +1,3 @@
1
1
  shared_context "no existing images" do
2
- let(:image) { FactoryGirl.create(:image) }
2
+ let(:image) { FactoryBot.create(:image) }
3
3
  end
@@ -1,3 +1,3 @@
1
1
  shared_context "one image" do
2
- let!(:image) { FactoryGirl.create(:image) }
2
+ let!(:image) { FactoryBot.create(:image) }
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-images
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Arndt
@@ -32,28 +32,22 @@ cert_chain:
32
32
  jOQmH9VbgbfUrXYM1YOKdlwW5sPR1f4PKLDlvEE+bppIUgKOgLOIv3i7KwrGvFOq
33
33
  5r7Wz/HY31SM47mkK21saPJG4NvUFEycf0wlpzP657Pl9aVo47aKKbxX
34
34
  -----END CERTIFICATE-----
35
- date: 2017-10-25 00:00:00.000000000 Z
35
+ date: 2018-05-21 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
- name: dragonfly
38
+ name: refinerycms-dragonfly
39
39
  requirement: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '1.1'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 1.1.0
43
+ version: '1.0'
47
44
  type: :runtime
48
45
  prerelease: false
49
46
  version_requirements: !ruby/object:Gem::Requirement
50
47
  requirements:
51
48
  - - "~>"
52
49
  - !ruby/object:Gem::Version
53
- version: '1.1'
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 1.1.0
50
+ version: '1.0'
57
51
  - !ruby/object:Gem::Dependency
58
52
  name: globalize
59
53
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +94,14 @@ dependencies:
100
94
  requirements:
101
95
  - - '='
102
96
  - !ruby/object:Gem::Version
103
- version: 4.0.1
97
+ version: 4.0.2
104
98
  type: :runtime
105
99
  prerelease: false
106
100
  version_requirements: !ruby/object:Gem::Requirement
107
101
  requirements:
108
102
  - - '='
109
103
  - !ruby/object:Gem::Version
110
- version: 4.0.1
104
+ version: 4.0.2
111
105
  description: Handles all image upload and processing functionality in Refinery CMS.
112
106
  email: refinerycms@p.arndt.io
113
107
  executables: []
@@ -172,7 +166,6 @@ files:
172
166
  - lib/generators/refinery/images/templates/config/initializers/refinery/images.rb.erb
173
167
  - lib/refinery/images.rb
174
168
  - lib/refinery/images/configuration.rb
175
- - lib/refinery/images/dragonfly.rb
176
169
  - lib/refinery/images/engine.rb
177
170
  - lib/refinery/images/validators.rb
178
171
  - lib/refinery/images/validators/image_size_validator.rb
@@ -181,6 +174,7 @@ files:
181
174
  - license.md
182
175
  - refinerycms-images.gemspec
183
176
  - spec/factories/image.rb
177
+ - spec/features/refinery/admin/dialog_spec.rb
184
178
  - spec/features/refinery/admin/images_spec.rb
185
179
  - spec/fixtures/beach-alternate.jpeg
186
180
  - spec/fixtures/beach.jpeg
@@ -188,7 +182,7 @@ files:
188
182
  - spec/fixtures/fathead.png
189
183
  - spec/fixtures/image-with-dashes.jpg
190
184
  - spec/lib/generators/refinery/images/images_generator_spec.rb
191
- - spec/lib/refinery/images/dragonfly_spec.rb
185
+ - spec/lib/refinery/images/engine_spec.rb
192
186
  - spec/models/refinery/image_spec.rb
193
187
  - spec/models/refinery/thumbnail_dimensions_spec.rb
194
188
  - spec/support/shared_contexts/admin_images_tab.rb
@@ -204,8 +198,7 @@ files:
204
198
  - spec/support/shared_examples/image_translator.rb
205
199
  - spec/support/shared_examples/image_uploader.rb
206
200
  - spec/support/spec_helper.rb
207
- - test.html
208
- homepage: http://refinerycms.com
201
+ homepage: https://www.refinerycms.com
209
202
  licenses:
210
203
  - MIT
211
204
  metadata: {}
@@ -231,6 +224,7 @@ specification_version: 4
231
224
  summary: Images extension for Refinery CMS
232
225
  test_files:
233
226
  - spec/factories/image.rb
227
+ - spec/features/refinery/admin/dialog_spec.rb
234
228
  - spec/features/refinery/admin/images_spec.rb
235
229
  - spec/fixtures/beach-alternate.jpeg
236
230
  - spec/fixtures/beach.jpeg
@@ -238,7 +232,7 @@ test_files:
238
232
  - spec/fixtures/fathead.png
239
233
  - spec/fixtures/image-with-dashes.jpg
240
234
  - spec/lib/generators/refinery/images/images_generator_spec.rb
241
- - spec/lib/refinery/images/dragonfly_spec.rb
235
+ - spec/lib/refinery/images/engine_spec.rb
242
236
  - spec/models/refinery/image_spec.rb
243
237
  - spec/models/refinery/thumbnail_dimensions_spec.rb
244
238
  - spec/support/shared_contexts/admin_images_tab.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,68 +0,0 @@
1
- require 'dragonfly'
2
-
3
- module Refinery
4
- module Images
5
- module Dragonfly
6
-
7
- class << self
8
- def configure!
9
- ActiveRecord::Base.extend ::Dragonfly::Model
10
- ActiveRecord::Base.extend ::Dragonfly::Model::Validations
11
-
12
- app_images = ::Dragonfly.app(:refinery_images)
13
-
14
- app_images.configure do
15
- plugin :imagemagick
16
- datastore :file, {
17
- :root_path => Refinery::Images.datastore_root_path
18
- }
19
- url_format Refinery::Images.dragonfly_url_format
20
- url_host Refinery::Images.dragonfly_url_host
21
- verify_urls Refinery::Images.dragonfly_verify_urls
22
- if Refinery::Images.dragonfly_verify_urls
23
- secret Refinery::Images.dragonfly_secret
24
- end
25
- dragonfly_url nil
26
- processor :strip do |content|
27
- content.process!(:convert, '-strip')
28
- end
29
- end
30
-
31
- if ::Refinery::Images.s3_backend
32
- require 'dragonfly/s3_data_store'
33
- options = {
34
- bucket_name: Refinery::Images.s3_bucket_name,
35
- access_key_id: Refinery::Images.s3_access_key_id,
36
- secret_access_key: Refinery::Images.s3_secret_access_key
37
- }
38
- # S3 Region otherwise defaults to 'us-east-1'
39
- options.update(region: Refinery::Images.s3_region) if Refinery::Images.s3_region
40
- app_images.use_datastore :s3, options
41
- end
42
-
43
- if Images.custom_backend?
44
- app_images.datastore = Images.custom_backend_class.new(Images.custom_backend_opts)
45
- end
46
- end
47
-
48
- ##
49
- # Injects Dragonfly::Middleware for Refinery::Images into the stack
50
- def attach!(app)
51
- if defined?(::Rack::Cache)
52
- unless app.config.action_controller.perform_caching && app.config.action_dispatch.rack_cache
53
- app.config.middleware.insert 0, ::Rack::Cache, {
54
- verbose: true,
55
- metastore: URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), # URI encoded in case of spaces
56
- entitystore: URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")
57
- }
58
- end
59
- app.config.middleware.insert_after ::Rack::Cache, ::Dragonfly::Middleware, :refinery_images
60
- else
61
- app.config.middleware.use ::Dragonfly::Middleware, :refinery_images
62
- end
63
- end
64
- end
65
-
66
- end
67
- end
68
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Refinery
4
-
5
- describe Dragonfly do
6
- def configure_dragonfly(name, verify)
7
- app = ::Dragonfly.app(name)
8
-
9
- app.configure do
10
- verify_urls verify
11
- end
12
- end
13
-
14
- context 'when verify_urls is true' do
15
- before do
16
- configure_dragonfly(:app1, true)
17
- end
18
- it 'it is reflected in the dragonfly configuration' do
19
- expect(Dragonfly.app(:app1).server.verify_urls).to be(true)
20
- end
21
- end
22
-
23
- context 'when verify_urls is false' do
24
- before do
25
- configure_dragonfly(:app2, false)
26
- end
27
- it 'it is reflected in the dragonfly configuration' do
28
- expect(Dragonfly.app(:app2).server.verify_urls).to be(false)
29
- end
30
- end
31
-
32
- end
33
- end
34
-
data/test.html DELETED
@@ -1,126 +0,0 @@
1
- <!DOCTYPE html>
2
- <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
3
- <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
4
- <!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
5
- <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
6
- <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
7
- <!--[if (gt IE 9)|!(IE)]><!-->
8
- <html lang="en" class="no-js">
9
- <!--<![endif]-->
10
-
11
- <head>
12
- <meta charset='utf-8' />
13
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
14
- <meta refinerycms='3.0.0' />
15
- <title>Company Name - Refinery</title>
16
-
17
- <link rel="stylesheet" media="screen" href="/assets/refinery/refinery.css" />
18
- <link rel="stylesheet" media="screen" href="/assets/wymeditor.css" />
19
- <link rel="stylesheet" media="screen" href="/assets/wymeditor/skins/refinery/skin.css" />
20
-
21
- <script type="text/javascript" >
22
- var refinery = window.refinery || {};
23
- refinery.current_admin_locale = 'en';
24
- </script>
25
- <script src="/assets/admin.js"></script><script src="/assets/refinery/refinery.js"></script><script src="/assets/refinery/application.js"></script>
26
- <script src="/assets/refi
27
- nery/wymeditor.js"></script>
28
- <script src="/assets/wymeditor/lang/en.js"></script>
29
- <script src="/assets/wymeditor/skins/refinery/skin.js"></script>
30
-
31
- </head>
32
-
33
- <body class="index en">
34
- <div id='site_bar'>
35
- <div id='site_bar_content' class='clearfix'>
36
-
37
- <div id='editor_switch'>
38
- <a data-turbolinks="false" href="/">Switch to your website</a>
39
- </div>
40
-
41
- <a id="site_bar_refinery_cms_logo" target="_blank" href="http://refinerycms.com"> <span>Refinery CMS™</span> </a>
42
- <div id='site_bar_branding'>
43
- <span id='site_bar_company_name'> Company Name </span>
44
-
45
- <a id="logout" href="/refinery/logout">Log out</a>
46
- </div>
47
- </div>
48
- </div>
49
-
50
- <div id='tooltip_container'></div>
51
- <div id="admin_container" class="clearfix">
52
- <header id="header">
53
- <nav id="menu">
54
- <a id="plugin_refinery_users" href="/refinery/users">Users</a>
55
- <a class="active" id="plugin_refinery_images" href="/refinery/images">Images</a>
56
- <a id="plugin_refinery_files" href="/refinery/resources">Files</a>
57
- <a id="plugin_refinery_pages" href="/refinery/pages">Pages</a>
58
-
59
- <a id="menu_reorder" title="Reorder menu" class=" reorder_icon" href=""></a>
60
- <a id="menu_reorder_done" title="i18n: Reorder Done" class=" reorder_done_icon hidden" href=""></a>
61
-
62
- </nav>
63
-
64
- </header>
65
- <div id="page_container">
66
- <div id="page">
67
- <div id="content" class="clearfix">
68
- <div id="flash_container">
69
- <noscript>
70
- <div class='flash flash_error'>
71
- For full functionality of this page it is necessary to enable JavaScript.
72
- Here are the
73
- <a target="_blank" href="http://www.enable-javascript.com">instructions for how to enable JavaScript in your web browser</a>
74
- </div>
75
- </noscript>
76
-
77
- </div>
78
- <section id="records" class="images">
79
-
80
- <div class="pagination_container">
81
-
82
- <div class="clearfix pagination_frame frame_center">
83
- <h3>March 04, 2015</h3>
84
- <ul class='images_list'>
85
- <li id="sortable_1" class="clearfix record on">
86
- <span class="title"> Beach </span>
87
- <span class='alt'> <a title="Title: Beach Alt text: Beach" class=" info_icon" href="#"></a> </span>
88
-
89
- <span class="preview">&nbsp;</span>
90
- <span class="actions"> <a title="View this image <br/><em>Opens in a new window</em>" class=" preview_icon" target="_blank" href="/system/images/W1siZiIsIjIwMTUvMDMvMDQvNmhleWpqcDJvZF9iZWFjaC5q
91
- cGVnIl1d/beach.jpeg?sha=9fd966feb5fd57e4"></a> <a title="Edit this image" class=" edit_icon" href="/refinery/images/1/edit"></a> <a data-confirm="Are you sure you want to remove &#39;Beach&#39;?" title="Remove this image forever" class=" delete_icon cancel confirm-delete" rel="nofollow" data-method
92
- ="delete" href="/refinery/images/1"></a> </span>
93
- </li>
94
-
95
- </ul>
96
- </div>
97
-
98
- </div>
99
-
100
- </section>
101
- <section id="actions">
102
- <ul>
103
- <li>
104
- <form method='GET' action='/refinery/images' class='search_form'>
105
- <input id="search" type="search" name="search" title="Put here a string of at least 3 characters containing what you are looking for." />
106
-
107
- <input type="submit" value="Search" />
108
- </form>
109
-
110
- </li>
111
- <li>
112
- <a title="Add new image" class=" add_icon" href="/refinery/images/new?dialog=true">Add new image</a>
113
- </li>
114
- <li>
115
- <a title="Switch to grid view" class=" switch_view_grid_icon" href="/refinery/images?view=grid">Switch to grid view</a>
116
- </li>
117
- </ul>
118
-
119
- </section>
120
-
121
- </div>
122
- </div>
123
- </div>
124
- </div>
125
- </body>
126
- </html>