Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added (empty) Dancer app.

  • Loading branch information...
commit f750bc6accc248fa68cb112944841df243d9ec4c 1 parent 1aa3b91
Dave Cross authored
2  Build.PL
View
@@ -7,6 +7,8 @@ my $build = Module::Build->new(
DBIx::Class => 0,
DBD::mysql => 0,
Moose => 0,
+ YAML => 0,
+ Dancer => 1,
MooseX::MarkAsMethods => 0,
MooseX::NonMoose => 0,
DBIx::Class::EncodedColumn => 0,
4 bin/app.pl
View
@@ -0,0 +1,4 @@
+#!/usr/bin/env perl
+use Dancer;
+use Lystyng;
+dance;
28 config.yml
View
@@ -0,0 +1,28 @@
+# This is the main configuration file of your Dancer app
+# env-related settings should go to environments/$env.yml
+# all the settings in this file will be loaded at Dancer's startup.
+
+# Your application's name
+appname: "Lystyng"
+
+# The default layout to use for your application (located in
+# views/layouts/main.tt)
+layout: "main"
+
+# when the charset is set to UTF-8 Dancer will handle for you
+# all the magic of encoding and decoding. You should not care
+# about unicode within your app when this setting is set (recommended).
+charset: "UTF-8"
+
+# template engine
+# simple: default and very basic template engine
+# template_toolkit: TT
+
+template: "simple"
+
+# template: "template_toolkit"
+# engines:
+# template_toolkit:
+# start_tag: '[%'
+# end_tag: '%]'
+
27 environments/development.yml
View
@@ -0,0 +1,27 @@
+# configuration file for development environment
+
+# the logger engine to use
+# console: log messages to STDOUT (your console where you started the
+# application server)
+# file: log message to a file in log/
+logger: "console"
+
+# the log level for this environment
+# core is the lowest, it shows Dancer's core log messages as well as yours
+# (debug, info, warning and error)
+log: "core"
+
+# should Dancer consider warnings as critical errors?
+warnings: 1
+
+# should Dancer show a stacktrace when an error is caught?
+show_errors: 1
+
+# auto_reload is a development and experimental feature
+# you should enable it by yourself if you want it
+# Module::Refresh is needed
+#
+# Be aware it's unstable and may cause a memory leak.
+# DO NOT EVER USE THIS FEATURE IN PRODUCTION
+# OR TINY KITTENS SHALL DIE WITH LOTS OF SUFFERING
+auto_reload: 0
17 environments/production.yml
View
@@ -0,0 +1,17 @@
+# configuration file for production environment
+
+# only log warning and error messsages
+log: "warning"
+
+# log message to a file in logs/
+logger: "file"
+
+# don't consider warnings critical
+warnings: 0
+
+# hide errors
+show_errors: 0
+
+# cache route resolution for maximum performance
+route_cache: 1
+
8 lib/Lystyng.pm
View
@@ -6,6 +6,12 @@ Lystyng - Code for listing things
package Lystyng;
+use Dancer ':syntax';
our $VERSION = '0.0.1';
-1;
+get '/' => sub {
+ template 'index';
+};
+
+true;
+
18 public/404.html
View
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<title>Error 404</title>
+<link rel="stylesheet" href="/css/error.css" />
+<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+<h1>Error 404</h1>
+<div id="content">
+<h2>Page Not Found</h2><p>Sorry, this is the void.</p>
+</div>
+<div id="footer">
+Powered by <a href="http://perldancer.org/">Dancer</a>.
+</div>
+</body>
+</html>
18 public/500.html
View
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<title>Error 500</title>
+<link rel="stylesheet" href="/css/error.css" />
+<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+<h1>Error 500</h1>
+<div id="content">
+<h2>Internal Server Error</h2><p>Wooops, something went wrong</p>
+</div>
+<div id="footer">
+Powered by <a href="http://perldancer.org/">Dancer</a>.
+</div>
+</body>
+</html>
70 public/css/error.css
View
@@ -0,0 +1,70 @@
+body {
+ font-family: Lucida,sans-serif;
+}
+
+h1 {
+ color: #AA0000;
+ border-bottom: 1px solid #444;
+}
+
+h2 { color: #444; }
+
+pre {
+ font-family: "lucida console","monaco","andale mono","bitstream vera sans mono","consolas",monospace;
+ font-size: 12px;
+ border-left: 2px solid #777;
+ padding-left: 1em;
+}
+
+footer {
+ font-size: 10px;
+}
+
+span.key {
+ color: #449;
+ font-weight: bold;
+ width: 120px;
+ display: inline;
+}
+
+span.value {
+ color: #494;
+}
+
+/* these are for the message boxes */
+
+pre.content {
+ background-color: #eee;
+ color: #000;
+ padding: 1em;
+ margin: 0;
+ border: 1px solid #aaa;
+ border-top: 0;
+ margin-bottom: 1em;
+}
+
+div.title {
+ font-family: "lucida console","monaco","andale mono","bitstream vera sans mono","consolas",monospace;
+ font-size: 12px;
+ background-color: #aaa;
+ color: #444;
+ font-weight: bold;
+ padding: 3px;
+ padding-left: 10px;
+}
+
+pre.content span.nu {
+ color: #889;
+ margin-right: 10px;
+}
+
+pre.error {
+ background: #334;
+ color: #ccd;
+ padding: 1em;
+ border-top: 1px solid #000;
+ border-left: 1px solid #000;
+ border-right: 1px solid #eee;
+ border-bottom: 1px solid #eee;
+}
+
189 public/css/style.css
View
@@ -0,0 +1,189 @@
+
+body {
+margin: 0;
+margin-bottom: 25px;
+padding: 0;
+background-color: #ddd;
+background-image: url("/images/perldancer-bg.jpg");
+background-repeat: no-repeat;
+background-position: top left;
+
+font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
+font-size: 13px;
+color: #333;
+}
+
+h1 {
+font-size: 28px;
+color: #000;
+}
+
+a {color: #03c}
+a:hover {
+background-color: #03c;
+color: white;
+text-decoration: none;
+}
+
+#page {
+background-color: #ddd;
+width: 750px;
+margin: auto;
+margin-left: auto;
+padding-left: 0px;
+margin-right: auto;
+}
+
+#content {
+background-color: white;
+border: 3px solid #aaa;
+border-top: none;
+padding: 25px;
+width: 500px;
+}
+
+#sidebar {
+float: right;
+width: 175px;
+}
+
+#header, #about, #getting-started {
+padding-left: 75px;
+padding-right: 30px;
+}
+
+
+#header {
+background-image: url("/images/perldancer.jpg");
+background-repeat: no-repeat;
+background-position: top left;
+height: 64px;
+}
+#header h1, #header h2 {margin: 0}
+#header h2 {
+color: #888;
+font-weight: normal;
+font-size: 16px;
+}
+
+#about h3 {
+margin: 0;
+margin-bottom: 10px;
+font-size: 14px;
+}
+
+#about-content {
+background-color: #ffd;
+border: 1px solid #fc0;
+margin-left: -11px;
+}
+#about-content table {
+margin-top: 10px;
+margin-bottom: 10px;
+font-size: 11px;
+border-collapse: collapse;
+}
+#about-content td {
+padding: 10px;
+padding-top: 3px;
+padding-bottom: 3px;
+}
+#about-content td.name {color: #555}
+#about-content td.value {color: #000}
+
+#about-content.failure {
+background-color: #fcc;
+border: 1px solid #f00;
+}
+#about-content.failure p {
+margin: 0;
+padding: 10px;
+}
+
+#getting-started {
+border-top: 1px solid #ccc;
+margin-top: 25px;
+padding-top: 15px;
+}
+#getting-started h1 {
+margin: 0;
+font-size: 20px;
+}
+#getting-started h2 {
+margin: 0;
+font-size: 14px;
+font-weight: normal;
+color: #333;
+margin-bottom: 25px;
+}
+#getting-started ol {
+margin-left: 0;
+padding-left: 0;
+}
+#getting-started li {
+font-size: 18px;
+color: #888;
+margin-bottom: 25px;
+}
+#getting-started li h2 {
+margin: 0;
+font-weight: normal;
+font-size: 18px;
+color: #333;
+}
+#getting-started li p {
+color: #555;
+font-size: 13px;
+}
+
+#search {
+margin: 0;
+padding-top: 10px;
+padding-bottom: 10px;
+font-size: 11px;
+}
+#search input {
+font-size: 11px;
+margin: 2px;
+}
+#search-text {width: 170px}
+
+#sidebar ul {
+margin-left: 0;
+padding-left: 0;
+}
+#sidebar ul h3 {
+margin-top: 25px;
+font-size: 16px;
+padding-bottom: 10px;
+border-bottom: 1px solid #ccc;
+}
+#sidebar li {
+list-style-type: none;
+}
+#sidebar ul.links li {
+margin-bottom: 5px;
+}
+
+h1, h2, h3, h4, h5 {
+font-family: sans-serif;
+margin: 1.2em 0 0.6em 0;
+}
+
+p {
+line-height: 1.5em;
+margin: 1.6em 0;
+}
+
+code, tt {
+ font-family: 'Andale Mono', Monaco, 'Liberation Mono', 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', monospace;
+}
+
+#footer {
+clear: both;
+padding-top: 2em;
+text-align: center;
+padding-right: 160px;
+font-family: sans-serif;
+font-size: 10px;
+}
15 public/dispatch.cgi
View
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+use Dancer ':syntax';
+use FindBin '$RealBin';
+use Plack::Runner;
+
+# For some reason Apache SetEnv directives dont propagate
+# correctly to the dispatchers, so forcing PSGI and env here
+# is safer.
+set apphandler => 'PSGI';
+set environment => 'production';
+
+my $psgi = path($RealBin, '..', 'bin', 'app.pl');
+die "Unable to read startup script: $psgi" unless -r $psgi;
+
+Plack::Runner->run($psgi);
17 public/dispatch.fcgi
View
@@ -0,0 +1,17 @@
+#!/usr/bin/env perl
+use Dancer ':syntax';
+use FindBin '$RealBin';
+use Plack::Handler::FCGI;
+
+# For some reason Apache SetEnv directives dont propagate
+# correctly to the dispatchers, so forcing PSGI and env here
+# is safer.
+set apphandler => 'PSGI';
+set environment => 'production';
+
+my $psgi = path($RealBin, '..', 'bin', 'app.pl');
+my $app = do($psgi);
+die "Unable to read startup script: $@" if $@;
+my $server = Plack::Handler::FCGI->new(nproc => 5, detach => 1);
+
+$server->run($app);
1  public/javascripts/jquery.js
View
7 t/001_base.t
View
@@ -0,0 +1,7 @@
+use Test::More tests => 1;
+use strict;
+use warnings;
+
+use lib 'lib';
+
+use_ok 'Lystyng';
12 t/002_index_route.t
View
@@ -0,0 +1,12 @@
+use Test::More tests => 2;
+use strict;
+use warnings;
+
+use lib 'lib';
+
+# the order is important
+use Lystyng;
+use Dancer::Test;
+
+route_exists [GET => '/'], 'a route handler is defined for /';
+response_status_is ['GET' => '/'], 200, 'response status is 200 for /';
148 views/index.tt
View
@@ -0,0 +1,148 @@
+
+<!--
+ Credit goes to the Ruby on Rails team for this page
+ has been heavily based on the default Rails page that is
+ built with a scaffolded application.
+
+ Thanks a lot to them for their work.
+
+ See Ruby on Rails if you want a kickass framework in Ruby:
+ http://www.rubyonrails.org/
+-->
+
+<div id="page">
+ <div id="sidebar">
+ <ul id="sidebar-items">
+ <li>
+ <h3>Join the community</h3>
+ <ul class="links">
+
+ <li><a href="http://perldancer.org/">PerlDancer</a></li>
+ <li><a href="http://twitter.com/PerlDancer/">Official Twitter</a></li>
+ <li><a href="https://github.com/PerlDancer/Dancer/">GitHub Community</a></li>
+ </ul>
+ </li>
+
+ <li>
+ <h3>Browse the documentation</h3>
+
+ <ul class="links">
+ <li><a
+ href="http://search.cpan.org/dist/Dancer/lib/Dancer/Introduction.pod">Introduction</a></li>
+ <li><a href="http://search.cpan.org/dist/Dancer/lib/Dancer/Cookbook.pod">Cookbook</a></li>
+ <li><a href="http://search.cpan.org/dist/Dancer/lib/Dancer/Deployment.pod">Deployment Guide</a></li>
+ <li><a
+ href="http://search.cpan.org/dist/Dancer/lib/Dancer/Tutorial.pod"
+ title="a tutorial to build a small blog engine with Dancer">Tutorial</a></li>
+ </ul>
+ </li>
+
+ <li>
+ <h3>Your application's environment</h3>
+
+ <ul>
+ <li>Location: <code>/home/dcross/dev/github/lystyng/Lystyng</code></li>
+ <li>Template engine: <code><% settings.template %></code></li>
+ <li>Logger: <code><% settings.logger %></code></li>
+ <li>Environment: <code><% settings.environment %></code></li>
+ </ul>
+
+ </li>
+ </ul>
+
+ </div>
+
+ <div id="content">
+ <div id="header">
+ <h1>Perl is dancing</h1>
+ <h2>You&rsquo;ve joined the dance floor!</h2>
+ </div>
+
+ <div id="getting-started">
+ <h1>Getting started</h1>
+ <h2>Here&rsquo;s how to get dancing:</h2>
+
+ <h3><a href="#" id="about_env_link">About your application's environment</a></h3>
+
+ <div id="about-content" style="display: none;">
+ <table>
+ <tbody>
+ <tr>
+ <td>Perl version</td>
+ <td><tt><% perl_version %></tt></td>
+ </tr>
+ <tr>
+ <td>Dancer version</td>
+ <td><tt><% dancer_version %></tt></td>
+ </tr>
+ <tr>
+ <td>Backend</td>
+ <td><tt><% settings.apphandler %></tt></td>
+ </tr>
+ <tr>
+ <td>Appdir</td>
+ <td><tt>/home/dcross/dev/github/lystyng/Lystyng</tt></td>
+ </tr>
+ <tr>
+ <td>Template engine</td>
+ <td><tt><% settings.template %></tt></td>
+ </tr>
+ <tr>
+ <td>Logger engine</td>
+ <td><tt><% settings.logger %></tt></td>
+ </tr>
+ <tr>
+ <td>Running environment</td>
+ <td><tt><% settings.environment %></tt></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <script type="text/javascript">
+ $('#about_env_link').click(function() {
+ $('#about-content').slideToggle('fast', function() {
+ // ok
+ });
+ return( false );
+ });
+ </script>
+
+
+ <ol>
+ <li>
+ <h2>Tune your application</h2>
+
+ <p>
+ Your application is configured via a global configuration file,
+ <tt>config.yml</tt> and an "environment" configuration file,
+ <tt>environments/development.yml</tt>. Edit those files if you
+ want to change the settings of your application.
+ </p>
+ </li>
+
+ <li>
+ <h2>Add your own routes</h2>
+
+ <p>
+ The default route that displays this page can be removed,
+ it's just here to help you get started. The template used to
+ generate this content is located in
+ <code>views/index.tt</code>.
+ You can add some routes to <tt>lib/Lystyng.pm</tt>.
+ </p>
+ </li>
+
+ <li>
+ <h2>Enjoy web development again</h2>
+
+ <p>
+ Once you've made your changes, restart your standalone server
+ (bin/app.pl) and you're ready to test your web application.
+ </p>
+ </li>
+
+ </ol>
+ </div>
+ </div>
+ </div>
20 views/layouts/main.tt
View
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=<% settings.charset %>" />
+<title>Lystyng</title>
+<link rel="stylesheet" href="<% request.uri_base %>/css/style.css" />
+
+<script type="text/javascript">/* <![CDATA[ */
+ !window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>')
+/* ]]> */</script>
+
+</head>
+<body>
+<% content %>
+<div id="footer">
+Powered by <a href="http://perldancer.org/">Dancer</a> <% dancer_version %>
+</div>
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.