s33r 0.3.1 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/examples/cli/acl_x.rb +41 -0
  2. data/examples/cli/logging_x.rb +20 -0
  3. data/{bin → examples/cli}/s3cli.rb +13 -20
  4. data/examples/fores33r/README +183 -0
  5. data/examples/fores33r/Rakefile +10 -0
  6. data/examples/fores33r/app/controllers/application.rb +4 -0
  7. data/examples/fores33r/app/controllers/browser_controller.rb +68 -0
  8. data/examples/fores33r/app/helpers/application_helper.rb +8 -0
  9. data/examples/fores33r/app/views/browser/index.rhtml +14 -0
  10. data/examples/fores33r/app/views/browser/show_bucket.rhtml +14 -0
  11. data/examples/fores33r/app/views/layouts/application.rhtml +29 -0
  12. data/examples/fores33r/config/boot.rb +44 -0
  13. data/examples/fores33r/config/database.yml +35 -0
  14. data/examples/fores33r/config/environment.rb +64 -0
  15. data/examples/fores33r/config/environments/development.rb +21 -0
  16. data/examples/fores33r/config/environments/production.rb +18 -0
  17. data/examples/fores33r/config/environments/test.rb +19 -0
  18. data/examples/fores33r/config/routes.rb +23 -0
  19. data/examples/fores33r/doc/README_FOR_APP +2 -0
  20. data/examples/fores33r/log/development.log +5507 -0
  21. data/examples/fores33r/log/production.log +0 -0
  22. data/examples/fores33r/log/server.log +0 -0
  23. data/examples/fores33r/log/test.log +0 -0
  24. data/examples/fores33r/public/404.html +8 -0
  25. data/examples/fores33r/public/500.html +8 -0
  26. data/examples/fores33r/public/dispatch.cgi +10 -0
  27. data/examples/fores33r/public/dispatch.fcgi +24 -0
  28. data/examples/fores33r/public/dispatch.rb +10 -0
  29. data/examples/fores33r/public/favicon.ico +0 -0
  30. data/examples/fores33r/public/images/rails.png +0 -0
  31. data/examples/fores33r/public/javascripts/application.js +2 -0
  32. data/examples/fores33r/public/javascripts/controls.js +815 -0
  33. data/examples/fores33r/public/javascripts/dragdrop.js +913 -0
  34. data/examples/fores33r/public/javascripts/effects.js +958 -0
  35. data/examples/fores33r/public/javascripts/prototype.js +2006 -0
  36. data/examples/fores33r/public/robots.txt +1 -0
  37. data/examples/fores33r/public/stylesheets/core.css +37 -0
  38. data/examples/fores33r/script/about +3 -0
  39. data/examples/fores33r/script/breakpointer +3 -0
  40. data/examples/fores33r/script/console +3 -0
  41. data/examples/fores33r/script/destroy +3 -0
  42. data/examples/fores33r/script/generate +3 -0
  43. data/examples/fores33r/script/performance/benchmarker +3 -0
  44. data/examples/fores33r/script/performance/profiler +3 -0
  45. data/examples/fores33r/script/plugin +3 -0
  46. data/examples/fores33r/script/process/reaper +3 -0
  47. data/examples/fores33r/script/process/spawner +3 -0
  48. data/examples/fores33r/script/runner +3 -0
  49. data/examples/fores33r/script/server +3 -0
  50. data/examples/fores33r/test/test_helper.rb +28 -0
  51. data/examples/fores33r/tmp/sessions/ruby_sess.39d37e054d21d545 +0 -0
  52. data/examples/fores33r/tmp/sessions/ruby_sess.acf71fc73aa74983 +0 -0
  53. data/examples/fores33r/tmp/sessions/ruby_sess.c1697b7d6670f3cd +0 -0
  54. data/examples/s3.yaml +11 -0
  55. data/html/classes/Net/HTTPGenericRequest.html +32 -32
  56. data/html/classes/Net/HTTPResponse.html +20 -19
  57. data/html/classes/S33r.html +422 -190
  58. data/html/classes/S33r/BucketListing.html +107 -70
  59. data/html/classes/S33r/Client.html +888 -414
  60. data/html/classes/S33r/LoggingResource.html +222 -0
  61. data/html/classes/S33r/NamedBucket.html +149 -150
  62. data/html/classes/S33r/OrderlyXmlMarkup.html +165 -0
  63. data/html/classes/S33r/S33rException.html +3 -0
  64. data/html/classes/S33r/S33rException/BucketNotLogTargetable.html +119 -0
  65. data/html/classes/S33r/S33rException/InvalidPermission.html +111 -0
  66. data/html/classes/S33r/S33rException/InvalidS3GroupType.html +111 -0
  67. data/html/classes/S33r/S3ACL.html +125 -0
  68. data/html/classes/S33r/S3ACL/ACLDoc.html +521 -0
  69. data/html/classes/S33r/{S3User.html → S3ACL/AmazonCustomer.html} +27 -30
  70. data/html/classes/S33r/S3ACL/CanonicalUser.html +212 -0
  71. data/html/classes/S33r/S3ACL/Grant.html +403 -0
  72. data/html/classes/S33r/S3ACL/Grantee.html +239 -0
  73. data/html/classes/S33r/S3ACL/Group.html +178 -0
  74. data/html/classes/S33r/S3Object.html +53 -50
  75. data/html/classes/S33r/Sync.html +6 -6
  76. data/html/classes/XML.html +4 -2
  77. data/html/created.rid +1 -1
  78. data/html/files/README_txt.html +82 -28
  79. data/html/files/lib/s33r/bucket_listing_rb.html +1 -8
  80. data/html/files/lib/s33r/builder_rb.html +108 -0
  81. data/html/files/lib/s33r/client_rb.html +2 -1
  82. data/html/files/lib/s33r/core_rb.html +2 -1
  83. data/html/files/lib/s33r/libxml_extensions_rb.html +1 -1
  84. data/html/files/lib/s33r/logging_rb.html +109 -0
  85. data/html/files/lib/s33r/named_bucket_rb.html +1 -1
  86. data/html/files/lib/s33r/s33r_exception_rb.html +1 -1
  87. data/html/files/lib/s33r/s33r_http_rb.html +1 -1
  88. data/html/files/lib/s33r/s3_acl_rb.html +109 -0
  89. data/html/fr_class_index.html +12 -1
  90. data/html/fr_file_index.html +3 -0
  91. data/html/fr_method_index.html +101 -57
  92. data/lib/s33r/bucket_listing.rb +21 -22
  93. data/lib/s33r/builder.rb +20 -0
  94. data/lib/s33r/client.rb +240 -42
  95. data/lib/s33r/core.rb +106 -36
  96. data/lib/s33r/libxml_extensions.rb +2 -2
  97. data/lib/s33r/logging.rb +43 -0
  98. data/lib/s33r/named_bucket.rb +16 -17
  99. data/lib/s33r/s33r_exception.rb +11 -0
  100. data/lib/s33r/s33r_http.rb +2 -1
  101. data/lib/s33r/s3_acl.rb +337 -0
  102. data/test/cases/spec_acl.rb +146 -0
  103. data/test/cases/spec_all_buckets.rb +28 -0
  104. data/test/cases/spec_bucket_listing.rb +2 -2
  105. data/test/cases/spec_client.rb +45 -18
  106. data/test/cases/spec_core.rb +0 -9
  107. data/test/cases/spec_namedbucket.rb +3 -3
  108. data/test/files/acl.xml +47 -0
  109. data/test/files/acl_grant1.xml +7 -0
  110. data/test/files/acl_grant2.xml +6 -0
  111. data/test/files/acl_grant3.xml +6 -0
  112. data/test/files/acl_grant4.xml +6 -0
  113. data/test/files/all_buckets.xml +21 -0
  114. data/test/files/bucket_listing.xml +138 -1
  115. data/test/files/client_config.yml +0 -1
  116. data/test/files/logging_acl.xml +34 -0
  117. data/test/files/namedbucket_config.yml +1 -5
  118. data/test/files/namedbucket_config2.yml +1 -5
  119. data/test/test_setup.rb +1 -0
  120. metadata +132 -7
@@ -0,0 +1,41 @@
1
+ # Example of how to manipulate ACLs (see s3_acl.rb or rdoc for all ACL classes)
2
+
3
+ require File.join(File.dirname(__FILE__), '../../lib/s33r')
4
+ include S33r
5
+ include S33r::S3ACL
6
+
7
+ # initialise the client from a config file
8
+ # (see s3.yaml in examples directory)
9
+ c = Client.init('/home/ell/.s33r')
10
+
11
+ # bucket whose ACL we're going to manipulate
12
+ bucket = 'es-test'
13
+
14
+ # get the ACL for the bucket
15
+ acl = c.get_acl(bucket)
16
+
17
+ # add a new grant to the ACL (allow all users read access)
18
+ acl.add_grant(Grant.for_group(:all_users, :read))
19
+
20
+ # remove a grant from the ACL;
21
+ # note that s33r is able to compare existing grants in
22
+ # an ACL with newly-minted ones
23
+ acl.remove_grant(Grant.for_group(:authenticated_users, :read))
24
+
25
+ # put the ACL back
26
+ c.set_acl(acl, bucket)
27
+
28
+ # get the ACL for a resource inside the bucket
29
+ # and make it readable by a specific Amazon customer
30
+ resource = 'test'
31
+
32
+ # NB this method raises an error if the resource doesn't exist
33
+ acl = c.get_acl(bucket, resource)
34
+
35
+ # the email address you set here needs to be a valid Amazon customer
36
+ acl.add_grant(Grant.for_amazon_customer('elliot@example.com', :read))
37
+ p c.set_acl(acl, bucket, resource)
38
+
39
+ # short-hand for making a resource public
40
+ # c.make_public(bucket)
41
+ # c.make_public(bucket, resource)
@@ -0,0 +1,20 @@
1
+ # Example of how to set up logging on a bucket or resource.
2
+
3
+ require File.join(File.dirname(__FILE__), '../../lib/s33r')
4
+ include S33r
5
+
6
+ # initialise the client from a config file
7
+ # (see s3.yaml in examples directory)
8
+ c = Client.init('/home/ell/.s33r')
9
+
10
+ # Make a logging destination
11
+ # This sets the required ACLs on a bucket to make it writeable by the
12
+ # logging processes.
13
+ c.enable_log_target('my-logging-bucket')
14
+
15
+ # Set up logging for a bucket.
16
+ c.enable_logging('es-test', 'my-logging-bucket')
17
+
18
+ # Set up logging for a bucket with a custom log prefix.
19
+ # (Default prefix is the name of the bucket which has logging enabled + "'")
20
+ c.enable_logging('es-test2', 'my-logging-bucket', :prefix => 'special-logs-')
@@ -1,9 +1,11 @@
1
1
  # SIMPLE COMMAND LINE S3 CLIENT
2
2
  # You need an Amazon S3 account to use this: get one at http://aws.amazon.com/
3
3
  #
4
- # Create a config. file called based on the example in test/files/namedbucket_config.yml;
5
- # then change the config_file setting below to set the path to your config. file.
6
- # You will be prompted to create a bucket if your setting for bucket in the config.
4
+ # Create a config. file called based on the example in examples/s3.yaml -
5
+ # you need to set your keys and the name of the default_bucket to use for storing files;
6
+ # then change the config_file line below to set the path to your config. file.
7
+ #
8
+ # NB you will be prompted to create a bucket if your setting for bucket in the config.
7
9
  # file is blank.
8
10
  #
9
11
  # Note that this script doesn't give you any means of deleting anything; you will
@@ -15,17 +17,19 @@
15
17
  # based on filename supplied (including path)
16
18
  # to_email: email address to send to (optional)
17
19
 
20
+ # set to the path to your s3.yaml file
21
+ config_file = '/home/ell/.s33r'
22
+
18
23
  require 'yaml'
19
24
  require 'net/smtp'
20
25
  require 'time'
21
26
  require 'parsedate'
22
27
 
23
- require File.join(File.dirname(__FILE__), '../lib/s33r')
28
+ # load the S33r libraries
29
+ require File.join(File.dirname(__FILE__), '..', '..', 'lib', 's33r')
24
30
 
25
31
  filename = ARGV[0]
26
32
  to_email = ARGV[1]
27
- # set to the path to your config. file
28
- config_file = '/home/ell/.s33r'
29
33
 
30
34
  # load config. file
31
35
  access_key, secret_key, options, custom = S33r::Client.load_config(config_file)
@@ -36,23 +40,12 @@ bucket = options[:default_bucket]
36
40
  puts "Using bucket: #{bucket}"
37
41
 
38
42
  # email addresses
39
- to_email = custom[:to_email]
40
- from_email = custom[:from_email]
43
+ to_email = options[:to_email]
44
+ from_email = options[:from_email]
41
45
 
42
46
  # expires can be a date/time string or 'forever';
43
47
  # if not set, defaults to 15 minutes
44
- expires = options[:default_expires]
45
- base_expires = Time.now.to_i
46
- if 'forever' == expires
47
- # 20 years (same as forever in computer terms)
48
- expires = base_expires + (60 * 60 * 24 * 365.25 * 20).to_i
49
- elsif expires.is_a?(String)
50
- datetime_parts = ParseDate.parsedate(expires)
51
- expires = Time.gm(*datetime_parts).to_i
52
- elsif !expires
53
- # default to 15 minutes from now if not set
54
- expires = base_expires + (15*60)
55
- end
48
+ expires = S33r.parse_expiry(options[:default_expires])
56
49
 
57
50
  # check for bucket
58
51
  if !bucket
@@ -0,0 +1,183 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application and persistence framework that includes everything
4
+ needed to create database-backed web-applications according to the
5
+ Model-View-Control pattern of separation. This pattern splits the view (also
6
+ called the presentation) into "dumb" templates that are primarily responsible
7
+ for inserting pre-built data in between HTML tags. The model contains the
8
+ "smart" domain objects (such as Account, Product, Person, Post) that holds all
9
+ the business logic and knows how to persist themselves to a database. The
10
+ controller handles the incoming requests (such as Save New Account, Update
11
+ Product, Show Post) by manipulating the model and directing data to the view.
12
+
13
+ In Rails, the model is handled by what's called an object-relational mapping
14
+ layer entitled Active Record. This layer allows you to present the data from
15
+ database rows as objects and embellish these data objects with business logic
16
+ methods. You can read more about Active Record in
17
+ link:files/vendor/rails/activerecord/README.html.
18
+
19
+ The controller and view are handled by the Action Pack, which handles both
20
+ layers by its two parts: Action View and Action Controller. These two layers
21
+ are bundled in a single package due to their heavy interdependence. This is
22
+ unlike the relationship between the Active Record and Action Pack that is much
23
+ more separate. Each of these packages can be used independently outside of
24
+ Rails. You can read more about Action Pack in
25
+ link:files/vendor/rails/actionpack/README.html.
26
+
27
+
28
+ == Getting started
29
+
30
+ 1. Start the web server: <tt>ruby script/server</tt> (run with --help for options)
31
+ 2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
32
+ 3. Follow the guidelines to start developing your application
33
+
34
+
35
+ == Web servers
36
+
37
+ Rails uses the built-in web server in Ruby called WEBrick by default, so you don't
38
+ have to install or configure anything to play around.
39
+
40
+ If you have lighttpd installed, though, it'll be used instead when running script/server.
41
+ It's considerably faster than WEBrick and suited for production use, but requires additional
42
+ installation and currently only works well on OS X/Unix (Windows users are encouraged
43
+ to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from
44
+ http://www.lighttpd.net.
45
+
46
+ If you want something that's halfway between WEBrick and lighttpd, we heartily recommend
47
+ Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that
48
+ also works very well with Windows. See more at http://mongrel.rubyforge.org/.
49
+
50
+ But of course its also possible to run Rails with the premiere open source web server Apache.
51
+ To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want
52
+ to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid.
53
+
54
+ See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI.
55
+
56
+ == Example for Apache conf
57
+
58
+ <VirtualHost *:80>
59
+ ServerName rails
60
+ DocumentRoot /path/application/public/
61
+ ErrorLog /path/application/log/server.log
62
+
63
+ <Directory /path/application/public/>
64
+ Options ExecCGI FollowSymLinks
65
+ AllowOverride all
66
+ Allow from all
67
+ Order allow,deny
68
+ </Directory>
69
+ </VirtualHost>
70
+
71
+ NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
72
+ should be on and ".cgi" should respond. All requests from 127.0.0.1 go
73
+ through CGI, so no Apache restart is necessary for changes. All other requests
74
+ go through FCGI (or mod_ruby), which requires a restart to show changes.
75
+
76
+
77
+ == Debugging Rails
78
+
79
+ Have "tail -f" commands running on both the server.log, production.log, and
80
+ test.log files. Rails will automatically display debugging and runtime
81
+ information to these files. Debugging info will also be shown in the browser
82
+ on requests from 127.0.0.1.
83
+
84
+
85
+ == Breakpoints
86
+
87
+ Breakpoint support is available through the script/breakpointer client. This
88
+ means that you can break out of execution at any point in the code, investigate
89
+ and change the model, AND then resume execution! Example:
90
+
91
+ class WeblogController < ActionController::Base
92
+ def index
93
+ @posts = Post.find_all
94
+ breakpoint "Breaking out from the list"
95
+ end
96
+ end
97
+
98
+ So the controller will accept the action, run the first line, then present you
99
+ with a IRB prompt in the breakpointer window. Here you can do things like:
100
+
101
+ Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
102
+
103
+ >> @posts.inspect
104
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
105
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
106
+ >> @posts.first.title = "hello from a breakpoint"
107
+ => "hello from a breakpoint"
108
+
109
+ ...and even better is that you can examine how your runtime objects actually work:
110
+
111
+ >> f = @posts.first
112
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
113
+ >> f.
114
+ Display all 152 possibilities? (y or n)
115
+
116
+ Finally, when you're ready to resume execution, you press CTRL-D
117
+
118
+
119
+ == Console
120
+
121
+ You can interact with the domain model by starting the console through script/console.
122
+ Here you'll have all parts of the application configured, just like it is when the
123
+ application is running. You can inspect domain models, change values, and save to the
124
+ database. Starting the script without arguments will launch it in the development environment.
125
+ Passing an argument will specify a different environment, like <tt>script/console production</tt>.
126
+
127
+ To reload your controllers and models after launching the console run <tt>reload!</tt>
128
+
129
+
130
+
131
+ == Description of contents
132
+
133
+ app
134
+ Holds all the code that's specific to this particular application.
135
+
136
+ app/controllers
137
+ Holds controllers that should be named like weblog_controller.rb for
138
+ automated URL mapping. All controllers should descend from
139
+ ActionController::Base.
140
+
141
+ app/models
142
+ Holds models that should be named like post.rb.
143
+ Most models will descend from ActiveRecord::Base.
144
+
145
+ app/views
146
+ Holds the template files for the view that should be named like
147
+ weblog/index.rhtml for the WeblogController#index action. All views use eRuby
148
+ syntax. This directory can also be used to keep stylesheets, images, and so on
149
+ that can be symlinked to public.
150
+
151
+ app/helpers
152
+ Holds view helpers that should be named like weblog_helper.rb.
153
+
154
+ app/apis
155
+ Holds API classes for web services.
156
+
157
+ config
158
+ Configuration files for the Rails environment, the routing map, the database, and other dependencies.
159
+
160
+ components
161
+ Self-contained mini-applications that can bundle together controllers, models, and views.
162
+
163
+ db
164
+ Contains the database schema in schema.rb. db/migrate contains all
165
+ the sequence of Migrations for your schema.
166
+
167
+ lib
168
+ Application specific libraries. Basically, any kind of custom code that doesn't
169
+ belong under controllers, models, or helpers. This directory is in the load path.
170
+
171
+ public
172
+ The directory available for the web server. Contains subdirectories for images, stylesheets,
173
+ and javascripts. Also contains the dispatchers and the default HTML files.
174
+
175
+ script
176
+ Helper scripts for automation and generation.
177
+
178
+ test
179
+ Unit and functional tests along with fixtures.
180
+
181
+ vendor
182
+ External libraries that the application depends on. Also includes the plugins subdirectory.
183
+ This directory is in the load path.
@@ -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,4 @@
1
+ # Filters added to this controller will be run for all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+ class ApplicationController < ActionController::Base
4
+ end
@@ -0,0 +1,68 @@
1
+ class BrowserController < ApplicationController
2
+ before_filter :get_s3_client
3
+
4
+ def get_s3_client
5
+ @s3 = S3_CLIENT
6
+ @default_prefix = S3_OPTIONS[:default_prefix]
7
+ end
8
+
9
+ def index
10
+ @buckets = @s3.list_buckets
11
+ end
12
+
13
+ def show_bucket
14
+ @bucket_name = params[:bucket_name]
15
+ _, listing = @s3.list_bucket(@bucket_name)
16
+ @keys = listing.pretty
17
+ end
18
+
19
+ # NB this doesn't check whether the thing being deleted exists;
20
+ # and as S3 treats a non-existent resource the same way as a
21
+ # just-deleted resource, it's difficult to distinguish the two
22
+ # (short of checking it's there before trying to delete it)
23
+ def delete
24
+ bucket_name = params[:bucket_name]
25
+ resource_key = params[:resource_key]
26
+ if resource_key
27
+ @s3.delete_resource(bucket_name, resource_key)
28
+ to_url = url_for(:action => 'show_bucket', :bucket_name => bucket_name)
29
+ notice = "Resource"
30
+ else
31
+ @s3.delete_bucket(bucket_name, {}, {:force => true})
32
+ to_url = url_for(:action => 'index')
33
+ notice = "Bucket"
34
+ end
35
+
36
+ notice += " deleted successfully"
37
+
38
+ flash[:notice] = notice
39
+ redirect_to to_url
40
+ end
41
+
42
+ def upload
43
+ file_to_upload = params[:upload][:filename]
44
+
45
+ base_filename = file_to_upload.original_filename
46
+ file_data = file_to_upload.read
47
+ content_type = file_to_upload.content_type.chomp
48
+ bucket_name = params[:upload][:bucket_name]
49
+
50
+ @s3.put_resource(bucket_name, base_filename, file_data, {'Content-Type' => content_type})
51
+ redirect_to :action => 'show_bucket', :bucket_name => bucket_name
52
+ end
53
+
54
+ def create_bucket
55
+ new_bucket_name = params[:bucket][:name]
56
+ use_prefix = (params[:bucket][:prefix]).to_i
57
+ if use_prefix
58
+ new_bucket_name = @default_prefix + '-' + new_bucket_name
59
+ end
60
+
61
+ if @s3.create_bucket(new_bucket_name)
62
+ flash[:notice] = "New bucket created successfully"
63
+ else
64
+ flash[:notice] = "Could not create bucket - already exists"
65
+ end
66
+ redirect_to :action => 'index'
67
+ end
68
+ end
@@ -0,0 +1,8 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ include S33r
4
+
5
+ def authenticated_url(bucket_name, resource_key)
6
+ s3_authenticated_url(ACCESS_KEY, SECRET_ACCESS_KEY, bucket_name, resource_key, S3_OPTIONS[:default_expires])
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ <h2>Buckets</h2>
2
+
3
+ <% for bucket in @buckets %>
4
+ <p><%= link_to bucket.name, :action => 'show_bucket',
5
+ :bucket_name => bucket.name %> | <%= link_to 'delete', {:action => 'delete', :bucket_name => bucket.name},
6
+ :confirm => 'Are you sure you want to delete this bucket?' %></p>
7
+ <% end %>
8
+
9
+ <%= start_form_tag :action => 'create_bucket' %>
10
+ <p>Create a new bucket: <%= text_field 'bucket', 'name' %></p>
11
+ <p>Use your default bucket prefix (<strong><%= @default_prefix %></strong>)?
12
+ <%= check_box_tag 'bucket[prefix]', 1, true %></p>
13
+ <p><%= submit_tag 'Create' %></p>
14
+ <%= end_form_tag %>
@@ -0,0 +1,14 @@
1
+ <h2>Content of bucket <em><%= @bucket_name %></em></h2>
2
+
3
+ <% for key in @keys do %>
4
+ <p><%= link_to key, authenticated_url(@bucket_name, key) %>&nbsp;|&nbsp;
5
+ <%= link_to 'delete', {:action => 'delete', :bucket_name => @bucket_name,
6
+ :resource_key => key}, :confirm => 'Are you sure you want to delete this resource?' %>
7
+ </p>
8
+ <% end %>
9
+
10
+ <%= start_form_tag({:action => 'upload'}, :multipart => true) %>
11
+ <%= hidden_field 'upload', 'bucket_name', :value => @bucket_name %>
12
+ <p>Upload a file to this bucket: <%= file_field('upload', 'filename') %></p>
13
+ <p><%= submit_tag 'Upload' %></p>
14
+ <%= end_form_tag %>
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB" xml:lang="en_GB">
5
+ <head>
6
+ <title>fores33r</title>
7
+ <%= stylesheet_link_tag 'core' %>
8
+ </head>
9
+ <body>
10
+
11
+ <div id="header">
12
+ <h1>fores33r</h1>
13
+ </div>
14
+
15
+ <div id="left_pane">
16
+ <p><%= link_to 'Buckets', :controller => 'browser', :action => 'index' %></p>
17
+ </div>
18
+
19
+ <div id="main_pane">
20
+
21
+ <% if not flash.empty? -%>
22
+ <p id="flash"><%= flash[:notice] %></p>
23
+ <% end -%>
24
+
25
+ <%= @content_for_layout %>
26
+ </div>
27
+
28
+ </body>
29
+ </html>