aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rogan Creswick <creswick@gmail.com>2013-06-25 10:44:43 -0700
committerGravatar Rogan Creswick <creswick@gmail.com>2013-06-25 10:44:43 -0700
commite166ed04bfe336f9e6340f7df1a50264f7d64622 (patch)
treeb2be288c69240e444ec70ece945f0ec59e667690
parent750bb02df87cb2731ee593b3206f1ac442fcd69d (diff)
parent50e042c8981608e4121f94faec138db0c3e294e3 (diff)
Merge branch 'master' of https://github.com/GaloisInc/FiveUI
-rw-r--r--Makefile53
-rw-r--r--doc/build.mk23
-rw-r--r--guidelines/accessibility/conformance-A.json7
-rw-r--r--guidelines/accessibility/guideline-1.js71
-rw-r--r--mk/gh-pages.mk53
-rw-r--r--mk/util.mk4
-rw-r--r--src/js/chrome/build.mk1
-rw-r--r--src/js/firefox/build.mk8
-rw-r--r--src/js/fiveui/build.mk4
9 files changed, 182 insertions, 42 deletions
diff --git a/Makefile b/Makefile
index b9c915c..e5e983b 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,16 @@ distclean:: clean
.PHONY: test
test:
+# Generate and commit all changed files to the gh-pages branch. There is a good
+# chance that this will always produce a new commit for the extensions, so use
+# it with care. If you only want to deploy the manual/doc changes, use
+# generate-docs, defined in doc/build.mk
+.PHONY: generate
+generate:
+
+.PHONY: deploy
+deploy:
+
# Utilities ####################################################################
@@ -59,6 +69,7 @@ endif
# Build Directory Staging ######################################################
build-dir := $(topdir)/build
+include mk/gh-pages.mk
$(build-dir):
$(call cmd,mkdir)
@@ -82,40 +93,16 @@ $(eval $(call subdir,profiles))
$(eval $(call subdir,doc))
-# Package Deployment ###########################################################
+# GH-Pages Generation ##########################################################
-ifeq "$(git-cmd)" ""
-$(call strict-error,"unable to locate git")
-else
+generate: generate-exts
-remote-url := $(shell $(git-cmd) config remote.origin.url)
+.PHONY: generate-exts
+generate-exts: $(build-dir)/gh-pages/binaries/fiveui.xpi \
+ $(build-dir)/gh-pages/binaries/fiveui.crx \
+ | pull-gh-pages
+ $(call commit,binaries,"deploy extensions")
-$(build-dir)/gh-pages: | $(build-dir)
- $(call label,CLONE $(call drop-prefix,$@))\
- ( $(git-cmd) clone $(if $(Q),-q) $(topdir) $@ \
- && cd $@ \
- && $(git-cmd) remote set-url origin $(remote-url) \
- && $(git-cmd) fetch $(if $(Q),-q) origin \
- && $(git-cmd) checkout $(if $(Q),-q) gh-pages )
-
-$(build-dir)/gh-pages/binaries/%: $(build-dir)/% \
- | $(build-dir)/gh-pages
+# Move extensions into the binaries directory of the gh-pages branch
+$(gh-pages-dir)/binaries/%: $(build-dir)/% pull-gh-pages
$(call cmd,cp)
-
-.PHONY: genereate
-generate: $(build-dir)/gh-pages/binaries/fiveui.xpi \
- $(build-dir)/gh-pages/binaries/fiveui.crx
- $(call label,GENERATE)\
- ( cd $(build-dir)/gh-pages \
- && $(git-cmd) pull $(if $(Q),-q) \
- && $(git-cmd) add binaries \
- && $(git-cmd) add -u binaries \
- && $(git-cmd) commit $(if $(Q),-q) -m "deploy extensions" )
-
-.PHONY: deploy
-deploy: generate
- $(call label,DEPLOY)\
- ( cd $(build-dir)/gh-pages \
- && git push $(if $(Q),-q) origin gh-pages )
-
-endif
diff --git a/doc/build.mk b/doc/build.mk
index 79efa14..f49f83c 100644
--- a/doc/build.mk
+++ b/doc/build.mk
@@ -62,3 +62,26 @@ $(jsdoc-dir)/index.html: \
$(topdir)/src/js/fiveui/injected/jquery-plugins.js \
| $(build-dir)
$(call label,JSDOC)$(topdir)/tools/bin/jsdoc $^ $(redir)
+
+
+
+# Web Manual Publishing ########################################################
+
+generate: generate-docs
+
+.PHONY: generate-docs
+generate-docs: $(gh-pages-dir)/manual
+
+# this is a bit conservative, as it will copy the documentation through each
+# time the rule gets invoked. Some sort of a tag file to track actual changes
+# would be sufficient to not perform extra work.
+$(gh-pages-dir)/manual: DIR := $(manual-dir)
+$(gh-pages-dir)/manual: web-manual | pull-gh-pages
+ $(call cmd,copydir)
+
+generate-docs: $(gh-pages-dir)/jsdoc
+ $(call commit,manual jsdoc,"update documentation")
+
+$(gh-pages-dir)/jsdoc: DIR := $(jsdoc-dir)
+$(gh-pages-dir)/jsdoc: $(jsdoc-dir)/index.html | pull-gh-pages
+ $(call cmd,copydir)
diff --git a/guidelines/accessibility/conformance-A.json b/guidelines/accessibility/conformance-A.json
new file mode 100644
index 0000000..5aa5bf3
--- /dev/null
+++ b/guidelines/accessibility/conformance-A.json
@@ -0,0 +1,7 @@
+{ "name": "W3C Accessibility Guidelines (Conformance A)"
+, "description": "See: www.w3.org/TR/WCAG10/"
+, "license": "BSD3"
+, "rules":
+ [ "guideline-1.js"
+ ]
+}
diff --git a/guidelines/accessibility/guideline-1.js b/guidelines/accessibility/guideline-1.js
new file mode 100644
index 0000000..fdb2c42
--- /dev/null
+++ b/guidelines/accessibility/guideline-1.js
@@ -0,0 +1,71 @@
+/**
+ * Provide equivalent alternatives to auditory and visual content
+ */
+
+exports.name = "Equivalent Alternatives";
+exports.description = "";
+
+exports.rule = function(report) {
+
+
+ /* Checkpoint 1.1 [Priority 1] **********************************************/
+
+ var hasAlt = function(ix) {
+ // TODO: strip space from the alt attribute to prevent ' ' from passing
+ // the test
+ if(_.isEmpty($(this).attr('alt')) && _.isEmpty($(this).attr('longdesc'))) {
+ report.error('No alt/longdesc specified', this);
+ }
+ };
+
+ var hasText = function(ix) {
+ // TODO: strip space from the text to prevent ' ' from passing the test
+ if(_.isEmpty($(this).text())) {
+ report.error('No text node', this);
+ }
+ };
+
+ // images with semantic meaning should have an alt attribute.
+ $5('a').find('img')
+ .add($5('dl').find('img'))
+ .add($5('dd').find('img'))
+ .each(hasAlt);
+
+ // All `input` tags must have an alt attribute.
+ $5('input').each(hasAlt);
+
+ // All `applet` tags must have a text node
+ $5('applet').each(hasText);
+
+ // All `object` tags must have a text node
+ $5('object').each(hasText).each(hasAlt);
+
+ // TODO: what's the best way to classify content that's `complex`?
+
+ // All `area` elements of an image map should have alt attributes. This isn't
+ // quite a faithful implementation, as it doesn't take into account the case
+ // where an `a` tag is wrapped around the `area` tag.
+ $5('map').find('area').each(hasAlt);
+
+ // TODO: figure out a good way to handle frames.
+ // TODO: figure out a good way to handle scripts.
+
+
+ /* Checkpoint 1.2 [Priority 1] **********************************************/
+
+ // TODO
+
+
+ /* Checkpoint 1.3 [Priority 1] **********************************************/
+
+ // TODO
+
+
+ /* Checkpoint 1.4 [Priority 1] **********************************************/
+
+ // TODO
+
+
+ /* Checkpoint 1.5 [Priority 3] **********************************************/
+
+};
diff --git a/mk/gh-pages.mk b/mk/gh-pages.mk
new file mode 100644
index 0000000..cfa67c5
--- /dev/null
+++ b/mk/gh-pages.mk
@@ -0,0 +1,53 @@
+
+# gh-pages Branch Management ###################################################
+
+gh-pages-dir := $(build-dir)/gh-pages
+
+ifeq "$(git-cmd)" ""
+$(call strict-error,"unable to locate git")
+else
+
+# figure out the url of the origin that the current work repo uses
+remote-url := $(shell $(git-cmd) config remote.origin.url)
+
+endif
+
+
+# Pull in the gh-pages directory.
+.PHONY: pull-gh-pages
+ifeq "$(pull)" "0"
+pull-gh-pages:
+else
+pull-gh-pages: | $(gh-pages-dir)
+ $(call label,PULL $(call drop-prefix,$(gh-pages-dir)))\
+ ( cd $(gh-pages-dir) \
+ && $(git-cmd) pull $(if $(Q),-q) )
+endif
+
+
+# checkout the gh-pages branch in a temp repo under the build tree
+$(gh-pages-dir): | $(build-dir)
+ $(call label,CLONE $(call drop-prefix,$@))\
+ ( $(git-cmd) clone $(if $(Q),-q) $(topdir) $@ \
+ && cd $(gh-pages-dir) \
+ && $(git-cmd) remote set-url origin $(remote-url) \
+ && $(git-cmd) fetch $(if $(Q),-q) origin gh-pages \
+ && $(git-cmd) checkout $(if $(Q),-q) gh-pages )
+
+
+# Generate a commit in the gh-pages-dir, after adding some files that may have
+# changed.
+commit = $(call label,COMMIT $(call drop-prefix,$(gh-pages-dir)))\
+ ( cd $(gh-pages-dir) \
+ && if test -n "`$(git-cmd) status -s`"; then \
+ $(git-cmd) add $1 \
+ && $(git-cmd) commit $(if $(Q),-q) -m $2 \
+ ; fi )
+
+
+
+# push to the gh-pages branch from the temp repo
+deploy: | pull-gh-pages
+ $(call label,DEPLOY)\
+ ( cd $(gh-pages-dir) \
+ && git push $(if $(Q),-q) origin gh-pages )
diff --git a/mk/util.mk b/mk/util.mk
index c37c8034..a7d2239 100644
--- a/mk/util.mk
+++ b/mk/util.mk
@@ -14,7 +14,7 @@ cmd = @$(echo-cmd) $(cmd_$1)
label = $(if $(Q),$(Q)echo ' $1';)
-find-cmd = $(shell which $1 2$(redir))
+find-cmd = $(shell which $1 2>/dev/null)
drop-prefix = $(patsubst $(topdir)/%,%,$1)
@@ -23,7 +23,7 @@ quiet_cmd_mkdir = MKDIR $(call drop-prefix,$@)
cmd_mkdir = mkdir -p $@
quiet_cmd_copydir = CPDIR $(call drop-prefix,$@)
- cmd_copydir = cp -r $(DIR) $@
+ cmd_copydir = cp -r $(DIR) $(dir $@)
quiet_cmd_cp = CP $(call drop-prefix,$@)
cmd_cp = cp $< $@
diff --git a/src/js/chrome/build.mk b/src/js/chrome/build.mk
index 30c07f3..f06fb20 100644
--- a/src/js/chrome/build.mk
+++ b/src/js/chrome/build.mk
@@ -6,6 +6,7 @@ all: stage-chrome
package: $(build-dir)/fiveui.crx
+
chrome-dir := $(path)
chrome-build := $(build-dir)/chrome
diff --git a/src/js/firefox/build.mk b/src/js/firefox/build.mk
index 0a20a80..36fad92 100644
--- a/src/js/firefox/build.mk
+++ b/src/js/firefox/build.mk
@@ -83,10 +83,8 @@ stage-firefox: \
$(firefox-build)/data/icons/options-icon.js \
| $(firefox-build)
-$(build-dir)/fiveui.xpi: \
- stage-firefox \
- $(addon-sdk-unpacked) \
- $(topdir)/profiles/firefox
+$(build-dir)/fiveui.xpi: stage-firefox \
+ | $(topdir)/profiles/firefox $(addon-sdk-unpacked)
$(call label,XPI $(call drop-prefix,$@))\
$(call cfx,$(build-dir),xpi -p $(topdir)/profiles/firefox \
--pkgdir=$(firefox-build) )
@@ -94,5 +92,5 @@ $(build-dir)/fiveui.xpi: \
# Testing ######################################################################
-run-firefox: stage-firefox $(addon-sdk-unpacked)
+run-firefox: stage-firefox | $(addon-sdk-unpacked)
$(call label,RUNFF)$(call cfx,$(firefox-build),run)
diff --git a/src/js/fiveui/build.mk b/src/js/fiveui/build.mk
index c9bbf7d..e229eed 100644
--- a/src/js/fiveui/build.mk
+++ b/src/js/fiveui/build.mk
@@ -29,7 +29,7 @@ define stage-fiveui
# Common Files #################################################################
-$1/data/injected/injected.css: $(build-dir)/injected.css
+$1/data/injected/injected.css: $(build-dir)/injected.css | $1/data/injected
$$(call cmd,cp)
$(call fiveui-files,$1/data,injected)
@@ -58,7 +58,7 @@ $2: $(patsubst $(fiveui-dir)/%,$1/data/%,$(wildcard $(fiveui-dir)/images/*))
$1/data/jquery: | $1/data
$$(call cmd,mkdir)
-$1/data/jquery/bundled.css: $(build-dir)/bundled.css
+$1/data/jquery/bundled.css: $(build-dir)/bundled.css | $1/data/jquery
$$(call cmd,cp)
$1/data/jquery/%: $(lib-dir)/jquery/% | $1/data/jquery