Merge branch 'common-convert' of github.com:HabitRPG/habitrpg into common-convert
Conflicts: common/public/habitrpg-shared.js
This commit is contained in:
@@ -1,107 +0,0 @@
|
||||
//var sizeOf = require('image-size');
|
||||
var _ = require('lodash');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
var timestamp = +new Date;
|
||||
|
||||
// So this sucks. Mobile Safari can't render image files > 1024x1024*3, so we have to break it down to multiple
|
||||
// files in this hack approach. See https://github.com/Ensighten/grunt-spritesmith/issues/67#issuecomment-34786248
|
||||
var images = grunt.file.expand('img/sprites/spritesmith/**/*.png');
|
||||
// var totalDims = {width:0,height:0};
|
||||
// _.each(images, function(img){
|
||||
// var dims = sizeOf(img);
|
||||
// if(!dims.width || !dims.height) console.log(dims);
|
||||
// totalDims.width += dims.width;
|
||||
// totalDims.height += dims.height;
|
||||
// })
|
||||
var COUNT = 6;//Math.ceil( (totalDims.width * totalDims.height) / (1024*1024*3) );
|
||||
//console.log({totalDims:totalDims,COUNT:COUNT});
|
||||
|
||||
var sprite = {};
|
||||
_.times(COUNT, function(i){
|
||||
var sliced = images.slice(i * (images.length/COUNT), (i+1) * images.length/COUNT)
|
||||
sprite[''+i] = {
|
||||
src: sliced,
|
||||
dest: 'dist/spritesmith'+i+'.png',
|
||||
destCss: 'dist/spritesmith'+i+'.css',
|
||||
engine: 'phantomjssmith',
|
||||
algorithm: 'binary-tree',
|
||||
padding:1,
|
||||
cssTemplate: 'css/css.template.mustache',
|
||||
cssVarMap: function (sprite) {
|
||||
// For hair, skins, beards, etc. we want to output a '.customize-options.WHATEVER' class, which works as a
|
||||
// 60x60 image pointing at the proper part of the 90x90 sprite.
|
||||
// We set up the custom info here, and the template makes use of it.
|
||||
if (sprite.name.match(/hair|skin|beard|mustach|shirt|flower/) || sprite.name=='head_0') {
|
||||
sprite.custom = {
|
||||
px: {
|
||||
offset_x: "-" + (sprite.x + 25) + "px",
|
||||
offset_y: "-" + (sprite.y + 15) + "px",
|
||||
width: "" + 60 + "px",
|
||||
height: "" + 60 + "px"
|
||||
}
|
||||
}
|
||||
}
|
||||
if (~sprite.name.indexOf('shirt'))
|
||||
sprite.custom.px.offset_y = "-" + (sprite.y + 30) + "px"; // even more for shirts
|
||||
}
|
||||
/*,cssOpts: {
|
||||
cssClass: function (item) {
|
||||
return '.' + item.name; //'.sprite-' + item.name;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
})
|
||||
|
||||
grunt.initConfig({
|
||||
|
||||
// Cleanup previous spritesmith files
|
||||
clean: {
|
||||
main: ['dist/spritesmith*.*']
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts our individual image files in img/spritesmith into a unified spritesheet.
|
||||
*/
|
||||
sprite: sprite,
|
||||
|
||||
cssmin: {
|
||||
dist: {
|
||||
options: {
|
||||
report: 'gzip'
|
||||
},
|
||||
files:{
|
||||
"dist/habitrpg-shared.css": [
|
||||
"dist/spritesmith*.css",
|
||||
"css/backer.css",
|
||||
"css/Mounts.css",
|
||||
"css/index.css"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
browserify: {
|
||||
dist: {
|
||||
src: ["index.js"],
|
||||
dest: "dist/habitrpg-shared.js"
|
||||
},
|
||||
options: {
|
||||
transform: ['coffeeify']
|
||||
//debug: true Huge data uri source map (400kb!)
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-spritesmith');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin'); // Load the plugin that provides the "uglify" task.
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
|
||||
// Default task(s).
|
||||
grunt.registerTask('default', ['cssmin', 'browserify']);
|
||||
grunt.registerTask('full', ['clean', 'sprite', 'cssmin', 'browserify']);
|
||||
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
This project's license can be obtained at https://raw2.github.com/HabitRPG/habitrpg/develop/LICENSE
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 789 B |
File diff suppressed because it is too large
Load Diff
@@ -98,6 +98,7 @@
|
||||
"phantomjssmith": "~0.5.4",
|
||||
"protractor": "~0.14.0",
|
||||
"rimraf": "^2.2.8",
|
||||
"sinon": "^1.12.2",
|
||||
"superagent": "~0.15.7",
|
||||
"superagent-defaults": "~0.1.5",
|
||||
"vinyl-source-stream": "^1.0.0",
|
||||
|
||||
@@ -10,7 +10,7 @@ superagentDefaults = require("superagent-defaults")
|
||||
request = superagentDefaults()
|
||||
moment = require("moment")
|
||||
conf = require("nconf")
|
||||
conf.argv().env().file(file: __dirname + "../config.json").defaults()
|
||||
conf.argv().env().file(file: __dirname + "../website/config.json").defaults()
|
||||
conf.set "port", "1337"
|
||||
|
||||
# Override normal ENV values with nconf ENV values (ENV values are used the same way without nconf)
|
||||
@@ -19,12 +19,12 @@ process.env.BASE_URL = conf.get("BASE_URL")
|
||||
process.env.FACEBOOK_KEY = conf.get("FACEBOOK_KEY")
|
||||
process.env.FACEBOOK_SECRET = conf.get("FACEBOOK_SECRET")
|
||||
process.env.NODE_DB_URI = "mongodb://localhost/habitrpg"
|
||||
User = require("../src/models/user").model
|
||||
Group = require("../src/models/group").model
|
||||
Challenge = require("../src/models/challenge").model
|
||||
app = require("../src/server")
|
||||
User = require("../website/src/models/user").model
|
||||
Group = require("../website/src/models/group").model
|
||||
Challenge = require("../website/src/models/challenge").model
|
||||
app = require("../website/src/server")
|
||||
shared = require("../common")
|
||||
payments = require("../src/controllers/payments")
|
||||
payments = require("../website/src/controllers/payments")
|
||||
|
||||
# ###### Helpers & Variables ######
|
||||
model = undefined
|
||||
@@ -64,7 +64,7 @@ describe "API", ->
|
||||
cb null, res.body
|
||||
|
||||
before (done) ->
|
||||
require "../src/server" # start the server
|
||||
require "../website/src/server" # start the server
|
||||
# then wait for it to do it's thing. TODO make a cb-compatible export of server
|
||||
setTimeout done, 2000
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ _ = require 'lodash'
|
||||
expect = require 'expect.js'
|
||||
sinon = require 'sinon'
|
||||
moment = require 'moment'
|
||||
shared = require '../script/index.coffee'
|
||||
shared.i18n.translations = require('habitrpg/src/i18n.js').translations
|
||||
shared = require '../../common/script/index.coffee'
|
||||
shared.i18n.translations = require('../../website/src/i18n.js').translations
|
||||
test_helper = require './test_helper'
|
||||
test_helper.addCustomMatchers()
|
||||
$w = (s)->s.split(' ')
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
Current results at https://gist.github.com/lefnire/8049676
|
||||
###
|
||||
|
||||
shared = require '../../script/index.coffee'
|
||||
shared = require '../../../common/script/index.coffee'
|
||||
_ = require 'lodash'
|
||||
$w = (s)->s.split(' ')
|
||||
|
||||
@@ -79,4 +79,4 @@ _.times [20], (lvl) ->
|
||||
u.ops.score {params:{id:u.habits[0].id},direction:'up'}
|
||||
u.fns.updateStats(u.stats) # trigger stats update
|
||||
str = mode + (if mode is 'taskbased' then " (#{u.habits[0].attribute})" else "")
|
||||
console.log str, _.pick(u.stats, $w 'per int con str')
|
||||
console.log str, _.pick(u.stats, $w 'per int con str')
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
Current results at https://gist.github.com/lefnire/8049676
|
||||
###
|
||||
|
||||
shared = require '../../script/index.coffee'
|
||||
shared = require '../../../common/script/index.coffee'
|
||||
_ = require 'lodash'
|
||||
|
||||
id = shared.uuid()
|
||||
+1
-1
@@ -30,7 +30,7 @@ if [ -z "$TRAVIS" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
NODE_DB_URI="$TEST_DB_URI" PORT=$TEST_SERVER_PORT node ./src/server.js > /dev/null &
|
||||
NODE_DB_URI="$TEST_DB_URI" PORT=$TEST_SERVER_PORT node ./website/src/server.js > /dev/null &
|
||||
NODE_PID=$!
|
||||
trap "kill $NODE_PID" EXIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user