Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #10 from shoes/download

Add downloads page
  • Loading branch information...
commit e151380f242ab5d511523acc1d52a42691828ace 2 parents 40e2c76 + 7ae40db
@steveklabnik steveklabnik authored
View
2  .gitignore
@@ -1,3 +1,5 @@
# IDEs
/.idea
+.rvmrc
+
View
2  config.ru
@@ -15,6 +15,8 @@ Shoes = Webmachine::Application.new do |app|
add ["blog"], BlogResource
add ["blog", :slug], BlogResource
add ["contribute"], ContributePage
+ add ["downloads"], DownloadsPage
+ add ["downloads", :filename], DownloadResource
add ['*'], StaticResource, :root => "public"
end
app.configure do |config|
View
33 resources/download_resource.rb
@@ -0,0 +1,33 @@
+# Manager for downloads hosted elsewhere. Handles redirects from shoesrb.com
+# URLs to the URLs where resources actually live.
+#
+# Request downloads by filename like this:
+#
+# GET /downloads/filename.zip HTTP/1.1
+#
+# Manage redirects to actual resources by adding to the DOWNLOADS hash:
+#
+# "filename.zip" => "http://url/for/actual/filename.zip"
+#
+class DownloadResource < Webmachine::Resource
+ DOWNLOADS = {
+ "shoes-app-template-0.0.1.zip" => "https://s3.amazonaws.com/net.wasnotrice.shoes/wrappers/shoes-app-template-0.0.1.zip"
+ }
+
+ # shows up in the URL like so: http://shoesrb.com/downloads/:filename
+ def filename
+ @request.path_info[:filename]
+ end
+
+ def resource_exists?
+ false
+ end
+
+ def previously_existed?
+ DOWNLOADS.has_key?(filename)
+ end
+
+ def moved_permanently?
+ previously_existed? && DOWNLOADS[filename]
+ end
+end
View
5 resources/downloads_page.rb
@@ -0,0 +1,5 @@
+class DownloadsPage < Webmachine::Resource
+ def to_html
+ Template.new(:downloads).render
+ end
+end
View
19 views/downloads.html.haml
@@ -0,0 +1,19 @@
+.hero-unit
+ .downloads
+ %h1 Downloads
+ %p Get your Shoes and Shoes Accessories Here.
+
+.row
+ .span5
+ %h2 Shoes
+ #shoes
+
+ .span5
+ %h2 Shoes Accessories
+ #accessories
+
+ %h3 App Wrappers
+ %ul
+ %li
+ %a{:href => "/downloads/shoes-app-template-0.0.1.zip"} OS X .app wrapper
+
View
2  views/layout.html.haml
@@ -36,6 +36,8 @@
%li.active
%a{:href => "/"} Home
%li
+ %a{:href => "/downloads"} Downloads
+ %li
%a{:href => "/tutorials"} Tutorials
%li
%a{:href => "/blog"} Blog
Please sign in to comment.
Something went wrong with that request. Please try again.