smock 0.1.30 → 0.1.31

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 (4) hide show
  1. data/Gemfile.lock +1 -1
  2. data/Rakefile +2 -1
  3. data/list.html +219 -0
  4. metadata +4 -3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smock (0.1.30)
4
+ smock (0.1.31)
5
5
  sass (= 3.2.19)
6
6
  thor (= 0.19.1)
7
7
 
data/Rakefile CHANGED
@@ -31,8 +31,9 @@ task :build_version => :clean do
31
31
  FileUtils.mkdir_p latest
32
32
 
33
33
  sh "cp -R #{target}/* #{latest}/"
34
- sh "cp ./lib/config.ru #{latest}/config.ru"
34
+ sh "cp ./lib/config.ru #{latest}/"
35
35
  sh "cp ./index.html #{latest}/"
36
+ sh "cp ./list.html versions/"
36
37
  end
37
38
 
38
39
  desc "run a sass watcher"
data/list.html ADDED
@@ -0,0 +1,219 @@
1
+ <html>
2
+ <head>
3
+ <!--
4
+
5
+ Amazon S3 Bucket listing.
6
+
7
+
8
+ Copyright (C) 2008 Francesco Pasqualini
9
+
10
+ This program is free software: you can redistribute it and/or modify
11
+ it under the terms of the GNU General Public License as published by
12
+ the Free Software Foundation, either version 3 of the License, or
13
+ (at your option) any later version.
14
+
15
+ This program is distributed in the hope that it will be useful,
16
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ GNU General Public License for more details.
19
+
20
+ You should have received a copy of the GNU General Public License
21
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
22
+
23
+ -->
24
+
25
+ <title>Bucket listing</title>
26
+ <SCRIPT>
27
+
28
+ function getSpace(s,l){
29
+ var ret = "";
30
+ while(s.length+ret.length<l){
31
+ ret = ret + " ";
32
+ }
33
+ return ret;
34
+ }
35
+
36
+
37
+ location.querystring = (function() {
38
+ // The return is a collection of key/value pairs
39
+ var result = {};
40
+
41
+ // Gets the query string with a preceeding '?'
42
+ var querystring = location.search;
43
+
44
+ // document.location.search is empty if a query string is absent
45
+ if (!querystring)
46
+ return result;
47
+
48
+ // substring(1) to remove the '?'
49
+ var pairs = querystring.substring(1).split("&");
50
+ var splitPair;
51
+
52
+ // Load the key/values of the return collection
53
+ for (var i = 0; i < pairs.length; i++) {
54
+ splitPair = pairs[i].split("=");
55
+ result[splitPair[0]] = splitPair[1];
56
+ }
57
+
58
+ return result;
59
+ })();
60
+
61
+ function createRequestObject(){
62
+ var request_o; //declare the variable to hold the object.
63
+ var browser = navigator.appName; //find the browser name
64
+ if(browser == "Microsoft Internet Explorer"){
65
+ /* Create the object using MSIE's method */
66
+ request_o = new ActiveXObject("Microsoft.XMLHTTP");
67
+ }else{
68
+ /* Create the object using other browser's method */
69
+ request_o = new XMLHttpRequest();
70
+ }
71
+ return request_o; //return the object
72
+ }
73
+
74
+ /* You can get more specific with version information by using
75
+ parseInt(navigator.appVersion)
76
+ Which will extract an integer value containing the version
77
+ of the browser being used.
78
+ */
79
+ /* The variable http will hold our new XMLHttpRequest object. */
80
+ var http = createRequestObject();
81
+ function getList(){
82
+ http.open('get', location.protocol+'//'+location.hostname);
83
+ http.onreadystatechange = handleList;
84
+ http.send(null);
85
+ }
86
+
87
+ function handleList(){
88
+ /* Make sure that the transaction has finished. The XMLHttpRequest object
89
+ has a property called readyState with several states:
90
+ 0: Uninitialized
91
+ 1: Loading
92
+ 2: Loaded
93
+ 3: Interactive
94
+ 4: Finished */
95
+ if(http.readyState == 4){ //Finished loading the response
96
+ /* We have got the response from the server-side script,
97
+ let's see just what it was. using the responseText property of
98
+ the XMLHttpRequest object. */
99
+ var response = http.responseXML;
100
+
101
+ filex = response.getElementsByTagName('Contents');
102
+
103
+
104
+ res = '';
105
+ fileList = new Array();
106
+ for(i=0; i<filex.length; i++){
107
+ fileData =new Array();
108
+ fileList[i] = fileData;
109
+ size = filex[i].getElementsByTagName('Size')[0].firstChild.data;
110
+ name = filex[i].getElementsByTagName('Key')[0].firstChild.data;
111
+ lastmod = filex[i].getElementsByTagName('LastModified')[0].firstChild.data;
112
+ link = "<A HREF=\""+name+"\">"+name+"</A>";
113
+ fileData[0] = name;
114
+ fileData[1] = size;
115
+ fileData[2] = lastmod;
116
+ fileData[3] = link;
117
+ }
118
+ fileList.sort(getSort());
119
+ for(i=0; i<fileList.length; i++){ //length is the same as count($array)
120
+ fileData = fileList[i];
121
+ name = fileData[0];
122
+ size = fileData[1];
123
+ lastmod = fileData[2];
124
+ link = fileData[3];
125
+ res = res + getSpace(size,15) +size + " B ";
126
+ res = res + " "+ getSpace(lastmod,20)+ lastmod + " ";
127
+ res = res + " "+ link+ getSpace(name,50) + " ";
128
+ res = res + "<BR>";
129
+ }
130
+
131
+
132
+ document.getElementById('bucket_list').innerHTML = "<PRE>"+getLink()+"<BR>"+res+"</PRE>" ;
133
+ }
134
+ }
135
+
136
+
137
+ function getQueryVariable(variable) {
138
+ var query = window.location.search.substring(1);
139
+ var vars = query.split("&");
140
+ for (var i=0;i<vars.length;i++) {
141
+ var pair = vars[i].split("=");
142
+ if (pair[0] == variable) {
143
+ return pair[1];
144
+ }
145
+ }
146
+ return null;
147
+ }
148
+
149
+
150
+ function sortSize(a,b) {
151
+ if(parseInt(a[1]) > parseInt(b[1])) return 1;
152
+ if(parseInt(a[1]) < parseInt(b[1])) return -1;
153
+ return 0;
154
+ }
155
+ function sortSizeDesc(a,b) { return (-sortSize(a,b)); }
156
+ function sortLastmod(a,b) {
157
+ if(a[2] > b[2]) return 1;
158
+ if(a[2] < b[2]) return -1;
159
+ return 0;
160
+ }
161
+ function sortLastmodDesc(a,b) { return (-sortLastmod(a,b)); }
162
+
163
+ function sortName(a,b) {
164
+ if(a[0] > b[0]) return 1;
165
+ if(a[0] < b[0]) return -1;
166
+ return 0;
167
+ }
168
+ function sortNameDesc(a,b) { return -sortName(a,b); }
169
+ //document.write('http://'+location.hostname);
170
+
171
+ function getSort(){
172
+ var s = getQueryVariable("sort");
173
+ var d = getQueryVariable("sortdir");
174
+ if(s=='size'){ return d == 'desc' ? sortSizeDesc : sortSize};
175
+ if(s=='name'){ return d == 'desc' ? sortNameDesc : sortName};
176
+ if(s=='lastmod'){ return d == 'desc' ? sortLastmodDesc : sortLastmod};
177
+ return sortName;
178
+ }
179
+
180
+
181
+ function getLink(){
182
+ return " "+getLinkSize() + " " + getLinkLastmod() + " " + getLinkName() + " " ;
183
+ }
184
+
185
+ function getNextSortDir(sortCol){
186
+ if (sortCol == getQueryVariable("sort"))
187
+ return getQueryVariable("sortdir") == 'desc' ? 'asc' : 'desc';
188
+ return 'asc'
189
+ }
190
+
191
+ function getLinkSize(){
192
+ return "<A HREF=\"?sort=size&sortdir=" +getNextSortDir('size') +"\">Size</A>";
193
+ }
194
+ function getLinkName(){
195
+ return "<A HREF=\"?sort=name&sortdir=" +getNextSortDir('name') +"\">Name</A>";
196
+ }
197
+ function getLinkLastmod(){
198
+ return "<A HREF=\"?sort=lastmod&sortdir=" +getNextSortDir('lastmod') +"\">Lastmodified</A>";
199
+ }
200
+
201
+
202
+ </SCRIPT>
203
+ </head>
204
+ <body onLoad="getList();">
205
+ <div id="bucket_list">
206
+
207
+ </div>
208
+ <BR>
209
+ <SMALL>
210
+ <PRE>
211
+ Smock Versions
212
+ </PRE>
213
+ </SMALL>
214
+
215
+
216
+
217
+ </body>
218
+ </html>
219
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.30
4
+ version: 0.1.31
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -248,6 +248,7 @@ files:
248
248
  - lib/smock/generator.rb
249
249
  - lib/smock/version.rb
250
250
  - lib/tasks/install.rake
251
+ - list.html
251
252
  - smock.gemspec
252
253
  - v2/_colors.css.sass
253
254
  - v2/_forms.css.sass
@@ -289,7 +290,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
289
290
  version: '0'
290
291
  segments:
291
292
  - 0
292
- hash: 1733307392278615953
293
+ hash: -1637544406402163131
293
294
  required_rubygems_version: !ruby/object:Gem::Requirement
294
295
  none: false
295
296
  requirements:
@@ -298,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
299
  version: '0'
299
300
  segments:
300
301
  - 0
301
- hash: 1733307392278615953
302
+ hash: -1637544406402163131
302
303
  requirements: []
303
304
  rubyforge_project: smock
304
305
  rubygems_version: 1.8.21