Ind.ie is now Small Technology Foundation.
Commit 3350c906 authored by ekaitz's avatar ekaitz

[WIP] Separate in Coffee and JS folders

    - Made all the compilation scripts in Package.json
    - Move all the coffeescript to its folder:
        - Make it find Static files
        - Make it find Readme
        - Make it find Package.json
        - Make Bootstrap.js work, it needed coffeescript/require
        - Change Cakefile to get the new file locations
    - Move the compiled to JS folder:
        - It runs well: tests, npm start, and all of that

    TODO LIST:
    - Check if it can be imported
    - Correct dev, deploy... and those scripts
parent e65cfba5
.DS_Store
node_modules
npm-debug.log
build
/js
......@@ -3,7 +3,8 @@ path = require 'path'
{spawn, exec} = require 'child_process'
ncp = (require 'ncp').ncp
TARGET = 'build'
TARGET = 'js'
SOURCE = 'coffee'
build = (source, target) ->
###
......@@ -40,6 +41,9 @@ copy_recursive = (source, target) ->
###
# Copy directory recursively
###
console.log ""
console.log "COMPILING..."
console.log ""
target_dir = path.dirname target
if not fs.existsSync target_dir
......@@ -55,19 +59,26 @@ task 'build', 'Build coffeescript to javascript', (opt)->
# Compile code folders
for source in ['lib', 'test', 'routes', 'views']
target = path.join TARGET, source
source = path.join SOURCE, source
build source, target
# Compile standalone files
for source in ['server.coffee']
source = path.join SOURCE, source
build source, TARGET
# Dump static folders
for source in ['views']
target = path.join TARGET, source
source = path.join SOURCE, source
copy_recursive source, target
task 'clean', 'Remove last build', (opt)->
###
# Remove all in Manifest file and the file itself
###
console.log ""
console.log "CLEANING DIRECTORY..."
console.log ""
delete_recursive TARGET
web: node_modules/forever/bin/forever -c coffee server.coffee
\ No newline at end of file
web: node_modules/forever/bin/forever -c coffee coffee/server.coffee
// CoffeeScript bootstrap for use with (e.g.) node --debug
require("coffee-script");
require("./server");
require("coffee-script/register");
require("./coffee/server");
......@@ -12,7 +12,7 @@
exports.route = (request, response) ->
# Get the version to display in the index page.
meta = require('../package.json')
meta = require('../../package.json')
version = meta.version
response.render 'main', {version: version}
......@@ -13,7 +13,7 @@ marked = require 'marked'
fs = require 'fs'
exports.route = (request, response) ->
fs.readFile __dirname + '/../readme.md', 'utf-8', (error, markdown) ->
fs.readFile __dirname + '/../../readme.md', 'utf-8', (error, markdown) ->
data = {}
if error
......@@ -25,4 +25,4 @@ exports.route = (request, response) ->
data.title = 'Read me!'
data.readme = readme
response.render 'readme', data
\ No newline at end of file
response.render 'readme', data
......@@ -29,7 +29,7 @@ app = express()
app.engine 'html', (require './lib/set-express').__express
app.set 'view engine', 'html'
app.set 'views', __dirname + '/views'
app.use express.static('views')
app.use express.static( __dirname + '/views')
# Index: links to the readme and examples.
createRoute '/'
......
......@@ -542,4 +542,4 @@
</div>
</body>
</html>
\ No newline at end of file
</html>
npm start
\ No newline at end of file
npm start
......@@ -7,21 +7,25 @@
"type": "git",
"url": "git@source.ind.ie:project/set.git"
},
"main": "./lib/set-express.coffee",
"main": "./js/lib/set-express.js",
"files": [
"js"
],
"scripts": {
"start": "coffee server.coffee",
"test": "node_modules/.bin/mocha test/*.coffee --require coffee-script/register --require should --reporter spec --compilers coffee:coffee-script/register"
"start": "node js/server.js",
"prepublish": "cake clean && cake build",
"test": "node_modules/.bin/mocha js/test/* --require should --reporter spec"
},
"dependencies": {
"express": "4.13.3",
"forever": "0.15.1",
"jsdom": "7.0.2",
"marked": "0.3.5",
"ncp": "^2.0.0",
"superagent": "1.4.0"
},
"devDependencies": {
"coffee-script": "1.10.0",
"ncp": "^2.0.0",
"coffee-script": "^1.10.0",
"should": "*",
"mocha": "*",
"publish": "*"
......@@ -29,6 +33,10 @@
"contributors": [
{
"email": "mocking@gmail.com"
},
{
"name": "Ekaitz Zárraga",
"email": "ekaitz.zarraga@protonmail.com"
}
],
"license": "MIT",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment