summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.rvmrc34
-rw-r--r--app.rb13
-rwxr-xr-xconfig.ru19
-rw-r--r--controller/init.rb18
-rw-r--r--controller/main.rb25
-rw-r--r--layout/default.xhtml57
-rw-r--r--model/init.rb6
-rw-r--r--public/.htaccess24
-rw-r--r--public/css/grid.css107
-rw-r--r--public/css/layout.css81
-rw-r--r--public/css/reset.css123
-rw-r--r--public/css/text.css109
-rwxr-xr-xpublic/dispatch.fcgi11
-rw-r--r--public/favicon.icobin0 -> 1150 bytes
-rw-r--r--public/images/bg.pngbin0 -> 127 bytes
-rw-r--r--spec/main.rb20
-rwxr-xr-xstart.rb20
-rw-r--r--view/index.xhtml45
18 files changed, 712 insertions, 0 deletions
diff --git a/.rvmrc b/.rvmrc
new file mode 100644
index 0000000..338185a
--- /dev/null
+++ b/.rvmrc
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+# This is an RVM Project .rvmrc file, used to automatically load the ruby
+# development environment upon cd'ing into the directory
+
+# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
+# Only full ruby name is supported here, for short names use:
+# echo "rvm use 1.9.3" > .rvmrc
+environment_id="ruby-1.9.3-p0@clockwork"
+
+# Uncomment the following lines if you want to verify rvm version per project
+# rvmrc_rvm_version="1.10.2" # 1.10.1 seams as a safe start
+# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
+# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
+# return 1
+# }
+
+# First we attempt to load the desired environment directly from the environment
+# file. This is very fast and efficient compared to running through the entire
+# CLI and selector. If you want feedback on which environment was used then
+# insert the word 'use' after --create as this triggers verbose mode.
+if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
+then
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
+else
+ # If the environment file has not yet been created, use the RVM CLI to select.
+ rvm --create "$environment_id" || {
+ echo "Failed to create RVM environment '${environment_id}'."
+ return 1
+ }
+fi
diff --git a/app.rb b/app.rb
new file mode 100644
index 0000000..00e002d
--- /dev/null
+++ b/app.rb
@@ -0,0 +1,13 @@
+# This file contains your application, it requires dependencies and necessary parts of
+# the application.
+#
+# It will be required from either `config.ru` or `start.rb`
+require 'rubygems'
+require 'ramaze'
+
+# Make sure that Ramaze knows where you are
+Ramaze.options.roots = [__DIR__]
+
+# Initialize controllers and models
+require __DIR__('model/init')
+require __DIR__('controller/init')
diff --git a/config.ru b/config.ru
new file mode 100755
index 0000000..5c44c7f
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,19 @@
+#!/usr/bin/env rackup
+#
+# config.ru for ramaze apps
+#
+# Rackup is a useful tool for running Rack applications, which uses the
+# Rack::Builder DSL to configure middleware and build up applications easily.
+#
+# Rackup automatically figures out the environment it is run in, and runs your
+# application as FastCGI, CGI, or standalone with Mongrel or WEBrick -- all from
+# the same configuration.
+#
+# Do not set the adapter.handler in here, it will be ignored.
+# You can choose the adapter like `ramaze start -s mongrel` or set it in the
+# 'start.rb' and use `ruby start.rb` instead.
+require ::File.expand_path('../app', __FILE__)
+
+Ramaze.start(:root => Ramaze.options.roots, :started => true)
+
+run Ramaze
diff --git a/controller/init.rb b/controller/init.rb
new file mode 100644
index 0000000..0725c9b
--- /dev/null
+++ b/controller/init.rb
@@ -0,0 +1,18 @@
+# Define a subclass of Ramaze::Controller holding your defaults for all controllers. Note
+# that these changes can be overwritten in sub controllers by simply calling the method
+# but with a different value.
+
+class Controller < Ramaze::Controller
+ layout :default
+ helper :xhtml
+ engine :etanni
+end
+
+# Here you can require all your other controllers. Note that if you have multiple
+# controllers you might want to do something like the following:
+#
+# Dir.glob('controller/*.rb').each do |controller|
+# require(controller)
+# end
+#
+require __DIR__('main')
diff --git a/controller/main.rb b/controller/main.rb
new file mode 100644
index 0000000..abe5367
--- /dev/null
+++ b/controller/main.rb
@@ -0,0 +1,25 @@
+# Default url mappings are:
+#
+# * a controller called Main is mapped on the root of the site: /
+# * a controller called Something is mapped on: /something
+#
+# If you want to override this, add a line like this inside the class:
+#
+# map '/otherurl'
+#
+# this will force the controller to be mounted on: /otherurl.
+class MainController < Controller
+ # the index action is called automatically when no other action is specified
+ def index
+ @title = 'Welcome to Ramaze!'
+ end
+
+ # the string returned at the end of the function is used as the html body
+ # if there is no template for the action. if there is a template, the string
+ # is silently ignored
+ def notemplate
+ @title = 'Welcome to Ramaze!'
+
+ return 'There is no \'notemplate.xhtml\' associated with this action.'
+ end
+end
diff --git a/layout/default.xhtml b/layout/default.xhtml
new file mode 100644
index 0000000..4bb6b69
--- /dev/null
+++ b/layout/default.xhtml
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+
+ <title>#{@title}</title>
+
+ #{css('reset')}
+ #{css('grid')}
+ #{css('layout')}
+ #{css('text')}
+ </head>
+ <body>
+ <div class="container">
+ <div id="container" class="row">
+ <!-- Top part, contains the navigation menu -->
+ <div id="top" class="grid_12">
+ <header class="grid_6">
+ <h1>#{@title}</h1>
+ </header>
+
+ <nav class="grid_6 last">
+ <ul class="clearfix">
+ <li>
+ <a href="http://ramaze.net/">Website</a>
+ </li>
+ <li>
+ <a href="http://ramaze.net/documentation/index.html">
+ Documentation
+ </a>
+ </li>
+ <li>
+ <a href="https://groups.google.com/forum/#!forum/ramaze">
+ Mailing List
+ </a>
+ </li>
+ </ul>
+ </nav>
+ </div>
+
+ <div id="content" class="grid_12">
+ #{@content}
+ </div>
+ </div>
+
+ <footer id="footer">
+ <p>
+ Ramaze is free software and is licensed under the Ruby license.<br />
+ All textual content is licensed under a
+ <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
+ Creative Commons license.
+ </a>
+ </p>
+ </footer>
+ </div>
+ </body>
+</html>
diff --git a/model/init.rb b/model/init.rb
new file mode 100644
index 0000000..56c72e3
--- /dev/null
+++ b/model/init.rb
@@ -0,0 +1,6 @@
+# This file is used for loading all your models. Note that you don't have to actually use
+# this file. The great thing about Ramaze is that you're free to change it the way you see
+# fit.
+
+# Here go your requires for models:
+# require __DIR__('user')
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 0000000..a0c708d
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,24 @@
+# General Apache options
+Options +FollowSymLinks +ExecCGI
+AddHandler cgi-script cgi rb
+<IfModule mod_fastcgi.c>
+ AddHandler fastcgi-script fcgi
+</IfModule>
+<IfModule mod_fcgid.c>
+ AddHandler fcgid-script fcgi
+</IfModule>
+
+# Redirect all requests not available on the filesystem to Ramaze.
+
+RewriteEngine On
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
+
+# In case Ramaze experiences terminal errors.
+# Instead of displaying this message you can supply a
+# file here which will be rendered instead.
+#
+# Example:
+# ErrorDocument 500 /500.html
+
+ErrorDocument 500 "<h2>Application error</h2>Ramaze failed to start properly"
diff --git a/public/css/grid.css b/public/css/grid.css
new file mode 100644
index 0000000..ed3ecee
--- /dev/null
+++ b/public/css/grid.css
@@ -0,0 +1,107 @@
+@charset "UTF-8";
+
+/**
+ * Modified version of the CSS grid (aka 1140 CSS) that can be found at http://cssgrid.net
+ *
+ * This modified version has some extra enhancements to make it a bit easier to work with
+ * the grid. Along with these minor fixes I also renamed all grid classes to the names
+ * used by the 960 grid system as I find "grid_6" easier to write than "sixcol".
+ */
+.container
+{
+ overflow: hidden;
+ padding-left: 1%;
+ padding-right: 1%;
+}
+
+.row
+{
+ max-width: 96%;
+ margin: 0 auto;
+ overflow: hidden;
+ width: 100%;
+}
+
+.grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7, .grid_8, .grid_9,
+.grid_10, .grid_11
+{
+ float: left;
+ margin-right: 3.8%;
+ min-height: 1px;
+}
+
+.row .grid_1
+{
+ width: 4.85%;
+}
+
+.row .grid_2
+{
+ width: 13.45%;
+}
+
+.row .grid_3
+{
+ width: 22.05%;
+}
+
+.row .grid_4
+{
+ width: 30.75%;
+}
+
+.row .grid_5
+{
+ width: 39.45%;
+}
+
+.row .grid_6
+{
+ width: 48%;
+}
+
+.row .grid_7
+{
+ width: 56.75%;
+}
+
+.row .grid_8
+{
+ width: 65.4%;
+}
+
+.row .grid_9
+{
+ width: 74.05%;
+}
+
+.row .grid_10
+{
+ width: 82.7%;
+}
+
+.row .grid_11
+{
+ width: 91.35%;
+}
+
+.row .grid_12
+{
+ float: left;
+ width: 100%;
+}
+
+.last, .row > *:last-child
+{
+ margin-right: 0px;
+}
+
+img, object, embed
+{
+ max-width: 100%;
+}
+
+img
+{
+ height: auto;
+}
diff --git a/public/css/layout.css b/public/css/layout.css
new file mode 100644
index 0000000..29f023d
--- /dev/null
+++ b/public/css/layout.css
@@ -0,0 +1,81 @@
+/**
+ * Stylesheet used for the layout of most elements.
+ *
+ * @author Yorick Peterse
+ * @link http://yorickpeterse.com/
+ */
+#container
+{
+ margin: 20px auto;
+ width: 940px;
+}
+
+#content
+{
+ background: #fff;
+ border: 1px solid #ddd;
+ padding: 20px;
+ width: 898px;
+}
+
+/* Top part of the website, contains the title and the navigation menu */
+#top
+{
+ background: #E33F1E;
+ height: 70px;
+ margin-bottom: 20px;
+ padding: 0px 10px;
+}
+
+ #top header h1
+ {
+ color: #fff;
+ font-size: 38px;
+ margin: 10px 0px 0px 0px;
+ padding: 0px;
+ }
+
+ #top nav ul
+ {
+ float: right;
+ margin-right: 15px;
+ }
+
+ #top nav ul li
+ {
+ float: left;
+ font-size: 16px;
+ list-style-type: none;
+ margin-right: 10px;
+ }
+
+ #top nav ul li:last-child
+ {
+ margin-right: 0px;
+ }
+
+ #top nav ul li a
+ {
+ color: #fff;
+ display: block;
+ height: 45px;
+ padding: 25px 10px 0px 10px;
+ text-decoration: none;
+ }
+
+ #top nav ul li a:hover
+ {
+ background: #D43919;
+ }
+
+/* Footer at the bottom of the page */
+#footer
+{
+ text-align: center;
+}
+
+ #footer p
+ {
+ font-size: 13px;
+ margin-bottom: 10px;
+ }
diff --git a/public/css/reset.css b/public/css/reset.css
new file mode 100644
index 0000000..855d951
--- /dev/null
+++ b/public/css/reset.css
@@ -0,0 +1,123 @@
+@charset "UTF-8";
+
+/**
+ * http://meyerweb.com/eric/tools/css/reset/
+ * v2.0 | 20110126
+ * License: none (public domain)
+ */
+html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small,
+strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset,
+form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside,
+canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output,
+ruby, section, summary, time, mark, audio, video
+{
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ margin: 0;
+ padding: 0;
+ vertical-align: baseline;
+}
+
+/* HTML5 display-role reset for older browsers */
+article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section
+{
+ display: block;
+}
+
+body
+{
+ line-height: 1.3;
+}
+
+ol, ul, ol li, ul li
+{
+ list-style-type: none;
+ margin: 0px;
+ padding: 0px;
+}
+
+blockquote, q
+{
+ quotes: none;
+}
+
+blockquote:before, blockquote:after, q:before, q:after
+{
+ content: '';
+ content: none;
+}
+
+table
+{
+ /**
+ * Instead of "collapse" I'm using "separate" as that allows me to give table cells
+ * a border without having to go through a lot of trouble
+ */
+ border-collapse: separate;
+ border-spacing: 0;
+ width: 100%;
+}
+
+ table th
+ {
+ font-weight: bold;
+ }
+
+pre, code
+{
+ font-size: 13px;
+ font-family: monospace;
+}
+
+/**
+ * These form elements usually don't trigger any special cursor and thus can confuse
+ * users when these elements have custom styles (e.g. a background image).
+ */
+input[type="submit"], input[type="button"], input[type="checkbox"], input[type="radio"],
+button, select
+{
+ cursor: pointer;
+}
+
+*[disabled], *[disabled="disabled"]
+{
+ cursor: not-allowed;
+}
+
+textarea
+{
+ overflow: auto;
+}
+
+acronym, abbr
+{
+ cursor: help;
+}
+
+/* Some typography related styles */
+body
+{
+ font-size: 16px;
+}
+
+h1, h2, h3, h4, h5, h6
+{
+ font-weight: bold;
+}
+
+a:hover, a:active
+{
+ outline: none;
+}
+
+strong
+{
+ font-weight: bold;
+}
+
+small
+{
+ font-size: 11px;
+}
diff --git a/public/css/text.css b/public/css/text.css
new file mode 100644
index 0000000..21e75a7
--- /dev/null
+++ b/public/css/text.css
@@ -0,0 +1,109 @@
+/**
+ * Stylesheet used for styling headings, links, etc.
+ *
+ * @author Yorick Peterse
+ * @link http://yorickpeterse.com/
+ */
+body
+{
+ background: url('../images/bg.png') repeat top left;
+ border-top: 5px solid #444;
+ color: #444;
+ font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, sans-serif;
+ font-size: 14px;
+}
+
+p
+{
+ font-size: 14px;
+ line-height: 22px;
+ margin-bottom: 20px;
+}
+
+a
+{
+ color: #444;
+}
+
+ol
+{
+ margin-left: 20px;
+}
+
+ ol li
+ {
+ list-style-type: decimal;
+ }
+
+ul
+{
+ margin-left: 18px;
+}
+
+ ul li
+ {
+ list-style-type: disc;
+ }
+
+ul, ol
+{
+ line-height: 22px;
+ margin-bottom: 20px;
+}
+
+a:hover, h1 a:hover
+{
+ color: #E33F1E;
+}
+
+h1, h2, h3, h4, h5, h6
+{
+ font-weight: bold;
+ margin-bottom: 5px;
+}
+
+h1
+{
+ font-size: 28px;
+}
+
+h2
+{
+ font-size: 24px;
+}
+
+h3
+{
+ font-size: 22px;
+}
+
+h4
+{
+ font-size: 20px;
+}
+
+h5
+{
+ font-size: 18px;
+}
+
+h6
+{
+ font-size: 16px;
+}
+
+h1 a
+{
+ color: #444;
+ text-decoration: none;
+}
+
+pre
+{
+ margin: 20px 0px;
+}
+
+code
+{
+ background: #eee;
+}
diff --git a/public/dispatch.fcgi b/public/dispatch.fcgi
new file mode 100755
index 0000000..4363b26
--- /dev/null
+++ b/public/dispatch.fcgi
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'ramaze'
+
+# FCGI doesn't like you writing to stdout
+Ramaze::Log.loggers = [ Ramaze::Logger::Informer.new( __DIR__("../ramaze.fcgi.log") ) ]
+Ramaze.options.adapter.handler = :fastcgi
+
+$0 = __DIR__("../start.rb")
+require $0
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..42b72ef
--- /dev/null
+++ b/public/favicon.ico
Binary files differ
diff --git a/public/images/bg.png b/public/images/bg.png
new file mode 100644
index 0000000..58ff604
--- /dev/null
+++ b/public/images/bg.png
Binary files differ
diff --git a/spec/main.rb b/spec/main.rb
new file mode 100644
index 0000000..4531b7e
--- /dev/null
+++ b/spec/main.rb
@@ -0,0 +1,20 @@
+require 'ramaze'
+require 'ramaze/spec/bacon'
+
+require __DIR__('../app')
+
+describe MainController do
+ behaves_like :rack_test
+
+ should 'show start page' do
+ get('/').status.should == 200
+ last_response['Content-Type'].should == 'text/html'
+ last_response.should =~ /Congratulations, Ramaze is running fine/
+ end
+
+ should 'show /notemplate' do
+ get('/notemplate').status.should == 200
+ last_response['Content-Type'].should == 'text/html'
+ last_response.should =~ /There is no 'notemplate\.xhtml' associated with this action\./
+ end
+end
diff --git a/start.rb b/start.rb
new file mode 100755
index 0000000..f3b046e
--- /dev/null
+++ b/start.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+
+# Use this file directly like `ruby start.rb` if you don't want to use the
+# `ramaze start` command.
+#
+# All application related things should go into `app.rb`, this file is simply
+# for options related to running the application locally.
+#
+# You can run this file as following:
+#
+# $ ruby start.rb
+# $ ./start.rb
+#
+# If you want to be able to do the latter you'll have to make sure the file can be
+# executed:
+#
+# $ chmod +x ./start.rb
+require File.expand_path('../app', __FILE__)
+
+Ramaze.start(:adapter => :webrick, :port => 7000, :file => __FILE__)
diff --git a/view/index.xhtml b/view/index.xhtml
new file mode 100644
index 0000000..c2aafac
--- /dev/null
+++ b/view/index.xhtml
@@ -0,0 +1,45 @@
+<p>
+ Congratulations, Ramaze is running fine and you can start working on your application.
+</p>
+
+<p>
+ You can play around with this prototype by changing the following:
+</p>
+
+<ul>
+ <li>
+ <code>view/index.xhtml</code>: the content of this page.
+ </li>
+ <li>
+ <code>layout/default.xhtml</code>: the layout for this page.
+ </li>
+ <li>
+ <code>controller/main.rb</code>: the controller responsible for server this page.
+ </li>
+</ul>
+
+<p>
+ For more information, check out <a href="http://ramaze.net">ramaze.net</a> and
+ <a href="http://ramaze.net/documentation/index.html">the documentation</a>.
+ <br />
+ You can also read the
+ <a href="http://doc.rubyists.com/ramaze%2binnate/">YARD documentation</a>
+ or browse around the <a href="https://github.com/ramaze/ramaze">Ramaze source code</a>.
+</p>
+
+<p>
+ For help with Ramaze, visit
+ <a href="irc://chat.freenode.net/ramaze">#ramaze on irc.freenode.net</a>.
+ <br />
+ You can use <a href="http://embed.mibbit.com/?server=irc.freenode.net&amp;channel=%23ramaze,%23ruby-lang&amp;forcePrompt=true">Mibbit</a>,
+ an AJAX based IRC client or
+ <a href="http://java.freenode.net/?channel=ramaze">
+ the official freenode irc java applet
+ </a>.
+</p>
+
+<p>
+ Feel free to post to the
+ <a href="https://groups.google.com/forum/#!forum/ramaze">Ramaze Google Group</a>, your
+ first mail has to go through moderation, so please be patient.
+</p>