Skip to content

Commit

Permalink
Added proper exclusion of test directory from builds
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-p committed Apr 6, 2015
1 parent fe9da40 commit f5b2d09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 68 deletions.
41 changes: 6 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
29 changes: 0 additions & 29 deletions make.sh

This file was deleted.

11 changes: 7 additions & 4 deletions utils/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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$/;


Expand All @@ -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;
}
}
Expand Down

0 comments on commit f5b2d09

Please sign in to comment.