Permalink
Browse files

modified file storage location to use "Rails.root/private/wesabe" whe…

…n in the development environment rather than /var/wesabe
  • Loading branch information...
jmilum authored and Andre Arko committed Jul 29, 2010
1 parent 79ce79e commit 3d54201586b56aa0fa7ef5f8a4bff8fd2e9ffc0d
@@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
after_filter :add_xss_blocker_to_js
def ssu_enabled?
- !File.exist?("/var/wesabe/ssu-down")
+ !File.exist?(File.join(ApiEnv::FILE_PATH, 'ssu-down'))
end
helper_method :ssu_enabled?
hide_action :ssu_enabled?
@@ -96,4 +96,4 @@ def notify_success(title, message)
def notify_error(title, message)
flash.now[:notification] = {:type => 'error', :title => title, :message => message}
end
-end
+end
View
@@ -9,7 +9,7 @@ class Attachment < ActiveRecord::Base
# delete the attached file when we delete the attachment
after_destroy :unlink
- BASE_DIR = Pathname('/var/wesabe/attachments')
+ BASE_DIR = Pathname(File.join(ApiEnv::FILE_PATH, 'attachments'))
MAX_SIZE = 2.megabytes
class MaxSizeExceeded < Exception; end
@@ -110,4 +110,4 @@ def self.create_zip_file(filename, attachments)
end
return temppath
end
-end
+end
View
@@ -22,7 +22,7 @@ def import
end
def archive
- Pathname.new("/var/wesabe/snapshots/#{uid}.zip")
+ Pathname.new(File.join(ApiEnv::FILE_PATH, 'snapshots', uid, '.zip'))
end
def built?
@@ -43,4 +43,4 @@ def generate_uid
def remove_files
archive.unlink if archive.exist?
end
-end
+end
@@ -0,0 +1,10 @@
+# installation-dependent paths for the api
+module ApiEnv
+ FILE_PATH = Rails.env.development? ? File.join(Rails.root, 'private', 'wesabe') : '/var/wesabe'
+
+ PATH = { :statement_files => Rails.env.test? ? File.join(FILE_PATH, 'uploads', 'test') : File.join(FILE_PATH, 'uploads', 'current'),
+ :upload_temp_dir => File.join(FILE_PATH, 'uploads', 'tmp') # temp dir for QIF uploads
+ }
+
+ MAX_UPLOAD_SIZE = 5242880 # bytes
+end
@@ -4,6 +4,9 @@
# prefer the version installed in /opt, if it exists
if File.exists?("/opt/fixofx/timeout")
OFX_CONVERTER = "/opt/fixofx/timeout #{FIXOFX_TIMEOUT} /opt/fixofx/fixofx"
-else
+elsif File.exists?("/var/wesabe/util/fixofx/timeout")
OFX_CONVERTER = "/var/wesabe/util/fixofx/timeout #{FIXOFX_TIMEOUT} /var/wesabe/util/fixofx/fixofx"
-end
+elsif File.exists?(Rails.root.join('../fixofx/fixofx.py'))
+ path = Rails.root.join('../fixofx/fixofx.py')
+ OFX_CONVERTER = "python #{path}"
+end
@@ -1,7 +0,0 @@
-# installation-dependent paths for the api
-module ApiEnv
- PATH = { :statement_files => ENV['RAILS_ENV'] == 'test' ? '/var/wesabe/uploads/test' : '/var/wesabe/uploads/current',
- :upload_temp_dir => "/var/wesabe/uploads/tmp" # temp dir for QIF uploads
- }
- MAX_UPLOAD_SIZE = 5242880 # bytes
-end
View
@@ -1,6 +1,6 @@
module ImageProcessing
def self.image_directory
- "/var/wesabe/images"
+ File.join(ApiEnv::FILE_PATH, 'images')
end
MAX_SIZE = 2.megabytes
View
@@ -0,0 +1,2 @@
+*
+!.gitignore

0 comments on commit 3d54201

Please sign in to comment.