This repository has been archived by the owner on Apr 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from mezis/update-gems
Update gems
- Loading branch information
Showing
8 changed files
with
82 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env ruby | ||
# | ||
# Converts attachment metadata for a format suitable for Dragonfly 1.0 | ||
# | ||
|
||
# require 'rubygems' | ||
# require 'bundler/setup' | ||
|
||
dir = File.expand_path('../..', __FILE__) | ||
$:.unshift(dir) unless $:.include?(dir) | ||
|
||
require 'config/environment' | ||
|
||
Storage::File.find_each do |file| | ||
file.metadata = JSON.parse(file.metadata.to_json) | ||
file.save! | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,20 @@ | ||
require 'dragonfly' | ||
|
||
Dragonfly[:files].tap do |dragonfly_app| | ||
dragonfly_app.configure_with(:imagemagick) | ||
dragonfly_app.configure_with(:rails) | ||
dragonfly_app.define_macro(ActiveRecord::Base, :file_accessor) | ||
dragonfly_app.datastore = Storage::DataStore.new | ||
dragonfly_app.configure do |config| | ||
config.identify_command = "identify -quiet" | ||
end | ||
end | ||
# Configure | ||
Dragonfly.app.configure do | ||
plugin :imagemagick, | ||
identify_command: 'identify -quiet' | ||
|
||
protect_from_dos_attacks true | ||
secret '07b23dcdfc0cc6f7ed12540ffdb1e74adc0fd914331c8936881edd9d4b5edd74' | ||
|
||
url_format '/media/:job/:name' | ||
|
||
memcached_url = case Rails.env | ||
when 'development' | ||
'memcached://127.0.0.1:11211/rack-cache' | ||
when 'test' | ||
'heap:/' | ||
else | ||
"memcached://%<user>s:%<password>s@%<host>s/rack-cache" % { | ||
host: ENV['MEMCACHIER_SERVERS'].split(',').first, | ||
user: ENV['MEMCACHIER_USERNAME'], | ||
password: ENV['MEMCACHIER_PASSWORD'] | ||
} | ||
datastore Storage::DataStore.new | ||
end | ||
|
||
AppFab::Application.config.middleware.insert 0, 'Rack::Cache', { | ||
:metastore => memcached_url, | ||
:entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body"), | ||
:verbose => false, | ||
} | ||
# Logger | ||
Dragonfly.logger = Rails.logger | ||
|
||
AppFab::Application.config.middleware.insert_after 'Rack::Cache', | ||
'Dragonfly::Middleware', :files | ||
# Mount as middleware | ||
AppFab::Application.config.middleware.use Dragonfly::Middleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Rack::Cache configuration | ||
memcached_url = case Rails.env | ||
when 'development' | ||
'memcached://127.0.0.1:11211/rack-cache' | ||
when 'test' | ||
'heap:/' | ||
else | ||
"memcached://%<user>s:%<password>s@%<host>s/rack-cache" % { | ||
host: ENV['MEMCACHIER_SERVERS'].split(',').first, | ||
user: ENV['MEMCACHIER_USERNAME'], | ||
password: ENV['MEMCACHIER_PASSWORD'] | ||
} | ||
end | ||
|
||
AppFab::Application.config.middleware.insert 0, 'Rack::Cache', { | ||
:metastore => memcached_url, | ||
:entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body"), | ||
:verbose => false, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters