Skip to content

Commit

Permalink
app directory> .app and ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
darvin committed Dec 23, 2012
1 parent f2972d6 commit 31072eb
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 88 deletions.
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
node_modules
.app/
.DS_Store
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log
node_modules
8 changes: 4 additions & 4 deletions Cakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ startCmd = pkg.scripts.start
log = (message, color, explanation) ->
console.log color + message + reset + ' ' + (explanation or '')

# Compiles app.coffee and src directory to the app directory
# Compiles app.coffee and src directory to the .app directory
build = (callback) ->
options = ['-c','-b', '-o', 'app', 'src']
options = ['-c','-b', '-o', '.app', 'src']
cmd = which.sync 'coffee'
coffee = spawn cmd, options
coffee.stdout.pipe process.stdout
Expand Down Expand Up @@ -75,14 +75,14 @@ task 'test', 'Run Mocha tests', ->

task 'dev', 'start dev env', ->
# watch_coffee
options = ['-c', '-b', '-w', '-o', 'app', 'src']
options = ['-c', '-b', '-w', '-o', '.app', 'src']
cmd = which.sync 'coffee'
coffee = spawn cmd, options
coffee.stdout.pipe process.stdout
coffee.stderr.pipe process.stderr
log 'Watching coffee files', green
# watch_js
supervisor = spawn 'node', ['./node_modules/supervisor/lib/cli-wrapper.js','-w','app,views', '-e', 'js|jade', 'server']
supervisor = spawn 'node', ['./node_modules/supervisor/lib/cli-wrapper.js','-w','.app,views', '-e', 'js|jade', 'server']
supervisor.stdout.pipe process.stdout
supervisor.stderr.pipe process.stderr
log 'Watching js files and running server', green
Expand Down
32 changes: 0 additions & 32 deletions app/controllers/posts.js

This file was deleted.

38 changes: 0 additions & 38 deletions app/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions app/models/post.js

This file was deleted.

11 changes: 11 additions & 0 deletions docs/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html> <html> <head> <title>post.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="posts.html"> posts.coffee </a> <a class="source" href="index.html"> index.coffee </a> <a class="source" href="post.html"> post.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> post.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> </td> <td class="code"> <div class="highlight"><pre><span class="nv">mongoose = </span><span class="nx">require</span> <span class="s">&#39;mongoose&#39;</span>

<span class="nv">Post = </span><span class="k">new</span> <span class="nx">mongoose</span><span class="p">.</span><span class="nx">Schema</span><span class="p">(</span>
<span class="nv">title: </span><span class="nb">String</span>
<span class="nv">body: </span><span class="nb">String</span>
<span class="nv">url: </span><span class="nb">String</span>
<span class="p">)</span>

<span class="nv">module.exports = </span><span class="nx">mongoose</span><span class="p">.</span><span class="nx">model</span> <span class="s">&#39;Post&#39;</span><span class="p">,</span> <span class="nx">Post</span>

</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
20 changes: 20 additions & 0 deletions docs/posts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html> <html> <head> <title>posts.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="posts.html"> posts.coffee </a> <a class="source" href="index.html"> index.coffee </a> <a class="source" href="post.html"> post.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> posts.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> </td> <td class="code"> <div class="highlight"><pre><span class="nv">Post = </span><span class="nx">require</span> <span class="s">&#39;../models/Post&#39;</span>

<span class="nv">module.exports = </span>
<span class="nv">index: </span><span class="nf">(req, res) -&gt;</span>
<span class="nx">Post</span><span class="p">.</span><span class="nx">find</span> <span class="p">{},</span> <span class="nf">(err, posts) -&gt;</span>
<span class="nx">res</span><span class="p">.</span><span class="nx">render</span> <span class="s">&quot;posts/index&quot;</span><span class="p">,</span>
<span class="nv">title: </span><span class="s">&quot;home&quot;</span>
<span class="nv">posts: </span><span class="nx">posts</span>

<span class="k">new</span><span class="o">:</span> <span class="nf">(req, res) -&gt;</span>
<span class="nx">res</span><span class="p">.</span><span class="nx">render</span> <span class="s">&#39;posts/new&#39;</span><span class="p">,</span> <span class="nx">title</span><span class="o">:</span><span class="s">&quot;Write New Post&quot;</span>

<span class="nv">create: </span><span class="nf">(req, res) -&gt;</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s">&#39;--------------------&#39;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>new Post(req.body.post).save ->
res.redirect "/"</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">show: </span><span class="nf">(req, res) -&gt;</span>
<span class="nx">Post</span><span class="p">.</span><span class="nx">findById</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span><span class="p">,</span> <span class="nf">(err, post) -&gt;</span>
<span class="nx">res</span><span class="p">.</span><span class="nx">render</span> <span class="s">&#39;post&#39;</span><span class="p">,</span> <span class="nv">post: </span><span class="nx">post</span><span class="p">,</span> <span class="nv">title: </span><span class="nx">post</span><span class="p">.</span><span class="nx">title</span>

</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
require('./app');
require('./.app');
88 changes: 88 additions & 0 deletions views/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
extends layout
block content
.container
.four.columns
div.
<a href="http://www.flickr.com/photos/astrapica/2560897976/" title="Uk express... by astrapi, on Flickr"><img src="http://farm4.staticflickr.com/3049/2560897976_48257593b7.jpg" width="100%" height="120px" alt="Uk express..."></a>
a.button(href="https://github.com/twilson63/express-coffee/zipball/v1.3.0") Download
&nbsp;
a.button(href="https://github.com/twilson63/express-coffee") Source
:markdown
### About

This template was built to make it very easy to get up and going on small little prototypes and weekend projects.

### Contact Us

Have questions, or would like to contribute?

* [Post an Issue](https://github.com/twilson63/express-coffee/issues)
* [Submit a pull request](https://github.com/twilson63/express-coffee)
* Follow Us on twitter! [@jackhq](http://twitter.com/jackhq)
.right.ten.columns.offset-by-two
:markdown
The express-coffee template is now upgraded to use node version 0.6.17+ and refined to utilized a few new features to get up and running.

# Features

### Automated Compile Step

express-coffee template is made to quickly start putting together an application/prototype.

Now you can run cake dev and when every coffee file is changed it will rebuild the app.

Also, it includes supervisor, which will restart you application everytime you change your views or js files.

cake dev


### Rails-like Asset Pipeline

express-coffee template comes ready to go with connect-assets a rails like asset pipeline. You can add your css and js to the assets folder. Then in jade you can reference your assets using a couple of helper methods.

!= css('mycss')
#= Pull from /assets/css/mycss.styl
!= js('app')
#= Pull from /assets/js/app.coffee or app.js

See [connect-assets](http://github.com/TrevorBurnham/connect-assets) for more information

### Jade as the default template language

express-coffee template as switched to jade as the default template language. It seems to be the clear winner and the most mature at this point. The rich featureset of integrating markdown and coffeescript and other helpers is big plus for getting things up fast.

extends layout
block content
.container
.four.columns
:markdown
# Hello World

### Skeleton CSS as the default responsive grid

skeleton is clean and basic and can easily be adjusted.

### Mocha and Request for testing

mocha is an extremely powerful and easy to use testing framework

see [http://visionmedia.github.com/mocha/](http://visionmedia.github.com/mocha/)

describe 'Sample test', ->
it 'should be true', ->
true.should.equal true

to run mocha

cake test

### Setup to deploy to heroku

rm -rf .git
git init
echo 'node_modules' >> '.gitignore'
git add .
git commit -am "first commit"
heroku create
git push heroku master
heroku open

0 comments on commit 31072eb

Please sign in to comment.