Skip to content
Browse files

Add article scaffolding for Dev Center-like rendering. Use this as te…

…st repo
  • Loading branch information...
1 parent 62babb4 commit 9b6414cebe952d23f87484aa80cabb0febacb7af @rwdaigle committed Jan 16, 2012
Showing with 314 additions and 0 deletions.
  1. +1 −0 .env
  2. +1 −0 .gitignore
  3. +10 −0 Gemfile
  4. +45 −0 Gemfile.lock
  5. +1 −0 Procfile
  6. +34 −0 README
  7. +20 −0 config.ru
  8. +1 −0 views/article.erb
  9. +201 −0 views/layout.erb
View
1 .env
@@ -0,0 +1 @@
+RACK_ENV=development
View
1 .gitignore
@@ -0,0 +1 @@
+.rvmrc
View
10 Gemfile
@@ -0,0 +1,10 @@
+source "http://rubygems.org"
+
+gem 'sinatra'
+gem 'redcarpet'
+gem 'thin'
+
+group :development do
+ gem 'heroku'
+ gem 'foreman'
+end
View
45 Gemfile.lock
@@ -0,0 +1,45 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.6)
+ daemons (1.1.5)
+ eventmachine (0.12.10)
+ foreman (0.34.1)
+ term-ansicolor (~> 1.0.5)
+ thor (>= 0.13.6)
+ heroku (2.18.1)
+ launchy (>= 0.3.2)
+ rest-client (~> 1.6.1)
+ rubyzip
+ term-ansicolor (~> 1.0.5)
+ launchy (2.0.5)
+ addressable (~> 2.2.6)
+ mime-types (1.17.2)
+ rack (1.4.0)
+ rack-protection (1.2.0)
+ rack
+ redcarpet (2.0.1)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ rubyzip (0.9.5)
+ sinatra (1.3.2)
+ rack (~> 1.3, >= 1.3.6)
+ rack-protection (~> 1.2)
+ tilt (~> 1.3, >= 1.3.3)
+ term-ansicolor (1.0.7)
+ thin (1.3.1)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ thor (0.14.6)
+ tilt (1.3.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ foreman
+ heroku
+ redcarpet
+ sinatra
+ thin
View
1 Procfile
@@ -0,0 +1 @@
+web: bundle exec thin start -p $PORT -e $RACK_ENV
View
34 README
@@ -0,0 +1,34 @@
+This is a prototype of treating an article like an application. Namely, the ability to locally edit
+article contents contained within a README using the editor of the author's choice and to render
+the article locally using (remote, and thus up-todate) Dev Center styling. This does not attempt to
+address deployment to the Dev Center.
+
+This is also a start in the direction of providing a git repo complete with article template for
+authors to fork and begin editing with minimal overhead.
+
+## Clone Template Article
+
+Begin by forking [this template repo](https://github.com/rwdaigle/devcenter-article) to your own your own GitHub account.
+Then clone to copy the template to the local environment.
+
+ $ git clone git@github.com:YOURUSER/devcenter-article.git my-article
+ $ cd my-article
+
+## Render Article Locally
+
+Before editing the article run the article to see its rendered state in a local environment
+that provides real-time rendering of the article contents.
+
+ $ foreman start
+ 15:30:24 web.1 | started with pid 42618
+
+Open your browser to [localhost:5000](http://localhost:5000) to view the article with Dev Center styling.
+
+## Edit Article
+
+Edit the article in the `README` file. Save changes and go back to the browser. Reloading [localhost:5000](http://localhost:5000)
+will re-render the article without a server restart.
+
+## Submit
+
+Directions for submitting to Dev Center editors...
View
20 config.ru
@@ -0,0 +1,20 @@
+require "rubygems"
+require "bundler"
+require 'sinatra/base'
+Bundler.setup
+
+require 'redcarpet'
+
+class DevCenterArticleApp < Sinatra::Base
+
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
+ :autolink => true, :space_after_headers => true)
+
+ get "/" do
+ source = File.open('README', 'r:UTF-8').read
+ @markdown = markdown.render(source)
+ erb :article
+ end
+end
+
+run DevCenterArticleApp
View
1 views/article.erb
@@ -0,0 +1 @@
+<%= @markdown %>
View
201 views/layout.erb
@@ -0,0 +1,201 @@
+
+<!DOCTYPE html>
+<html class="no-js" dir="ltr" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link href="https://nav.heroku.com/header.css" media="all" rel="stylesheet" type="text/css">
+<title>Heroku | Dev Center</title>
+<meta charset="utf-8">
+<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
+<!--[if !IE 6]><!--><link href="http://devcenter.heroku.com/stylesheets/dev-center/screen.css?1324564088" media="screen" rel="stylesheet" type="text/css">
+<link href="http://devcenter.heroku.com/stylesheets/coderay.css?1324564088" media="screen" rel="stylesheet" type="text/css">
+<!--<![endif]--><!--[if IE 6]>
+ <link href="https://universal-ie6-css.googlecode.com/files/ie6.0.3.css" media="screen" rel="stylesheet" type="text/css" />
+ <![endif]--><script type="text/javascript">
+//<![CDATA[
+//]]>
+</script>
+</head>
+<body>
+ <div id="sheet">
+ <div class="wrapper">
+ <div class="pie-clearfix" id="article">
+ <aside id="sidebar"><section class="pie-clearfix pie-clearfix-ie" id="search"><form accept-charset="UTF-8" action="/articles" id="home-search" method="get">
+<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value=""></div>
+ <p>
+ <input id="q" name="q" placeholder="search" required="required" type="text"></p>
+ </form>
+</section><select id="quicknav"><option value="/">Home</option>
+<optgroup label="Overview">
+<option value="/categories/getting-started">Getting Started</option>
+<option value="/categories/platform-basics">Platform Basics</option>
+<option value="/categories/platform-constraints">Platform Constraints</option>
+</optgroup>
+<optgroup label="Tutorials">
+<option value="/categories/facebook">Facebook</option>
+<option value="/categories/best-practices">Best Practices</option>
+<option value="/categories/features">Adding Features</option>
+<option value="/categories/performance">Performance</option>
+</optgroup>
+<optgroup label="Reference">
+<option value="/categories/platform-features">Platform Features</option>
+<option value="/categories/command-line">Command Line</option>
+<option value="/categories/collaboration">Collaboration</option>
+<option value="/categories/deployment">Deployment</option>
+<option value="/categories/troubleshooting">Troubleshooting</option>
+<option value="/categories/devcenter">Dev Center</option>
+</optgroup>
+<optgroup label="Languages">
+<option value="/categories/java">Java</option>
+<option value="/categories/ruby">Ruby</option>
+<option value="/categories/python">Python</option>
+<option value="/categories/clojure">Clojure</option>
+<option value="/categories/scala">Scala</option>
+<option value="/categories/play">Play</option>
+<option value="/categories/node-js">Node.js</option>
+</optgroup>
+<optgroup label="Accounts &amp; Billing">
+<option value="/categories/accounts">Accounts</option>
+<option value="/categories/billing">Billing</option>
+<option value="/categories/support">Support</option>
+</optgroup>
+<optgroup label="Add-ons">
+<option value="/categories/addon-overview">Overview</option>
+<option value="/categories/add-on-documentation">All Add-ons</option>
+<option value="/categories/heroku-postgres">Heroku Postgres</option>
+</optgroup></select><ul id="nav">
+<li class="category-group">
+ <a class="category" href="#">Overview</a>
+
+ <ul class="tags" style="display:none;">
+<li>
+ <a href="/categories/getting-started">Getting Started</a>
+ </li>
+ <li>
+ <a href="/categories/platform-basics">Platform Basics</a>
+ </li>
+ <li>
+ <a href="/categories/platform-constraints">Platform Constraints</a>
+ </li>
+ </ul>
+</li>
+ <li class="category-group">
+ <a class="category" href="#">Tutorials</a>
+
+ <ul class="tags" style="display:none;">
+<li>
+ <a href="/categories/facebook">Facebook</a>
+ </li>
+ <li>
+ <a href="/categories/best-practices">Best Practices</a>
+ </li>
+ <li>
+ <a href="/categories/features">Adding Features</a>
+ </li>
+ <li>
+ <a href="/categories/performance">Performance</a>
+ </li>
+ </ul>
+</li>
+ <li class="category-group">
+ <a class="category" href="#">Reference</a>
+
+ <ul class="tags" style="display:none;">
+<li>
+ <a href="/categories/platform-features">Platform Features</a>
+ </li>
+ <li>
+ <a href="/categories/command-line">Command Line</a>
+ </li>
+ <li>
+ <a href="/categories/collaboration">Collaboration</a>
+ </li>
+ <li>
+ <a href="/categories/deployment">Deployment</a>
+ </li>
+ <li>
+ <a href="/categories/troubleshooting">Troubleshooting</a>
+ </li>
+ <li>
+ <a href="/categories/devcenter">Dev Center</a>
+ </li>
+ </ul>
+</li>
+ <li class="category-group">
+ <a class="category" href="#">Languages</a>
+
+ <ul class="tags" style="display:block;">
+<li class="active">
+ <a href="/categories/java">Java</a>
+ </li>
+ <li>
+ <a href="/categories/ruby">Ruby</a>
+ </li>
+ <li>
+ <a href="/categories/python">Python</a>
+ </li>
+ <li>
+ <a href="/categories/clojure">Clojure</a>
+ </li>
+ <li>
+ <a href="/categories/scala">Scala</a>
+ </li>
+ <li>
+ <a href="/categories/play">Play</a>
+ </li>
+ <li>
+ <a href="/categories/node-js">Node.js</a>
+ </li>
+ </ul>
+</li>
+ <li class="category-group">
+ <a class="category" href="#">Accounts &amp; Billing</a>
+
+ <ul class="tags" style="display:none;">
+<li>
+ <a href="/categories/accounts">Accounts</a>
+ </li>
+ <li>
+ <a href="/categories/billing">Billing</a>
+ </li>
+ <li>
+ <a href="/categories/support">Support</a>
+ </li>
+ </ul>
+</li>
+ <li class="category-group">
+ <a class="category" href="#">Add-ons</a>
+
+ <ul class="tags" style="display:none;">
+<li>
+ <a href="/categories/addon-overview">Overview</a>
+ </li>
+ <li>
+ <a href="/categories/add-on-documentation">All Add-ons</a>
+ </li>
+ <li>
+ <a href="/categories/heroku-postgres">Heroku Postgres</a>
+ </li>
+ </ul>
+</li>
+</ul></aside>
+
+<section id="main">
+ <article>
+ <div id="admin-tabs"></div>
+ <hgroup><h1>Dev Center Article Title</h1>
+
+ <p class="meta">
+ Last Updated: now
+ </p>
+
+ <p class="tags">
+ <a href="/tags/java">relevant tag</a>
+ </p>
+ </hgroup>
+
+ <%= yield %>
+ </article>
+ </section>
+</div>
+</body>

0 comments on commit 9b6414c

Please sign in to comment.
Something went wrong with that request. Please try again.