This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 865
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: 1) Moved jshint to a third-party directory 2) Moved calculator.js to genfiles. This is because I've noticed several commits over the years that have edited calculator.js directly, only to have that edit overwritten the next time it was auto-regenerated. By putting it in genfiles, I hope to indicate to people that they should change the source .jison file instead. (I still check in the genfiles/ file, so folks can use khan-exercises without needing to install jison.) While testing, I realized that we don't do a very good job of installing deps for you, so I added deps-manifests for the three (!) programming languages we use, and changed the Makefile to use them. Small cleanups based on review. Test Plan: To test the jshint move, I ran: env LC_ALL=en_US.UTF-8 .bundle exec ruby build/pack.rb exercises/z_scores_3.html::exercises-packed/z_scores_3.html without error. To test the calculator move/change, I ran: python -mSimpleHTTPServer and visited http://localhost:8000/exercises/law_of_cosines.html and clicked '3+4=' and got 7, and clicked 'ln(-5)' and saw the bar turn red because it's an error. (It looks like the actual error message is suppressed these days.) (same) Reviewers: eater, alpert Reviewed By: alpert Differential Revision: http://phabricator.khanacademy.org/D9356
- Loading branch information
Showing
12 changed files
with
81 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
*.pyc | ||
_hashed-*.js | ||
.bundle | ||
node_modules | ||
exercises-packed | ||
exercises-packed.zip | ||
genfiles/** | ||
build/lxml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'json', '1.8.0' | ||
gem 'nokogiri', '1.5.10' | ||
gem 'therubyracer', '0.12.0' | ||
gem 'uglifier', '2.3.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
utils/calculator.js: build/calculator/calculator.jison build/calculator/calculator-tail.js | ||
jison -m js build/calculator/calculator.jison -o utils/Calculator.js | ||
cat build/calculator/calculator-tail.js >>utils/Calculator.js | ||
mv utils/Calculator.js utils/calculator.js | ||
.FAKE: pack packed lint fix_lint | ||
|
||
# This needs 'npm' on your system, to install jison. | ||
# The output file has to be named 'Calculator' because that's how jison | ||
# determines the variable name. | ||
genfiles/calculator.js: build/calculator/calculator.jison build/calculator/calculator-tail.js | ||
npm install | ||
mkdir -p genfiles | ||
node_modules/.bin/jison -m js build/calculator/calculator.jison -o genfiles/Calculator.js | ||
cat build/calculator/calculator-tail.js >>genfiles/Calculator.js | ||
mv genfiles/Calculator.js genfiles/calculator.js | ||
|
||
|
||
# Pack all files in exercises/ into exercises-packed/, unless the one | ||
# in exercises-packed is newer. | ||
pack packed: | ||
args=`cd exercises && find * -name '*.html' | while read infile; do outfile="../exercises-packed/$$infile"; echo "$$outfile" | xargs dirname | xargs mkdir -p; [ "$$outfile" -nt "$$infile" ] || echo "exercises/$$infile::exercises-packed/$$infile"; done`; echo "$$args" | tr ' ' '\012'; [ -z "$$args" ] || ruby build/pack.rb $$args | ||
# This needs 'bundle' on your system, to install needed ruby modules. | ||
pack packed: deps | ||
args=`cd exercises && find * -name '*.html' | while read infile; do outfile="../exercises-packed/$$infile"; echo "$$outfile" | xargs dirname | xargs mkdir -p; [ "$$outfile" -nt "$$infile" ] || echo "exercises/$$infile::exercises-packed/$$infile"; done`; echo "$$args" | tr ' ' '\012'; [ -z "$$args" ] || env LC_ALL=en_US.UTF-8 bundle exec ruby build/pack.rb $$args | ||
|
||
|
||
# These need 'pip' on your system, to install lxml/etc. | ||
lint: | ||
pip install -r requirements.txt | ||
python build/lint_i18n_strings.py exercises/*html | ||
|
||
fix_lint: | ||
python build/lint_i18n_strings.py --fix exercises/*html | ||
pip install -r requirements.txt | ||
python build/lint_i18n_strings.py --fix exercises/*html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "khan-exercises", | ||
"version": "1.0.0", | ||
"author": "Khan Academy", | ||
"keywords": "education exercises khanacademy khan math exercises", | ||
"description": "(Some) exercises for Khan Academy", | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
}, | ||
{ | ||
"type": "CC Attribution/Non-Commercial/Share-Alike", | ||
"url": "http://creativecommons.org/licenses/by-nc-sa/3.0/" | ||
} | ||
], | ||
|
||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/Khan/khan-exercises/" | ||
}, | ||
|
||
"devDependencies": { | ||
"jison" : "0.4.13" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters