From d538e07c07c6057126748ac9cccac3139600be5b Mon Sep 17 00:00:00 2001 From: Trevor Elliott Date: Fri, 21 Jun 2013 13:59:41 -0700 Subject: Fix a parallel build bug with the fiveui generic rule --- src/js/fiveui/build.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- cgit v1.2.3 From 4b9a4468238b96482478b3fabdfe6fb8cabb4fd6 Mon Sep 17 00:00:00 2001 From: Trevor Elliott Date: Fri, 21 Jun 2013 14:29:28 -0700 Subject: Populate the gh-pages branch of the repo --- Makefile | 59 ++++++++++++++++++++++++++++++++----------------- doc/build.mk | 22 ++++++++++++++++++ mk/util.mk | 4 ++-- src/js/chrome/build.mk | 1 + src/js/firefox/build.mk | 8 +++---- 5 files changed, 67 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index b9c915c..497caa7 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,12 @@ distclean:: clean .PHONY: test test: +.PHONY: generate +generate: + +.PHONY: deploy +deploy: + # Utilities #################################################################### @@ -60,6 +66,8 @@ endif build-dir := $(topdir)/build +gh-pages-dir := $(build-dir)/gh-pages + $(build-dir): $(call cmd,mkdir) @@ -82,40 +90,51 @@ $(eval $(call subdir,profiles)) $(eval $(call subdir,doc)) -# Package Deployment ########################################################### +# GH-Pages Generation ########################################################## ifeq "$(git-cmd)" "" $(call strict-error,"unable to locate git") -else +endif remote-url := $(shell $(git-cmd) config remote.origin.url) -$(build-dir)/gh-pages: | $(build-dir) +$(gh-pages-dir): | $(build-dir) $(call label,CLONE $(call drop-prefix,$@))\ ( $(git-cmd) clone $(if $(Q),-q) $(topdir) $@ \ - && cd $@ \ + && cd $(gh-pages-dir) \ && $(git-cmd) remote set-url origin $(remote-url) \ - && $(git-cmd) fetch $(if $(Q),-q) origin \ + && $(git-cmd) fetch $(if $(Q),-q) origin gh-pages \ && $(git-cmd) checkout $(if $(Q),-q) gh-pages ) -$(build-dir)/gh-pages/binaries/%: $(build-dir)/% \ - | $(build-dir)/gh-pages + +generate: pull-gh-pages + +.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 + + +# 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" ) +generate: $(build-dir)/gh-pages/binaries/fiveui.xpi +generate: $(build-dir)/gh-pages/binaries/fiveui.crx -.PHONY: deploy + +# GH-Pages Deployment ########################################################## + +# this should be the only implementation of deploy. deploy: generate $(call label,DEPLOY)\ - ( cd $(build-dir)/gh-pages \ + ( cd $(gh-pages-dir) \ + && $(git-cmd) commit $(if $(Q),-q) -m "deploy gh-pages" \ + && $(git-cmd) add \ + && $(git-cmd) add -u \ && git push $(if $(Q),-q) origin gh-pages ) - -endif diff --git a/doc/build.mk b/doc/build.mk index 79efa14..8015747 100644 --- a/doc/build.mk +++ b/doc/build.mk @@ -62,3 +62,25 @@ $(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 + +$(gh-pages-dir)/jsdoc: DIR := $(jsdoc-dir) +$(gh-pages-dir)/jsdoc: $(jsdoc-dir)/index.html | pull-gh-pages + $(call cmd,copydir) 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) -- cgit v1.2.3 From a1100b640f2ed9469158cb0bc42f2f9bf288f917 Mon Sep 17 00:00:00 2001 From: Trevor Elliott Date: Fri, 21 Jun 2013 16:53:40 -0700 Subject: Move gh-pages management stuff to mk/gh-pages.mk --- Makefile | 54 +++++++++++------------------------------------------- doc/build.mk | 1 + mk/gh-pages.mk | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 43 deletions(-) create mode 100644 mk/gh-pages.mk diff --git a/Makefile b/Makefile index 497caa7..e5e983b 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,10 @@ 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: @@ -65,8 +69,7 @@ endif # Build Directory Staging ###################################################### build-dir := $(topdir)/build - -gh-pages-dir := $(build-dir)/gh-pages +include mk/gh-pages.mk $(build-dir): $(call cmd,mkdir) @@ -92,49 +95,14 @@ $(eval $(call subdir,doc)) # GH-Pages Generation ########################################################## -ifeq "$(git-cmd)" "" -$(call strict-error,"unable to locate git") -endif - -remote-url := $(shell $(git-cmd) config remote.origin.url) - -$(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: pull-gh-pages - -.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 +generate: generate-exts +.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") # Move extensions into the binaries directory of the gh-pages branch $(gh-pages-dir)/binaries/%: $(build-dir)/% pull-gh-pages $(call cmd,cp) - -generate: $(build-dir)/gh-pages/binaries/fiveui.xpi -generate: $(build-dir)/gh-pages/binaries/fiveui.crx - - -# GH-Pages Deployment ########################################################## - -# this should be the only implementation of deploy. -deploy: generate - $(call label,DEPLOY)\ - ( cd $(gh-pages-dir) \ - && $(git-cmd) commit $(if $(Q),-q) -m "deploy gh-pages" \ - && $(git-cmd) add \ - && $(git-cmd) add -u \ - && git push $(if $(Q),-q) origin gh-pages ) diff --git a/doc/build.mk b/doc/build.mk index 8015747..f49f83c 100644 --- a/doc/build.mk +++ b/doc/build.mk @@ -80,6 +80,7 @@ $(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 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 ) -- cgit v1.2.3 From 1bf5409ef45872e84f62d2199b918ab233461aed Mon Sep 17 00:00:00 2001 From: Trevor Elliott Date: Mon, 24 Jun 2013 13:40:42 -0700 Subject: Start work on implmenting the W3C accessibilty guidelines See http://www.w3.org/TR/WCAG10/#Guidelines --- guidelines/accessibility/conformance-A.json | 7 +++++++ guidelines/accessibility/guideline-1.js | 30 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 guidelines/accessibility/conformance-A.json create mode 100644 guidelines/accessibility/guideline-1.js 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..35b3d89 --- /dev/null +++ b/guidelines/accessibility/guideline-1.js @@ -0,0 +1,30 @@ +/** + * Provide equivalent alternatives to auditory and visual content + */ + +exports.name = "Equivalent Alternatives"; +exports.description = ""; + +exports.rule = function(report) { + + var hasAlt = function(type) { + return function(ix) { + if(_.isEmpty($(this).attr('alt'))) { + report.error('No alt text specified for ' + type + ' element', this); + } + }; + }; + + // We treat anchors with images as a child as things that should contain + // alternatives. + $5('a').find('img').each(hasAlt('img')); + + // All input tags must have an alt attribute. + $5('input').each(hasAlt('input')); + + // All applet tags must have an alt attribute. + $5('applet').each(hasAlt('applet')); + + // All object tags must have an alt attribute. + $5('object').each(hasAlt('applet')); +}; -- cgit v1.2.3 From 50e042c8981608e4121f94faec138db0c3e294e3 Mon Sep 17 00:00:00 2001 From: Trevor Elliott Date: Mon, 24 Jun 2013 15:23:02 -0700 Subject: Better coverage of checkpoint 1.1 requirements --- guidelines/accessibility/guideline-1.js | 71 ++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 15 deletions(-) diff --git a/guidelines/accessibility/guideline-1.js b/guidelines/accessibility/guideline-1.js index 35b3d89..fdb2c42 100644 --- a/guidelines/accessibility/guideline-1.js +++ b/guidelines/accessibility/guideline-1.js @@ -7,24 +7,65 @@ exports.description = ""; exports.rule = function(report) { - var hasAlt = function(type) { - return function(ix) { - if(_.isEmpty($(this).attr('alt'))) { - report.error('No alt text specified for ' + type + ' element', this); - } - }; + + /* 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); + } }; - // We treat anchors with images as a child as things that should contain - // alternatives. - $5('a').find('img').each(hasAlt('img')); + 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 - // All input tags must have an alt attribute. - $5('input').each(hasAlt('input')); - // All applet tags must have an alt attribute. - $5('applet').each(hasAlt('applet')); + /* Checkpoint 1.5 [Priority 3] **********************************************/ - // All object tags must have an alt attribute. - $5('object').each(hasAlt('applet')); }; -- cgit v1.2.3