Permalink
Browse files

Added proper exclusion of test directory from builds

1 parent fe9da40 commit f5b2d099bc9b96a7a3d3f6db2966630adf53eb01 @adam-p committed Apr 6, 2015
Showing with 13 additions and 68 deletions.
  1. +6 −35 Makefile
  2. +0 −29 make.sh
  3. +7 −4 utils/build.js
View
@@ -4,45 +4,16 @@
#
-PACKAGE_NAME = markdown-here
-MOZILLA_PACKAGE_NAME = $(PACKAGE_NAME)-mozilla.xpi
-CHROME_PACKAGE_NAME = $(PACKAGE_NAME)-chrome.zip
-POSTBOX_PACKAGE_NAME = $(PACKAGE_NAME)-postbox.xpi
DIST_DIR = dist
-SRC_DIR = src
-TEST_DIR = $(SRC_DIR)/common/test
+UTILS_DIR = utils
-ZIP_ARGS = -r -1
+.PHONY: all clean build
-MOZILLA_INPUT = chrome.manifest install.rdf common firefox
-CHROME_INPUT = manifest.json common chrome _locales
-
-.PHONY: all dirs chrome mozilla clean
-
-# Targets for creating directories
-dirs: $(DIST_DIR)
- rm -rf $(TEST_DIR)
-$(DIST_DIR):
- mkdir $(DIST_DIR)
-
-chrome: | dirs
- rm -f $(DIST_DIR)/$(CHROME_PACKAGE_NAME); \
- cd $(SRC_DIR); \
- zip $(ZIP_ARGS) "../$(DIST_DIR)/$(CHROME_PACKAGE_NAME)" $(CHROME_INPUT)
-
-mozilla: | dirs
- rm -f $(DIST_DIR)/$(MOZILLA_PACKAGE_NAME); \
- cd $(SRC_DIR); \
- zip $(ZIP_ARGS) "../$(DIST_DIR)/$(MOZILLA_PACKAGE_NAME)" $(MOZILLA_INPUT)
-
-#postbox: mozilla
-# cp -f $(DIST_DIR)/$(MOZILLA_PACKAGE_NAME) $(DIST_DIR)/$(POSTBOX_PACKAGE_NAME)
-# cd $(SRC_DIR)/postbox; \
-# zip $(ZIP_ARGS) ../../$(DIST_DIR)/$(POSTBOX_PACKAGE_NAME) common/*
+build: | clean
+ cd $(UTILS_DIR); \
+ node "build.js";
clean:
rm -rf $(DIST_DIR)
- find . -name "desktop.ini" -or -name ".*" -and -not -name "." -and -not -name ".git*" -print0 | xargs -0 rm -rf
- git checkout -- $(TEST_DIR)
-all: clean chrome mozilla
+all: clean build
View
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-PACKAGE_NAME=markdown-here
-MOZILLA_PACKAGE_NAME=${PACKAGE_NAME}-mozilla.xpi
-CHROME_PACKAGE_NAME=${PACKAGE_NAME}-chrome.zip
-DIST_DIR=dist
-SRC_DIR=src
-TEST_DIR=${SRC_DIR}/common/test
-
-MOZILLA_INPUT="chrome.manifest install.rdf common firefox"
-CHROME_INPUT="manifest.json common chrome _locales"
-
-ZIP_ARGS="-r -1"
-
-rm -rf "${DIST_DIR}"
-rm -rf "${TEST_DIR}"
-find . -name "desktop.ini" -or -name ".*" -and -not -name "." -and -not -name ".git*" -print0 | xargs -0 rm -rf
-
-mkdir ${DIST_DIR}
-
-cd ${SRC_DIR}
-
-zip ${ZIP_ARGS} "../${DIST_DIR}/${CHROME_PACKAGE_NAME}" ${CHROME_INPUT}
-
-zip ${ZIP_ARGS} "../${DIST_DIR}/${MOZILLA_PACKAGE_NAME}" ${MOZILLA_INPUT}
-
-cd -
-
-git checkout -- "${TEST_DIR}"
View
@@ -7,6 +7,7 @@
"use strict";
var fs = require('fs');
+var path = require('path');
var file = require('file');
var archiver = require('archiver');
var MetaScript = require('MetaScript');
@@ -17,11 +18,13 @@ var SRC_DIR = file.path.join(BASE_DIR, 'src');
var DIST_DIR = file.path.join(BASE_DIR, 'dist');
var CHROME_EXTENSION = file.path.join(DIST_DIR, 'chrome.zip');
var FIREFOX_EXTENSION = file.path.join(DIST_DIR, 'firefox.xpi');
-var CHROME_INPUT = ['manifest.json', 'common/', 'chrome/', '_locales/'];
-var FIREFOX_INPUT = ['chrome.manifest', 'install.rdf', 'common/', 'firefox/'];
+var CHROME_INPUT = [/^manifest\.json$/, /^common(\\|\/)/, /^chrome(\\|\/)/, /^_locales(\\|\/)/];
+var FIREFOX_INPUT = [/^chrome.manifest$/, /^install.rdf$/, /^common(\\|\/)/, /^firefox(\\|\/)/];
var FIREFOX_PLATFORM = 'mozilla';
-var skipFileRegexes = [/\.DS_Store$/, /.+\.bts$/];
+var skipFileRegexes = [/^common(\\|\/)test(\\|\/)/,
+ // OS files and temp files
+ /\.DS_Store$/, /.+\.bts$/, /desktop\.ini$/];
var javascriptFileRegex = /.+\.js$/;
@@ -38,7 +41,7 @@ function fnameMatch(fpath, inputArray) {
}
for (i = 0; i < inputArray.length; i++) {
- if (fname === inputArray[i] || fname.indexOf(inputArray[i]) === 0) {
+ if (inputArray[i].test(fname)) {
return fname;
}
}

0 comments on commit f5b2d09

Please sign in to comment.