thin_upload 0.0.1.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. data/Gemfile +7 -0
  2. data/Gemfile.lock +31 -0
  3. data/Manifest +44 -0
  4. data/README.rdoc +40 -0
  5. data/Rakefile +33 -0
  6. data/html/README_rdoc.html +133 -0
  7. data/html/Thin.html +149 -0
  8. data/html/Thin/Request.html +537 -0
  9. data/html/Thin/Server.html +194 -0
  10. data/html/created.rid +4 -0
  11. data/html/images/brick.png +0 -0
  12. data/html/images/brick_link.png +0 -0
  13. data/html/images/bug.png +0 -0
  14. data/html/images/bullet_black.png +0 -0
  15. data/html/images/bullet_toggle_minus.png +0 -0
  16. data/html/images/bullet_toggle_plus.png +0 -0
  17. data/html/images/date.png +0 -0
  18. data/html/images/find.png +0 -0
  19. data/html/images/loadingAnimation.gif +0 -0
  20. data/html/images/macFFBgHack.png +0 -0
  21. data/html/images/package.png +0 -0
  22. data/html/images/page_green.png +0 -0
  23. data/html/images/page_white_text.png +0 -0
  24. data/html/images/page_white_width.png +0 -0
  25. data/html/images/plugin.png +0 -0
  26. data/html/images/ruby.png +0 -0
  27. data/html/images/tag_green.png +0 -0
  28. data/html/images/wrench.png +0 -0
  29. data/html/images/wrench_orange.png +0 -0
  30. data/html/images/zoom.png +0 -0
  31. data/html/index.html +124 -0
  32. data/html/js/darkfish.js +116 -0
  33. data/html/js/jquery.js +32 -0
  34. data/html/js/quicksearch.js +114 -0
  35. data/html/js/thickbox-compressed.js +10 -0
  36. data/html/lib/thin_upload/parser_rb.html +54 -0
  37. data/html/lib/thin_upload/request_rb.html +54 -0
  38. data/html/lib/thin_upload_rb.html +54 -0
  39. data/html/rdoc.css +763 -0
  40. data/lib/thin_upload.rb +3 -0
  41. data/lib/thin_upload/request.rb +93 -0
  42. data/test/test_helper.rb +30 -0
  43. data/test/thin_upload/request_test.rb +91 -0
  44. data/thin_upload.gemspec +33 -0
  45. metadata +111 -0
@@ -0,0 +1,194 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Thin::Server</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="class">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="../index.html">Home</a>
25
+ <a href="../index.html#classes">Classes</a>
26
+ <a href="../index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="../lib/thin_upload/request_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/thin_upload/request.rb">lib/thin_upload/request.rb</a></li>
39
+
40
+ </ul>
41
+ </div>
42
+ </div>
43
+
44
+
45
+ </div>
46
+
47
+ <div id="class-metadata">
48
+
49
+ <!-- Parent Class -->
50
+ <div id="parent-class-section" class="section">
51
+ <h3 class="section-header">Parent</h3>
52
+
53
+ <p class="link">Object</p>
54
+
55
+ </div>
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ <!-- Method Quickref -->
64
+ <div id="method-list-section" class="section">
65
+ <h3 class="section-header">Methods</h3>
66
+ <ul class="link-list">
67
+
68
+ <li><a href="#method-c-progress">::progress</a></li>
69
+
70
+ </ul>
71
+ </div>
72
+
73
+
74
+
75
+ </div>
76
+
77
+ <div id="project-metadata">
78
+
79
+
80
+ <div id="fileindex-section" class="section project-section">
81
+ <h3 class="section-header">Files</h3>
82
+ <ul>
83
+
84
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
85
+
86
+ </ul>
87
+ </div>
88
+
89
+
90
+ <div id="classindex-section" class="section project-section">
91
+ <h3 class="section-header">Class/Module Index
92
+ <span class="search-toggle"><img src="../images/find.png"
93
+ height="16" width="16" alt="[+]"
94
+ title="show/hide quicksearch" /></span></h3>
95
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
96
+ <fieldset>
97
+ <legend>Quicksearch</legend>
98
+ <input type="text" name="quicksearch" value=""
99
+ class="quicksearch-field" />
100
+ </fieldset>
101
+ </form>
102
+
103
+ <ul class="link-list">
104
+
105
+ <li><a href="../Thin.html">Thin</a></li>
106
+
107
+ <li><a href="../Thin/Request.html">Thin::Request</a></li>
108
+
109
+ <li><a href="../Thin/Server.html">Thin::Server</a></li>
110
+
111
+ </ul>
112
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
113
+ </div>
114
+
115
+
116
+ </div>
117
+ </div>
118
+
119
+ <div id="documentation">
120
+ <h1 class="class">Thin::Server</h1>
121
+
122
+ <div id="description" class="description">
123
+
124
+ <p>Thin’s server class</p>
125
+
126
+ </div><!-- description -->
127
+
128
+
129
+
130
+
131
+ <div id="5Buntitled-5D" class="documentation-section">
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <!-- Methods -->
141
+
142
+ <div id="public-class-method-details" class="method-section section">
143
+ <h3 class="section-header">Public Class Methods</h3>
144
+
145
+
146
+ <div id="progress-method" class="method-detail ">
147
+ <a name="method-c-progress"></a>
148
+
149
+
150
+ <div class="method-heading">
151
+ <span class="method-name">progress</span><span
152
+ class="method-args">()</span>
153
+ <span class="method-click-advice">click to toggle source</span>
154
+ </div>
155
+
156
+
157
+ <div class="method-description">
158
+
159
+ <p>adding a hash to store all the upload progress in the server</p>
160
+
161
+
162
+
163
+ <div class="method-source-code" id="progress-source">
164
+ <pre>
165
+ <span class="ruby-comment"># File lib/thin_upload/request.rb, line 91</span>
166
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">progress</span>
167
+ <span class="ruby-identifier">@@progress</span><span class="ruby-operator">||=</span>{}
168
+ <span class="ruby-keyword">end</span></pre>
169
+ </div><!-- progress-source -->
170
+
171
+ </div>
172
+
173
+
174
+
175
+
176
+ </div><!-- progress-method -->
177
+
178
+
179
+ </div><!-- public-class-method-details -->
180
+
181
+ </div><!-- 5Buntitled-5D -->
182
+
183
+
184
+ </div><!-- documentation -->
185
+
186
+ <div id="validator-badges">
187
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
188
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
189
+ Rdoc Generator</a> 2</small>.</p>
190
+ </div>
191
+
192
+ </body>
193
+ </html>
194
+
data/html/created.rid ADDED
@@ -0,0 +1,4 @@
1
+ Wed, 19 Oct 2011 12:03:24 +0300
2
+ README.rdoc Tue, 11 Oct 2011 13:05:54 +0300
3
+ lib/thin_upload/request.rb Wed, 19 Oct 2011 12:01:07 +0300
4
+ lib/thin_upload.rb Tue, 11 Oct 2011 11:18:50 +0300
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/html/index.html ADDED
@@ -0,0 +1,124 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
+
9
+ <title>RDoc Documentation</title>
10
+
11
+ <link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
16
+ <script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
17
+
18
+ </head>
19
+ <body class="indexpage">
20
+
21
+
22
+ <h1>RDoc Documentation</h1>
23
+
24
+
25
+ <div id="main">
26
+
27
+ <p><a href="http://travis-ci.org/dombesz/thin_upload"><img
28
+ src="http://travis-ci.org/dombesz/thin_upload.png" /></a></p>
29
+
30
+
31
+ <pre>gem install thin_upload --pre</pre>
32
+
33
+ <h1>Usage</h1>
34
+
35
+ <p>In your Gemfile</p>
36
+
37
+ <pre>gem &quot;thin&quot;
38
+ gem &quot;thin_upload&quot;, &quot;~&gt; 0.0.1.pre&quot;</pre>
39
+
40
+ <p>Note: Works only with thin server!</p>
41
+
42
+ <p>Upload progress is available for any file upload request.</p>
43
+
44
+ <p>Example:</p>
45
+
46
+ <pre>&lt;iframe id=&quot;upload_frame&quot; name=&quot;upload_frame&quot; style=&quot;width: 0px; height: 0px;&quot;&gt;&lt;/iframe&gt;
47
+
48
+ &lt;%= form_tag(photos_path, {:multipart =&gt; true ,:target=&gt;&quot;upload_frame&quot;}) do %&gt;
49
+ &lt;%= text_field_tag :uuid, UUID.new.generate %&gt;
50
+ &lt;%= file_field_tag :file %&gt;
51
+ &lt;p&gt;&lt;%= submit_tag &quot;Continue &amp;rarr;&quot;.html_safe, :id=&gt;'submit_form' %&gt;&lt;/p&gt;
52
+ &lt;% end %&gt;</pre>
53
+
54
+ <p>To have progress tracking, we need to send a +uuid param in the submited
55
+ form, and the +uuid param MUST be before the file field.</p>
56
+
57
+ <p>If you want to ask for progress use get request.</p>
58
+
59
+ <pre>$.getJSON('/progress?uuid='+$(&quot;#uuid&quot;).attr('value'),function(response){
60
+ //process response
61
+ }</pre>
62
+
63
+ <p>While your upload is processing you can request the progress from rack.</p>
64
+
65
+ <pre>@progress = request.env['rack.progress'][params[:uuid]]
66
+ @progress is an integer in range 0..100 or nil if doesn't exists</pre>
67
+
68
+ <p>Note: This is just an experiment, so I don’t know if it’s production ready.
69
+ Any suggestions are welcome.</p>
70
+
71
+ </div>
72
+
73
+
74
+
75
+
76
+ <h2>Files</h2>
77
+ <ul>
78
+
79
+ <li class="file"><a href="README_rdoc.html">README.rdoc</a></li>
80
+
81
+ </ul>
82
+
83
+
84
+ <h2 id="classes">Classes/Modules</h2>
85
+ <ul>
86
+
87
+ <li class="module"><a href="Thin.html">Thin</a></li>
88
+
89
+ <li class="class"><a href="Thin/Request.html">Thin::Request</a></li>
90
+
91
+ <li class="class"><a href="Thin/Server.html">Thin::Server</a></li>
92
+
93
+ </ul>
94
+
95
+ <h2 id="methods">Methods</h2>
96
+ <ul>
97
+
98
+ <li><a href="Thin/Server.html#method-c-progress">::progress &mdash; Thin::Server</a></li>
99
+
100
+ <li><a href="Thin/Request.html#method-i-cleanup_progress_hash">#cleanup_progress_hash &mdash; Thin::Request</a></li>
101
+
102
+ <li><a href="Thin/Request.html#method-i-new_parse">#new_parse &mdash; Thin::Request</a></li>
103
+
104
+ <li><a href="Thin/Request.html#method-i-parse">#parse &mdash; Thin::Request</a></li>
105
+
106
+ <li><a href="Thin/Request.html#method-i-progress">#progress &mdash; Thin::Request</a></li>
107
+
108
+ <li><a href="Thin/Request.html#method-i-scan_content">#scan_content &mdash; Thin::Request</a></li>
109
+
110
+ <li><a href="Thin/Request.html#method-i-store_progress">#store_progress &mdash; Thin::Request</a></li>
111
+
112
+ <li><a href="Thin/Request.html#method-i-thin_parse">#thin_parse &mdash; Thin::Request</a></li>
113
+
114
+ <li><a href="Thin/Request.html#method-i-uuid_found_or_limit_reached-3F">#uuid_found_or_limit_reached? &mdash; Thin::Request</a></li>
115
+
116
+ </ul>
117
+
118
+ <div id="validator-badges">
119
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
120
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
121
+ Rdoc Generator</a> 2</small>.</p>
122
+ </div>
123
+ </body>
124
+ </html>
@@ -0,0 +1,116 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ if (!("console" in window) || !("firebug" in console)) {
12
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
+
15
+ window.console = {};
16
+ for (var i = 0; i < names.length; ++i)
17
+ window.console[names[i]] = function() {};
18
+ };
19
+
20
+
21
+ /**
22
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
23
+ */
24
+ $.fn.unwrap = function( expr ) {
25
+ return this.each( function() {
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
+ });
28
+ };
29
+
30
+
31
+ function showSource( e ) {
32
+ var target = e.target;
33
+ var codeSections = $(target).
34
+ parents('.method-detail').
35
+ find('.method-source-code');
36
+
37
+ $(target).
38
+ parents('.method-detail').
39
+ find('.method-source-code').
40
+ slideToggle();
41
+ };
42
+
43
+ function hookSourceViews() {
44
+ $('.method-description,.method-heading').click( showSource );
45
+ };
46
+
47
+ function toggleDebuggingSection() {
48
+ $('.debugging-section').slideToggle();
49
+ };
50
+
51
+ function hookDebuggingToggle() {
52
+ $('#debugging-toggle img').click( toggleDebuggingSection );
53
+ };
54
+
55
+ function hookQuickSearch() {
56
+ $('.quicksearch-field').each( function() {
57
+ var searchElems = $(this).parents('.section').find( 'li' );
58
+ var toggle = $(this).parents('.section').find('h3 .search-toggle');
59
+ // console.debug( "Toggle is: %o", toggle );
60
+ var qsbox = $(this).parents('form').get( 0 );
61
+
62
+ $(this).quicksearch( this, searchElems, {
63
+ noSearchResultsIndicator: 'no-class-search-results',
64
+ focusOnLoad: false
65
+ });
66
+ $(toggle).click( function() {
67
+ // console.debug( "Toggling qsbox: %o", qsbox );
68
+ $(qsbox).toggle();
69
+ });
70
+ });
71
+ };
72
+
73
+ function highlightTarget( anchor ) {
74
+ console.debug( "Highlighting target '%s'.", anchor );
75
+
76
+ $("a[name=" + anchor + "]").each( function() {
77
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
78
+ console.debug( "Wrapping the target-section" );
79
+ $('div.method-detail').unwrap( 'div.target-section' );
80
+ $(this).parent().wrap( '<div class="target-section"></div>' );
81
+ } else {
82
+ console.debug( "Already wrapped." );
83
+ }
84
+ });
85
+ };
86
+
87
+ function highlightLocationTarget() {
88
+ console.debug( "Location hash: %s", window.location.hash );
89
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
90
+
91
+ var anchor = window.location.hash.substring(1);
92
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
93
+
94
+ highlightTarget( anchor );
95
+ };
96
+
97
+ function highlightClickTarget( event ) {
98
+ console.debug( "Highlighting click target for event %o", event.target );
99
+ try {
100
+ var anchor = $(event.target).attr( 'href' ).substring(1);
101
+ console.debug( "Found target anchor: %s", anchor );
102
+ highlightTarget( anchor );
103
+ } catch ( err ) {
104
+ console.error( "Exception while highlighting: %o", err );
105
+ };
106
+ };
107
+
108
+
109
+ $(document).ready( function() {
110
+ hookSourceViews();
111
+ hookDebuggingToggle();
112
+ hookQuickSearch();
113
+ highlightLocationTarget();
114
+
115
+ $('ul.link-list a').bind( "click", highlightClickTarget );
116
+ });