<commit_before>GIT = git
NPM = npm
JAM = ./node_modules/.bin/jam
LESSC = ./node_modules/.bin/lessc
CSSMIN = ./node_modules/.bin/cssmin
UGLIFYJS = ./node_modules/.bin/uglifyjs
TESTEM = ./node_modules/.bin/testem

DOCS = docs/index.html docs/index.js docs/index.css docs/jquery.js docs/img docs/widgets.html docs/widgets.js docs/widgets.css docs/widgets.png docs/widgets-spinner.gif docs/toolbar.html docs/toolbar_init.js docs/toolbar_init.css docs/toolbar.js docs/toolbar.css docs/toolbar.png
WIDGETS = build/widgets.js build/widgets.min.js build/widgets.css build/widgets.png build/widgets-spinner.gif
TOOLBAR = build/toolbar_init.js build/toolbar_init.min.js build/toolbar_init.css build/toolbar.js build/toolbar.min.js build/toolbar.css build/toolbar.png

all:: widgets toolbar

clean: clean_docs clean_widgets clean_toolbar

bootstrap:
	mkdir -p build
	if test ! -d docs; then $(GIT) clone git://github.com/plone/mockup.git -b gh-pages docs; fi
	$(NPM) install jamjs less cssmin uglify-js --prefix=./node_modules
	$(NPM) install testem --prefix=./node_modules
	$(JAM) install


test:
	$(TESTEM)

test-ci:
	$(TESTEM) ci


clean_docs:
	rm -rf $(DOCS)

docs: clean_docs $(DOCS)
	# ----------------------------------------------------------------------- #
	# commit docs folder to gh-pages                                          #
	# ----------------------------------------------------------------------- #

docs/index.html:
	cp index.html $@
	sed -i -e 's@<link href="jam/SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link href="less/shThemeGitHub.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/mockup.less" />@<link href="index.css" rel="stylesheet" type="text/css" />@g' $@
	sed -i -e 's@<script src="jam/less/dist/less-1.3.3.js"></script>@<script src="index.js"></script>@g' $@
	sed -i -e 's@<script src="jam/SyntaxHighlighter/scripts/XRegExp.js"></script>@@g' $@
	sed -i -e 's@<script src="jam/SyntaxHighlighter/scripts/shCore.js"></script>@@g' $@
	sed -i -e 's@<script src="jam/SyntaxHighlighter/scripts/shBrushBash.js"></script>@@g' $@

docs/index.js:
	$(UGLIFYJS) jam/SyntaxHighlighter/scripts/XRegExp.js > $@
	$(UGLIFYJS) jam/SyntaxHighlighter/scripts/shCore.js >> $@
	$(UGLIFYJS) jam/SyntaxHighlighter/scripts/shBrushBash.js >> $@

docs/index.css:
	$(CSSMIN) jam/SyntaxHighlighter/styles/shCore.css > $@
	$(CSSMIN) less/shThemeGitHub.css >> $@
	$(LESSC) less/mockup.less | $(CSSMIN) >> $@

docs/jquery.js:
	$(UGLIFYJS) jam/jquery/dist/jquery.js > $@

docs/img:
	mkdir $@
	cp img/* $@
	cp jam/bootstrap/img/glyphicons-halflings.png $@

docs/widgets.html:
	cp widgets.html $@
	sed -i -e 's@<link href="jam/SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link href="less/shThemeGitHub.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet" type="text/css" href="jam/select2/select2.css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet" type="text/css" href="jam/pickadate/themes/pickadate.02.classic.css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/mockup.less" />@@g' $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/widgets.less" />@<link href="widgets.css" rel="stylesheet" type="text/css" />@g' $@
	sed -i -e 's@<script src="jam/less/dist/less-1.3.3.js"></script>@@g' $@
	sed -i -e 's@jam/jquery/dist/jquery.js@jquery.js@g' $@
	sed -i -e 's@<script src="jam/require.js"></script>@@g' $@
	sed -i -e 's@<script src="js/demo/widgets.js"></script>@<script src="widgets.js"></script>@g' $@

docs/widgets.js:
	$(JAM) compile -i js/demo/widgets -i sinon -e jquery --no-minify --almond $@
	sed -i -e 's@define('\''sinon'\'', \['\''sinon/sinon'\''\], function (main) { return main; });@@g' $@
	sed -i -e 's@define("sinon/sinon", function(){});@define("sinon", function(){ return window.sinon; });@g' $@

docs/widgets.css:
	$(CSSMIN) jam/SyntaxHighlighter/styles/shCore.css > $@
	$(CSSMIN) less/shThemeGitHub.css >> $@
	$(CSSMIN) jam/select2/select2.css >> $@
	$(CSSMIN) jam/pickadate/themes/pickadate.02.classic.css >> $@
	$(LESSC) less/widgets.less | $(CSSMIN) >> $@
	$(LESSC) less/mockup.less | $(CSSMIN) >> $@
	sed -i -e 's@select2.png@widgets.png@g' $@
	sed -i -e 's@select2-spinner.gif@widgets-spinner.gif@g' $@
	sed -i -e 's@jam/bootstrap/img/glyphicons-halflings.png@img/glyphicons-halflings.png@g' $@

docs/widgets.png:
	cp jam/select2/select2.png $@

docs/widgets-spinner.gif:
	cp jam/select2/select2-spinner.gif $@

docs/toolbar.html:
	cp toolbar.html $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/mockup.less" />@<link rel="stylesheet" type="text/css" href="toolbar_init.css" />@g' $@
	sed -i -e 's@<script src="jam/less/dist/less-1.3.3.js"></script>@<script src="toolbar_init.js"></script>@g' $@
	sed -i -e 's@<script src="js/iframe.js"></script>@@g' $@
	sed -i -e 's@jam/select2/select2.css;@@g' $@
	sed -i -e 's@jam/pickadate/themes/pickadate.02.classic.css;@@g' $@
	sed -i -e 's@less/toolbar.less;@@g' $@
	sed -i -e 's@jam/less/dist/less-1.3.3.js;@@g' $@
	sed -i -e 's@jam/jquery/dist/jquery.js;@jquery.js;@g' $@
	sed -i -e 's@jam/require.js;@toolbar.css;@g' $@
	sed -i -e 's@js/demo/toolbar.js;@toolbar.js;@g' $@

docs/toolbar_init.js:
	$(UGLIFYJS) js/iframe.js > $@

docs/toolbar_init.css:
	$(LESSC) less/mockup.less | $(CSSMIN) > $@

docs/toolbar.js:
	$(JAM) compile -i js/demo/toolbar -e jquery --no-minify --almond $@
	sed -i -e 's@define('\''sinon'\'', \['\''sinon/sinon'\''\], function (main) { return main; });@@g' $@
	sed -i -e 's@define("sinon/sinon", function(){});@define("sinon", function(){ return window.sinon; });@g' $@

docs/toolbar.css:
	$(CSSMIN) jam/select2/select2.css > $@
	$(CSSMIN) jam/pickadate/themes/pickadate.02.classic.css >> $@
	$(LESSC) less/toolbar.less | $(CSSMIN) >> $@
	sed -i -e 's@../img/glyphicons-halflings.png@toolbar.png@g' $@

docs/toolbar.png:
	cp jam/bootstrap/img/glyphicons-halflings.png $@


clean_widgets:
	rm -rf $(WIDGETS)

widgets: clean_widgets $(WIDGETS)
	# ----------------------------------------------------------------------- #
	# cp build/widgets* path/to/plone.app.widgets/plone/app/widgets/static    #
	# ----------------------------------------------------------------------- #

build/widgets.js:
	$(JAM) compile -i js/bundles/widgets -e jquery --no-minify --almond $@
	echo "require(['jquery', 'jam/Patterns/src/registry', 'js/bundles/widgets'], function(jQuery, registry) { jQuery(document).ready(function() { registry.scan(jQuery('body')); }); });" >> $@

build/widgets.min.js: build/widgets.js
	$(UGLIFYJS) build/widgets.js > $@

build/widgets.css:
	$(CSSMIN) jam/select2/select2.css > $@
	$(CSSMIN) jam/pickadate/themes/pickadate.02.classic.css >> $@
	$(LESSC) less/sunburst.less | $(CSSMIN) >> $@
	sed -i -e 's@select2.png@++resource++plone.app.widgets.png@g' $@
	sed -i -e 's@select2-spinner.gif@++resource++plone.app.widgets-spinner.gif@g' $@

build/widgets.png:
	cp jam/select2/select2.png $@

build/widgets-spinner.gif:
	cp jam/select2/select2-spinner.gif $@

<commit_msg>adding docs/patters* building steps for docs<commit_after>GIT = git
NPM = npm
JAM = ./node_modules/.bin/jam
LESSC = ./node_modules/.bin/lessc
CSSMIN = ./node_modules/.bin/cssmin
UGLIFYJS = ./node_modules/.bin/uglifyjs
TESTEM = ./node_modules/.bin/testem

DOCS = docs/index.html docs/index.js docs/index.css docs/jquery.js docs/img docs/widgets.html docs/widgets.js docs/widgets.css docs/widgets.png docs/widgets-spinner.gif docs/toolbar.html docs/toolbar_init.js docs/toolbar_init.css docs/toolbar.js docs/toolbar.css docs/toolbar.png docs/patterns.html docs/patterns.css docs/patterns.js docs/patterns.png docs/patterns-spinner.gif
WIDGETS = build/widgets.js build/widgets.min.js build/widgets.css build/widgets.png build/widgets-spinner.gif
TOOLBAR = build/toolbar_init.js build/toolbar_init.min.js build/toolbar_init.css build/toolbar.js build/toolbar.min.js build/toolbar.css build/toolbar.png

all:: widgets toolbar

clean: clean_docs clean_widgets clean_toolbar

bootstrap:
	mkdir -p build
	if test ! -d docs; then $(GIT) clone git://github.com/plone/mockup.git -b gh-pages docs; fi
	$(NPM) install jamjs less cssmin uglify-js --prefix=./node_modules
	$(NPM) install testem --prefix=./node_modules
	$(JAM) install


test:
	$(TESTEM)

test-ci:
	$(TESTEM) ci


clean_docs:
	rm -rf $(DOCS)

docs: clean_docs $(DOCS)
	# ----------------------------------------------------------------------- #
	# commit docs folder to gh-pages                                          #
	# ----------------------------------------------------------------------- #

docs/index.html:
	cp index.html $@
	sed -i -e 's@<link href="jam/SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link href="less/shThemeGitHub.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/mockup.less" />@<link href="index.css" rel="stylesheet" type="text/css" />@g' $@
	sed -i -e 's@<script src="jam/less/dist/less-1.3.3.js"></script>@<script src="index.js"></script>@g' $@
	sed -i -e 's@<script src="jam/SyntaxHighlighter/scripts/XRegExp.js"></script>@@g' $@
	sed -i -e 's@<script src="jam/SyntaxHighlighter/scripts/shCore.js"></script>@@g' $@
	sed -i -e 's@<script src="jam/SyntaxHighlighter/scripts/shBrushBash.js"></script>@@g' $@

docs/index.js:
	$(UGLIFYJS) jam/SyntaxHighlighter/scripts/XRegExp.js > $@
	$(UGLIFYJS) jam/SyntaxHighlighter/scripts/shCore.js >> $@
	$(UGLIFYJS) jam/SyntaxHighlighter/scripts/shBrushBash.js >> $@

docs/index.css:
	$(CSSMIN) jam/SyntaxHighlighter/styles/shCore.css > $@
	$(CSSMIN) less/shThemeGitHub.css >> $@
	$(LESSC) less/mockup.less | $(CSSMIN) >> $@

docs/jquery.js:
	$(UGLIFYJS) jam/jquery/dist/jquery.js > $@

docs/img:
	mkdir $@
	cp img/* $@
	cp jam/bootstrap/img/glyphicons-halflings.png $@

docs/widgets.html:
	cp widgets.html $@
	sed -i -e 's@<link href="jam/SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link href="less/shThemeGitHub.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet" type="text/css" href="jam/select2/select2.css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet" type="text/css" href="jam/pickadate/themes/pickadate.02.classic.css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/mockup.less" />@@g' $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/widgets.less" />@<link href="widgets.css" rel="stylesheet" type="text/css" />@g' $@
	sed -i -e 's@<script src="jam/less/dist/less-1.3.3.js"></script>@@g' $@
	sed -i -e 's@jam/jquery/dist/jquery.js@jquery.js@g' $@
	sed -i -e 's@<script src="jam/require.js"></script>@@g' $@
	sed -i -e 's@<script src="js/demo/widgets.js"></script>@<script src="widgets.js"></script>@g' $@

docs/widgets.js:
	$(JAM) compile -i js/demo/widgets -i sinon -e jquery --no-minify --almond $@
	sed -i -e 's@define('\''sinon'\'', \['\''sinon/sinon'\''\], function (main) { return main; });@@g' $@
	sed -i -e 's@define("sinon/sinon", function(){});@define("sinon", function(){ return window.sinon; });@g' $@

docs/widgets.css:
	$(CSSMIN) jam/SyntaxHighlighter/styles/shCore.css > $@
	$(CSSMIN) less/shThemeGitHub.css >> $@
	$(CSSMIN) jam/select2/select2.css >> $@
	$(CSSMIN) jam/pickadate/themes/pickadate.02.classic.css >> $@
	$(LESSC) less/widgets.less | $(CSSMIN) >> $@
	$(LESSC) less/mockup.less | $(CSSMIN) >> $@
	sed -i -e 's@select2.png@widgets.png@g' $@
	sed -i -e 's@select2-spinner.gif@widgets-spinner.gif@g' $@
	sed -i -e 's@jam/bootstrap/img/glyphicons-halflings.png@img/glyphicons-halflings.png@g' $@

docs/widgets.png:
	cp jam/select2/select2.png $@

docs/widgets-spinner.gif:
	cp jam/select2/select2-spinner.gif $@

docs/toolbar.html:
	cp toolbar.html $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/mockup.less" />@<link rel="stylesheet" type="text/css" href="toolbar_init.css" />@g' $@
	sed -i -e 's@<script src="jam/less/dist/less-1.3.3.js"></script>@<script src="toolbar_init.js"></script>@g' $@
	sed -i -e 's@<script src="js/iframe.js"></script>@@g' $@
	sed -i -e 's@jam/select2/select2.css;@@g' $@
	sed -i -e 's@jam/pickadate/themes/pickadate.02.classic.css;@@g' $@
	sed -i -e 's@less/toolbar.less;@@g' $@
	sed -i -e 's@jam/less/dist/less-1.3.3.js;@@g' $@
	sed -i -e 's@jam/jquery/dist/jquery.js;@jquery.js;@g' $@
	sed -i -e 's@jam/require.js;@toolbar.css;@g' $@
	sed -i -e 's@js/demo/toolbar.js;@toolbar.js;@g' $@

docs/toolbar_init.js:
	$(UGLIFYJS) js/iframe.js > $@

docs/toolbar_init.css:
	$(LESSC) less/mockup.less | $(CSSMIN) > $@

docs/toolbar.js:
	$(JAM) compile -i js/demo/toolbar -e jquery --no-minify --almond $@
	sed -i -e 's@define('\''sinon'\'', \['\''sinon/sinon'\''\], function (main) { return main; });@@g' $@
	sed -i -e 's@define("sinon/sinon", function(){});@define("sinon", function(){ return window.sinon; });@g' $@

docs/toolbar.css:
	$(CSSMIN) jam/select2/select2.css > $@
	$(CSSMIN) jam/pickadate/themes/pickadate.02.classic.css >> $@
	$(LESSC) less/toolbar.less | $(CSSMIN) >> $@
	sed -i -e 's@../img/glyphicons-halflings.png@toolbar.png@g' $@

docs/toolbar.png:
	cp jam/bootstrap/img/glyphicons-halflings.png $@

docs/patterns.html:
	cp patterns.html $@
	sed -i -e 's@<link href="jam/SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link href="less/shThemeGitHub.css" rel="stylesheet" type="text/css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet" type="text/css" href="jam/select2/select2.css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet" type="text/css" href="jam/pickadate/themes/pickadate.02.classic.css" />@@g' $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/mockup.less" />@@g' $@
	sed -i -e 's@<link rel="stylesheet/less" type="text/css" href="less/widgets.less" />@<link rel="stylesheet" type="text/css" href="patterns.css" />@g' $@
	sed -i -e 's@<script src="jam/less/dist/less-1.3.3.js"></script>@@g' $@
	sed -i -e 's@<script src="jam/jquery/dist/jquery.js"></script>@@g' $@
	sed -i -e 's@<script src="jam/require.js"></script>@@g' $@
	sed -i -e 's@<script src="js/demo/widgets.js"></script>@<script src="patterns.js"></script>@g' $@

docs/patterns.png:
	cp jam/select2/select2.png $@

docs/patterns-spinner.gif:
	cp jam/select2/select2-spinner.gif $@


docs/patterns.css:
	$(CSSMIN) jam/SyntaxHighlighter/styles/shCore.css > $@
	$(CSSMIN) less/shThemeGitHub.css >> $@
	$(CSSMIN) jam/select2/select2.css >> $@
	$(CSSMIN) jam/pickadate/themes/pickadate.02.classic.css >> $@
	$(LESSC) less/mockup.less | $(CSSMIN) >> $@
	$(LESSC) less/widgets.less | $(CSSMIN) >> $@
	sed -i -e 's@select2.png@patterns.png@g' $@
	sed -i -e 's@select2-spinner.gif@patterns-spinner.gif@g' $@
	sed -i -e 's@jam/bootstrap/img/glyphicons-halflings.png@img/glyphicons-halflings.png@g' $@

docs/patterns.js:
	$(UGLIFYJS) jam/less/dist/less-1.3.3.js > $@
	$(UGLIFYJS) jam/jquery/dist/jquery.js >> $@
	$(JAM) compile -i js/demo/widgets -i sinon -e jquery --no-minify --almond tmp
	sed -i -e 's@define('\''sinon'\'', \['\''sinon/sinon'\''\], function (main) { return main; });@@g' tmp
	sed -i -e 's@define("sinon/sinon", function(){});@define("sinon", function(){ return window.sinon; });@g' tmp
	cat tmp >> $@
	rm tmp


clean_widgets:
	rm -rf $(WIDGETS)

widgets: clean_widgets $(WIDGETS)
	# ----------------------------------------------------------------------- #
	# cp build/widgets* path/to/plone.app.widgets/plone/app/widgets/static    #
	# ----------------------------------------------------------------------- #

build/widgets.js:
	$(JAM) compile -i js/bundles/widgets -e jquery --no-minify --almond $@
	echo "require(['jquery', 'jam/Patterns/src/registry', 'js/bundles/widgets'], function(jQuery, registry) { jQuery(document).ready(function() { registry.scan(jQuery('body')); }); });" >> $@

build/widgets.min.js: build/widgets.js
	$(UGLIFYJS) build/widgets.js > $@

build/widgets.css:
	$(CSSMIN) jam/select2/select2.css > $@
	$(CSSMIN) jam/pickadate/themes/pickadate.02.classic.css >> $@
	$(LESSC) less/sunburst.less | $(CSSMIN) >> $@
	sed -i -e 's@select2.png@++resource++plone.app.widgets.png@g' $@
	sed -i -e 's@select2-spinner.gif@++resource++plone.app.widgets-spinner.gif@g' $@

build/widgets.png:
	cp jam/select2/select2.png $@

build/widgets-spinner.gif:
	cp jam/select2/select2-spinner.gif $@


{'fraction_non_alphanumeric': 0.24914986640757833, 'fraction_numerical': 0.006558173427252854, 'mean_word_length': 3.4838007078682276, 'pattern_counts': {'":': 0, '<': 94, '<?xml version=': 0, '>': 184, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 14, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '839673', 'n_tokens_mistral': 6842, 'n_tokens_neox': 6410, 'n_words': 1098}