Split flag parrots into their own bundle.
|
@ -3,6 +3,7 @@ node_modules/
|
|||
parrots.zip
|
||||
guests.zip
|
||||
dist/
|
||||
.cache/
|
||||
|
||||
# Created by https://www.gitignore.io/api/vim,osx
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
[
|
||||
{
|
||||
"hd": "hd/americaparrot.gif",
|
||||
"name": "American Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/canadaparrot.gif",
|
||||
"name": "Canadian Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/mexicoparrot.gif",
|
||||
"name": "Mexican Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/serbiaparrot.gif",
|
||||
"name": "Serbian Parrot"
|
||||
},
|
||||
{
|
||||
"gif": "prideparrot.gif",
|
||||
"hd": "hd/prideparrot.gif",
|
||||
"name": "Pride Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/trans-parrot.gif",
|
||||
"name": "Trans Flag Parrot",
|
||||
"tip": "Transgender flag pride parrot"
|
||||
}
|
||||
]
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
@ -67,6 +67,7 @@ gulp.task('render-web', function () {
|
|||
var renderData = {
|
||||
parrots: JSON.parse(fs.readFileSync('parrots.json')).map(ParrotObjectAsSlackName),
|
||||
guests: JSON.parse(fs.readFileSync('guests.json')).map(ParrotObjectAsSlackName),
|
||||
flags: JSON.parse(fs.readFileSync('flags.json')).map(ParrotObjectAsSlackName),
|
||||
files: assets
|
||||
};
|
||||
return gulp.src(['templates/index.html', 'templates/parrotparty.yaml'])
|
||||
|
|
11
make
|
@ -107,17 +107,23 @@ function images () {
|
|||
|
||||
cp -r parrots dist/parrots
|
||||
cp -r guests dist/guests
|
||||
cp -r flags dist/flags
|
||||
}
|
||||
|
||||
# Make gif's into zip files.
|
||||
function compress () {
|
||||
header "compress"
|
||||
printf " ~= Party or Die =~\\n~= cultofthepartyparrot.com =~" | zip -u -o -r -z "$CACHE_DIR/parrots.zip" ./parrots/*
|
||||
printf " ~= Party or Die =~\\n~= cultofthepartyparrot.com =~" | zip -q -o -r -z "$CACHE_DIR/parrots.zip" ./parrots/*
|
||||
cp "$CACHE_DIR/parrots.zip" "dist/parrots.zip"
|
||||
mv dist/parrots.zip "dist/$(update_manifest dist/parrots.zip)"
|
||||
printf " ~= Party or Die =~\\n~= cultofthepartyparrot.com =~" | zip -u -o -r -z "$CACHE_DIR/guests.zip" ./guests/*
|
||||
|
||||
printf " ~= Party or Die =~\\n~= cultofthepartyparrot.com =~" | zip -q -o -r -z "$CACHE_DIR/guests.zip" ./guests/*
|
||||
cp "$CACHE_DIR/guests.zip" "dist/guests.zip"
|
||||
mv dist/guests.zip "dist/$(update_manifest dist/guests.zip)"
|
||||
|
||||
printf " ~= Party or Die =~\\n~= cultofthepartyparrot.com =~" | zip -q -o -r -z "$CACHE_DIR/flags.zip" ./flags/*
|
||||
cp "$CACHE_DIR/flags.zip" "dist/flags.zip"
|
||||
mv dist/flags.zip "dist/$(update_manifest dist/flags.zip)"
|
||||
}
|
||||
|
||||
# Run tests with gulp
|
||||
|
@ -157,6 +163,7 @@ function main () {
|
|||
;;
|
||||
"build")
|
||||
header "build"
|
||||
test
|
||||
clean
|
||||
css
|
||||
images
|
||||
|
|
26
parrots.json
|
@ -339,11 +339,6 @@
|
|||
"hd": "hd/scienceparrot.gif",
|
||||
"name": "Science Parrot"
|
||||
},
|
||||
{
|
||||
"gif": "prideparrot.gif",
|
||||
"hd": "hd/prideparrot.gif",
|
||||
"name": "Pride Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/revolutionparrot.gif",
|
||||
"name": "Revolution Parrot"
|
||||
|
@ -502,11 +497,6 @@
|
|||
"hd": "hd/whitewalkerparrot.gif",
|
||||
"name": "White Walker Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/trans-parrot.gif",
|
||||
"name": "Trans Flag Parrot",
|
||||
"tip": "Transgender flag pride parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/calvinist_parrot.gif",
|
||||
"name": "Calvinist Parrot"
|
||||
|
@ -546,22 +536,6 @@
|
|||
"hd": "hd/pingpongparrot.gif",
|
||||
"name": "Ping Pong Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/americaparrot.gif",
|
||||
"name": "American Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/canadaparrot.gif",
|
||||
"name": "Canadian Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/mexicoparrot.gif",
|
||||
"name": "Mexican Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/serbiaparrot.gif",
|
||||
"name": "Serbian Parrot"
|
||||
},
|
||||
{
|
||||
"hd": "hd/laptop_parrot.gif",
|
||||
"name": "Laptop Parrot"
|
||||
|
|
|
@ -93,6 +93,20 @@
|
|||
|
||||
<hr/>
|
||||
|
||||
<h3>Flag Parrots</h3>
|
||||
|
||||
<ul>
|
||||
{{#flags}}
|
||||
<li><img src="/flags/{{#hd}}{{{hd}}}{{/hd}}{{^hd}}{{gif}}{{/hd}}" alt="{{name}}"/> {{name}}{{#hd}}<span class="hd">HD</span>{{/hd}}{{#tip}}<span tooltip="{{tip}}">*</span>{{/tip}}</li>
|
||||
{{/flags}}
|
||||
</ul>
|
||||
|
||||
<div id="other_download">
|
||||
<a class="button-small" id="flags_zip" href="/{{files.flags_zip}}">Download</a>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h3>Party Guests</h3>
|
||||
|
||||
<ul>
|
||||
|
|
|
@ -5,3 +5,13 @@ emojis:
|
|||
src: 'http://cultofthepartyparrot.com/parrots/{{#hd}}{{{hd}}}{{/hd}}{{^hd}}{{gif}}{{/hd}}'
|
||||
fullname: {{name}}
|
||||
{{/parrots}}
|
||||
{{#guests}}
|
||||
- name: {{slack_name}}
|
||||
src: 'http://cultofthepartyparrot.com/guests/{{#hd}}{{{hd}}}{{/hd}}{{^hd}}{{gif}}{{/hd}}'
|
||||
fullname: {{name}}
|
||||
{{/guests}}
|
||||
{{#flags}}
|
||||
- name: {{slack_name}}
|
||||
src: 'http://cultofthepartyparrot.com/flags/{{#hd}}{{{hd}}}{{/hd}}{{^hd}}{{gif}}{{/hd}}'
|
||||
fullname: {{name}}
|
||||
{{/flags}}
|
||||
|
|
112
test/json.js
|
@ -22,90 +22,48 @@ var json_schema = {
|
|||
}
|
||||
};
|
||||
|
||||
describe("parrots.json", function () {
|
||||
it("should validate", function () {
|
||||
var parrots_json = JSON.parse(fs.readFileSync(__dirname + '/../parrots.json', 'utf8')),
|
||||
validation_result = validate(parrots_json, json_schema);
|
||||
['parrots.json', 'guests.json', 'flags.json'].forEach(function(jsonFile) {
|
||||
describe(jsonFile, function () {
|
||||
let gifPath = jsonFile.replace('.json', '')
|
||||
let gif_json = JSON.parse(fs.readFileSync(__dirname + '/../' + jsonFile, 'utf8'));
|
||||
|
||||
// Schema errors in mocha are pretty useless, so print some here.
|
||||
validation_result.errors.forEach(function (e) {
|
||||
var header = "-- " + e.toString() + " ------------",
|
||||
footer = "";
|
||||
for(var i = 0; i < header.length; i++) { footer += '-'; } // lol
|
||||
console.log("\n" + header);
|
||||
console.log(e.instance);
|
||||
console.log(footer + "\n");
|
||||
it("should validate", function () {
|
||||
validation_result = validate(gif_json, json_schema);
|
||||
|
||||
// Schema errors in mocha are pretty useless, so print some here.
|
||||
validation_result.errors.forEach(function (e) {
|
||||
var header = "-- " + e.toString() + " ------------",
|
||||
footer = "";
|
||||
for(var i = 0; i < header.length; i++) { footer += '-'; } // lol
|
||||
console.log("\n" + header);
|
||||
console.log(e.instance);
|
||||
console.log(footer + "\n");
|
||||
});
|
||||
|
||||
assert.equal(0, validation_result.errors.length);
|
||||
});
|
||||
|
||||
assert.equal(0, validation_result.errors.length);
|
||||
});
|
||||
|
||||
it("should not have extra gifs", function () {
|
||||
var parrots_json = JSON.parse(fs.readFileSync(__dirname + '/../parrots.json', 'utf8'));
|
||||
parrots_json.forEach(function(parrot) {
|
||||
assert.ok(fs.existsSync(__dirname + '/../parrots/' + parrot.gif) || fs.existsSync(__dirname + '/../parrots/' + parrot.hd), parrot.name);
|
||||
it("should not have extra gifs", function () {
|
||||
gif_json.forEach(function(entry) {
|
||||
assert.ok(fs.existsSync(__dirname + '/../' + gifPath + '/' + entry.gif) || fs.existsSync(__dirname + '/../' + gifPath + '/' + entry.hd), entry.name);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("should contain all gifs", function () {
|
||||
var parrots = JSON.parse(fs.readFileSync(__dirname + '/../parrots.json', 'utf8')).map(function(parrot) { return parrot.gif; }).filter(function(gif) { return gif != undefined; });
|
||||
var parrot_gifs = fs.readdirSync(__dirname + '/../parrots');
|
||||
parrot_gifs.forEach(function(gif) {
|
||||
if(! fs.statSync(__dirname + '/../parrots/' + gif).isFile()) { return; }
|
||||
assert.ok(-1 !== parrots.indexOf(gif), gif);
|
||||
it("should contain all gifs", function () {
|
||||
let gifs = fs.readdirSync(__dirname + '/../' + gifPath);
|
||||
gifs.forEach(function(gif) {
|
||||
if(! fs.statSync(__dirname + '/../' + gifPath + '/' + gif).isFile()) { return; }
|
||||
assert.ok(-1 !== gifs.indexOf(gif), gif);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("should contain all HD gifs", function () {
|
||||
var hd_parrots = JSON.parse(fs.readFileSync(__dirname + '/../parrots.json', 'utf8')).map(function(parrot) { return parrot.hd; }).filter(function(hd) { return hd != undefined; });
|
||||
var parrot_hd_gifs = fs.readdirSync(__dirname + '/../parrots/hd');
|
||||
parrot_hd_gifs.forEach(function(gif) {
|
||||
if(! fs.statSync(__dirname + '/../parrots/hd/' + gif).isFile()) { return; }
|
||||
assert.ok(-1 !== hd_parrots.indexOf('hd/' + gif), gif);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("guests.json", function () {
|
||||
it("should validate", function () {
|
||||
var guests_json = JSON.parse(fs.readFileSync(__dirname + '/../guests.json', 'utf8')),
|
||||
validation_result = validate(guests_json, json_schema);
|
||||
|
||||
// Schema errors in mocha are pretty useless, so print some here.
|
||||
validation_result.errors.forEach(function (e) {
|
||||
var header = "-- " + e.toString() + " ------------",
|
||||
footer = "";
|
||||
for(var i = 0; i < header.length; i++) { footer += '-'; } // lol
|
||||
console.log("\n" + header);
|
||||
console.log(e.instance);
|
||||
console.log(footer + "\n");
|
||||
});
|
||||
|
||||
assert.equal(0, validation_result.errors.length);
|
||||
});
|
||||
|
||||
it("should not have extra gifs", function () {
|
||||
var guests_json = JSON.parse(fs.readFileSync(__dirname + '/../guests.json', 'utf8'));
|
||||
guests_json.forEach(function(guests) {
|
||||
assert.ok(fs.existsSync(__dirname + '/../guests/' + guests.gif) || fs.existsSync(__dirname + '/../guests/' + guests.hd), guests.name);
|
||||
});
|
||||
});
|
||||
|
||||
it("should contain all gifs", function () {
|
||||
var guests = JSON.parse(fs.readFileSync(__dirname + '/../guests.json', 'utf8')).map(function(guests) { return guests.gif; }).filter(function(gif) { return gif != undefined; });
|
||||
var guests_gifs = fs.readdirSync(__dirname + '/../guests');
|
||||
guests_gifs.forEach(function(gif) {
|
||||
if(! fs.statSync(__dirname + '/../guests/' + gif).isFile()) { return; }
|
||||
assert.ok(-1 !== guests.indexOf(gif), gif);
|
||||
});
|
||||
});
|
||||
|
||||
it("should contain all HD gifs", function () {
|
||||
var hd_guests = JSON.parse(fs.readFileSync(__dirname + '/../guests.json', 'utf8')).map(function(guests) { return guests.hd; }).filter(function(hd) { return hd != undefined; });
|
||||
var guests_hd_gifs = fs.readdirSync(__dirname + '/../guests/hd');
|
||||
guests_hd_gifs.forEach(function(gif) {
|
||||
if(! fs.statSync(__dirname + '/../guests/hd/' + gif).isFile()) { return; }
|
||||
assert.ok(-1 !== hd_guests.indexOf('hd/' + gif), gif);
|
||||
it("should contain all HD gifs", function () {
|
||||
let hd_gifs = gif_json.map(function(entry) { return entry.hd; }).filter(function(hd) { return hd != undefined; });
|
||||
var hd_gif_files = fs.readdirSync(__dirname + '/../' + gifPath + '/hd');
|
||||
hd_gif_files.forEach(function(gif) {
|
||||
if(! fs.statSync(__dirname + '/../' + gifPath + '/hd/' + gif).isFile()) { return; }
|
||||
assert.ok(-1 !== hd_gifs.indexOf('hd/' + gif), gif);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ var fs = require('fs'),
|
|||
|
||||
|
||||
function modeString(mode) {
|
||||
return '0' + (mode & 0777).toString(8);
|
||||
return '0' + (mode & 0777).toString(8);
|
||||
}
|
||||
|
||||
// Return true if a mode doesn't have any execute bits.
|
||||
|
@ -11,38 +11,26 @@ function modeNoExecute(mode) {
|
|||
return 0 == (mode & 0111);
|
||||
}
|
||||
|
||||
describe("gifs", function() {
|
||||
['parrots', 'guests', 'flags'].forEach(function(type) {
|
||||
describe(type + " gifs", function() {
|
||||
|
||||
it("in HD should be read only", function() {
|
||||
var parrot_hd_gifs = fs.readdirSync(__dirname + '/../parrots/hd'),
|
||||
guests_hd_gifs = fs.readdirSync(__dirname + '/../guests/hd');
|
||||
let hd_gifs = fs.readdirSync(__dirname + '/../' + type + '/hd');
|
||||
|
||||
parrot_hd_gifs.forEach(function(gif) {
|
||||
var mode = fs.statSync(__dirname + '/../parrots/hd/' + gif).mode;
|
||||
assert(modeNoExecute(mode), gif + " has bad permissions, " + modeString(mode));
|
||||
});
|
||||
|
||||
guests_hd_gifs.forEach(function(gif) {
|
||||
var mode = fs.statSync(__dirname + '/../guests/hd/' + gif).mode;
|
||||
assert(modeNoExecute(mode), gif + " has bad permissions, " + modeString(mode));
|
||||
});
|
||||
hd_gifs.forEach(function(gif) {
|
||||
let mode = fs.statSync(__dirname + '/../' + type + '/hd/' + gif).mode;
|
||||
assert(modeNoExecute(mode), gif + " has bad permissions, " + modeString(mode));
|
||||
});
|
||||
});
|
||||
|
||||
it("in SD should be read only", function() {
|
||||
var parrot_gifs = fs.readdirSync(__dirname + '/../parrots'),
|
||||
guests_gifs = fs.readdirSync(__dirname + '/../guests');
|
||||
let gifs = fs.readdirSync(__dirname + '/../' + type);
|
||||
|
||||
parrot_gifs.forEach(function(gif) {
|
||||
if(gif == "hd") { return; }
|
||||
var mode = fs.statSync(__dirname + '/../parrots/' + gif).mode;
|
||||
assert(modeNoExecute(mode), gif + " has bad permissions, " + modeString(mode));
|
||||
});
|
||||
|
||||
guests_gifs.forEach(function(gif) {
|
||||
if(gif == "hd") { return; }
|
||||
var mode = fs.statSync(__dirname + '/../guests/' + gif).mode;
|
||||
assert(modeNoExecute(mode), gif + " has bad permissions, " + modeString(mode));
|
||||
});
|
||||
gifs.forEach(function(gif) {
|
||||
if(gif == "hd") { return; }
|
||||
let mode = fs.statSync(__dirname + '/../' + type + '/' + gif).mode;
|
||||
assert(modeNoExecute(mode), gif + " has bad permissions, " + modeString(mode));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
79
test/size.js
|
@ -4,69 +4,42 @@ var fs = require('fs'),
|
|||
imageSize = require('image-size');
|
||||
|
||||
|
||||
describe("gifs", function() {
|
||||
|
||||
['parrots', 'guests', 'flags'].forEach(function(type) {
|
||||
describe(type + " gifs", function() {
|
||||
it("in HD should weight less than 64KB", function() {
|
||||
var parrot_hd_gifs = fs.readdirSync(__dirname + '/../parrots/hd'),
|
||||
guests_hd_gifs = fs.readdirSync(__dirname + '/../guests/hd');
|
||||
let gifs = fs.readdirSync(__dirname + '/../' + type + '/hd');
|
||||
|
||||
parrot_hd_gifs.forEach(function(gif) {
|
||||
var size = fs.statSync(__dirname + '/../parrots/hd/' + gif).size;
|
||||
assert(size <= convert(64).from('KB').to('B'), gif + " is too big(" + convert(size).from('B').to('KB') + " KB)");
|
||||
});
|
||||
|
||||
guests_hd_gifs.forEach(function(gif) {
|
||||
var size = fs.statSync(__dirname + '/../guests/hd/' + gif).size;
|
||||
assert(size <= convert(64).from('KB').to('B'), gif + " is too big(" + convert(size).from('B').to('KB') + " KB)");
|
||||
});
|
||||
gifs.forEach(function(gif) {
|
||||
let size = fs.statSync(__dirname + '/../' + type + '/hd/' + gif).size;
|
||||
assert(size <= convert(64).from('KB').to('B'), gif + " is too big(" + convert(size).from('B').to('KB') + " KB)");
|
||||
});
|
||||
});
|
||||
|
||||
it("in SD should weight less than 64KB", function() {
|
||||
var parrot_gifs = fs.readdirSync(__dirname + '/../parrots'),
|
||||
guests_gifs = fs.readdirSync(__dirname + '/../guests');
|
||||
let gifs = fs.readdirSync(__dirname + '/../' + type);
|
||||
|
||||
parrot_gifs.forEach(function(gif) {
|
||||
var size = fs.statSync(__dirname + '/../parrots/' + gif).size;
|
||||
assert(size <= convert(64).from('KB').to('B'), gif + " is too big(" + convert(size).from('B').to('KB') + " KB)");
|
||||
});
|
||||
|
||||
guests_gifs.forEach(function(gif) {
|
||||
var size = fs.statSync(__dirname + '/../guests/' + gif).size;
|
||||
assert(size <= convert(64).from('KB').to('B'), gif + " is too big(" + convert(size).from('B').to('KB') + " KB)");
|
||||
});
|
||||
gifs.forEach(function(gif) {
|
||||
var size = fs.statSync(__dirname + '/../' + type + '/' + gif).size;
|
||||
assert(size <= convert(64).from('KB').to('B'), gif + " is too big(" + convert(size).from('B').to('KB') + " KB)");
|
||||
});
|
||||
});
|
||||
|
||||
it("should never be wider or taller than 128px", function () {
|
||||
var parrot_hd_gifs = fs.readdirSync(__dirname + '/../parrots/hd'),
|
||||
parrot_gifs = fs.readdirSync(__dirname + '/../parrots'),
|
||||
guests_hd_gifs = fs.readdirSync(__dirname + '/../guests/hd'),
|
||||
guests_gifs = fs.readdirSync(__dirname + '/../guests');
|
||||
let hd_gifs = fs.readdirSync(__dirname + '/../' + type + '/hd'),
|
||||
gifs = fs.readdirSync(__dirname + '/../' + type);
|
||||
|
||||
parrot_gifs.forEach(function(gif) {
|
||||
if(gif == "hd") { return; } // Skip the HD directory
|
||||
var dimensions = imageSize(__dirname + '/../parrots/' + gif);
|
||||
assert(dimensions.width <= 128, gif + " is wider than 128px");
|
||||
assert(dimensions.height <= 128, gif + " is taller than 128px");
|
||||
});
|
||||
gifs.forEach(function(gif) {
|
||||
if(gif == "hd") { return; } // Skip the HD directory
|
||||
let dimensions = imageSize(__dirname + '/../' + type + '/' + gif);
|
||||
assert(dimensions.width <= 128, gif + " is wider than 128px");
|
||||
assert(dimensions.height <= 128, gif + " is taller than 128px");
|
||||
});
|
||||
|
||||
parrot_hd_gifs.forEach(function(gif) {
|
||||
var dimensions = imageSize(__dirname + '/../parrots/hd/' + gif);
|
||||
assert(dimensions.width <= 128, gif + " is wider than 128px");
|
||||
assert(dimensions.height <= 128, gif + " is taller than 128px");
|
||||
});
|
||||
|
||||
guests_gifs.forEach(function(gif) {
|
||||
if(gif == "hd") { return; } // Skip the HD directory
|
||||
var dimensions = imageSize(__dirname + '/../guests/' + gif);
|
||||
assert(dimensions.width <= 128, gif + " is wider than 128px");
|
||||
assert(dimensions.height <= 128, gif + " is taller than 128px");
|
||||
});
|
||||
|
||||
guests_hd_gifs.forEach(function(gif) {
|
||||
var dimensions = imageSize(__dirname + '/../guests/hd/' + gif);
|
||||
assert(dimensions.width <= 128, gif + " is wider than 128px");
|
||||
assert(dimensions.height <= 128, gif + " is taller than 128px");
|
||||
});
|
||||
hd_gifs.forEach(function(gif) {
|
||||
let dimensions = imageSize(__dirname + '/../' + type + '/hd/' + gif);
|
||||
assert(dimensions.width <= 128, gif + " is wider than 128px");
|
||||
assert(dimensions.height <= 128, gif + " is taller than 128px");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|