From 5cf109280b23290ecdb526b8b9025fcec367c8a1 Mon Sep 17 00:00:00 2001 From: Espen Antonsen Date: Tue, 13 Apr 2010 23:56:13 -0400 Subject: [PATCH] balder ENV settings. s3 init. remove settings.yml --- app/controllers/application_controller.rb | 2 +- app/models/album.rb | 8 ++++---- app/uploaders/file_uploader.rb | 7 +++++-- app/views/albums/_form.html.erb | 5 +---- app/views/layouts/application.html.erb | 8 ++++---- config/environment.rb | 4 ++++ config/initializers/load_settings.rb | 2 -- config/initializers/s3.rb | 6 +++--- config/settings.example.yml | 13 ------------- 9 files changed, 22 insertions(+), 33 deletions(-) delete mode 100644 config/initializers/load_settings.rb delete mode 100644 config/settings.example.yml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 41d7565..b266b3d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base end def check_public_access - require_user unless APP_CONFIG[:public] + require_user unless ENV['public'] == 'true' end def current_user_session diff --git a/app/models/album.rb b/app/models/album.rb index 9dd0e3f..285a27f 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -92,13 +92,13 @@ class Album < ActiveRecord::Base private def create_folders - Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) unless File.exists?( APP_CONFIG[:photos_path] + self.path ) - Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) unless File.exists?( APP_CONFIG[:thumbs_path] + self.path ) + #Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) unless File.exists?( APP_CONFIG[:photos_path] + self.path ) + #Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) unless File.exists?( APP_CONFIG[:thumbs_path] + self.path ) end def destroy_folders #puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path - Dir.delete( APP_CONFIG[:photos_path] + self.path ) if File.exists?( APP_CONFIG[:photos_path] + self.path ) - Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if File.exists?( APP_CONFIG[:thumbs_path] + self.path ) + #Dir.delete( APP_CONFIG[:photos_path] + self.path ) if File.exists?( APP_CONFIG[:photos_path] + self.path ) + #Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if File.exists?( APP_CONFIG[:thumbs_path] + self.path ) end end diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index 2390eed..d0a1066 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -8,8 +8,11 @@ class FileUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader #storage :file - storage :s3 - + if ENV['S3_KEY'] + storage :s3 + else + storage :file + end # Override the directory where uploaded files will be stored # This is a sensible default for uploaders that are meant to be mounted: diff --git a/app/views/albums/_form.html.erb b/app/views/albums/_form.html.erb index 28df6ff..bf83b9b 100644 --- a/app/views/albums/_form.html.erb +++ b/app/views/albums/_form.html.erb @@ -27,7 +27,4 @@ <%= form.text_field :tags, { :autocomplete => "off", :class => 'tag_list', :value => (@album.tags.map{|tag|tag.title}.join(" ") unless @album.tags.nil?) } %>

-<% if @album.path? %> -Location on disk: <%= APP_CONFIG[:photos_path] + @album.path %>
-Contains: <%= @album.photos.count %> photos
-<% end %> \ No newline at end of file +Contains: <%= @album.photos.count %> photos
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b995820..70439fd 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,7 +3,7 @@ - <%= APP_CONFIG[:site_name] %> + <%= ENV['site_name'] %> <%= yield :head %> <%= stylesheet_link_tag 'application' %> @@ -22,10 +22,10 @@ <% end %>

- <% if APP_CONFIG[:site_logo] %> - <%= image_tag APP_CONFIG[:site_logo] %> + <% if ENV['LOGO'] %> + <%= image_tag ENV['LOGO'] %> <% else %> - <%= APP_CONFIG[:site_name] %> + <%= ENV['TITLE'] %> <% end %>