commit
dae0a6538a
2
Gemfile
2
Gemfile
|
@ -33,6 +33,8 @@ gem 'font-awesome-rails', '~> 4.3.0.0'
|
||||||
gem 'rails-assets-growl'
|
gem 'rails-assets-growl'
|
||||||
gem "paperclip", "~> 4.2"
|
gem "paperclip", "~> 4.2"
|
||||||
gem 'delayed_paperclip'
|
gem 'delayed_paperclip'
|
||||||
|
gem 'fog'
|
||||||
|
gem 'fog-aws'
|
||||||
gem 'momentjs-rails', '>= 2.9.0'
|
gem 'momentjs-rails', '>= 2.9.0'
|
||||||
gem 'bootstrap3-datetimepicker-rails', '~> 4.7.14'
|
gem 'bootstrap3-datetimepicker-rails', '~> 4.7.14'
|
||||||
|
|
||||||
|
|
92
Gemfile.lock
92
Gemfile.lock
|
@ -8,6 +8,7 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
remote: https://rails-assets.org/
|
remote: https://rails-assets.org/
|
||||||
specs:
|
specs:
|
||||||
|
CFPropertyList (2.3.1)
|
||||||
actionmailer (4.2.1)
|
actionmailer (4.2.1)
|
||||||
actionpack (= 4.2.1)
|
actionpack (= 4.2.1)
|
||||||
actionview (= 4.2.1)
|
actionview (= 4.2.1)
|
||||||
|
@ -95,6 +96,7 @@ GEM
|
||||||
equalizer (0.0.11)
|
equalizer (0.0.11)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
eventmachine (1.0.7)
|
eventmachine (1.0.7)
|
||||||
|
excon (0.45.1)
|
||||||
execjs (2.5.2)
|
execjs (2.5.2)
|
||||||
factory_girl (4.5.0)
|
factory_girl (4.5.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
@ -107,12 +109,95 @@ GEM
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
faraday_middleware (0.9.1)
|
faraday_middleware (0.9.1)
|
||||||
faraday (>= 0.7.4, < 0.10)
|
faraday (>= 0.7.4, < 0.10)
|
||||||
|
fission (0.5.0)
|
||||||
|
CFPropertyList (~> 2.2)
|
||||||
|
fog (1.28.0)
|
||||||
|
fog-atmos
|
||||||
|
fog-aws (~> 0.0)
|
||||||
|
fog-brightbox (~> 0.4)
|
||||||
|
fog-core (~> 1.27, >= 1.27.3)
|
||||||
|
fog-ecloud
|
||||||
|
fog-json
|
||||||
|
fog-profitbricks
|
||||||
|
fog-radosgw (>= 0.0.2)
|
||||||
|
fog-riakcs
|
||||||
|
fog-sakuracloud (>= 0.0.4)
|
||||||
|
fog-serverlove
|
||||||
|
fog-softlayer
|
||||||
|
fog-storm_on_demand
|
||||||
|
fog-terremark
|
||||||
|
fog-vmfusion
|
||||||
|
fog-voxel
|
||||||
|
fog-xml (~> 0.1.1)
|
||||||
|
ipaddress (~> 0.5)
|
||||||
|
nokogiri (~> 1.5, >= 1.5.11)
|
||||||
|
fog-atmos (0.1.0)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
fog-aws (0.1.1)
|
||||||
|
fog-core (~> 1.27)
|
||||||
|
fog-json (~> 1.0)
|
||||||
|
fog-xml (~> 0.1)
|
||||||
|
ipaddress (~> 0.8)
|
||||||
|
fog-brightbox (0.7.1)
|
||||||
|
fog-core (~> 1.22)
|
||||||
|
fog-json
|
||||||
|
inflecto (~> 0.0.2)
|
||||||
|
fog-core (1.29.0)
|
||||||
|
builder
|
||||||
|
excon (~> 0.38)
|
||||||
|
formatador (~> 0.2)
|
||||||
|
mime-types
|
||||||
|
net-scp (~> 1.1)
|
||||||
|
net-ssh (>= 2.1.3)
|
||||||
|
fog-ecloud (0.0.2)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
fog-json (1.0.0)
|
||||||
|
multi_json (~> 1.0)
|
||||||
|
fog-profitbricks (0.0.2)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
nokogiri
|
||||||
|
fog-radosgw (0.0.3)
|
||||||
|
fog-core (>= 1.21.0)
|
||||||
|
fog-json
|
||||||
|
fog-xml (>= 0.0.1)
|
||||||
|
fog-riakcs (0.1.0)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-xml
|
||||||
|
fog-sakuracloud (1.0.0)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-serverlove (0.1.1)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-softlayer (0.4.1)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-storm_on_demand (0.1.0)
|
||||||
|
fog-core
|
||||||
|
fog-json
|
||||||
|
fog-terremark (0.0.4)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
fog-vmfusion (0.0.1)
|
||||||
|
fission
|
||||||
|
fog-core
|
||||||
|
fog-voxel (0.0.2)
|
||||||
|
fog-core
|
||||||
|
fog-xml
|
||||||
|
fog-xml (0.1.1)
|
||||||
|
fog-core
|
||||||
|
nokogiri (~> 1.5, >= 1.5.11)
|
||||||
font-awesome-rails (4.3.0.0)
|
font-awesome-rails (4.3.0.0)
|
||||||
railties (>= 3.2, < 5.0)
|
railties (>= 3.2, < 5.0)
|
||||||
font-kit-rails (1.1.0)
|
font-kit-rails (1.1.0)
|
||||||
rails
|
rails
|
||||||
foreman (0.78.0)
|
foreman (0.78.0)
|
||||||
thor (~> 0.19.1)
|
thor (~> 0.19.1)
|
||||||
|
formatador (0.2.5)
|
||||||
globalid (0.3.5)
|
globalid (0.3.5)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
haml (4.0.6)
|
haml (4.0.6)
|
||||||
|
@ -125,6 +210,8 @@ GEM
|
||||||
http_accept_language (2.0.5)
|
http_accept_language (2.0.5)
|
||||||
http_parser.rb (0.6.0)
|
http_parser.rb (0.6.0)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
|
inflecto (0.0.2)
|
||||||
|
ipaddress (0.8.0)
|
||||||
jbuilder (2.2.13)
|
jbuilder (2.2.13)
|
||||||
activesupport (>= 3.0.0, < 5)
|
activesupport (>= 3.0.0, < 5)
|
||||||
multi_json (~> 1.2)
|
multi_json (~> 1.2)
|
||||||
|
@ -158,6 +245,9 @@ GEM
|
||||||
mysql2 (0.3.18)
|
mysql2 (0.3.18)
|
||||||
naught (1.0.0)
|
naught (1.0.0)
|
||||||
nested_form (0.3.2)
|
nested_form (0.3.2)
|
||||||
|
net-scp (1.2.1)
|
||||||
|
net-ssh (>= 2.6.5)
|
||||||
|
net-ssh (2.9.2)
|
||||||
nokogiri (1.6.6.2)
|
nokogiri (1.6.6.2)
|
||||||
mini_portile (~> 0.6.0)
|
mini_portile (~> 0.6.0)
|
||||||
nokogumbo (1.2.0)
|
nokogumbo (1.2.0)
|
||||||
|
@ -377,6 +467,8 @@ DEPENDENCIES
|
||||||
devise-async
|
devise-async
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
faker
|
faker
|
||||||
|
fog
|
||||||
|
fog-aws
|
||||||
font-awesome-rails (~> 4.3.0.0)
|
font-awesome-rails (~> 4.3.0.0)
|
||||||
font-kit-rails
|
font-kit-rails
|
||||||
foreman
|
foreman
|
||||||
|
|
30
Rakefile
30
Rakefile
|
@ -6,6 +6,36 @@ require File.expand_path('../config/application', __FILE__)
|
||||||
Rails.application.load_tasks
|
Rails.application.load_tasks
|
||||||
|
|
||||||
namespace :justask do
|
namespace :justask do
|
||||||
|
desc "Upload to AWS"
|
||||||
|
task paperclaws: :environment do
|
||||||
|
if APP_CONFIG["fog"]["credentials"].nil? or APP_CONFIG["fog"]["credentials"]["provider"] != :AWS
|
||||||
|
throw "Needs fog (AWS) to be defined in justask.yml"
|
||||||
|
|
||||||
|
format = '%t (%c/%C) [%b>%i] %e'
|
||||||
|
root = "#{Rails.root}/public/system"
|
||||||
|
files = Dir["#{root}/**/*.*"]
|
||||||
|
progress = ProgressBar.create title: 'Processing files', format: format, starting_at: 0, total: files.length
|
||||||
|
|
||||||
|
# weird voodoo, something is causing just using "APP_CONFIG["fog"]["credentials"]" as Fog::Storage.new to cause an exception
|
||||||
|
# TODO: Programmatically copy?
|
||||||
|
credentials = {
|
||||||
|
provider: :AWS,
|
||||||
|
aws_access_key_id: APP_CONFIG["fog"]["credentials"]["aws_access_key_id"],
|
||||||
|
aws_secret_access_key: APP_CONFIG["fog"]["credentials"]["aws_secret_access_key"],
|
||||||
|
region: APP_CONFIG["fog"]["credentials"]["region"]
|
||||||
|
}
|
||||||
|
|
||||||
|
fog = Fog::Storage.new credentials
|
||||||
|
bucket = fog.directories.get APP_CONFIG["fog"]["directory"]
|
||||||
|
|
||||||
|
files.each do |file|
|
||||||
|
bucket.files.create key: file[root.length + 1 ... file.length], body: File.open(file), public: true
|
||||||
|
progress.increment
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "hopefully uploaded #{files.length} files"
|
||||||
|
end
|
||||||
|
|
||||||
desc "Recount everything!"
|
desc "Recount everything!"
|
||||||
task recount: :environment do
|
task recount: :environment do
|
||||||
format = '%t (%c/%C) [%b>%i] %e'
|
format = '%t (%c/%C) [%b>%i] %e'
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
Paperclip::Attachment.default_options[:storage] = :fog
|
||||||
|
Paperclip::Attachment.default_options[:fog_credentials] = {:provider => "Local", :local_root => "#{Rails.root}/public"}
|
||||||
|
Paperclip::Attachment.default_options[:fog_directory] = "/system"
|
||||||
|
Paperclip::Attachment.default_options[:fog_host] = "/system"
|
||||||
|
|
||||||
|
unless APP_CONFIG["fog"].nil?
|
||||||
|
Paperclip::Attachment.default_options[:fog_credentials] = APP_CONFIG["fog"]["credentials"] unless APP_CONFIG["fog"]["credentials"].nil?
|
||||||
|
Paperclip::Attachment.default_options[:fog_directory] = APP_CONFIG["fog"]["directory"] unless APP_CONFIG["fog"]["directory"].nil?
|
||||||
|
Paperclip::Attachment.default_options[:fog_host] = APP_CONFIG["fog"]["host"] unless APP_CONFIG["fog"]["host"].nil?
|
||||||
|
|
||||||
|
if not APP_CONFIG["fog"]["credentials"].nil? and APP_CONFIG["fog"]["host"].nil?
|
||||||
|
Paperclip::Attachment.default_options[:fog_host] = nil
|
||||||
|
end
|
||||||
|
end
|
|
@ -42,3 +42,15 @@ admins:
|
||||||
about_text: Filippus
|
about_text: Filippus
|
||||||
subtext: Moderator Management & Support
|
subtext: Moderator Management & Support
|
||||||
|
|
||||||
|
# delete if using local storage
|
||||||
|
fog:
|
||||||
|
# fog credentials
|
||||||
|
credentials:
|
||||||
|
provider: 'AWS'
|
||||||
|
aws_access_key_id: 'ACCESS KEY'
|
||||||
|
aws_secret_access_key: 'SECRET KEY'
|
||||||
|
region: 'space-pluto-1'
|
||||||
|
# bucket name, required
|
||||||
|
directory: 'retrospring'
|
||||||
|
# URL host, comment out to use default, GENERALLY you don't want to define this
|
||||||
|
# host: ''
|
||||||
|
|
Loading…
Reference in New Issue