Restructure static files into a single directory
This commit is contained in:
+37
-65
@@ -21,7 +21,7 @@ module.exports = (grunt)->
|
|||||||
debug: true
|
debug: true
|
||||||
extensions: ['.coffee']
|
extensions: ['.coffee']
|
||||||
files:
|
files:
|
||||||
'./dist/js/main.js': ['./src/scripts/main.coffee']
|
'./dist/js/main.js': ['./src/coffee/main.coffee']
|
||||||
test:
|
test:
|
||||||
options:
|
options:
|
||||||
transform: ['coffeeify']
|
transform: ['coffeeify']
|
||||||
@@ -29,7 +29,7 @@ module.exports = (grunt)->
|
|||||||
debug: true
|
debug: true
|
||||||
extensions: ['.coffee']
|
extensions: ['.coffee']
|
||||||
files:
|
files:
|
||||||
'./dist/js/test.js': ['./test/test.coffee']
|
'./dist/js/test.js': ['./src/coffee/test/test.coffee']
|
||||||
when:
|
when:
|
||||||
options:
|
options:
|
||||||
browserifyOptions:
|
browserifyOptions:
|
||||||
@@ -40,31 +40,21 @@ module.exports = (grunt)->
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
dist: ['./dist']
|
dist: ['./dist']
|
||||||
build: ['./build']
|
|
||||||
|
|
||||||
copy:
|
copy:
|
||||||
data_cg:
|
index_prerender:
|
||||||
files: [expand:true, cwd:'./src/data', src:'**/*.cg', dest:'./dist/data']
|
files:
|
||||||
data_images:
|
'./dist/index.html': ['./static/index.html']
|
||||||
files: [expand:true, cwd:'./src/data', src:'**/*.png', dest:'./dist/data']
|
|
||||||
fonts:
|
|
||||||
files: [expand:true, cwd:'./src/fonts', src:['**/*.ttf', '**/*.woff'], dest:'./dist/fonts']
|
|
||||||
images:
|
|
||||||
files: [expand:true, cwd:'./src/images/', src:['**/*.png', '**/*.jpg'], dest:'./dist/images']
|
|
||||||
jquery_ui_images:
|
jquery_ui_images:
|
||||||
files: [expand:true, cwd:'./lib/jquery-ui/images', src:['*.png'], dest:'./dist/css/images']
|
files: [expand:true, cwd:'./lib/jquery-ui/images', src:['*.png'], dest:'./dist/css/images']
|
||||||
raw_pages:
|
|
||||||
files: [expand:true, cwd:'./src/pages', src:['**/*.html', '**/*.txt'], dest:'./dist']
|
|
||||||
rendered_pages:
|
|
||||||
files: [expand: true, cwd:'./prerender', src:['**/*.html'], dest:'./dist']
|
|
||||||
scripts:
|
scripts:
|
||||||
files:
|
files:
|
||||||
'./dist/js/backbone.js': ['./node_modules/backbone/backbone.js']
|
'./dist/js/backbone.js': ['./node_modules/backbone/backbone.js']
|
||||||
'./dist/js/chai.js': ['./node_modules/chai/chai.js']
|
'./dist/js/chai.js': ['./node_modules/chai/chai.js']
|
||||||
'./dist/js/jade.js': ['./node_modules/jade/runtime.js']
|
'./dist/js/jade.js': ['./node_modules/jade/runtime.js']
|
||||||
'./dist/js/jquery.js': ['./node_modules/jquery/dist/jquery.js']
|
'./dist/js/jquery.js': ['./node_modules/jquery/dist/jquery.js']
|
||||||
'./dist/js/jquery-ui.js': ['./lib/jquery-ui/jquery-ui.js']
|
'./dist/js/jquery-ui.js': ['./lib/jquery-ui/jquery-ui.js']
|
||||||
'./dist/js/mocha.js': ['./node_modules/mocha/mocha.js']
|
'./dist/js/mocha.js': ['./node_modules/mocha/mocha.js']
|
||||||
'./dist/js/underscore.js': ['./node_modules/underscore/underscore.js']
|
'./dist/js/underscore.js': ['./node_modules/underscore/underscore.js']
|
||||||
styles:
|
styles:
|
||||||
files: [expand:true, cwd:'./src/css', src:'**/*.scss', dest:'./dist/src/css']
|
files: [expand:true, cwd:'./src/css', src:'**/*.scss', dest:'./dist/src/css']
|
||||||
@@ -87,7 +77,7 @@ module.exports = (grunt)->
|
|||||||
pretty: true
|
pretty: true
|
||||||
files: [
|
files: [
|
||||||
expand: true
|
expand: true
|
||||||
cwd: './src/pages'
|
cwd: './src/jade'
|
||||||
src: '*.jade'
|
src: '*.jade'
|
||||||
dest: './dist'
|
dest: './dist'
|
||||||
ext: '.html'
|
ext: '.html'
|
||||||
@@ -98,29 +88,31 @@ module.exports = (grunt)->
|
|||||||
client: true
|
client: true
|
||||||
node: true
|
node: true
|
||||||
processName: (f)->
|
processName: (f)->
|
||||||
f = f.replace './src/templates/', ''
|
f = f.replace './src/jade/templates/', ''
|
||||||
f = f.replace '_view', ''
|
f = f.replace '_view', ''
|
||||||
f = f.replace '.jade', ''
|
f = f.replace '.jade', ''
|
||||||
f = f.replace /\//g, '_'
|
f = f.replace /\//g, '_'
|
||||||
return f
|
return f
|
||||||
files:
|
files:
|
||||||
'./src/scripts/views.js': ['./src/templates/**/*.jade']
|
'./src/coffee/views.js': ['./src/jade/templates/**/*.jade']
|
||||||
|
|
||||||
rename:
|
rsync:
|
||||||
scripts:
|
static:
|
||||||
src: './dist/js'
|
options:
|
||||||
dest: './build/js'
|
src: './static/'
|
||||||
|
dest: './dist/'
|
||||||
|
recursive: true
|
||||||
|
|
||||||
sass:
|
sass:
|
||||||
main:
|
build:
|
||||||
files:
|
files:
|
||||||
'./dist/css/main.css': ['./src/css/main.scss']
|
'./dist/css/main.css': ['./src/scss/main.scss']
|
||||||
dist:
|
dist:
|
||||||
options:
|
options:
|
||||||
sourcemap: 'none'
|
sourcemap: 'none'
|
||||||
style: 'compressed'
|
style: 'compressed'
|
||||||
files:
|
files:
|
||||||
'./dist/css/main.css': ['./src/css/main.scss']
|
'./dist/css/main.css': ['./src/scss/main.scss']
|
||||||
|
|
||||||
uglify:
|
uglify:
|
||||||
scripts:
|
scripts:
|
||||||
@@ -128,52 +120,32 @@ module.exports = (grunt)->
|
|||||||
maxLineLen: 20
|
maxLineLen: 20
|
||||||
files: [
|
files: [
|
||||||
expand: true
|
expand: true
|
||||||
cwd: './build/js'
|
cwd: './dist/js'
|
||||||
src: '**/*.js'
|
src: '**/*.js'
|
||||||
dest: './dist/js'
|
dest: './dist/js'
|
||||||
]
|
]
|
||||||
|
|
||||||
watch:
|
watch:
|
||||||
data_json:
|
static:
|
||||||
files: ['./src/data/**/*.json']
|
files: ['./static/**/*']
|
||||||
tasks: ['copy:data_json']
|
tasks: ['rsync:static']
|
||||||
data_cg:
|
coffee:
|
||||||
files: ['./src/data/**/*.cg']
|
files: ['./src/**/*.coffee']
|
||||||
tasks: ['copy:data_cg']
|
|
||||||
data_images:
|
|
||||||
files: ['./src/data/**/*.png']
|
|
||||||
tasks: ['copy:data_images']
|
|
||||||
fonts:
|
|
||||||
files: ['./src/fonts/**/*']
|
|
||||||
tasks: ['copy:fonts']
|
|
||||||
images:
|
|
||||||
files: ['./src/images/**/*']
|
|
||||||
tasks: ['copy:images']
|
|
||||||
source:
|
|
||||||
files: ['./src/scripts/**/*.coffee']
|
|
||||||
tasks: ['browserify:main']
|
tasks: ['browserify:main']
|
||||||
pages:
|
jade:
|
||||||
files: ['./src/pages/**/*.jade']
|
files: ['./src/**/*.jade']
|
||||||
tasks: ['jade:pages']
|
tasks: ['jade:pages', 'jade:templates']
|
||||||
templates:
|
|
||||||
files: ['./src/templates/**/*.jade']
|
|
||||||
tasks: ['jade:templates', 'browserify:main']
|
|
||||||
sass:
|
sass:
|
||||||
files: ['./src/css/**/*.scss']
|
files: ['./src/**/*.scss']
|
||||||
tasks: ['sass', 'copy:styles']
|
tasks: ['sass', 'copy:styles']
|
||||||
tests:
|
tests:
|
||||||
files: ['./src/scripts/**/*.coffee', './test/**/*.coffee']
|
files: ['./src/**/*.coffee', './test/**/*.coffee']
|
||||||
tasks: ['browserify:test']
|
tasks: ['browserify:test']
|
||||||
|
|
||||||
grunt.registerTask 'default', 'build'
|
grunt.registerTask 'default', 'build'
|
||||||
|
|
||||||
grunt.registerTask 'build', [ 'copy_for_build', 'sass:main', 'jade', 'browserify', 'exorcise' ]
|
grunt.registerTask 'build', [ 'rsync', 'copy', 'sass:build', 'jade', 'browserify', 'exorcise' ]
|
||||||
|
|
||||||
grunt.registerTask 'copy_for_build', [
|
grunt.registerTask 'dist', ['clean', 'build', 'copy:index_prerender', 'sass:dist', 'uglify']
|
||||||
'copy:data_cg', 'copy:data_images', 'copy:fonts', 'copy:images', 'copy:jquery_ui_images',
|
|
||||||
'copy:raw_pages', 'copy:scripts', 'copy:styles', 'copy:style_extras'
|
|
||||||
]
|
|
||||||
|
|
||||||
grunt.registerTask 'dist', ['clean', 'build', 'copy:rendered_pages', 'sass:dist', 'rename:scripts', 'uglify']
|
grunt.registerTask 'clean-watch', ['clean', 'build', 'watch']
|
||||||
|
|
||||||
grunt.registerTask 'full-watch', ['clean', 'build', 'watch']
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
OUTPUT_DIR='./prerender'
|
OUTPUT_DIR='./static'
|
||||||
SCRIPT='/tmp/phantomjs_render.coffee'
|
SCRIPT='/tmp/phantomjs_render.coffee'
|
||||||
|
|
||||||
if [[ "$1" != "" ]]; then
|
if [[ "$1" != "" ]]; then
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
#!/usr/bin/env coffee
|
|
||||||
#
|
|
||||||
# Crafting Guide - serve-prerendered
|
|
||||||
#
|
|
||||||
# Copyright (c) 2014-2015 by Redwood Labs
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
|
|
||||||
express = require 'express'
|
|
||||||
path = require 'path'
|
|
||||||
|
|
||||||
########################################################################################################################
|
|
||||||
|
|
||||||
ROOT = './dist'
|
|
||||||
|
|
||||||
########################################################################################################################
|
|
||||||
|
|
||||||
app = express()
|
|
||||||
|
|
||||||
app.get '*', (request, response)->
|
|
||||||
effectivePath = request.path.replace /\/$/, '/index.html'
|
|
||||||
|
|
||||||
extension = path.extname(effectivePath)
|
|
||||||
contentType = {
|
|
||||||
'.css': 'text/css'
|
|
||||||
'.html': 'text/html'
|
|
||||||
'.js': 'text/javascript'
|
|
||||||
'.json': 'application/json'
|
|
||||||
'.map': 'application/json'
|
|
||||||
'.png': 'image/png'
|
|
||||||
'.ttf': 'application/octet-stream'
|
|
||||||
'.scss': 'text/css'
|
|
||||||
}[extension]
|
|
||||||
|
|
||||||
console.log ">>> #{effectivePath}"
|
|
||||||
|
|
||||||
response.set 'Content-Type', contentType
|
|
||||||
setTimeout (-> response.sendFile effectivePath, root:ROOT), 100 # post files after a short delay
|
|
||||||
|
|
||||||
server = app.listen 8001, ->
|
|
||||||
console.log "listening at: #{server.address().address}:#{server.address().port}"
|
|
||||||
+10
-11
@@ -7,6 +7,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
express = require 'express'
|
express = require 'express'
|
||||||
|
fs = require 'fs'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
@@ -17,18 +18,16 @@ ROOT = './dist/'
|
|||||||
|
|
||||||
app = express()
|
app = express()
|
||||||
|
|
||||||
serveIndex = (request, response)->
|
app.get '*/$', (request, response)->
|
||||||
console.log ">>> index.html (for #{request.path})"
|
|
||||||
response.set 'Content-Type', 'text/html'
|
response.set 'Content-Type', 'text/html'
|
||||||
response.sendFile 'index.html', root:ROOT
|
filePath = "#{request.path}index.html"
|
||||||
|
fs.stat "#{ROOT}#{filePath}", (err, stats)->
|
||||||
app.get '/', serveIndex
|
if stats.isFile()
|
||||||
app.get '/browse(/*)?', serveIndex
|
response.sendFile filePath, root:ROOT
|
||||||
app.get '/configure(/*)?', serveIndex
|
console.log ">>> #{filePath} (for #{request.path})"
|
||||||
app.get '/craft(/*)?', serveIndex
|
else
|
||||||
app.get '/crafting(/*)?', serveIndex
|
response.sendFile '/index.html', root:ROOT
|
||||||
app.get '/item(/*)?', serveIndex
|
console.log ">>> index.html (for #{request.path})"
|
||||||
app.get '/mod(/*)?', serveIndex
|
|
||||||
|
|
||||||
app.get '*', (request, response)->
|
app.get '*', (request, response)->
|
||||||
extension = path.extname(request.path)
|
extension = path.extname(request.path)
|
||||||
|
|||||||
@@ -57,13 +57,12 @@ Text.title = 'Crafting Guide for Minecraft | The Ultimate Step-by-Step Tutorial
|
|||||||
|
|
||||||
exports.Url = Url = {}
|
exports.Url = Url = {}
|
||||||
Url.crafting = _.template "/craft/<%= inventoryText %>"
|
Url.crafting = _.template "/craft/<%= inventoryText %>"
|
||||||
Url.itemIcon = _.template "/data/<%= modSlug %>/<%= modVersion %>/images/<%= itemSlug %>.png"
|
Url.itemIcon = _.template "/browse/<%= modSlug %>/<%= itemSlug %>/icon.png"
|
||||||
Url.item = _.template "/browse/<%= modSlug %>/<%= itemSlug %>/"
|
Url.item = _.template "/browse/<%= modSlug %>/<%= itemSlug %>/"
|
||||||
Url.mod = _.template "/browse/<%= modSlug %>/"
|
Url.mod = _.template "/browse/<%= modSlug %>/"
|
||||||
Url.modData = _.template "/data/<%= modSlug %>/mod.cg"
|
Url.modData = _.template "/data/<%= modSlug %>/mod.cg"
|
||||||
Url.modLogo = _.template "/data/<%= modSlug %>/logo.png"
|
Url.modIcon = _.template "/browse/<%= modSlug %>/icon.png"
|
||||||
Url.modVersion = _.template "/data/<%= modSlug %>/<%= modVersion %>/mod-version.cg"
|
Url.modVersion = _.template "/data/<%= modSlug %>/<%= modVersion %>/mod-version.cg"
|
||||||
Url.modLogoImage = _.template "/data/<%= modSlug %>/logo.png"
|
|
||||||
|
|
||||||
exports.UrlParam = UrlParam = {}
|
exports.UrlParam = UrlParam = {}
|
||||||
UrlParam.quantity = 'count'
|
UrlParam.quantity = 'count'
|
||||||
+1
-1
@@ -30,7 +30,7 @@ module.exports = class ModController extends BaseController
|
|||||||
@$el.removeClass 'empty'
|
@$el.removeClass 'empty'
|
||||||
|
|
||||||
@$link.attr 'href', Url.mod modSlug:@model.slug
|
@$link.attr 'href', Url.mod modSlug:@model.slug
|
||||||
@$logo.attr 'src', Url.modLogo modSlug:@model.slug
|
@$logo.attr 'src', Url.modIcon modSlug:@model.slug
|
||||||
@$name.html @model.name
|
@$name.html @model.name
|
||||||
@$description.html @model.description
|
@$description.html @model.description
|
||||||
else
|
else
|
||||||
+1
-1
@@ -68,7 +68,7 @@ module.exports = class ModPageController extends PageController
|
|||||||
if @model?
|
if @model?
|
||||||
@$name.html @model.name
|
@$name.html @model.name
|
||||||
@$byline.html "by #{@model.author}"
|
@$byline.html "by #{@model.author}"
|
||||||
@$titleImage.attr 'src', Url.modLogoImage modSlug:@model.slug
|
@$titleImage.attr 'src', Url.modIcon modSlug:@model.slug
|
||||||
@$description.html @model.description
|
@$description.html @model.description
|
||||||
|
|
||||||
@$el.slideDown duration:Duration.normal
|
@$el.slideDown duration:Duration.normal
|
||||||
@@ -185,7 +185,7 @@ module.exports = class Inventory extends BaseModel
|
|||||||
stack = @_stacks[itemSlug]
|
stack = @_stacks[itemSlug]
|
||||||
if not stack?
|
if not stack?
|
||||||
stack = new Stack itemSlug:itemSlug, quantity:quantity
|
stack = new Stack itemSlug:itemSlug, quantity:quantity
|
||||||
@listenTo stack, Event.change, => @trigger Event.change
|
@listenTo stack, Event.change, => @trigger Event.change, stack
|
||||||
@_stacks[itemSlug] = stack
|
@_stacks[itemSlug] = stack
|
||||||
@_itemSlugs.push itemSlug
|
@_itemSlugs.push itemSlug
|
||||||
@_sort()
|
@_sort()
|
||||||
@@ -20,10 +20,13 @@ module.exports = class Item extends BaseModel
|
|||||||
constructor: (attributes={}, options={})->
|
constructor: (attributes={}, options={})->
|
||||||
if not attributes.name? then throw new Error 'attributes.name is required'
|
if not attributes.name? then throw new Error 'attributes.name is required'
|
||||||
|
|
||||||
|
attributes.description ?= null
|
||||||
attributes.group ?= Item.Group.Other
|
attributes.group ?= Item.Group.Other
|
||||||
attributes.isGatherable ?= false
|
attributes.isGatherable ?= false
|
||||||
attributes.modVersion ?= null
|
attributes.modVersion ?= null
|
||||||
|
attributes.officialUrl ?= null
|
||||||
attributes.slug ?= ItemSlug.slugify attributes.name
|
attributes.slug ?= ItemSlug.slugify attributes.name
|
||||||
|
attributes.videos ?= []
|
||||||
|
|
||||||
options.logEvents ?= false
|
options.logEvents ?= false
|
||||||
super attributes, options
|
super attributes, options
|
||||||
+32
-4
@@ -39,10 +39,11 @@ module.exports = class CommandParserVersionBase
|
|||||||
@_rawData = {}
|
@_rawData = {}
|
||||||
@_lineNumber = 1
|
@_lineNumber = 1
|
||||||
|
|
||||||
lines = text.split '\n'
|
@_lines = text.split '\n'
|
||||||
for i in [0...lines.length]
|
@_lineNumber = 0
|
||||||
@_lineNumber = i + 1
|
while @_lineNumber < @_lines.length
|
||||||
commands = @_parseLine lines[i]
|
@_lineNumber += 1
|
||||||
|
commands = @_parseLine @_lines[@_lineNumber - 1]
|
||||||
for command in commands
|
for command in commands
|
||||||
@_handleErrors @_execute, command
|
@_handleErrors @_execute, command
|
||||||
|
|
||||||
@@ -77,6 +78,8 @@ module.exports = class CommandParserVersionBase
|
|||||||
line = line.trim()
|
line = line.trim()
|
||||||
return [] if line.length is 0
|
return [] if line.length is 0
|
||||||
|
|
||||||
|
hereDoc = @_parseHereDoc line
|
||||||
|
|
||||||
lineParts = (part.trim() for part in line.split(';'))
|
lineParts = (part.trim() for part in line.split(';'))
|
||||||
commands = []
|
commands = []
|
||||||
for linePart in lineParts
|
for linePart in lineParts
|
||||||
@@ -87,6 +90,7 @@ module.exports = class CommandParserVersionBase
|
|||||||
|
|
||||||
args = []
|
args = []
|
||||||
args = (s.trim() for s in match[2].split(',')) if match[2]?
|
args = (s.trim() for s in match[2].split(',')) if match[2]?
|
||||||
|
args.push hereDoc if hereDoc
|
||||||
commands.push name:match[1], args:args
|
commands.push name:match[1], args:args
|
||||||
|
|
||||||
return commands
|
return commands
|
||||||
@@ -100,3 +104,27 @@ module.exports = class CommandParserVersionBase
|
|||||||
e.message = "line #{@_lineNumber}: #{e.message}"
|
e.message = "line #{@_lineNumber}: #{e.message}"
|
||||||
if not @_showAllErrors then throw e
|
if not @_showAllErrors then throw e
|
||||||
logger.error -> e.message
|
logger.error -> e.message
|
||||||
|
|
||||||
|
_parseHereDoc: (line)->
|
||||||
|
hereDocIndex = line.indexOf '<<-'
|
||||||
|
return null unless hereDocIndex isnt -1
|
||||||
|
|
||||||
|
hereDocStopText = line[hereDocIndex+3...line.length]
|
||||||
|
hereDocLines = []
|
||||||
|
while true
|
||||||
|
@_lineNumber += 1
|
||||||
|
break if @_lineNumber >= @_lines.length
|
||||||
|
|
||||||
|
nextLine = @_lines[@_lineNumber-1]
|
||||||
|
break if nextLine.trim() is hereDocStopText
|
||||||
|
hereDocLines.push nextLine
|
||||||
|
|
||||||
|
shortestIndent = Number.MAX_VALUE
|
||||||
|
for line in hereDocLines
|
||||||
|
shortestIndent = Math.min line.match(/( *).*/)[1].length, shortestIndent
|
||||||
|
|
||||||
|
for i in [0...hereDocLines.length]
|
||||||
|
hereDocLines[i] = hereDocLines[i][shortestIndent..]
|
||||||
|
|
||||||
|
return null unless hereDocLines.length > 0
|
||||||
|
return hereDocLines.join '\n'
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
###
|
||||||
|
Crafting Guide - item_parser_v1.coffee
|
||||||
|
|
||||||
|
Copyright (c) 2015 by Redwood Labs
|
||||||
|
All rights reserved.
|
||||||
|
###
|
||||||
|
|
||||||
|
CommandParserVersionBase = require './command_parser_version_base'
|
||||||
|
|
||||||
|
########################################################################################################################
|
||||||
|
|
||||||
|
module.exports = class ItemParserV1 extends CommandParserVersionBase
|
||||||
|
|
||||||
|
# CommandParserVersionBase Overrides ###########################################################
|
||||||
|
|
||||||
|
_buildModel: (rawData, model)->
|
||||||
|
@_buildItem rawData, model
|
||||||
|
|
||||||
|
_unparseModel: (builder, model)->
|
||||||
|
@_unparseItem builder, model
|
||||||
|
|
||||||
|
# Command Methods ##############################################################################
|
||||||
|
|
||||||
|
_command_description: (textParts...)->
|
||||||
|
@_rawData.text ?= ''
|
||||||
|
@_rawData.text += textParts.join ', '
|
||||||
|
|
||||||
|
_command_officialUrl: (officialUrl)->
|
||||||
|
if @_rawData.officialUrl? then throw new Error 'duplicate declaration of "officialUrl"'
|
||||||
|
if officialUrl.length is 0 then throw new Error 'officialUrl cannot be empty'
|
||||||
|
@_rawData.officialUrl = officialUrl
|
||||||
|
|
||||||
|
_command_video: (youTubeId, name)->
|
||||||
|
if not youTubeId?.length then throw new Error 'video declaration requires a YouTubeID'
|
||||||
|
if not name?.length then throw new Error 'video declaration requires a name'
|
||||||
|
|
||||||
|
@_rawData.videos ?= []
|
||||||
|
@_rawData.videos.push youTubeId:youTubeId, name:name
|
||||||
|
|
||||||
|
# Object Building Methods ######################################################################
|
||||||
|
|
||||||
|
_buildItem: (rawData, model)->
|
||||||
|
item.description = rawData.description if rawData.description
|
||||||
|
item.officialUrl = rawData.officialUrl if rawData.officialUrl
|
||||||
|
item.videos = rawData.videos if rawData.videos
|
||||||
+1
-1
@@ -11,7 +11,7 @@ ModVersion = require '../mod_version'
|
|||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
module.exports = class ModParserV2 extends CommandParserVersionBase
|
module.exports = class ModParserV1 extends CommandParserVersionBase
|
||||||
|
|
||||||
# CommandParserVersionBase Overrides ###########################################################
|
# CommandParserVersionBase Overrides ###########################################################
|
||||||
|
|
||||||
@@ -5,11 +5,11 @@ Copyright (c) 2014-2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
CraftingPlan = require '../src/scripts/models/crafting_plan'
|
CraftingPlan = require '../models/crafting_plan'
|
||||||
ItemSlug = require '../src/scripts/models/item_slug'
|
ItemSlug = require '../models/item_slug'
|
||||||
Mod = require '../src/scripts/models/mod'
|
Mod = require '../models/mod'
|
||||||
ModPack = require '../src/scripts/models/mod_pack'
|
ModPack = require '../models/mod_pack'
|
||||||
ModVersion = require '../src/scripts/models/mod_version'
|
ModVersion = require '../models/mod_version'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -5,11 +5,11 @@
|
|||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
{Event} = require '../src/scripts/constants'
|
{Event} = require '../constants'
|
||||||
EventRecorder = require './event_recorder'
|
EventRecorder = require './event_recorder'
|
||||||
Inventory = require '../src/scripts/models/inventory'
|
Inventory = require '../models/inventory'
|
||||||
Item = require '../src/scripts/models/item'
|
Item = require '../models/item'
|
||||||
ItemSlug = require '../src/scripts/models/item_slug'
|
ItemSlug = require '../models/item_slug'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -208,4 +208,4 @@ describe 'inventory.coffee', ->
|
|||||||
it 'emits the proper events', ->
|
it 'emits the proper events', ->
|
||||||
events = new EventRecorder inventory
|
events = new EventRecorder inventory
|
||||||
inventory.remove 'wool'
|
inventory.remove 'wool'
|
||||||
events.names.should.eql [Event.remove, Event.change]
|
events.names.should.eql [Event.change, Event.remove, Event.change]
|
||||||
@@ -5,7 +5,7 @@ Copyright (c) 2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
ItemSlug = require '../src/scripts/models/item_slug'
|
ItemSlug = require '../models/item_slug'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ Copyright (c) 2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
Mod = require '../src/scripts/models/mod'
|
Mod = require '../models/mod'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -5,11 +5,11 @@ Copyright (c) 2014-2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
Item = require '../src/scripts/models/item'
|
Item = require '../models/item'
|
||||||
ItemSlug = require '../src/scripts/models/item_slug'
|
ItemSlug = require '../models/item_slug'
|
||||||
Mod = require '../src/scripts/models/mod'
|
Mod = require '../models/mod'
|
||||||
ModPack = require '../src/scripts/models/mod_pack'
|
ModPack = require '../models/mod_pack'
|
||||||
ModVersion = require '../src/scripts/models/mod_version'
|
ModVersion = require '../models/mod_version'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -82,22 +82,22 @@ describe 'mod_pack.coffee', ->
|
|||||||
|
|
||||||
it 'returns all data for a regular Minecraft item', ->
|
it 'returns all data for a regular Minecraft item', ->
|
||||||
display = modPack.findItemDisplay ItemSlug.slugify 'bed'
|
display = modPack.findItemDisplay ItemSlug.slugify 'bed'
|
||||||
display.iconUrl.should.equal '/data/minecraft/1.7.10/images/bed.png'
|
display.iconUrl.should.equal '/browse/minecraft/bed/icon.png'
|
||||||
display.itemUrl.should.equal '/mod/minecraft/bed'
|
display.itemUrl.should.equal '/browse/minecraft/bed/'
|
||||||
display.itemName.should.equal 'Bed'
|
display.itemName.should.equal 'Bed'
|
||||||
display.modSlug.should.equal 'minecraft'
|
display.modSlug.should.equal 'minecraft'
|
||||||
|
|
||||||
it 'returns all data for an item in an enabled mod', ->
|
it 'returns all data for an item in an enabled mod', ->
|
||||||
buildcraft.activeVersion = '6.2.6'
|
buildcraft.activeVersion = '6.2.6'
|
||||||
display = modPack.findItemDisplay ItemSlug.slugify 'stone_gear'
|
display = modPack.findItemDisplay ItemSlug.slugify 'stone_gear'
|
||||||
display.iconUrl.should.equal '/data/buildcraft/6.2.6/images/stone_gear.png'
|
display.iconUrl.should.equal '/browse/buildcraft/stone_gear/icon.png'
|
||||||
display.itemUrl.should.equal '/mod/buildcraft/stone_gear'
|
display.itemUrl.should.equal '/browse/buildcraft/stone_gear/'
|
||||||
display.itemName.should.equal 'Stone Gear'
|
display.itemName.should.equal 'Stone Gear'
|
||||||
display.modSlug.should.equal 'buildcraft'
|
display.modSlug.should.equal 'buildcraft'
|
||||||
|
|
||||||
it 'assumes an unfound item is from Minecraft', ->
|
it 'assumes an unfound item is from Minecraft', ->
|
||||||
display = modPack.findItemDisplay ItemSlug.slugify 'iron_chestplate'
|
display = modPack.findItemDisplay ItemSlug.slugify 'iron_chestplate'
|
||||||
display.iconUrl.should.equal '/data/minecraft/1.7.10/images/iron_chestplate.png'
|
display.iconUrl.should.equal '/browse/minecraft/iron_chestplate/icon.png'
|
||||||
display.itemUrl.should.equal '/mod/minecraft/iron_chestplate'
|
display.itemUrl.should.equal '/browse/minecraft/iron_chestplate/'
|
||||||
display.itemName.should.equal 'Iron Chestplate'
|
display.itemName.should.equal 'Iron Chestplate'
|
||||||
display.modSlug.should.equal 'minecraft'
|
display.modSlug.should.equal 'minecraft'
|
||||||
@@ -5,9 +5,9 @@ Copyright (c) 2014-2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
Item = require '../src/scripts/models/item'
|
Item = require '../models/item'
|
||||||
ItemSlug = require '../src/scripts/models/item_slug'
|
ItemSlug = require '../models/item_slug'
|
||||||
ModVersion = require '../src/scripts/models/mod_version'
|
ModVersion = require '../models/mod_version'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
###
|
||||||
|
Crafting Guide - command_parser_version_base.test.coffee
|
||||||
|
|
||||||
|
Copyright (c) 2015 by Redwood Labs
|
||||||
|
All rights reserved.
|
||||||
|
###
|
||||||
|
|
||||||
|
CommandParserVersionBase = require '../../models/parser_versions/command_parser_version_base'
|
||||||
|
|
||||||
|
########################################################################################################################
|
||||||
|
|
||||||
|
parser = null
|
||||||
|
|
||||||
|
########################################################################################################################
|
||||||
|
|
||||||
|
describe 'command_parser_version_base.coffee', ->
|
||||||
|
|
||||||
|
beforeEach -> parser = new CommandParserVersionBase model:{}
|
||||||
|
|
||||||
|
describe '_parseHereDoc', ->
|
||||||
|
|
||||||
|
it 'returns null for non-heredoc lines', ->
|
||||||
|
result = parser._parseHereDoc 'foobar: baz'
|
||||||
|
expect(result).to.be.null
|
||||||
|
|
||||||
|
it 'identifies the right text for a real heredoc', ->
|
||||||
|
parser._lines = ['command: <<-END', 'alpha', 'bravo', 'charlie', 'END', 'command1: arg2']
|
||||||
|
parser._lineNumber = 1
|
||||||
|
|
||||||
|
result = parser._parseHereDoc parser._lines[0]
|
||||||
|
result.should.equal 'alpha\nbravo\ncharlie'
|
||||||
|
|
||||||
|
it 'identifies an empty heredoc', ->
|
||||||
|
parser._lines = ['command: <<-END', 'END']
|
||||||
|
parser._lineNumber = 1
|
||||||
|
|
||||||
|
result = parser._parseHereDoc parser._lines[0]
|
||||||
|
expect(result).to.be.null
|
||||||
|
|
||||||
|
it 'trims smallest leading whitespace', ->
|
||||||
|
parser._lines = ['command: <<-END', ' alpha', ' bravo', ' charlie', 'END', 'command1: arg2']
|
||||||
|
parser._lineNumber = 1
|
||||||
|
|
||||||
|
result = parser._parseHereDoc parser._lines[0]
|
||||||
|
result.should.equal 'alpha\n bravo\ncharlie'
|
||||||
+4
-4
@@ -5,10 +5,10 @@ Copyright (c) 2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
CommandParserVersionBase = require '../../src/scripts/models/parser_versions/command_parser_version_base'
|
CommandParserVersionBase = require '../../models/parser_versions/command_parser_version_base'
|
||||||
ItemSlug = require '../../src/scripts/models/item_slug'
|
ItemSlug = require '../../models/item_slug'
|
||||||
ModVersion = require '../../src/scripts/models/mod_version'
|
ModVersion = require '../../models/mod_version'
|
||||||
ModVersionParserV1 = require '../../src/scripts/models/parser_versions/mod_version_parser_v1'
|
ModVersionParserV1 = require '../../models/parser_versions/mod_version_parser_v1'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -5,10 +5,10 @@ Copyright (c) 2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
Item = require '../src/scripts/models/item'
|
Item = require '../models/item'
|
||||||
ItemSlug = require '../src/scripts/models/item_slug'
|
ItemSlug = require '../models/item_slug'
|
||||||
Recipe = require '../src/scripts/models/recipe'
|
Recipe = require '../models/recipe'
|
||||||
Stack = require '../src/scripts/models/stack'
|
Stack = require '../models/stack'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ Copyright (c) 2015 by Redwood Labs
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
StringBuilder = require '../src/scripts/models/string_builder'
|
StringBuilder = require '../models/string_builder'
|
||||||
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
@@ -18,11 +18,11 @@ global.expect = chai.expect
|
|||||||
global.should = chai.should()
|
global.should = chai.should()
|
||||||
global.util = require 'util'
|
global.util = require 'util'
|
||||||
|
|
||||||
Logger = require '../src/scripts/logger'
|
Logger = require '../logger'
|
||||||
global.logger = new Logger level:Logger.DEBUG
|
global.logger = new Logger level:Logger.DEBUG
|
||||||
|
|
||||||
require '../src/scripts/polyfill'
|
require '../polyfill'
|
||||||
require '../src/scripts/underscore_mixins'
|
require '../underscore_mixins'
|
||||||
|
|
||||||
# Test Registry ########################################################################################################
|
# Test Registry ########################################################################################################
|
||||||
|
|
||||||
@@ -36,6 +36,7 @@ require './recipe.test'
|
|||||||
require './mod_version.test'
|
require './mod_version.test'
|
||||||
require './mod.test'
|
require './mod.test'
|
||||||
require './mod_pack.test'
|
require './mod_pack.test'
|
||||||
|
require './parser_versions/command_parser_version_base.test'
|
||||||
require './parser_versions/mod_version_parser_v1.test'
|
require './parser_versions/mod_version_parser_v1.test'
|
||||||
require './crafting_plan.test'
|
require './crafting_plan.test'
|
||||||
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
.view__home_page
|
.view__home_page
|
||||||
.sidebar
|
.sidebar
|
||||||
.titleImage <a href="/browse/minecraft/"><img src="/data/minecraft/logo.png"></a>
|
.titleImage <a href="/browse/minecraft/"><img src="/browse/minecraft/icon.png"></a>
|
||||||
.titleImage <a href="/browse/buildcraft/"><img src="/data/buildcraft/logo.png"></a>
|
.titleImage <a href="/browse/buildcraft/"><img src="/browse/buildcraft/icon.png"></a>
|
||||||
.titleImage <a href="/browse/industrial_craft_2/"><img src="/data/industrial_craft_2/logo.png"></a>
|
.titleImage <a href="/browse/industrial_craft_2/"><img src="/browse/industrial_craft_2/icon.png"></a>
|
||||||
.titleImage <a href="/browse/applied_energistics_2/"><img src="/data/applied_energistics_2/logo.png"></a>
|
.titleImage <a href="/browse/applied_energistics_2/"><img src="/browse/applied_energistics_2/icon.png"></a>
|
||||||
.titleImage <a href="/browse/thermal_expansion/"><img src="/data/thermal_expansion/logo.png"></a>
|
.titleImage <a href="/browse/thermal_expansion/"><img src="/browse/thermal_expansion/icon.png"></a>
|
||||||
.titleImage <a href="/browse/enderio/"><img src="/data/enderio/logo.png"></a>
|
.titleImage <a href="/browse/enderio/"><img src="/browse/enderio/icon.png"></a>
|
||||||
.titleImage <a href="/browse/railcraft/"><img src="/data/railcraft/logo.png"></a>
|
.titleImage <a href="/browse/railcraft/"><img src="/browse/railcraft/icon.png"></a>
|
||||||
|
|
||||||
include ./includes/_sidebar_skyscraper.html
|
include ./includes/_sidebar_skyscraper.html
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user