uploader 2.0.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +55 -57
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/app/helpers/uploader_helper.rb +3 -3
- data/app/views/uploads/_swf_javascript.html.erb +9 -6
- data/app/views/uploads/_swf_upload.html.erb +2 -2
- data/app/views/uploads/_uploadify.html.erb +3 -3
- data/{locales → config/locales}/ar.yml +0 -0
- data/{locales → config/locales}/bg.yml +0 -0
- data/{locales → config/locales}/ca.yml +0 -0
- data/{locales → config/locales}/cs.yml +0 -0
- data/{locales → config/locales}/da.yml +0 -0
- data/{locales → config/locales}/de.yml +0 -0
- data/{locales → config/locales}/el.yml +0 -0
- data/{locales → config/locales}/en.yml +0 -0
- data/{locales → config/locales}/es.yml +0 -0
- data/{locales → config/locales}/et.yml +0 -0
- data/{locales → config/locales}/fa.yml +2 -2
- data/{locales → config/locales}/fi.yml +0 -0
- data/{locales → config/locales}/fr.yml +0 -0
- data/{locales → config/locales}/gl.yml +0 -0
- data/{locales → config/locales}/hi.yml +1 -1
- data/{locales → config/locales}/hr.yml +0 -0
- data/{locales → config/locales}/hu.yml +0 -0
- data/{locales → config/locales}/id.yml +1 -1
- data/{locales → config/locales}/it.yml +0 -0
- data/{locales → config/locales}/iw.yml +0 -0
- data/{locales → config/locales}/ja.yml +0 -0
- data/{locales → config/locales}/ko.yml +2 -2
- data/{locales → config/locales}/lt.yml +0 -0
- data/{locales → config/locales}/lv.yml +0 -0
- data/{locales → config/locales}/mt.yml +0 -0
- data/{locales → config/locales}/nl.yml +0 -0
- data/{locales → config/locales}/no.yml +0 -0
- data/{locales → config/locales}/pl.yml +0 -0
- data/{locales → config/locales}/pt-PT.yml +0 -0
- data/{locales → config/locales}/ro.yml +0 -0
- data/{locales → config/locales}/ru.yml +0 -0
- data/{locales → config/locales}/sk.yml +0 -0
- data/{locales → config/locales}/sl.yml +0 -0
- data/{locales → config/locales}/sq.yml +0 -0
- data/{locales → config/locales}/sr.yml +0 -0
- data/{locales → config/locales}/sv.yml +0 -0
- data/{locales → config/locales}/th.yml +1 -1
- data/{locales → config/locales}/tl.yml +0 -0
- data/{locales → config/locales}/tr.yml +0 -0
- data/{locales → config/locales}/uk.yml +0 -0
- data/{locales → config/locales}/vi.yml +2 -2
- data/{locales → config/locales}/zh-CN.yml +0 -0
- data/{locales → config/locales}/zh-TW.yml +0 -0
- data/{locales → config/locales}/zh.yml +0 -0
- data/config/routes.rb +8 -0
- data/lib/tasks/uploader.rake +22 -0
- data/lib/uploader/config.rb +65 -0
- data/lib/uploader/engine.rb +19 -0
- data/lib/uploader/models/upload.rb +229 -0
- data/lib/uploader.rb +4 -2
- data/test/{rails_root → rails_test}/.gitignore +0 -0
- data/test/{rails_root → rails_test}/.rake_tasks +0 -0
- data/test/rails_test/Gemfile +21 -0
- data/{Gemfile.lock → test/rails_test/Gemfile.lock} +21 -1
- data/test/rails_test/README +256 -0
- data/test/{rails_root → rails_test}/Rakefile +2 -7
- data/test/{rails_root → rails_test}/app/controllers/application_controller.rb +0 -0
- data/test/rails_test/app/controllers/default_controller.rb +18 -0
- data/test/{rails_root → rails_test}/app/controllers/uploads_controller.rb +5 -2
- data/test/{rails_root → rails_test}/app/models/.keep +0 -0
- data/test/rails_test/app/models/upload.rb +38 -0
- data/test/{rails_root → rails_test}/app/models/user.rb +0 -0
- data/test/{rails_root → rails_test}/app/views/default/index.html.erb +11 -1
- data/test/rails_test/app/views/default/uploadify.html.erb +27 -0
- data/test/{rails_root → rails_test}/app/views/layouts/application.html.erb +2 -2
- data/test/{rails_root → rails_test}/config/amazon_s3.yml +0 -0
- data/test/{rails_root → rails_test}/config/application.rb +6 -12
- data/test/rails_test/config/boot.rb +13 -0
- data/test/{rails_root → rails_test}/config/database.yml +3 -11
- data/test/rails_test/config/environment.rb +5 -0
- data/test/rails_test/config/environments/development.rb +26 -0
- data/test/rails_test/config/environments/production.rb +49 -0
- data/test/rails_test/config/environments/test.rb +35 -0
- data/test/{rails_root → rails_test}/config/global_config.yml +0 -0
- data/test/{rails_root → rails_test}/config/initializers/backtrace_silencers.rb +0 -0
- data/test/{rails_root → rails_test}/config/initializers/inflections.rb +2 -2
- data/test/{rails_root → rails_test}/config/initializers/mime_types.rb +0 -0
- data/test/{rails_root → rails_test}/config/initializers/s3_credentials.rb +1 -1
- data/test/{rails_root → rails_test}/config/initializers/secret_token.rb +1 -1
- data/test/rails_test/config/initializers/session_store.rb +8 -0
- data/test/rails_test/config/locales/en.yml +5 -0
- data/test/rails_test/config/routes.rb +13 -0
- data/test/rails_test/config.ru +4 -0
- data/test/{rails_root → rails_test}/db/.keep +0 -0
- data/test/{rails_root → rails_test}/db/migrate/20090517040220_create_uploads.rb +0 -0
- data/test/{rails_root → rails_test}/db/migrate/20090602041838_create_users.rb +0 -0
- data/test/rails_test/db/seeds.rb +7 -0
- data/test/rails_test/doc/README_FOR_APP +2 -0
- data/test/{rails_root → rails_test}/features/step_definitions/webrat_steps.rb +0 -0
- data/test/{rails_root → rails_test}/features/support/env.rb +0 -0
- data/test/{rails_root → rails_test}/lib/daemons/amazonaws.rb +0 -0
- data/test/{rails_root/public/favicon.ico → rails_test/lib/tasks/.gitkeep} +0 -0
- data/test/rails_test/public/404.html +26 -0
- data/test/rails_test/public/422.html +26 -0
- data/test/rails_test/public/500.html +26 -0
- data/test/{rails_root/public/stylesheets/.keep → rails_test/public/favicon.ico} +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/excel.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_aac.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ai.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_avi.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_bin.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_bmp.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_cue.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_divx.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_doc.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_eps.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_flac.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_flv.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_gif.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_html.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ical.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_indd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_inx.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_iso.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_jpg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mov.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mp3.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_mpg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_pdf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_php.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_png.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_pps.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_ppt.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_psd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_qxd.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_qxp.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_raw.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_rtf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_svg.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_tif.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_txt.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_vcf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_wav.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_wma.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_xls.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/file_xml.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/mp3.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/pdf.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/pdf.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/text.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/text.png +0 -0
- data/test/{rails_root → rails_test}/public/images/file_icons/word.gif +0 -0
- data/test/rails_test/public/images/rails.png +0 -0
- data/test/{rails_root/public/images → rails_test/public/images/swfupload}/SWFUploadButton.png +0 -0
- data/test/{rails_root/public/images → rails_test/public/images/swfupload}/cancelbutton.gif +0 -0
- data/test/{rails_root → rails_test}/public/images/uploadify/cancel.png +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/application.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/controls.js +75 -73
- data/test/{rails_root → rails_test}/public/javascripts/dragdrop.js +171 -169
- data/test/{rails_root → rails_test}/public/javascripts/effects.js +180 -177
- data/test/{rails_root/public/javascripts/jquery/jquery.js → rails_test/public/javascripts/jquery/jquery-1.4.2.min.js} +0 -0
- data/test/{rails_root/public/javascripts/jquery/jquery-ui.js → rails_test/public/javascripts/jquery/jquery-ui-1.8.4.custom.min.js} +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/jquery/jquery.uploadify.min.js +0 -0
- data/test/rails_test/public/javascripts/prototype.js +6001 -0
- data/test/rails_test/public/javascripts/rails.js +175 -0
- data/test/{rails_root → rails_test}/public/javascripts/swf/swfobject.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/fileprogress.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/handlers.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.cookies.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.proxy.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.queue.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.speed.js +0 -0
- data/test/{rails_root → rails_test}/public/javascripts/swfupload/swfupload.swfobject.js +0 -0
- data/test/rails_test/public/robots.txt +5 -0
- data/test/{rails_root/test/functional/.keep → rails_test/public/stylesheets/.gitkeep} +0 -0
- data/test/{rails_root → rails_test}/public/stylesheets/swfupload.css +0 -0
- data/test/{rails_root → rails_test}/public/stylesheets/uploadify.css +0 -0
- data/test/{rails_root → rails_test}/public/swf/expressInstall.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/swfupload.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/swfupload_fp9.swf +0 -0
- data/test/{rails_root → rails_test}/public/swf/uploadify.swf +0 -0
- data/test/rails_test/script/rails +6 -0
- data/test/{rails_root → rails_test}/test/factories.rb +1 -1
- data/test/{rails_root → rails_test}/test/fixtures/files/5k.png +0 -0
- data/test/{rails_root → rails_test}/test/fixtures/files/IT'sUPPERCASE!AND WeIRD.JPG +0 -0
- data/test/rails_test/test/fixtures/rails.png +0 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.doc +0 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.pdf +0 -0
- data/test/rails_test/test/fixtures/test.txt +1 -0
- data/test/{rails_root/test → rails_test/test/fixtures}/test.xls +0 -0
- data/test/{rails_root/test/integration → rails_test/test/functional}/.keep +0 -0
- data/test/{rails_root → rails_test}/test/functional/default_controller_test.rb +0 -0
- data/test/{rails_root → rails_test}/test/functional/uploads_controller_test.rb +0 -0
- data/test/{rails_root/test/mocks/development → rails_test/test/integration}/.keep +0 -0
- data/test/rails_test/test/performance/browsing_test.rb +9 -0
- data/test/{rails_root → rails_test}/test/shoulda_macros/paperclip.rb +0 -0
- data/test/rails_test/test/test_helper.rb +25 -0
- data/test/{rails_root/test/mocks/test → rails_test/test/unit}/.keep +0 -0
- data/test/{rails_root → rails_test}/test/unit/upload_test.rb +9 -18
- data/test/{rails_root/test/unit/.keep → rails_test/vendor/plugins/.gitkeep} +0 -0
- data/uploader.gemspec +225 -255
- metadata +228 -258
- data/Gemfile +0 -13
- data/config/uploader_routes.rb +0 -3
- data/lib/active_record/acts/uploader_upload.rb +0 -279
- data/lib/uploader/initialize_routes.rb +0 -8
- data/lib/uploader/tasks.rb +0 -42
- data/rails/init.rb +0 -38
- data/tasks/rails.rake +0 -2
- data/test/rails_root/Capfile +0 -3
- data/test/rails_root/app/controllers/default_controller.rb +0 -12
- data/test/rails_root/app/models/upload.rb +0 -55
- data/test/rails_root/app/views/default/uploadify.html.erb +0 -17
- data/test/rails_root/config/boot.rb +0 -109
- data/test/rails_root/config/environment.rb +0 -29
- data/test/rails_root/config/environments/development.rb +0 -19
- data/test/rails_root/config/environments/production.rb +0 -1
- data/test/rails_root/config/environments/test.rb +0 -27
- data/test/rails_root/config/initializers/requires.rb +0 -13
- data/test/rails_root/config/initializers/session_store.rb +0 -8
- data/test/rails_root/config/initializers/uploader.rb +0 -11
- data/test/rails_root/config/routes.rb +0 -13
- data/test/rails_root/db/development.sqlite3 +0 -0
- data/test/rails_root/db/schema.rb +0 -47
- data/test/rails_root/db/test.sqlite3 +0 -0
- data/test/rails_root/public/.htaccess +0 -40
- data/test/rails_root/public/404.html +0 -30
- data/test/rails_root/public/422.html +0 -30
- data/test/rails_root/public/500.html +0 -30
- data/test/rails_root/public/dispatch.rb +0 -10
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/images/swfupload/SWFUploadButton.png +0 -0
- data/test/rails_root/public/images/swfupload/cancelbutton.gif +0 -0
- data/test/rails_root/public/javascripts/builder.js +0 -136
- data/test/rails_root/public/javascripts/jquery/jquery.easing.js +0 -1
- data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +0 -9
- data/test/rails_root/public/javascripts/jquery/jquery.form.js +0 -637
- data/test/rails_root/public/javascripts/jquery/jquery.jgrowl.js +0 -2
- data/test/rails_root/public/javascripts/jquery/jquery.tips.js +0 -69
- data/test/rails_root/public/javascripts/jquery/jrails.js +0 -1
- data/test/rails_root/public/javascripts/prototype.js +0 -4225
- data/test/rails_root/public/javascripts/scriptaculous.js +0 -58
- data/test/rails_root/public/javascripts/slider.js +0 -277
- data/test/rails_root/public/javascripts/sound.js +0 -60
- data/test/rails_root/public/robots.txt +0 -1
- data/test/rails_root/script/about +0 -3
- data/test/rails_root/script/breakpointer +0 -3
- data/test/rails_root/script/console +0 -3
- data/test/rails_root/script/create_project.rb +0 -52
- data/test/rails_root/script/cucumber +0 -7
- data/test/rails_root/script/dbconsole +0 -3
- data/test/rails_root/script/destroy +0 -3
- data/test/rails_root/script/generate +0 -3
- data/test/rails_root/script/performance/benchmarker +0 -3
- data/test/rails_root/script/performance/profiler +0 -3
- data/test/rails_root/script/performance/request +0 -3
- data/test/rails_root/script/plugin +0 -3
- data/test/rails_root/script/process/inspector +0 -3
- data/test/rails_root/script/process/reaper +0 -3
- data/test/rails_root/script/process/spawner +0 -3
- data/test/rails_root/script/runner +0 -3
- data/test/rails_root/script/server +0 -3
- data/test/rails_root/test/test_helper.rb +0 -26
@@ -1,279 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module Acts #:nodoc:
|
3
|
-
|
4
|
-
module UploaderUpload #:nodoc:
|
5
|
-
def self.included(base)
|
6
|
-
base.extend(ClassMethods)
|
7
|
-
end
|
8
|
-
|
9
|
-
module ClassMethods
|
10
|
-
|
11
|
-
# options:
|
12
|
-
# S3_no_wait - Immediately send files to S3 instead of waiting for an aysnc process to send them over.
|
13
|
-
# keep_local_file - If using S3 determines whether or not to keep files local as well as sending to S3.
|
14
|
-
#
|
15
|
-
# acts_as_uploader requires an option for :has_attached_file. These values will be passed to paperclip.
|
16
|
-
# i.e.
|
17
|
-
# acts_as_uploader :has_attached_file => {
|
18
|
-
# :url => "/uploads/:class/:id/:style_:basename.:extension",
|
19
|
-
# :path => ":rails_root/public/uploads/:class/:id/:style_:basename.:extension",
|
20
|
-
# :styles => { :icon => "30x30!", :thumb => "100>", :small => "150>", :medium => "300>", :large => "660>"},
|
21
|
-
# :default_url => "/images/profile_default.jpg" },
|
22
|
-
# :disable_halt_nonimage_processing => false
|
23
|
-
#
|
24
|
-
# disable_halt_nonimage_processing - By default all post processing is turned off for non image files. This is useful if you want to setup styles to generate thumbnails for
|
25
|
-
# images but don't want the default Geometry processor to die on non-image files.
|
26
|
-
def acts_as_uploader(options = {})
|
27
|
-
|
28
|
-
default_options = {
|
29
|
-
:S3_no_wait => false,
|
30
|
-
:keep_local_file => true
|
31
|
-
}
|
32
|
-
|
33
|
-
options = default_options.merge(options)
|
34
|
-
|
35
|
-
#Named scopes
|
36
|
-
named_scope :newest, :order => "created_at DESC"
|
37
|
-
named_scope :by_filename, :order => "local_file_name DESC"
|
38
|
-
named_scope :newest, :order => "created_at DESC"
|
39
|
-
named_scope :public, :conditions => 'is_public = true'
|
40
|
-
named_scope :images, :conditions => "local_content_type IN (#{Uploader::MimeTypeGroups::IMAGE_TYPES.collect{|type| "'#{type}'"}.join(',')})"
|
41
|
-
named_scope :documents, :conditions => "local_content_type IN (#{(Uploader::MimeTypeGroups::WORD_TYPES + Uploader::MimeTypeGroups::EXCEL_TYPES + Uploader::MimeTypeGroups::PDF_TYPES).collect{|type| "'#{type}'"}.join(',')})"
|
42
|
-
named_scope :files, :conditions => "local_content_type NOT IN (#{Uploader::MimeTypeGroups::IMAGE_TYPES.collect{|type| "'#{type}'"}.join(',')})"
|
43
|
-
named_scope :recent, lambda { |*args| { :conditions => ["created_at > ?", (args.first || 7.days.ago.to_s(:db)) ]} }
|
44
|
-
named_scope :created_by, lambda { |*args| { :conditions => ["creator_id = ?", (args.first) ]} }
|
45
|
-
named_scope :pending_s3_migrations, lambda { { :conditions => ["remote_file_name IS NULL"], :order => 'created_at DESC' } }
|
46
|
-
|
47
|
-
@uploader_s3_no_wait = options.delete(:S3_no_wait)
|
48
|
-
@uploader_keep_file_local = options.delete(:keep_local_file)
|
49
|
-
|
50
|
-
# Paperclip
|
51
|
-
has_attached_file :local, options[:has_attached_file].merge(:storage => :filesystem) # Override any storage settings. This one has to be local.
|
52
|
-
has_attached_file :remote, options[:has_attached_file].merge(:url => ':s3_alias_url',
|
53
|
-
:path => options[:s3_path],
|
54
|
-
:storage => :s3)
|
55
|
-
|
56
|
-
belongs_to :uploadable, :polymorphic => true
|
57
|
-
belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
|
58
|
-
|
59
|
-
before_save :determine_immediate_send_to_remote
|
60
|
-
|
61
|
-
class_eval <<-EOV
|
62
|
-
|
63
|
-
before_post_process :transliterate_file_name
|
64
|
-
before_post_process :halt_nonimage_processing unless options[:disable_halt_nonimage_processing]
|
65
|
-
before_create :add_width_and_height
|
66
|
-
|
67
|
-
# prevents a user from submitting a crafted form that bypasses activation
|
68
|
-
attr_protected :creator_id, :uploadable_id, :uploadable_type
|
69
|
-
EOV
|
70
|
-
|
71
|
-
include ActiveRecord::Acts::UploaderUpload::InstanceMethods
|
72
|
-
extend ActiveRecord::Acts::UploaderUpload::SingletonMethods
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
# class methods
|
77
|
-
module SingletonMethods
|
78
|
-
|
79
|
-
def s3_no_wait?
|
80
|
-
@uploader_s3_no_wait
|
81
|
-
end
|
82
|
-
|
83
|
-
def keep_local_file?
|
84
|
-
@uploader_keep_file_local
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
|
89
|
-
# All the methods available to a record that has had <tt>acts_as_uploader</tt> specified.
|
90
|
-
module InstanceMethods
|
91
|
-
|
92
|
-
def file
|
93
|
-
local_file_name ? local : remote
|
94
|
-
end
|
95
|
-
|
96
|
-
def file_name
|
97
|
-
remote_file_name || local_file_name
|
98
|
-
end
|
99
|
-
|
100
|
-
def determine_immediate_send_to_remote
|
101
|
-
if self.class.s3_no_wait?
|
102
|
-
self.remote = local.to_file # This will result in the file being sent to S3
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def send_to_remote
|
107
|
-
if local_file_name
|
108
|
-
self.remote = local.to_file
|
109
|
-
if self.save and remote.original_filename and remote.exists?
|
110
|
-
self.local = nil unless keep_local_file?
|
111
|
-
self.save
|
112
|
-
else
|
113
|
-
false
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def multiupload_local=(filedata)
|
119
|
-
filedata.content_type = MIME::Types.type_for(filedata.original_filename)[0].to_s
|
120
|
-
self.local = filedata
|
121
|
-
end
|
122
|
-
|
123
|
-
def is_image?
|
124
|
-
Uploader::MimeTypeGroups::IMAGE_TYPES.include?(self.local_content_type)
|
125
|
-
end
|
126
|
-
|
127
|
-
def is_mp3?
|
128
|
-
Uploader::MimeTypeGroups::MP3_TYPES.include?(self.local_content_type)
|
129
|
-
end
|
130
|
-
|
131
|
-
def is_excel?
|
132
|
-
Uploader::MimeTypeGroups::EXCEL_TYPES.include?(self.local_content_type)
|
133
|
-
end
|
134
|
-
|
135
|
-
def is_pdf?
|
136
|
-
Uploader::MimeTypeGroups::PDF_TYPES.include?(self.local_content_type)
|
137
|
-
end
|
138
|
-
|
139
|
-
def is_word?
|
140
|
-
Uploader::MimeTypeGroups::WORD_TYPES.include?(self.local_content_type)
|
141
|
-
end
|
142
|
-
|
143
|
-
def is_text?
|
144
|
-
Uploader::MimeTypeGroups::TEXT_TYPES.include?(self.local_content_type)
|
145
|
-
end
|
146
|
-
|
147
|
-
def upload_type
|
148
|
-
if self.is_pdf?
|
149
|
-
'Adobe pdf file'
|
150
|
-
elsif self.is_word?
|
151
|
-
'Word document'
|
152
|
-
elsif self.is_image?
|
153
|
-
'photo'
|
154
|
-
elsif self.is_mp3?
|
155
|
-
'mp3'
|
156
|
-
elsif self.is_excel?
|
157
|
-
'Excel document'
|
158
|
-
elsif self.is_text?
|
159
|
-
'text file'
|
160
|
-
else
|
161
|
-
'file'
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def icon
|
166
|
-
if self.is_pdf?
|
167
|
-
'/images/file_icons/file_pdf.gif'
|
168
|
-
elsif self.is_word?
|
169
|
-
'/images/file_icons/file_doc.gif'
|
170
|
-
elsif self.is_image?
|
171
|
-
self.file.url(:icon)
|
172
|
-
elsif self.is_mp3?
|
173
|
-
'/images/file_icons/file_mp3.gif'
|
174
|
-
elsif self.is_excel?
|
175
|
-
'/images/file_icons/file_xls.gif'
|
176
|
-
elsif self.is_text?
|
177
|
-
'/images/file_icons/file_txt.gif'
|
178
|
-
else
|
179
|
-
'/images/file_icons/file_raw.gif'
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
# Only works for images
|
184
|
-
def thumb
|
185
|
-
if self.is_image?
|
186
|
-
self.file.url(:thumb)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
def display_name
|
191
|
-
CGI::escapeHTML(self.local_file_name)
|
192
|
-
end
|
193
|
-
|
194
|
-
def can_edit?(check_user)
|
195
|
-
return false if check_user.blank?
|
196
|
-
check_user == self.creator
|
197
|
-
end
|
198
|
-
|
199
|
-
# Image dimension calculations
|
200
|
-
|
201
|
-
def width(style = :default)
|
202
|
-
return nil unless self[:width]
|
203
|
-
return self[:width] if style == :default
|
204
|
-
calculate_sizes(style.to_sym)
|
205
|
-
return @image_width.to_i
|
206
|
-
end
|
207
|
-
|
208
|
-
def height(style = :default)
|
209
|
-
return nil unless self[:height]
|
210
|
-
return self[:height] if style == :default
|
211
|
-
calculate_sizes(style.to_sym)
|
212
|
-
return @image_height.to_i
|
213
|
-
end
|
214
|
-
|
215
|
-
def size(style = :default)
|
216
|
-
return nil unless width || height
|
217
|
-
return "#{width}x#{height}" if style == :default
|
218
|
-
calculate_sizes(style.to_sym)
|
219
|
-
return @image_size
|
220
|
-
end
|
221
|
-
|
222
|
-
def max_dimension(style)
|
223
|
-
@max_dimension ||= Paperclip::Geometry.parse(self.local.styles[style][:geometry]).width.to_f
|
224
|
-
end
|
225
|
-
|
226
|
-
def image_ratio
|
227
|
-
@image_ratio ||= width.to_f / height.to_f
|
228
|
-
end
|
229
|
-
|
230
|
-
def calculate_sizes(style)
|
231
|
-
if image_ratio > 1
|
232
|
-
@image_width ||= width > max_dimension(style) ? max_dimension(style) : width
|
233
|
-
@image_height ||= (@image_width / image_ratio).round
|
234
|
-
else
|
235
|
-
@image_height ||= height > max_dimension(style) ? max_dimension(style) : height
|
236
|
-
@image_width ||= (@image_height * image_ratio).round
|
237
|
-
end
|
238
|
-
@image_size ||= "#{@image_width.to_i}x#{@image_height.to_i}"
|
239
|
-
end
|
240
|
-
|
241
|
-
protected
|
242
|
-
def transliterate_file_name
|
243
|
-
extension = File.extname(local_file_name).gsub(/^\.+/, '')
|
244
|
-
filename = local_file_name.gsub(/\.#{extension}$/, '')
|
245
|
-
self.local.instance_write(:file_name, "#{transliterate(filename)}.#{transliterate(extension)}")
|
246
|
-
end
|
247
|
-
|
248
|
-
def transliterate(str)
|
249
|
-
# Lifted from permalink_fu by Rick Olsen
|
250
|
-
# Escape str by transliterating to UTF-8 with Iconv,
|
251
|
-
# downcasing, then removing illegal characters and replacing them with ’-’
|
252
|
-
s = Iconv.iconv('ascii//ignore//translit', 'utf-8', str).to_s
|
253
|
-
s.downcase!
|
254
|
-
s.gsub!(/\'/, '')
|
255
|
-
s.gsub!(/[^A-Za-z0-9]+/, ' ')
|
256
|
-
s.strip!
|
257
|
-
s.gsub!(/\ +/, '-') # set single or multiple spaces to a single dash
|
258
|
-
return s
|
259
|
-
end
|
260
|
-
|
261
|
-
def add_width_and_height
|
262
|
-
return unless self.is_image?
|
263
|
-
if self.local.to_file
|
264
|
-
geometry = Paperclip::Geometry.from_file self.local.to_file
|
265
|
-
self[:width] = geometry.width.to_i
|
266
|
-
self[:height] = geometry.height.to_i
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
def halt_nonimage_processing
|
271
|
-
if !self.is_image? && self.local.options[:styles]
|
272
|
-
return false
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
end
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
class ActionController::Routing::RouteSet
|
2
|
-
def load_routes_with_uploader!
|
3
|
-
uploader_routes = File.join(File.dirname(__FILE__), *%w[.. .. config uploader_routes.rb])
|
4
|
-
add_configuration_file(uploader_routes) unless configuration_files.include? uploader_routes
|
5
|
-
load_routes_without_uploader!
|
6
|
-
end
|
7
|
-
alias_method_chain :load_routes!, :uploader
|
8
|
-
end
|
data/lib/uploader/tasks.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/tasklib'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module Uploader
|
6
|
-
class Tasks < ::Rake::TaskLib
|
7
|
-
def initialize
|
8
|
-
define
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
def define
|
13
|
-
namespace :uploader do
|
14
|
-
|
15
|
-
task :app_env do
|
16
|
-
Rake::Task[:environment].invoke if defined?(RAILS_ROOT)
|
17
|
-
end
|
18
|
-
|
19
|
-
desc 'Send all uploads to S3. (Will only send uploads from a model named Upload)'
|
20
|
-
task :upload_to_s3 do
|
21
|
-
uploads = Upload.pending_s3_migrations
|
22
|
-
uploads.each do |upload|
|
23
|
-
upload.remote = upload.local
|
24
|
-
upload.save!
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Sync required files from uploader."
|
29
|
-
task :sync do
|
30
|
-
path = File.join(File.dirname(__FILE__), *%w[.. ..])
|
31
|
-
daemons_path = "#{RAILS_ROOT}/lib/daemons"
|
32
|
-
system "rsync -ruv #{path}/public ."
|
33
|
-
system "rsync -ruv #{path}/db ."
|
34
|
-
FileUtils.mkdir_p(daemons_path) unless File.directory?(daemons_path)
|
35
|
-
FileUtils.cp_r("#{path}/lib/daemons/amazonaws.rb", "#{RAILS_ROOT}/lib/daemons/amazonaws.rb")
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
Uploader::Tasks.new
|
data/rails/init.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'paperclip'
|
3
|
-
rescue LoadError
|
4
|
-
begin
|
5
|
-
gem 'paperclip'
|
6
|
-
rescue Gem::LoadError
|
7
|
-
puts "Please install the paperclip gem"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
begin
|
12
|
-
require 'mime/types'
|
13
|
-
rescue LoadError
|
14
|
-
begin
|
15
|
-
gem 'mime-types'
|
16
|
-
rescue Gem::LoadError
|
17
|
-
puts "Please install the mime-types gem"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'uploader'
|
22
|
-
require 'uploader/initialize_routes'
|
23
|
-
|
24
|
-
ActiveRecord::Base.class_eval { include ActiveRecord::Acts::UploaderUpload }
|
25
|
-
ActionController::Base.send :helper, UploaderHelper
|
26
|
-
I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locales', '*.{rb,yml}') ]
|
27
|
-
|
28
|
-
config.after_initialize do
|
29
|
-
if defined?(Rails.application)
|
30
|
-
# Rails 3
|
31
|
-
Rails.application.config.middleware.insert_before(ActionDispatch::Session::CookieStore, Uploader::FlashSessionCookieMiddleware, Rails.application.config.session_options[:key])
|
32
|
-
else
|
33
|
-
# Rails 2
|
34
|
-
ActionController::Dispatcher.middleware.use Uploader::FlashSessionCookieMiddleware, ActionController::Base.session_options[:key]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
|
data/tasks/rails.rake
DELETED
data/test/rails_root/Capfile
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# == Schema Information
|
2
|
-
#
|
3
|
-
# Table name: uploads
|
4
|
-
#
|
5
|
-
# id :integer not null, primary key
|
6
|
-
# creator_id :integer
|
7
|
-
# name :string(255)
|
8
|
-
# caption :string(1000)
|
9
|
-
# description :text
|
10
|
-
# is_public :boolean default(TRUE)
|
11
|
-
# uploadable_id :integer
|
12
|
-
# uploadable_type :string(255)
|
13
|
-
# width :string(255)
|
14
|
-
# height :string(255)
|
15
|
-
# local_file_name :string(255)
|
16
|
-
# local_content_type :string(255)
|
17
|
-
# local_file_size :integer
|
18
|
-
# local_updated_at :datetime
|
19
|
-
# remote_file_name :string(255)
|
20
|
-
# remote_content_type :string(255)
|
21
|
-
# remote_file_size :integer
|
22
|
-
# remote_updated_at :datetime
|
23
|
-
# created_at :datetime
|
24
|
-
# updated_at :datetime
|
25
|
-
#
|
26
|
-
|
27
|
-
class Upload < ActiveRecord::Base
|
28
|
-
|
29
|
-
acts_as_uploader :enable_s3 => true,
|
30
|
-
:has_attached_file => {
|
31
|
-
:url => "/system/:attachment/:id_partition/:style/:basename.:extension",
|
32
|
-
:path => ":rails_root/public/system/:attachment/:id_partition/:style/:basename.:extension",
|
33
|
-
:styles => { :icon => "30x30!",
|
34
|
-
:thumb => "100>",
|
35
|
-
:small => "150>",
|
36
|
-
:medium => "300>",
|
37
|
-
:large => "660>" },
|
38
|
-
:default_url => "/images/profile_default.jpg",
|
39
|
-
:storage => :s3,
|
40
|
-
:s3_credentials => AMAZON_S3_CREDENTIALS,
|
41
|
-
:bucket => "assets.#{GlobalConfig.application_url}",
|
42
|
-
:s3_host_alias => "assets.#{GlobalConfig.application_url}",
|
43
|
-
:convert_options => {
|
44
|
-
:all => '-quality 80'
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
validates_attachment_presence :local
|
49
|
-
validates_attachment_size :local, :less_than => 10.megabytes
|
50
|
-
|
51
|
-
def can_edit?(user)
|
52
|
-
return true
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<h1>Uploadify</h1>
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<a href="/">SWFUpload</a> | <a href="/default/uploadify">uploadify</a>
|
5
|
-
</p>
|
6
|
-
|
7
|
-
<p>Upload One restricted to 10 MB:
|
8
|
-
<%= uploadify_form(@user, true, container_prefix = '', :sizeLimit => 1310720) %>
|
9
|
-
</p>
|
10
|
-
|
11
|
-
<p>Upload restricted to images:
|
12
|
-
<%= uploadify_form(@user, false, container_prefix = 'a_container_with_a_long_name', :fileExt => '*.jpg', :fileDesc => 'Images') %>
|
13
|
-
</p>
|
14
|
-
|
15
|
-
<p>Upload With Custom Background Button and rollover:
|
16
|
-
<%= uploadify_form(@user, false, container_prefix = 'background', :buttonImg => '/images/SWFUploadButton.png', :width => 61, :height => 22, :rollover => true) %>
|
17
|
-
</p>
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# Don't change this file!
|
2
|
-
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
-
|
4
|
-
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
-
|
6
|
-
module Rails
|
7
|
-
class << self
|
8
|
-
def boot!
|
9
|
-
unless booted?
|
10
|
-
preinitialize
|
11
|
-
pick_boot.run
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def booted?
|
16
|
-
defined? Rails::Initializer
|
17
|
-
end
|
18
|
-
|
19
|
-
def pick_boot
|
20
|
-
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
-
end
|
22
|
-
|
23
|
-
def vendor_rails?
|
24
|
-
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
-
end
|
26
|
-
|
27
|
-
def preinitialize
|
28
|
-
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
-
end
|
30
|
-
|
31
|
-
def preinitializer_path
|
32
|
-
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class Boot
|
37
|
-
def run
|
38
|
-
load_initializer
|
39
|
-
Rails::Initializer.run(:set_load_path)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class VendorBoot < Boot
|
44
|
-
def load_initializer
|
45
|
-
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
-
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
class GemBoot < Boot
|
51
|
-
def load_initializer
|
52
|
-
self.class.load_rubygems
|
53
|
-
load_rails_gem
|
54
|
-
require 'initializer'
|
55
|
-
end
|
56
|
-
|
57
|
-
def load_rails_gem
|
58
|
-
if version = self.class.gem_version
|
59
|
-
gem 'rails', version
|
60
|
-
else
|
61
|
-
gem 'rails'
|
62
|
-
end
|
63
|
-
rescue Gem::LoadError => load_error
|
64
|
-
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
65
|
-
exit 1
|
66
|
-
end
|
67
|
-
|
68
|
-
class << self
|
69
|
-
def rubygems_version
|
70
|
-
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
|
71
|
-
end
|
72
|
-
|
73
|
-
def gem_version
|
74
|
-
if defined? RAILS_GEM_VERSION
|
75
|
-
RAILS_GEM_VERSION
|
76
|
-
elsif ENV.include?('RAILS_GEM_VERSION')
|
77
|
-
ENV['RAILS_GEM_VERSION']
|
78
|
-
else
|
79
|
-
parse_gem_version(read_environment_rb)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def load_rubygems
|
84
|
-
require 'rubygems'
|
85
|
-
min_version = '1.1.1'
|
86
|
-
unless rubygems_version >= min_version
|
87
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
88
|
-
exit 1
|
89
|
-
end
|
90
|
-
|
91
|
-
rescue LoadError
|
92
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
93
|
-
exit 1
|
94
|
-
end
|
95
|
-
|
96
|
-
def parse_gem_version(text)
|
97
|
-
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
def read_environment_rb
|
102
|
-
File.read("#{RAILS_ROOT}/config/environment.rb")
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# All that for this:
|
109
|
-
Rails.boot!
|
@@ -1,29 +0,0 @@
|
|
1
|
-
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
|
2
|
-
|
3
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
4
|
-
|
5
|
-
# Load a global constant so the initializers can use them
|
6
|
-
require 'ostruct'
|
7
|
-
require 'yaml'
|
8
|
-
|
9
|
-
::GlobalConfig = OpenStruct.new(YAML.load_file("#{RAILS_ROOT}/config/global_config.yml")[RAILS_ENV])
|
10
|
-
|
11
|
-
class << GlobalConfig
|
12
|
-
def prepare_options_for_attachment_fu(options)
|
13
|
-
attachment_fu_options = options.symbolize_keys.merge({:storage => options['storage'].to_sym,
|
14
|
-
:max_size => options['max_size'].to_i.megabytes})
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class TestGemLocator < Rails::Plugin::Locator
|
19
|
-
def plugins
|
20
|
-
Rails::Plugin.new(File.join(File.dirname(__FILE__), *%w(.. .. ..)))
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
Rails::Initializer.run do |config|
|
25
|
-
config.load_paths += Dir.glob(File.join(RAILS_ROOT, 'vendor', 'gems', '*', 'lib'))
|
26
|
-
config.time_zone = 'UTC'
|
27
|
-
config.gem 'paperclip'
|
28
|
-
config.plugin_locators << TestGemLocator
|
29
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
-
|
3
|
-
# In the development environment your application's code is reloaded on
|
4
|
-
# every request. This slows down response time but is perfect for development
|
5
|
-
# since you don't have to restart the webserver when you make code changes.
|
6
|
-
config.cache_classes = false
|
7
|
-
|
8
|
-
# Log error messages when you accidentally call methods on nil.
|
9
|
-
config.whiny_nils = true
|
10
|
-
|
11
|
-
# Show full error reports and disable caching
|
12
|
-
config.action_controller.consider_all_requests_local = true
|
13
|
-
config.action_controller.perform_caching = false
|
14
|
-
config.action_view.debug_rjs = true
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
HOST = "localhost"
|
@@ -1 +0,0 @@
|
|
1
|
-
HOST = "http://example.com"
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
-
|
3
|
-
# The test environment is used exclusively to run your application's
|
4
|
-
# test suite. You never need to work with it otherwise. Remember that
|
5
|
-
# your test database is "scratch space" for the test suite and is wiped
|
6
|
-
# and recreated between test runs. Don't rely on the data there!
|
7
|
-
config.cache_classes = true
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.action_controller.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Disable request forgery protection in test environment
|
17
|
-
config.action_controller.allow_forgery_protection = false
|
18
|
-
|
19
|
-
# Tell ActionMailer not to deliver emails to the real world.
|
20
|
-
# The :test delivery method accumulates sent emails in the
|
21
|
-
# ActionMailer::Base.deliveries array.
|
22
|
-
config.action_mailer.delivery_method = :test
|
23
|
-
|
24
|
-
HOST = "localhost"
|
25
|
-
|
26
|
-
config.gem 'shoulda', :version => '>= 2.11.3'
|
27
|
-
config.gem 'factory_girl', :version => '>= 1.3.2'
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Dir[File.join(RAILS_ROOT, 'lib', 'extensions', '*.rb')].each do |f|
|
2
|
-
require f
|
3
|
-
end
|
4
|
-
|
5
|
-
Dir[File.join(RAILS_ROOT, 'lib', '*.rb')].each do |f|
|
6
|
-
require f
|
7
|
-
end
|
8
|
-
|
9
|
-
# Rails 2 doesn't like mocks
|
10
|
-
|
11
|
-
Dir[File.join(RAILS_ROOT, 'test', 'mocks', RAILS_ENV, '*.rb')].each do |f|
|
12
|
-
require f
|
13
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Your secret key for verifying cookie session data integrity.
|
2
|
-
# If you change this key, all old sessions will become invalid!
|
3
|
-
# Make sure the secret is at least 30 characters and all random,
|
4
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
5
|
-
ActionController::Base.session = {
|
6
|
-
:key => GlobalConfig.session_key,
|
7
|
-
:secret => GlobalConfig.session_secret
|
8
|
-
}
|