uploader 0.1.10 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -1
- data/Rakefile +4 -3
- data/VERSION +1 -1
- data/test/rails_root/.gitignore +8 -0
- data/test/rails_root/.rake_tasks +103 -0
- data/test/rails_root/Capfile +3 -0
- data/test/rails_root/Rakefile +10 -0
- data/test/rails_root/app/controllers/application_controller.rb +4 -0
- data/test/rails_root/app/controllers/uploads_controller.rb +18 -0
- data/test/rails_root/app/models/.keep +0 -0
- data/test/rails_root/app/models/upload.rb +28 -0
- data/test/rails_root/app/models/user.rb +9 -0
- data/test/rails_root/app/views/layouts/application.html.erb +18 -0
- data/test/rails_root/config/amazon_s3.yml +14 -0
- data/test/rails_root/config/boot.rb +109 -0
- data/test/rails_root/config/database.yml +14 -0
- data/test/rails_root/config/environment.rb +23 -0
- data/test/rails_root/config/environments/development.rb +19 -0
- data/test/rails_root/config/environments/production.rb +1 -0
- data/test/rails_root/config/environments/test.rb +33 -0
- data/test/rails_root/config/global_config.yml +18 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/initializers/requires.rb +13 -0
- data/test/rails_root/config/initializers/s3_credentials.rb +9 -0
- data/test/rails_root/config/initializers/session_store.rb +8 -0
- data/test/rails_root/config/routes.rb +6 -0
- data/test/rails_root/db/.keep +0 -0
- data/test/rails_root/db/migrate/20090517040220_create_uploads.rb +38 -0
- data/test/rails_root/db/migrate/20090602041838_create_users.rb +12 -0
- data/test/rails_root/db/schema.rb +47 -0
- data/test/rails_root/features/step_definitions/webrat_steps.rb +99 -0
- data/test/rails_root/features/support/env.rb +14 -0
- data/test/rails_root/public/.htaccess +40 -0
- data/test/rails_root/public/404.html +30 -0
- data/test/rails_root/public/422.html +30 -0
- data/test/rails_root/public/500.html +30 -0
- data/test/rails_root/public/dispatch.rb +10 -0
- data/test/rails_root/public/favicon.ico +0 -0
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/javascripts/application.js +2 -0
- data/test/rails_root/public/javascripts/builder.js +136 -0
- data/test/rails_root/public/javascripts/controls.js +963 -0
- data/test/rails_root/public/javascripts/dragdrop.js +972 -0
- data/test/rails_root/public/javascripts/effects.js +1120 -0
- data/test/rails_root/public/javascripts/prototype.js +4225 -0
- data/test/rails_root/public/javascripts/scriptaculous.js +58 -0
- data/test/rails_root/public/javascripts/slider.js +277 -0
- data/test/rails_root/public/javascripts/sound.js +60 -0
- data/test/rails_root/public/robots.txt +1 -0
- data/test/rails_root/public/stylesheets/.keep +0 -0
- data/test/rails_root/script/about +3 -0
- data/test/rails_root/script/breakpointer +3 -0
- data/test/rails_root/script/console +3 -0
- data/test/rails_root/script/create_project.rb +52 -0
- data/test/rails_root/script/cucumber +7 -0
- data/test/rails_root/script/dbconsole +3 -0
- data/test/rails_root/script/destroy +3 -0
- data/test/rails_root/script/generate +3 -0
- data/test/rails_root/script/performance/benchmarker +3 -0
- data/test/rails_root/script/performance/profiler +3 -0
- data/test/rails_root/script/performance/request +3 -0
- data/test/rails_root/script/plugin +3 -0
- data/test/rails_root/script/process/inspector +3 -0
- data/test/rails_root/script/process/reaper +3 -0
- data/test/rails_root/script/process/spawner +3 -0
- data/test/rails_root/script/runner +3 -0
- data/test/rails_root/script/server +3 -0
- data/test/rails_root/test/factories.rb +14 -0
- data/test/rails_root/test/functional/.keep +0 -0
- data/test/rails_root/test/functional/uploads_controller_test.rb +104 -0
- data/test/rails_root/test/integration/.keep +0 -0
- data/test/rails_root/test/mocks/development/.keep +0 -0
- data/test/rails_root/test/mocks/test/.keep +0 -0
- data/test/rails_root/test/test_helper.rb +22 -0
- data/test/rails_root/test/unit/.keep +0 -0
- data/test/{unit → rails_root/test/unit}/upload_test.rb +1 -1
- data/uploader.gemspec +104 -6
- metadata +111 -6
- data/test/test_helper.rb +0 -3
data/README.rdoc
CHANGED
@@ -8,8 +8,9 @@ Uploader makes it easy to integrate multiple file uploads into your application
|
|
8
8
|
=== Install the gem:
|
9
9
|
sudo gem install uploader
|
10
10
|
|
11
|
-
Installing uploader should also install mime-types. If for some reason it does not then manually install it:
|
11
|
+
Installing uploader should also install mime-types and rack. If for some reason it does not then manually install it:
|
12
12
|
sudo gem install mime-types
|
13
|
+
sudo gem install rack
|
13
14
|
|
14
15
|
|
15
16
|
=== Add the gem to environment.rb
|
data/Rakefile
CHANGED
@@ -5,11 +5,11 @@ require 'rake/rdoctask'
|
|
5
5
|
desc 'Default: run unit tests.'
|
6
6
|
task :default => :test
|
7
7
|
|
8
|
-
desc 'Test the uploader
|
8
|
+
desc 'Test the uploader gem.'
|
9
9
|
Rake::TestTask.new(:test) do |t|
|
10
10
|
t.libs << 'lib'
|
11
|
-
t.libs << 'test'
|
12
|
-
t.pattern = 'test/**/*_test.rb'
|
11
|
+
t.libs << 'test/rails_root/test'
|
12
|
+
t.pattern = 'test/rails_root/test/**/*_test.rb'
|
13
13
|
t.verbose = true
|
14
14
|
end
|
15
15
|
|
@@ -34,6 +34,7 @@ begin
|
|
34
34
|
#gemspec.files.include %w( tasks/rails.rake lib/uploader/*.rb lib/uploader/middleware/*.rb db/migrate/*.rb public/images/file_icons/* app/views/uploads/* )
|
35
35
|
gemspec.rubyforge_project = 'uploader'
|
36
36
|
gemspec.add_dependency "mime-types"
|
37
|
+
gemspec.add_dependency "rack"
|
37
38
|
end
|
38
39
|
rescue LoadError
|
39
40
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.12
|
@@ -0,0 +1,103 @@
|
|
1
|
+
db:abort_if_pending_migrations
|
2
|
+
db:bootstrap
|
3
|
+
db:bootstrap:load
|
4
|
+
db:charset
|
5
|
+
db:collation
|
6
|
+
db:create
|
7
|
+
db:create:all
|
8
|
+
db:drop
|
9
|
+
db:drop:all
|
10
|
+
db:fixtures:identify
|
11
|
+
db:fixtures:load
|
12
|
+
db:migrate
|
13
|
+
db:migrate:down
|
14
|
+
db:migrate:redo
|
15
|
+
db:migrate:reset
|
16
|
+
db:migrate:up
|
17
|
+
db:reset
|
18
|
+
db:rollback
|
19
|
+
db:schema:dump
|
20
|
+
db:schema:load
|
21
|
+
db:sessions:clear
|
22
|
+
db:sessions:create
|
23
|
+
db:structure:dump
|
24
|
+
db:test:clone
|
25
|
+
db:test:clone_structure
|
26
|
+
db:test:prepare
|
27
|
+
db:test:purge
|
28
|
+
db:version
|
29
|
+
deploy
|
30
|
+
doc:app
|
31
|
+
doc:clobber_app
|
32
|
+
doc:clobber_plugins
|
33
|
+
doc:clobber_rails
|
34
|
+
doc:plugins
|
35
|
+
doc:rails
|
36
|
+
doc:reapp
|
37
|
+
doc:rerails
|
38
|
+
gems
|
39
|
+
gems:build
|
40
|
+
gems:install
|
41
|
+
gems:unpack
|
42
|
+
gems:unpack:dependencies
|
43
|
+
git:branch:production
|
44
|
+
git:diff:production
|
45
|
+
git:diff:staging
|
46
|
+
git:pull:template
|
47
|
+
git:push:production
|
48
|
+
git:push:staging
|
49
|
+
log:clear
|
50
|
+
notes
|
51
|
+
notes:fixme
|
52
|
+
notes:optimize
|
53
|
+
notes:todo
|
54
|
+
rails:freeze:edge
|
55
|
+
rails:freeze:gems
|
56
|
+
rails:unfreeze
|
57
|
+
rails:update
|
58
|
+
rails:update:configs
|
59
|
+
rails:update:javascripts
|
60
|
+
rails:update:scripts
|
61
|
+
remote:cleanup
|
62
|
+
remote:cold_deploy
|
63
|
+
remote:deploy
|
64
|
+
remote:deploy_with_migrations
|
65
|
+
remote:diff_from_last_deploy
|
66
|
+
remote:disable_web
|
67
|
+
remote:enable_web
|
68
|
+
remote:exec
|
69
|
+
remote:invoke
|
70
|
+
remote:migrate
|
71
|
+
remote:restart
|
72
|
+
remote:rollback
|
73
|
+
remote:rollback_code
|
74
|
+
remote:setup
|
75
|
+
remote:shell
|
76
|
+
remote:show_tasks
|
77
|
+
remote:spinner
|
78
|
+
remote:symlink
|
79
|
+
remote:update
|
80
|
+
remote:update_code
|
81
|
+
remote:update_current
|
82
|
+
rollback
|
83
|
+
routes
|
84
|
+
secret
|
85
|
+
shoulda:from_yaml
|
86
|
+
shoulda:list
|
87
|
+
stats
|
88
|
+
test
|
89
|
+
test:functionals
|
90
|
+
test:integration
|
91
|
+
test:plugins
|
92
|
+
test:recent
|
93
|
+
test:uncommitted
|
94
|
+
test:units
|
95
|
+
time:zones:all
|
96
|
+
time:zones:local
|
97
|
+
time:zones:us
|
98
|
+
tmp:cache:clear
|
99
|
+
tmp:clear
|
100
|
+
tmp:create
|
101
|
+
tmp:pids:clear
|
102
|
+
tmp:sessions:clear
|
103
|
+
tmp:sockets:clear
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class UploadsController < Uploader::UploadsController
|
2
|
+
|
3
|
+
def get_redirect(source)
|
4
|
+
case source
|
5
|
+
when :destroy_success
|
6
|
+
'/destroy_success'
|
7
|
+
when :create_success
|
8
|
+
'/create_success'
|
9
|
+
when :create_failure
|
10
|
+
'/create_failure'
|
11
|
+
when :permission_denied
|
12
|
+
'/permission_denied'
|
13
|
+
else
|
14
|
+
raise 'An unknown source was provided to get_redirect'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Upload < ActiveRecord::Base
|
2
|
+
|
3
|
+
acts_as_uploader :enable_s3 => false,
|
4
|
+
:has_attached_file => {
|
5
|
+
:url => "/system/:attachment/:id_partition/:style/:basename.:extension",
|
6
|
+
:path => ":rails_root/public/system/:attachment/:id_partition/:style/:basename.:extension",
|
7
|
+
:styles => { :icon => "30x30!",
|
8
|
+
:thumb => "100>",
|
9
|
+
:small => "150>",
|
10
|
+
:medium => "300>",
|
11
|
+
:large => "660>" },
|
12
|
+
:default_url => "/images/profile_default.jpg",
|
13
|
+
:storage => :s3,
|
14
|
+
:s3_credentials => AMAZON_S3_CREDENTIALS,
|
15
|
+
:bucket => "assets.#{GlobalConfig.application_url}",
|
16
|
+
:s3_host_alias => "assets.#{GlobalConfig.application_url}",
|
17
|
+
:convert_options => {
|
18
|
+
:all => '-quality 80'
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
validates_attachment_presence :local
|
23
|
+
|
24
|
+
def can_edit?(user)
|
25
|
+
return true
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Uploader</title>
|
7
|
+
<%= stylesheet_link_tag 'screen', :media => 'all' %>
|
8
|
+
<%= javascript_include_tag :defaults %>
|
9
|
+
</head>
|
10
|
+
<body class="<%= body_class %>">
|
11
|
+
<div id="flash">
|
12
|
+
<% flash.each do |key, value| -%>
|
13
|
+
<div id="flash_<%= key %>"><%=h value %></div>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
<%= yield %>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,109 @@
|
|
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!
|
@@ -0,0 +1,23 @@
|
|
1
|
+
RAILS_GEM_VERSION = '2.3.2' 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
|
+
Rails::Initializer.run do |config|
|
19
|
+
config.load_paths += Dir.glob(File.join(RAILS_ROOT, 'vendor', 'gems', '*', 'lib'))
|
20
|
+
config.time_zone = 'UTC'
|
21
|
+
config.gem 'uploader'
|
22
|
+
config.gem 'thoughtbot-paperclip', :version => '~> 2.2.2', :lib => 'paperclip', :source => 'http://gems.github.com'
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
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"
|
@@ -0,0 +1 @@
|
|
1
|
+
HOST = "http://example.com"
|
@@ -0,0 +1,33 @@
|
|
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 'thoughtbot-shoulda',
|
27
|
+
:lib => 'shoulda',
|
28
|
+
:source => "http://gems.github.com",
|
29
|
+
:version => '>= 2.9.1'
|
30
|
+
config.gem 'thoughtbot-factory_girl',
|
31
|
+
:lib => 'factory_girl',
|
32
|
+
:source => "http://gems.github.com",
|
33
|
+
:version => '>= 1.2.0'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#The account plugin needs to be configured. The following values may be used to customize the account
|
2
|
+
|
3
|
+
default: &DEFAULT
|
4
|
+
|
5
|
+
application_url: localhost:3000
|
6
|
+
|
7
|
+
# session key information
|
8
|
+
session_key: _uploader_session
|
9
|
+
session_secret: ea55c4d5e105735fdfb1caec46711b3dd14ec976d0ba95b4c0f575cb046cc358bce7a335ee36eb29253fb680ef8b838d871f6baeff48220fee8e9e42ab84774b
|
10
|
+
|
11
|
+
production:
|
12
|
+
<<: *DEFAULT
|
13
|
+
|
14
|
+
development:
|
15
|
+
<<: *DEFAULT
|
16
|
+
|
17
|
+
test:
|
18
|
+
<<: *DEFAULT
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,13 @@
|
|
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
|
@@ -0,0 +1,8 @@
|
|
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
|
+
}
|
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class CreateUploads < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :uploads, :force => true do |t|
|
4
|
+
t.integer :creator_id
|
5
|
+
t.string :name
|
6
|
+
t.string :caption, :limit => 1000
|
7
|
+
t.text :description
|
8
|
+
t.boolean :is_public, :default => true
|
9
|
+
t.integer :uploadable_id
|
10
|
+
t.string :uploadable_type
|
11
|
+
t.string :width
|
12
|
+
t.string :height
|
13
|
+
|
14
|
+
t.string :local_file_name
|
15
|
+
t.string :local_content_type
|
16
|
+
t.integer :local_file_size
|
17
|
+
t.datetime :local_updated_at
|
18
|
+
|
19
|
+
t.string :remote_file_name
|
20
|
+
t.string :remote_content_type
|
21
|
+
t.integer :remote_file_size
|
22
|
+
t.datetime :remote_updated_at
|
23
|
+
|
24
|
+
t.timestamps
|
25
|
+
end
|
26
|
+
|
27
|
+
add_index :uploads, ["creator_id"]
|
28
|
+
add_index :uploads, ["uploadable_id"]
|
29
|
+
add_index :uploads, ["uploadable_type"]
|
30
|
+
add_index :uploads, ["local_content_type"]
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.down
|
35
|
+
drop_table :uploads
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
2
|
+
# please use the migrations feature of Active Record to incrementally modify your database, and
|
3
|
+
# then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
6
|
+
# to create the application database on another system, you should be using db:schema:load, not running
|
7
|
+
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
8
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
9
|
+
#
|
10
|
+
# It's strongly recommended to check this file into your version control system.
|
11
|
+
|
12
|
+
ActiveRecord::Schema.define(:version => 20090602041838) do
|
13
|
+
|
14
|
+
create_table "uploads", :force => true do |t|
|
15
|
+
t.integer "creator_id"
|
16
|
+
t.string "name"
|
17
|
+
t.string "caption", :limit => 1000
|
18
|
+
t.text "description"
|
19
|
+
t.boolean "is_public", :default => true
|
20
|
+
t.integer "uploadable_id"
|
21
|
+
t.string "uploadable_type"
|
22
|
+
t.string "width"
|
23
|
+
t.string "height"
|
24
|
+
t.string "local_file_name"
|
25
|
+
t.string "local_content_type"
|
26
|
+
t.integer "local_file_size"
|
27
|
+
t.datetime "local_updated_at"
|
28
|
+
t.string "remote_file_name"
|
29
|
+
t.string "remote_content_type"
|
30
|
+
t.integer "remote_file_size"
|
31
|
+
t.datetime "remote_updated_at"
|
32
|
+
t.datetime "created_at"
|
33
|
+
t.datetime "updated_at"
|
34
|
+
end
|
35
|
+
|
36
|
+
add_index "uploads", ["creator_id"], :name => "index_uploads_on_creator_id"
|
37
|
+
add_index "uploads", ["local_content_type"], :name => "index_uploads_on_local_content_type"
|
38
|
+
add_index "uploads", ["uploadable_id"], :name => "index_uploads_on_uploadable_id"
|
39
|
+
add_index "uploads", ["uploadable_type"], :name => "index_uploads_on_uploadable_type"
|
40
|
+
|
41
|
+
create_table "users", :force => true do |t|
|
42
|
+
t.string "name"
|
43
|
+
t.datetime "created_at"
|
44
|
+
t.datetime "updated_at"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|