diff --git a/.gitignore b/.gitignore index 8409915..9c48e28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .bundle +.rvmrc db/*.sqlite3 log/*.log tmp diff --git a/Gemfile b/Gemfile index ad2f755..ba02ce3 100644 --- a/Gemfile +++ b/Gemfile @@ -9,16 +9,18 @@ gem "carrierwave", :git => 'git://github.com/jnicklas/carrierwave.git' #gem "mysql2" # PostgreSQL: gem 'pg' +# SQLite +gem 'sqlite3-ruby' # S3 support gem 'fog' # ImageMagick: -gem "rmagick", :require => 'RMagick' +#gem "rmagick", :require => 'RMagick' # FreeImage: #gem "RubyInline" #gem "image_science", :git => 'git://github.com/perezd/image_science.git' # MiniMagick -#gem "mini_magick" \ No newline at end of file +gem "mini_magick" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index b939521..59bbccd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,6 +60,8 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.16) + mini_magick (3.2) + subexec (~> 0.0.4) net-ssh (2.0.23) nokogiri (1.4.4) pg (0.10.0) @@ -83,8 +85,11 @@ GEM rake (>= 0.8.7) thor (~> 0.14.4) rake (0.8.7) - rmagick (2.13.1) ruby-hmac (0.4.0) + sqlite3 (1.3.3) + sqlite3-ruby (1.3.3) + sqlite3 (>= 1.3.3) + subexec (0.0.4) thor (0.14.6) treetop (1.4.9) polyglot (>= 0.3.1) @@ -98,6 +103,7 @@ DEPENDENCIES carrierwave! fog mime-types + mini_magick pg rails (= 3.0.3) - rmagick + sqlite3-ruby diff --git a/README b/README index a0980ef..77fbf50 100644 --- a/README +++ b/README @@ -31,7 +31,7 @@ Free for personal use. Contact me for commercial license. Rails 3.0 Software -- RMagicK (required for Carrierwave resizing). Can also use ImageScience +- ImageMagicK (required for Carrierwave resizing). Can also use ImageScience Optional: - ExifTool (required for Mini_EfixTool) @@ -47,15 +47,15 @@ Optional: 1. Clone the project from GitHub or Gitorious: GitHub: git clone git://github.com/espen/balder.git - Gitorious: git clone git://gitorious.org/gallery-without-a-name/gallery-without-a-name.git -2. install required software listed above -3. Copy settings file: - cp gallery/config/database.example.yml gallery/config/database.yml - cp gallery/config/settings.example.yml gallery/config/settings.yml -4. Create databsae user and edit settings files. -5. rake db:create -6. rake db:migrate -7. Start up the project with your preferred web-server +2. Install required software listed above +3. 'bundle install' to install required gems. +4. Adjust the settings in balder.rb +5. Copy database file (not needed when hosting on Heroku): + cp config/database.example.yml config/database.yml +6. Create database user and edit database file. (unless on Heroku or using SQLite3) +7. rake db:create +8. rake db:migrate +9. Start up the project with your preferred web-server === Optional: add photos directly to disk diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1036fee..b7a1651 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -45,7 +45,7 @@ class ApplicationController < ActionController::Base end def check_public_access - require_user if ENV['PUBLIC'] == 'false' + require_user if ENV['PRIVATE'] == 'true' end def current_user_session diff --git a/app/models/photo.rb b/app/models/photo.rb index 71fc0b6..c560df7 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -10,8 +10,8 @@ class Photo < ActiveRecord::Base validates :title, :presence => true before_validation :set_title - #before_create :exif_read - #before_update :exif_write # should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file + before_create :exif_read + before_update :exif_write attr_accessor :tag_list #attr_protected :path @@ -79,6 +79,7 @@ class Photo < ActiveRecord::Base end def exif_write + # should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file photo = MiniExiftool.new(self.path.file) photo.GPSLongitude = self.longitude photo.GPSLatitude = self.latitude diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index d549281..76fdc3c 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -3,9 +3,9 @@ class FileUploader < CarrierWave::Uploader::Base # Include RMagick or ImageScience support - include CarrierWave::RMagick + # include CarrierWave::RMagick # include CarrierWave::ImageScience - # include CarrierWave::MiniMagick + include CarrierWave::MiniMagick # Choose what kind of storage to use for this uploader if ENV['S3_KEY'] storage :s3 diff --git a/app/views/photos/upload.html.erb b/app/views/photos/upload.html.erb index 4f530c3..f6a5df4 100644 --- a/app/views/photos/upload.html.erb +++ b/app/views/photos/upload.html.erb @@ -4,6 +4,9 @@ <% end %> +
I'm really sorry, you need Flash to upload files.
+

diff --git a/config/database.example.yml b/config/database.example.yml index 7630b54..4bfdef8 100644 --- a/config/database.example.yml +++ b/config/database.example.yml @@ -1,8 +1,8 @@ development: - adapter: postgresql - database: balder_development - username: balder - password: changeme + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 production: adapter: mysql encoding: utf8