uploader 0.1.10 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/README.rdoc +2 -1
  2. data/Rakefile +4 -3
  3. data/VERSION +1 -1
  4. data/test/rails_root/.gitignore +8 -0
  5. data/test/rails_root/.rake_tasks +103 -0
  6. data/test/rails_root/Capfile +3 -0
  7. data/test/rails_root/Rakefile +10 -0
  8. data/test/rails_root/app/controllers/application_controller.rb +4 -0
  9. data/test/rails_root/app/controllers/uploads_controller.rb +18 -0
  10. data/test/rails_root/app/models/.keep +0 -0
  11. data/test/rails_root/app/models/upload.rb +28 -0
  12. data/test/rails_root/app/models/user.rb +9 -0
  13. data/test/rails_root/app/views/layouts/application.html.erb +18 -0
  14. data/test/rails_root/config/amazon_s3.yml +14 -0
  15. data/test/rails_root/config/boot.rb +109 -0
  16. data/test/rails_root/config/database.yml +14 -0
  17. data/test/rails_root/config/environment.rb +23 -0
  18. data/test/rails_root/config/environments/development.rb +19 -0
  19. data/test/rails_root/config/environments/production.rb +1 -0
  20. data/test/rails_root/config/environments/test.rb +33 -0
  21. data/test/rails_root/config/global_config.yml +18 -0
  22. data/test/rails_root/config/initializers/inflections.rb +10 -0
  23. data/test/rails_root/config/initializers/mime_types.rb +5 -0
  24. data/test/rails_root/config/initializers/requires.rb +13 -0
  25. data/test/rails_root/config/initializers/s3_credentials.rb +9 -0
  26. data/test/rails_root/config/initializers/session_store.rb +8 -0
  27. data/test/rails_root/config/routes.rb +6 -0
  28. data/test/rails_root/db/.keep +0 -0
  29. data/test/rails_root/db/migrate/20090517040220_create_uploads.rb +38 -0
  30. data/test/rails_root/db/migrate/20090602041838_create_users.rb +12 -0
  31. data/test/rails_root/db/schema.rb +47 -0
  32. data/test/rails_root/features/step_definitions/webrat_steps.rb +99 -0
  33. data/test/rails_root/features/support/env.rb +14 -0
  34. data/test/rails_root/public/.htaccess +40 -0
  35. data/test/rails_root/public/404.html +30 -0
  36. data/test/rails_root/public/422.html +30 -0
  37. data/test/rails_root/public/500.html +30 -0
  38. data/test/rails_root/public/dispatch.rb +10 -0
  39. data/test/rails_root/public/favicon.ico +0 -0
  40. data/test/rails_root/public/images/rails.png +0 -0
  41. data/test/rails_root/public/javascripts/application.js +2 -0
  42. data/test/rails_root/public/javascripts/builder.js +136 -0
  43. data/test/rails_root/public/javascripts/controls.js +963 -0
  44. data/test/rails_root/public/javascripts/dragdrop.js +972 -0
  45. data/test/rails_root/public/javascripts/effects.js +1120 -0
  46. data/test/rails_root/public/javascripts/prototype.js +4225 -0
  47. data/test/rails_root/public/javascripts/scriptaculous.js +58 -0
  48. data/test/rails_root/public/javascripts/slider.js +277 -0
  49. data/test/rails_root/public/javascripts/sound.js +60 -0
  50. data/test/rails_root/public/robots.txt +1 -0
  51. data/test/rails_root/public/stylesheets/.keep +0 -0
  52. data/test/rails_root/script/about +3 -0
  53. data/test/rails_root/script/breakpointer +3 -0
  54. data/test/rails_root/script/console +3 -0
  55. data/test/rails_root/script/create_project.rb +52 -0
  56. data/test/rails_root/script/cucumber +7 -0
  57. data/test/rails_root/script/dbconsole +3 -0
  58. data/test/rails_root/script/destroy +3 -0
  59. data/test/rails_root/script/generate +3 -0
  60. data/test/rails_root/script/performance/benchmarker +3 -0
  61. data/test/rails_root/script/performance/profiler +3 -0
  62. data/test/rails_root/script/performance/request +3 -0
  63. data/test/rails_root/script/plugin +3 -0
  64. data/test/rails_root/script/process/inspector +3 -0
  65. data/test/rails_root/script/process/reaper +3 -0
  66. data/test/rails_root/script/process/spawner +3 -0
  67. data/test/rails_root/script/runner +3 -0
  68. data/test/rails_root/script/server +3 -0
  69. data/test/rails_root/test/factories.rb +14 -0
  70. data/test/rails_root/test/functional/.keep +0 -0
  71. data/test/rails_root/test/functional/uploads_controller_test.rb +104 -0
  72. data/test/rails_root/test/integration/.keep +0 -0
  73. data/test/rails_root/test/mocks/development/.keep +0 -0
  74. data/test/rails_root/test/mocks/test/.keep +0 -0
  75. data/test/rails_root/test/test_helper.rb +22 -0
  76. data/test/rails_root/test/unit/.keep +0 -0
  77. data/test/{unit → rails_root/test/unit}/upload_test.rb +1 -1
  78. data/uploader.gemspec +104 -6
  79. metadata +111 -6
  80. data/test/test_helper.rb +0 -3
@@ -0,0 +1,99 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
2
+
3
+ # Commonly used webrat steps
4
+ # http://github.com/brynary/webrat
5
+
6
+ When /^I go to (.+)$/ do |page_name|
7
+ visit path_to(page_name)
8
+ end
9
+
10
+ When /^I press "(.*)"$/ do |button|
11
+ click_button(button)
12
+ end
13
+
14
+ When /^I follow "(.*)"$/ do |link|
15
+ click_link(link)
16
+ end
17
+
18
+ When /^I fill in "(.*)" with "(.*)"$/ do |field, value|
19
+ fill_in(field, :with => value)
20
+ end
21
+
22
+ When /^I select "(.*)" from "(.*)"$/ do |value, field|
23
+ select(value, :from => field)
24
+ end
25
+
26
+ # Use this step in conjunction with Rail's datetime_select helper. For example:
27
+ # When I select "December 25, 2008 10:00" as the date and time
28
+ When /^I select "(.*)" as the date and time$/ do |time|
29
+ select_datetime(time)
30
+ end
31
+
32
+ # Use this step when using multiple datetime_select helpers on a page or
33
+ # you want to specify which datetime to select. Given the following view:
34
+ # <%= f.label :preferred %><br />
35
+ # <%= f.datetime_select :preferred %>
36
+ # <%= f.label :alternative %><br />
37
+ # <%= f.datetime_select :alternative %>
38
+ # The following steps would fill out the form:
39
+ # When I select "November 23, 2004 11:20" as the "Preferred" data and time
40
+ # And I select "November 25, 2004 10:30" as the "Alternative" data and time
41
+ When /^I select "(.*)" as the "(.*)" date and time$/ do |datetime, datetime_label|
42
+ select_datetime(datetime, :from => datetime_label)
43
+ end
44
+
45
+ # Use this step in conjuction with Rail's time_select helper. For example:
46
+ # When I select "2:20PM" as the time
47
+ # Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
48
+ # will convert the 2:20PM to 14:20 and then select it.
49
+ When /^I select "(.*)" as the time$/ do |time|
50
+ select_time(time)
51
+ end
52
+
53
+ # Use this step when using multiple time_select helpers on a page or you want to
54
+ # specify the name of the time on the form. For example:
55
+ # When I select "7:30AM" as the "Gym" time
56
+ When /^I select "(.*)" as the "(.*)" time$/ do |time, time_label|
57
+ select_time(time, :from => time_label)
58
+ end
59
+
60
+ # Use this step in conjuction with Rail's date_select helper. For example:
61
+ # When I select "February 20, 1981" as the date
62
+ When /^I select "(.*)" as the date$/ do |date|
63
+ select_date(date)
64
+ end
65
+
66
+ # Use this step when using multiple date_select helpers on one page or
67
+ # you want to specify the name of the date on the form. For example:
68
+ # When I select "April 26, 1982" as the "Date of Birth" date
69
+ When /^I select "(.*)" as the "(.*)" date$/ do |date, date_label|
70
+ select_date(date, :from => date_label)
71
+ end
72
+
73
+ When /^I check "(.*)"$/ do |field|
74
+ check(field)
75
+ end
76
+
77
+ When /^I uncheck "(.*)"$/ do |field|
78
+ uncheck(field)
79
+ end
80
+
81
+ When /^I choose "(.*)"$/ do |field|
82
+ choose(field)
83
+ end
84
+
85
+ When /^I attach the file at "(.*)" to "(.*)" $/ do |path, field|
86
+ attach_file(field, path)
87
+ end
88
+
89
+ Then /^I should see "(.*)"$/ do |text|
90
+ assert_match /#{text}/m, response.body
91
+ end
92
+
93
+ Then /^I should not see "(.*)"$/ do |text|
94
+ assert_match /#{text}/m, response.body
95
+ end
96
+
97
+ Then /^the "(.*)" checkbox should be checked$/ do |label|
98
+ field_labeled(label).should be_checked
99
+ end
@@ -0,0 +1,14 @@
1
+ # Sets up the Rails environment for Cucumber
2
+ ENV["RAILS_ENV"] = "test"
3
+ require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
4
+ require 'factory_girl'
5
+ require 'cucumber/rails/world'
6
+ require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
7
+ Cucumber::Rails.use_transactional_fixtures
8
+ Cucumber::Rails.bypass_rescue
9
+
10
+ require 'webrat'
11
+
12
+ Webrat.configure do |config|
13
+ config.mode = :rails
14
+ end
@@ -0,0 +1,40 @@
1
+ # General Apache options
2
+ AddHandler fastcgi-script .fcgi
3
+ AddHandler cgi-script .cgi
4
+ Options +FollowSymLinks +ExecCGI
5
+
6
+ # If you don't want Rails to look in certain directories,
7
+ # use the following rewrite rules so that Apache won't rewrite certain requests
8
+ #
9
+ # Example:
10
+ # RewriteCond %{REQUEST_URI} ^/notrails.*
11
+ # RewriteRule .* - [L]
12
+
13
+ # Redirect all requests not available on the filesystem to Rails
14
+ # By default the cgi dispatcher is used which is very slow
15
+ #
16
+ # For better performance replace the dispatcher with the fastcgi one
17
+ #
18
+ # Example:
19
+ # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
20
+ RewriteEngine On
21
+
22
+ # If your Rails application is accessed via an Alias directive,
23
+ # then you MUST also set the RewriteBase in this htaccess file.
24
+ #
25
+ # Example:
26
+ # Alias /myrailsapp /path/to/myrailsapp/public
27
+ # RewriteBase /myrailsapp
28
+
29
+ RewriteRule ^$ index.html [QSA]
30
+ RewriteRule ^([^.]+)$ $1.html [QSA]
31
+ RewriteCond %{REQUEST_FILENAME} !-f
32
+ RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
33
+
34
+ # In case Rails experiences terminal errors
35
+ # Instead of displaying this message you can supply a file here which will be rendered instead
36
+ #
37
+ # Example:
38
+ # ErrorDocument 500 /500.html
39
+
40
+ ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>The page you were looking for doesn't exist (404)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/404.html -->
25
+ <div class="dialog">
26
+ <h1>The page you were looking for doesn't exist.</h1>
27
+ <p>You may have mistyped the address or the page may have moved.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>The change you wanted was rejected (422)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/422.html -->
25
+ <div class="dialog">
26
+ <h1>The change you wanted was rejected.</h1>
27
+ <p>Maybe you tried to change something you didn't have access to.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>We're sorry, but something went wrong</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/500.html -->
25
+ <div class="dialog">
26
+ <h1>We're sorry, but something went wrong.</h1>
27
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,10 @@
1
+ #!/opt/local/bin/ruby
2
+
3
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
+
5
+ # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
6
+ # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
7
+ require "dispatcher"
8
+
9
+ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
10
+ Dispatcher.dispatch
File without changes
@@ -0,0 +1,2 @@
1
+ // Place your application-specific JavaScript functions and classes here
2
+ // This file is automatically included by javascript_include_tag :defaults
@@ -0,0 +1,136 @@
1
+ // script.aculo.us builder.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
2
+
3
+ // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4
+ //
5
+ // script.aculo.us is freely distributable under the terms of an MIT-style license.
6
+ // For details, see the script.aculo.us web site: http://script.aculo.us/
7
+
8
+ var Builder = {
9
+ NODEMAP: {
10
+ AREA: 'map',
11
+ CAPTION: 'table',
12
+ COL: 'table',
13
+ COLGROUP: 'table',
14
+ LEGEND: 'fieldset',
15
+ OPTGROUP: 'select',
16
+ OPTION: 'select',
17
+ PARAM: 'object',
18
+ TBODY: 'table',
19
+ TD: 'table',
20
+ TFOOT: 'table',
21
+ TH: 'table',
22
+ THEAD: 'table',
23
+ TR: 'table'
24
+ },
25
+ // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
26
+ // due to a Firefox bug
27
+ node: function(elementName) {
28
+ elementName = elementName.toUpperCase();
29
+
30
+ // try innerHTML approach
31
+ var parentTag = this.NODEMAP[elementName] || 'div';
32
+ var parentElement = document.createElement(parentTag);
33
+ try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
34
+ parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
35
+ } catch(e) {}
36
+ var element = parentElement.firstChild || null;
37
+
38
+ // see if browser added wrapping tags
39
+ if(element && (element.tagName.toUpperCase() != elementName))
40
+ element = element.getElementsByTagName(elementName)[0];
41
+
42
+ // fallback to createElement approach
43
+ if(!element) element = document.createElement(elementName);
44
+
45
+ // abort if nothing could be created
46
+ if(!element) return;
47
+
48
+ // attributes (or text)
49
+ if(arguments[1])
50
+ if(this._isStringOrNumber(arguments[1]) ||
51
+ (arguments[1] instanceof Array) ||
52
+ arguments[1].tagName) {
53
+ this._children(element, arguments[1]);
54
+ } else {
55
+ var attrs = this._attributes(arguments[1]);
56
+ if(attrs.length) {
57
+ try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
58
+ parentElement.innerHTML = "<" +elementName + " " +
59
+ attrs + "></" + elementName + ">";
60
+ } catch(e) {}
61
+ element = parentElement.firstChild || null;
62
+ // workaround firefox 1.0.X bug
63
+ if(!element) {
64
+ element = document.createElement(elementName);
65
+ for(attr in arguments[1])
66
+ element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
67
+ }
68
+ if(element.tagName.toUpperCase() != elementName)
69
+ element = parentElement.getElementsByTagName(elementName)[0];
70
+ }
71
+ }
72
+
73
+ // text, or array of children
74
+ if(arguments[2])
75
+ this._children(element, arguments[2]);
76
+
77
+ return element;
78
+ },
79
+ _text: function(text) {
80
+ return document.createTextNode(text);
81
+ },
82
+
83
+ ATTR_MAP: {
84
+ 'className': 'class',
85
+ 'htmlFor': 'for'
86
+ },
87
+
88
+ _attributes: function(attributes) {
89
+ var attrs = [];
90
+ for(attribute in attributes)
91
+ attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
92
+ '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
93
+ return attrs.join(" ");
94
+ },
95
+ _children: function(element, children) {
96
+ if(children.tagName) {
97
+ element.appendChild(children);
98
+ return;
99
+ }
100
+ if(typeof children=='object') { // array can hold nodes and text
101
+ children.flatten().each( function(e) {
102
+ if(typeof e=='object')
103
+ element.appendChild(e)
104
+ else
105
+ if(Builder._isStringOrNumber(e))
106
+ element.appendChild(Builder._text(e));
107
+ });
108
+ } else
109
+ if(Builder._isStringOrNumber(children))
110
+ element.appendChild(Builder._text(children));
111
+ },
112
+ _isStringOrNumber: function(param) {
113
+ return(typeof param=='string' || typeof param=='number');
114
+ },
115
+ build: function(html) {
116
+ var element = this.node('div');
117
+ $(element).update(html.strip());
118
+ return element.down();
119
+ },
120
+ dump: function(scope) {
121
+ if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
122
+
123
+ var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
124
+ "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
125
+ "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
126
+ "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
127
+ "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
128
+ "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
129
+
130
+ tags.each( function(tag){
131
+ scope[tag] = function() {
132
+ return Builder.node.apply(Builder, [tag].concat($A(arguments)));
133
+ }
134
+ });
135
+ }
136
+ }