lib/desoto-photoapp.rb in desoto-photoapp-0.1.1 vs lib/desoto-photoapp.rb in desoto-photoapp-0.1.3

- old
+ new

@@ -3,10 +3,16 @@ require "desoto-photoapp/s3" require 'yaml' require 'colorator' module Photoapp + extend self + + def gem_dir(*paths) + File.expand_path(File.join(File.dirname(__FILE__), '..', *paths)) + end + class Session attr_accessor :photos, :print, :upload ROOT = File.expand_path('~/cave.pics') # where photos are stored @@ -25,12 +31,12 @@ @config || begin config = { 'source' => Dir.pwd, # where photos are located 'url_base' => 'www.cave.pics', - 'watermark' => gem_dir('assets', 'watermark.png'), - 'font' => gem_dir('assets', "SourceSansPro-Semibold.ttf"), + 'watermark' => Photoapp.gem_dir('assets', 'watermark.png'), + 'font' => Photoapp.gem_dir('assets', "SourceSansPro-Semibold.ttf"), 'font_size' => 30, 'config' => 'photoapp.yml', 'upload' => 'upload', 'print' => 'print' } @@ -49,14 +55,10 @@ config end end - def gem_dir(*paths) - File.expand_path(File.join(File.dirname(__FILE__), '..', *paths)) - end - def root(path='') File.expand_path(File.join(ROOT, path)) end def process @@ -70,10 +72,10 @@ end load_photos.each do |f| FileUtils.mv f, tmp path = File.join(tmp, File.basename(f)) - `automator -i #{path} #{gem_dir("lib/adjust-image.workflow")}` + `automator -i #{path} #{Photoapp.gem_dir("lib/adjust-image.workflow")}` photos << Photo.new(path, logo, self) end photos.each do |p| p.write