This commit is contained in:
Espen Antonsen 2011-01-12 16:48:28 +08:00
commit 9e09177769
10 changed files with 30 additions and 27 deletions

5
.gems
View file

@ -1,4 +1,5 @@
rails --version '2.3.9'
authlogic
carrierwave
carrierwave --version '0.4.5'
aws-s3
mini_exiftool
rmagick

3
.gitignore vendored
View file

@ -3,6 +3,7 @@ tmp/**/*
.DS_Store
doc/api
doc/app
config/balder.rb
config/database.yml
config/settings.yml
config/deploy.rb
@ -10,4 +11,4 @@ config/deploy
Capfile
photos
public/thumbs
public/uploads
public/uploads

View file

@ -46,7 +46,7 @@ class ApplicationController < ActionController::Base
end
def check_public_access
require_user unless ENV['PUBLIC'] == 'true'
require_user if ENV['PRIVATE'] == 'true'
end
def current_user_session

View file

@ -22,7 +22,7 @@ class FileUploader < CarrierWave::Uploader::Base
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
#{}"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
"uploads/files/#{model.album.path}"
ENV['STORAGE_PATH'] + "files/#{model.album.path}"
end
# Provide a default URL as a default if there hasn't been a file uploaded
@ -41,25 +41,25 @@ class FileUploader < CarrierWave::Uploader::Base
version :collection do
process :resize_to_fill => [200, 200]
def store_dir
"uploads/thumbs/#{model.album.path}"
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
end
end
version :album do
process :resize_to_fill => [100, 100]
def store_dir
"uploads/thumbs/#{model.album.path}"
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
end
end
version :preview do
process :resize_to_fit => [210, 210]
def store_dir
"uploads/thumbs/#{model.album.path}"
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
end
end
version :single do
process :resize_to_limit => [950, 950]
def store_dir
"uploads/thumbs/#{model.album.path}"
ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}"
end
end

View file

@ -3,7 +3,7 @@
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%= ENV['TITLE'] %></title>
<title><%= ENV['TITLE'] || "Photos" %></title>
<%= yield :head %>
<%= stylesheet_link_tag 'application' %>
</head>

View file

@ -1,6 +1,7 @@
ENV['PUBLIC'] = 'true'
ENV['TITLE'] = 'photo'
ENV['STORAGE_PATH'] = "uploads" if ENV['STORAGE_PATH'].nil?
#ENV['PRIVATE'] = 'true'
#ENV['TITLE'] = 'photo'
#ENV['HEROKU'] = 'true'
#ENV['S3_KEY'] = ''
#ENV['S3_SECRET'] = ''
#ENV['S3_BUCKET'] = ''
#ENV['S3_KEY'] = ''
#ENV['S3_SECRET'] = ''
#ENV['S3_BUCKET'] = ''

View file

@ -16,9 +16,9 @@ Rails::Initializer.run do |config|
config.gem "authlogic"
config.gem 'mime-types', :lib => 'mime/types'
config.gem "carrierwave"
config.gem "mysql2"
config.gem "mysql2" unless ENV['HEROKU']
config.gem "aws-s3", :lib => "aws/s3" if ENV['HEROKU']
#config.gem "mini_exiftool"
#config.gem "aws-s3", :lib => "aws/s3"
config.load_paths += %W( #{RAILS_ROOT}/app/middleware )

View file

@ -1,5 +1,5 @@
CarrierWave.configure do |config|
config.s3_access_key_id = ENV['S3_KEY']
config.s3_secret_access_key = ENV['S3_SECRET']
config.s3_bucket = ENV['S3_BUCKET']
end
config.s3_access_key_id = ENV['S3_KEY']
config.s3_secret_access_key = ENV['S3_SECRET']
config.s3_bucket = ENV['S3_BUCKET']
end

View file

@ -27,8 +27,8 @@ Feature: Manage Albums
Scenario: Create Valid Album
Given the following user records
| email | password |
| espen@inspired.no | megmeg |
When I am logged in as "espen@inspired.no" with password "megmeg"
| balder@balderapp.com | balder |
When I am logged in as "balder@balderapp.com" with password "balder"
And I am on the list of albums
And I have no albums
When I follow "New Album"

View file

@ -1,12 +1,12 @@
Given /i am logged in as a user in the (.*) role/i do |role|
#@user = Factory.create(:user, :name => "Espen Antonsen",
# :email => "espen@inspired.no",
# :password => "megmeg")
# :email => "balder@balderapp.com",
# :password => "balder")
#@role = Factory.create(:role, :rolename => role)
#@user.roles << @role
visits "/login"
fills_in("email", :with => "espen@inspired.no")
fills_in("password", :with => "megmeg")
fills_in("email", :with => "balder@balderapp.com")
fills_in("password", :with => "balder")
clicks_button("Log in")
end