Separate IC2-Classic and IC2-Exp
@@ -127,7 +127,7 @@ module.exports = (grunt)->
|
||||
|
||||
watch:
|
||||
static:
|
||||
files: ['./static/**/*']
|
||||
files: ['./static/**/*.cg', './static/**/*.txt']
|
||||
tasks: ['rsync:static']
|
||||
coffee:
|
||||
files: ['./src/**/*.coffee']
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASE_DIR="$1"
|
||||
for FILE in $(ls $BASE_DIR/images); do
|
||||
NAME=$(basename -s.png $FILE)
|
||||
DIR="$BASE_DIR/$NAME"
|
||||
IMG_DEST="$DIR/icon.png"
|
||||
|
||||
mkdir -p $DIR
|
||||
mv "$BASE_DIR/images/$FILE" "$IMG_DEST"
|
||||
done
|
||||
@@ -1,18 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
OUTPUT_DIR='./static'
|
||||
SCRIPT='/tmp/phantomjs_render.coffee'
|
||||
USAGE=<<END
|
||||
USAGE: prerender <options>
|
||||
|
||||
if [[ "$1" != "" ]]; then
|
||||
SITEMAP_FILE="$1"
|
||||
else
|
||||
SITEMAP_FILE='./src/pages/sitemap.txt'
|
||||
fi
|
||||
Options:
|
||||
|
||||
--force : overwrite existing files (default skips)
|
||||
--clean : remove all files before starting
|
||||
--only <pattern> : restrict rendering to the given pattern
|
||||
--output <dir> : output directory (default: ./static)
|
||||
--sitemap <file> : sitemap file (default: ./static/sitemap.txt
|
||||
|
||||
END
|
||||
|
||||
CLEAN="yes"
|
||||
FORCE="no"
|
||||
OUTPUT_DIR="./static"
|
||||
SITEMAP_FILE="./static/sitemap.txt"
|
||||
while [[ "$1" != "" ]]; do
|
||||
case "$1" in
|
||||
"--force") FORCE="yes";;
|
||||
"--help") echo $USAGE; exit 0;;
|
||||
"--clean") CLEAN="yes";;
|
||||
"--only") shift; ONLY="$1";;
|
||||
"--output") shift; OUTPUT_DIR="$1";;
|
||||
"--sitemap") shift; SITEMAP_FILE="$1";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
SCRIPT='/tmp/prerender_script.coffee'
|
||||
cat > $SCRIPT <<END
|
||||
url = require('system').args[1]
|
||||
page = require('webpage').create()
|
||||
path = "#{url}".replace(/http:\/\/[^/]*/, '').replace(/^\//, '').replace(/\/$/, '')
|
||||
path = "#{url}".replace(/http:\/\/[^/]*/, '').replace(/^\//, '')
|
||||
localUrl = "http://localhost:8000/#{path}"
|
||||
|
||||
page.open localUrl, (status)->
|
||||
@@ -26,15 +47,23 @@ page.open localUrl, (status)->
|
||||
), 5000
|
||||
END
|
||||
|
||||
if [[ "$CLEAN" == "yes" ]]; then
|
||||
find "$OUTPUT_DIR/browse" -name "*.html" | xargs rm
|
||||
fi
|
||||
|
||||
cat $SITEMAP_FILE | while read URL; do
|
||||
OUTPUT_FILE=$(sed 's/http:\/\/[^/]*\///' <<< $URL)
|
||||
OUTPUT_FILE="$OUTPUT_DIR/$OUTPUT_FILE/index.html"
|
||||
OUTPUT_FILE=$(sed 's/\/\//\//' <<< $OUTPUT_FILE)
|
||||
|
||||
if [[ ! -e "$OUTPUT_FILE" ]]; then
|
||||
if [[ ! -e "$OUTPUT_FILE" || "$FORCE" == "yes" ]]; then
|
||||
mkdir -p $(dirname "$OUTPUT_FILE")
|
||||
echo "prerendering $URL into $OUTPUT_FILE"
|
||||
phantomjs --web-security=false --load-images=false $SCRIPT "$URL" >"$OUTPUT_FILE" 2>/dev/null
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "An error occured rendering $URL"
|
||||
rm "$OUTPUT_FILE" 2>/dev/null
|
||||
fi
|
||||
else
|
||||
echo "Skipping $URL..."
|
||||
fi
|
||||
|
||||
@@ -20,9 +20,9 @@ app = express()
|
||||
|
||||
app.get '*/$', (request, response)->
|
||||
response.set 'Content-Type', 'text/html'
|
||||
filePath = "#{request.path}index.html"
|
||||
filePath = "#{request.path}index.html".replace /^\//, ''
|
||||
fs.stat "#{ROOT}#{filePath}", (err, stats)->
|
||||
if stats.isFile()
|
||||
if not err?
|
||||
response.sendFile filePath, root:ROOT
|
||||
console.log ">>> #{filePath} (for #{request.path})"
|
||||
else
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
#!/usr/bin/env coffee
|
||||
|
||||
Logger = require '../src/scripts/logger'
|
||||
Logger = require '../src/coffee/logger'
|
||||
|
||||
global._ = require 'underscore'
|
||||
global.Backbone = require 'backbone'
|
||||
global.logger = new Logger level:Logger.FATAL
|
||||
|
||||
require '../src/scripts/underscore_mixins'
|
||||
require '../src/coffee/underscore_mixins'
|
||||
|
||||
Mod = require '../src/scripts/models/mod'
|
||||
ModParser = require '../src/scripts/models/mod_parser'
|
||||
ModVersionParser = require '../src/scripts/models/mod_version_parser'
|
||||
{DefaultMods} = require '../src/coffee/constants'
|
||||
Mod = require '../src/coffee/models/mod'
|
||||
ModParser = require '../src/coffee/models/mod_parser'
|
||||
ModVersionParser = require '../src/coffee/models/mod_version_parser'
|
||||
fs = require 'fs'
|
||||
|
||||
modSlugs = {}
|
||||
@@ -25,17 +26,17 @@ urls = [
|
||||
"#{base}/craft/"
|
||||
]
|
||||
|
||||
for modSlug in fs.readdirSync './src/data'
|
||||
continue if modSlug[0] is '.'
|
||||
for modSlug in DefaultMods
|
||||
modSlugs[modSlug] = modSlug
|
||||
|
||||
mod = new Mod slug:modSlug
|
||||
modParser = new ModParser model:mod
|
||||
modParser.parse fs.readFileSync "./src/data/#{modSlug}/mod.cg", 'utf-8'
|
||||
modParser.parse fs.readFileSync "./static/data/#{modSlug}/mod.cg", 'utf-8'
|
||||
|
||||
mod.eachModVersion (modVersion)->
|
||||
modVersionDataFile = "./static/data/#{modSlug}/#{modVersion.version}/mod-version.cg"
|
||||
modVersionParser = new ModVersionParser model:modVersion
|
||||
modVersionParser.parse fs.readFileSync "./src/data/#{modSlug}/#{modVersion.version}/mod-version.cg", 'utf-8'
|
||||
modVersionParser.parse fs.readFileSync modVersionDataFile, 'utf-8'
|
||||
|
||||
modVersion.eachItem (item)->
|
||||
itemSlugs[item.slug] = item.slug
|
||||
|
||||
@@ -11,7 +11,8 @@ exports.DefaultMods = [
|
||||
'applied_energistics_2',
|
||||
'buildcraft',
|
||||
'enderio',
|
||||
'industrial_craft_2',
|
||||
'ic2_classic',
|
||||
'ic2_exp',
|
||||
'railcraft',
|
||||
'thermal_expansion',
|
||||
]
|
||||
|
||||
|
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 232 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 460 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 450 B |
|
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 213 B |
|
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 606 B |
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 227 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
|
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 353 B |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 432 B After Width: | Height: | Size: 432 B |
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
|
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 232 B |
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 387 B |
|
Before Width: | Height: | Size: 432 B After Width: | Height: | Size: 432 B |
|
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 728 B After Width: | Height: | Size: 728 B |
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 232 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 453 B |
|
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
|
Before Width: | Height: | Size: 293 B After Width: | Height: | Size: 293 B |
|
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 141 B After Width: | Height: | Size: 141 B |
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 294 B |
|
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 304 B |
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 399 B After Width: | Height: | Size: 399 B |
|
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 240 B |
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 634 B After Width: | Height: | Size: 634 B |
|
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 284 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
|
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |