Skip to content

Combine repositories into Tutor #1238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1,789 commits into from
Aug 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1789 commits
Select commit Hold shift + click to select a range
c2be389
fix linting error
jivewise May 26, 2016
6f67221
fixing some tests
jivewise May 27, 2016
402a4e4
updating indentifier link
jivewise May 27, 2016
2179e7f
adding in tooltip text based on project
jivewise May 31, 2016
5bb8d42
fix surety-guard require to use react-components
nathanstitt May 31, 2016
8d0407c
Add methods to display notices manually
nathanstitt May 31, 2016
c05d6a9
Merge pull request #74 from openstax/surety-guard-extraction
philschatz May 31, 2016
22bb557
Merge pull request #74 from openstax/custom-notices
philschatz May 31, 2016
95e1a19
adding in proptypes for project attribute to group component
jivewise Jun 2, 2016
b686bcc
allow pinned prop for multiparts
pandafulmanda Jun 3, 2016
b4ee0a6
Update launcher design
dak Jun 3, 2016
4f25f30
restore to original key scope if one exists after answer table's key …
pandafulmanda Jun 3, 2016
fad9566
Merge pull request #144 from openstax/launcher-redesign
philschatz Jun 6, 2016
e060a3f
Merge pull request #73 from openstax/feature/spaced-practice-tooltip
philschatz Jun 6, 2016
993421f
add isInteractive toggle
nathanstitt Jun 7, 2016
71452f9
remove required message shape
nathanstitt Jun 7, 2016
eb9b31b
Render stimulus with placeholders
nathanstitt Jun 7, 2016
b350be5
update data and specs to reflect new placeholders
nathanstitt Jun 7, 2016
f397d75
Display exercise "context" if present
nathanstitt Jun 7, 2016
6312d61
Fix specs
nathanstitt Jun 8, 2016
df388b9
Merge pull request #77 from openstax/ex-context
philschatz Jun 9, 2016
455a284
Merge pull request #76 from openstax/placeholders
philschatz Jun 9, 2016
442dd27
use waypoints instead of homegrown
pandafulmanda Jun 10, 2016
b05ab9a
separate on enter for parts with scroll
pandafulmanda Jun 10, 2016
1a215a7
add part leave
pandafulmanda Jun 10, 2016
5475bc8
add id for waypoint
pandafulmanda Jun 10, 2016
c628aca
wrap waypoints for ids
pandafulmanda Jun 10, 2016
66230e4
set ids and keys of waypoints of use stepIndex
pandafulmanda Jun 10, 2016
a6deda7
Removed page UUID from cnxfeature tags
Dantemss Jun 10, 2016
438f280
multipart footer only needed when step is pinned
pandafulmanda Jun 10, 2016
3f22195
Merge pull request #75 from openstax/remove_uuid_from_cnxfeature_tags
jpslav Jun 11, 2016
a3ab54d
Merge pull request #75 from openstax/fix/multiscroll-with-milestones
philschatz Jun 13, 2016
ae23ac2
adding in position:static for android devices
jivewise Jun 13, 2016
7160986
fixing indentation
jivewise Jun 13, 2016
0ff385f
Merge pull request #78 from openstax/fix/android-question-stem
pandafulmanda Jun 13, 2016
738c468
enroll or login appearance details
pandafulmanda Jun 14, 2016
f10c5fd
wording update
pandafulmanda Jun 14, 2016
52068ee
update specs and lint for long lines
pandafulmanda Jun 14, 2016
e3788c8
update enrollment screen with new mockup
nathanstitt Jun 14, 2016
1c1dd73
test that teachers are set
nathanstitt Jun 14, 2016
b57bae3
fixup specs
nathanstitt Jun 14, 2016
8ab7428
Merge pull request #145 from openstax/update/enroll-or-login
nathanstitt Jun 14, 2016
249eed2
Merge pull request #146 from openstax/id-ui-with-skip
pandafulmanda Jun 14, 2016
97a23f5
title is no longer given as a prop
nathanstitt Jun 15, 2016
3e74724
only set student_identifier if given
nathanstitt Jun 15, 2016
1ba9d61
switch to display: block for IE
nathanstitt Jun 15, 2016
e979803
Merge pull request #147 from openstax/fix/blank-student-id
pandafulmanda Jun 15, 2016
22dd1d4
update with more space for sign in button and coffee steam is white
pandafulmanda Jun 16, 2016
6f69851
Merge pull request #148 from openstax/updates/appearance-changes
nathanstitt Jun 16, 2016
09356e9
Safari/IE fix: use explicit color vs 'transparent'
nathanstitt Jun 16, 2016
09545a3
pinned prop should pass through for single parts form parent
pandafulmanda Jun 16, 2016
5f3fb6e
omit double 'comes with' related content for mpqs
pandafulmanda Jun 16, 2016
a8bba50
Style heading color and add label
nathanstitt Jun 16, 2016
801a2f9
Merge pull request #79 from openstax/fix/ie-styles
philschatz Jun 16, 2016
d474219
Merge pull request #80 from openstax/fix/mpq-footer
philschatz Jun 17, 2016
80874a9
update widths to be the same
nathanstitt Jun 17, 2016
38a9ca6
use div for sub-parts, bump up join size
nathanstitt Jun 17, 2016
b654387
Merge pull request #149 from openstax/confirm-styles
pandafulmanda Jun 18, 2016
d34e84a
fixed spaced practice icon alignment
Jun 20, 2016
e625364
Merge pull request #81 from openstax/fix/spaced-practice-icon
philschatz Jun 22, 2016
3f1e9c5
code to make sure incorrect answer instructions are hidden until feed…
jivewise Jun 22, 2016
dd08ae9
Merge pull request #82 from openstax/fix/hide-incorrect-instructions
philschatz Jun 22, 2016
5ab065f
Remove position static, set size
nathanstitt Jun 22, 2016
d80af3a
Merge pull request #83 from openstax/ql-styles
philschatz Jun 23, 2016
800227c
add "enrollment code needed" help text
nathanstitt Jun 23, 2016
81a9f6d
Fix spec to reflect new wording
nathanstitt Jun 23, 2016
45bd698
update spaced practice icon/text on exercise card
Jun 23, 2016
29fc99a
updated multi-part instruction text
Jun 23, 2016
ac61b20
Merge pull request #150 from openstax/launcher-styles
philschatz Jun 27, 2016
c774581
Merge pull request #84 from openstax/spaced-practice-icon-text
philschatz Jun 27, 2016
f749455
Merge pull request #85 from openstax/two-part-explanation-text
philschatz Jun 27, 2016
44f16dd
move laptop and mug to separate component
nathanstitt Jun 27, 2016
0e63c0f
Add laptop, style and remove instructor wording
nathanstitt Jun 27, 2016
89eae0d
test laptop and background separately
nathanstitt Jun 27, 2016
4436176
fix spec to have new wording
nathanstitt Jun 27, 2016
2800022
Merge pull request #151 from openstax/e-or-s
pandafulmanda Jun 27, 2016
ca91866
Removes the default functionality where it tries to determine whether…
pwolfert Jun 29, 2016
d9be2cd
I removed the test for ArbitraryHtmlAndMath figuring out whether a si…
pwolfert Jun 29, 2016
391c24b
fixing missing exercise id and report error link
jivewise Jun 30, 2016
ab41787
Merge pull request #86 from openstax/fix/embedded-interactives
pandafulmanda Jun 30, 2016
b74cb51
taking out unnecessary function
jivewise Jun 30, 2016
f1bbdad
Merge pull request #87 from openstax/fix/missing-id-link
nathanstitt Jun 30, 2016
e0af24e
removing display table for answers-answer class so safari displays co…
jivewise Jul 1, 2016
b207a93
replace placeholder components with SVG files
nathanstitt Jul 1, 2016
3af6082
style SVG placeholder images
nathanstitt Jul 1, 2016
32fbbf3
remove spec for deleted component
nathanstitt Jul 1, 2016
ea5e4ac
remove reference to deleted placeholder component
nathanstitt Jul 1, 2016
f208a68
updating exercise preview, this time for real
jivewise Jul 5, 2016
364c425
Merge pull request #89 from openstax/fix/safari-exercise-preview
philschatz Jul 5, 2016
4d09346
use var for images-path
nathanstitt Jul 5, 2016
034e2fc
ArbitraryHtmlAndMath components can now self-determine whether an ifr…
pwolfert Jul 5, 2016
4899608
Render context on exercise preview
nathanstitt Jul 5, 2016
41f0d3d
context max is 300px is when ex is height limited
nathanstitt Jul 5, 2016
7effe9b
Revert "context max is 300px is when ex is height limited"
nathanstitt Jul 5, 2016
6fd6b17
Revert "Render context on exercise preview"
nathanstitt Jul 5, 2016
571e5a6
Merge pull request #91 from openstax/fix/embedded-interactives
philschatz Jul 6, 2016
17597c4
Process entire document if mathml is found
nathanstitt Jul 6, 2016
9d499b9
move placeholders to icons, use icon-bg mixin
nathanstitt Jul 6, 2016
55072f3
Merge pull request #88 from openstax/fix/ex-placeholder
philschatz Jul 6, 2016
e107b12
use parentElement and unique to select nodes
nathanstitt Jul 6, 2016
057d853
Render context on exercise preview
nathanstitt Jul 5, 2016
d971899
context max is 300px is when ex is height limited
nathanstitt Jul 5, 2016
1d06c26
remove placeholder spec
nathanstitt Jul 6, 2016
04fa837
update comment
philschatz Jul 7, 2016
70083f6
Merge pull request #93 from openstax/fix/mathml
philschatz Jul 7, 2016
12c42d8
Merge pull request #92 from openstax/exercise-context
philschatz Jul 7, 2016
d00d1ea
De-activate scrolling with MPQ
nathanstitt Jul 5, 2016
c4999d5
restore scrolling behavior
nathanstitt Jul 6, 2016
c01b779
remove scrolling from MPQ
nathanstitt Jul 7, 2016
bd4c4a5
remove waypoints
nathanstitt Jul 7, 2016
88e344d
add scroll-to mixin
nathanstitt Jul 8, 2016
24774e0
add a data-step attribute for scroll targeting
nathanstitt Jul 8, 2016
1fbb533
scroll to step when mounted or it changes
nathanstitt Jul 8, 2016
d338e84
focus textarea
nathanstitt Jul 8, 2016
ef1c095
handle focusing text area for current step
nathanstitt Jul 8, 2016
9c1c10e
read state from nextProps, not current
nathanstitt Jul 8, 2016
58ba67b
Update react-components to get MPQ scroll fixes
nathanstitt Jul 8, 2016
de72d70
Merge pull request #152 from openstax/fix/delayed-state
philschatz Jul 8, 2016
d176a27
small updates - ScrollTo is ScrollToMixin and taking out old props
pandafulmanda Jul 8, 2016
cc4cf11
export scroll to mixin for easy import
pandafulmanda Jul 8, 2016
e660385
Merge pull request #90 from openstax/fix/mpq-scroll
pandafulmanda Jul 8, 2016
21bbf45
Scroll to step using it's index, not MPQ index
nathanstitt Jul 11, 2016
a28aeda
Merge pull request #94 from openstax/fix/scroll-index
pandafulmanda Jul 11, 2016
fabf6f5
try first updating shared components to see if this helps the double …
pandafulmanda Jul 11, 2016
7aa6c98
Merge pull request #153 from openstax/fix/double-mced
nathanstitt Jul 11, 2016
0ecc988
Makes it so the `.question-stem` element gets the `data-question-numb…
pwolfert Jul 11, 2016
c764e4b
Merge pull request #95 from openstax/fix/question-context-styling
pandafulmanda Jul 12, 2016
397c2f5
Fixed an instance of "course/period" when it should have been "section".
pwolfert Jul 13, 2016
5f8c4cc
Title should be full-width
nathanstitt Jul 14, 2016
6a0c8cd
Add `send_pin: true` to confirmation
nathanstitt Jul 15, 2016
22330bf
adding in project property for exercises so spaced practice tooltip s…
jivewise Jul 15, 2016
6b00b89
Merge pull request #96 from openstax/pin-body
pandafulmanda Jul 15, 2016
3b1a3ae
update with email confirmation change and error notification link
pandafulmanda Jul 15, 2016
b8d773a
add nice line break
pandafulmanda Jul 15, 2016
af65278
more line breaks
pandafulmanda Jul 15, 2016
d1ac177
Merge pull request #157 from openstax/update/help-link-and-email-confirm
nathanstitt Jul 18, 2016
f76d978
Merge pull request #154 from openstax/fix/course-period-section
pandafulmanda Jul 18, 2016
2ccdfe0
Merge pull request #155 from openstax/fix/wraping-header
pandafulmanda Jul 18, 2016
dd8e12e
Merge pull request #156 from openstax/fix/add-project-property
pandafulmanda Jul 18, 2016
0d604f7
minimal change to add help link into dropdown menu
pandafulmanda Jul 18, 2016
88592ae
Merge pull request #158 from openstax/feature/help-link-in-nav
nathanstitt Jul 18, 2016
1482732
This changes the order that the question ID link and the submit butto…
pwolfert Jul 19, 2016
f53ff9b
Delinted.
pwolfert Jul 19, 2016
8e1cd8d
Merge pull request #98 from openstax/fix/submit-btn-tabbing
philschatz Jul 20, 2016
75786ff
dont push to url state when scrolling to react-root-container
pandafulmanda Jul 15, 2016
362865c
no need to push history when scrolling to step -- task manages url up…
pandafulmanda Jul 18, 2016
d7a51d9
once part is completed, show passed in footer button for single parts…
pandafulmanda Jul 18, 2016
b282766
more declaratively set focus and blur on textarea
pandafulmanda Jul 18, 2016
d8b0a01
focus or blur only if changed
pandafulmanda Jul 19, 2016
248a0b5
dont need prev state in componentDidUpdate
pandafulmanda Jul 19, 2016
be31cac
scroll to exercise part only when not mostly in view
pandafulmanda Jul 19, 2016
31527c6
props need canOnlyContinue
pandafulmanda Jul 21, 2016
dc7a1f5
some props types
pandafulmanda Jul 21, 2016
5d11e66
single parts should definitely render footers as passed in
pandafulmanda Jul 25, 2016
d49c8ca
style entire document when mathml nodes are found
nathanstitt Jul 25, 2016
b61ef0e
pass control buttons all the way through
pandafulmanda Jul 25, 2016
d4d73ae
Make FakeWindow spy on itself when instantiated
nathanstitt Jul 25, 2016
9f75829
Use passed in window implementation for testing
nathanstitt Jul 25, 2016
5743568
Test mathjax helpers
nathanstitt Jul 25, 2016
7513e0d
re-create localStorage for each object
nathanstitt Jul 25, 2016
186772b
id link cannot render in pinned footer and must be in card body
pandafulmanda Jul 25, 2016
55323a9
dont need related to be passed into mpq id link
pandafulmanda Jul 25, 2016
6ff470c
name focus function more clearing and pass scroll selector in view as…
pandafulmanda Jul 26, 2016
18babd4
Merge pull request #97 from openstax/fix/no-more-react-root-container…
nathanstitt Jul 26, 2016
6ca11e8
Merge pull request #100 from openstax/fix/mathml
pandafulmanda Jul 26, 2016
5a6c537
Changed the "Change Course" and "Register for Course" to "Change Sect…
pwolfert Jul 26, 2016
215d0a3
Updated the tests to test against the right text for the menu.
pwolfert Jul 27, 2016
3f845a0
Merge pull request #159 from openstax/fix/change-course-text
nathanstitt Jul 27, 2016
6e98c54
Add college version of icons
nathanstitt Jul 27, 2016
a41963c
replaced icon-personalized
Jul 29, 2016
b1a2cae
replaced icon-multipart
Jul 29, 2016
49438f8
updated multipart icon component svg
Jul 29, 2016
d67573a
updated interactive icon component svg
Jul 29, 2016
81796db
replaced icon-interactive
Jul 29, 2016
eceb3d4
replaced icon-review
Jul 29, 2016
fe50caf
updated review icon jsx in component
Jul 29, 2016
2ee2aa2
added interstitial review icon to resources
Jul 29, 2016
8f71fed
added interstitial personalized icon to resources
Jul 29, 2016
8b30d16
allow handling of deleted homeworks and readings
jivewise Jul 26, 2016
2d9a189
forgot to commit update to tests
jivewise Jul 26, 2016
9a92372
updating proptypes and a bit of logic
jivewise Jul 27, 2016
97d3416
cleaning up exercise task props and classnames
jivewise Jul 29, 2016
e19afce
adding in question number, not sure how it got removed
jivewise Jul 29, 2016
e736a23
fixing tab width in less file
jivewise Jul 29, 2016
7380c03
Merge pull request #103 from openstax/icon-assets-multipart-interactive
pandafulmanda Jul 29, 2016
3683793
Merge pull request #101 from openstax/fix/handle-deleted-tasks
pandafulmanda Jul 29, 2016
aa3279e
make cl icons match old hs icons for merging into master
pandafulmanda Jul 29, 2016
5116182
add back in sim icon just in case
pandafulmanda Jul 29, 2016
b51d6e8
Merge pull request #102 from openstax/college-icons
pandafulmanda Jul 29, 2016
f38440d
adding in help link in concept coach
jivewise Aug 1, 2016
394b6d0
Merge pull request #160 from openstax/fix/cc-help-link
pandafulmanda Aug 1, 2016
58cb860
removing old files and folders
jivewise Aug 1, 2016
f6009ab
switch stubs subdir to api subdir to match other repos
pandafulmanda Aug 1, 2016
3fdce5e
Merge pull request #77 from openstax/remove-old-files
pandafulmanda Aug 1, 2016
ceec5fe
Merge pull request #105 from openstax/update/make-stubs-api-to-match
nathanstitt Aug 1, 2016
3327add
Move all Tutor files into sub-directory
nathanstitt Aug 1, 2016
20ca305
Merge remote-tracking branch 'shared/master' into mono-repo-or-bust
nathanstitt Aug 1, 2016
c13f26a
Move shared components into sub-directory
nathanstitt Aug 1, 2016
ed8d87b
Merge remote-tracking branch 'exercises/master' into mono-repo-or-bust
nathanstitt Aug 1, 2016
4237a84
Move exercises into sub-directory
nathanstitt Aug 1, 2016
ed7a883
Merge remote-tracking branch 'coach/master' into mono-repo-or-bust
nathanstitt Aug 1, 2016
9eb9ca8
Move CC into sub-directory
nathanstitt Aug 1, 2016
ded0fb5
Move Tutor files back into main directory
nathanstitt Aug 1, 2016
8c0992f
Add bare-bones 'serve' script to test vars
nathanstitt Aug 1, 2016
1ecbd49
initial adding of configs and webpack configs, both for based, and fo…
pandafulmanda Aug 2, 2016
1c72e46
dont need to do production config twice, make environment name stricter
pandafulmanda Aug 2, 2016
f70e2bc
Merge branch 'master' into mono-repo-or-bust
nathanstitt Aug 2, 2016
90445f5
webpack building
nathanstitt Aug 2, 2016
c81842c
a known-good standalone config for Tutor
nathanstitt Aug 2, 2016
2eea492
update webpack building config
nathanstitt Aug 3, 2016
e618a13
build and serve scripts
nathanstitt Aug 3, 2016
f92b297
fix paths for production build
nathanstitt Aug 3, 2016
a4f42c8
remove unused/uneeded gulpfile
nathanstitt Aug 3, 2016
56c00f7
fix script
nathanstitt Aug 3, 2016
15ff98e
Load shared components from "shared" directory
nathanstitt Aug 3, 2016
3dc7143
remove spec that tests non-existant component
nathanstitt Aug 3, 2016
3e82a25
Basic test setup
nathanstitt Aug 3, 2016
f92ed53
add `bin-archive` command for backwards compat
nathanstitt Aug 3, 2016
52b22f5
rename scripts folder to bin
nathanstitt Aug 3, 2016
e15236d
Update README to describe updated serve/build
nathanstitt Aug 3, 2016
405aed6
move coffeelint config into top level dir
nathanstitt Aug 3, 2016
c964539
add shared path resolves to base webpack config from tutor-specific
pandafulmanda Aug 3, 2016
1d9dcc1
serve preview for all projects with serve script
pandafulmanda Aug 3, 2016
543185b
pull out repeated input checking
pandafulmanda Aug 3, 2016
b058e29
make sure course data is loaded
nathanstitt Aug 3, 2016
bbdfd1b
body can be both element or string
nathanstitt Aug 3, 2016
bdeff02
Add needed task counts for late message
nathanstitt Aug 3, 2016
1cf650f
remove malfunctioning spec (it's tested in store)
nathanstitt Aug 3, 2016
31fc887
add name to course
nathanstitt Aug 3, 2016
ea048c1
update message to match actual text
nathanstitt Aug 3, 2016
6a22978
disable spec that has indeterminate behaviour
nathanstitt Aug 3, 2016
7f95586
setup scripts for each testing purpose
nathanstitt Aug 3, 2016
5e50950
rename ci runner script to match package.json
nathanstitt Aug 3, 2016
bebe3fb
course may be null in specs
nathanstitt Aug 3, 2016
2c5d5de
re-enable spec
nathanstitt Aug 3, 2016
ce008f4
Make tdd actually start webserver
nathanstitt Aug 3, 2016
c251199
webpack config for karma should also have project based paths so that…
pandafulmanda Aug 4, 2016
a105545
hardcode ci for tutor for now
pandafulmanda Aug 4, 2016
8d0e4d7
Update karma related packages
nathanstitt Aug 4, 2016
b29750f
remove single-run from config and set it using cli
nathanstitt Aug 4, 2016
c7b39b4
include tutor test files directly
nathanstitt Aug 4, 2016
750bf7c
update phantomjs
nathanstitt Aug 4, 2016
c094d09
revert phantom/karma versio changes
nathanstitt Aug 4, 2016
d7d7a22
test command works for other projects
pandafulmanda Aug 4, 2016
4202522
build projects in their own dist folders
nathanstitt Aug 4, 2016
bafd7f4
travis matrix for ci of each project
pandafulmanda Aug 5, 2016
bb92087
update BS.Modal use for coach to newer current version, update spec a…
pandafulmanda Aug 5, 2016
de24440
take out node_js version in travis, travis will fallback to .nvmrc
pandafulmanda Aug 5, 2016
1c4b8a7
darn i thought node 4.4 installs with npm@^3
pandafulmanda Aug 5, 2016
2aa0ff1
Merge pull request #1243 from openstax/webpack-build
nathanstitt Aug 5, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/coverage
/coverage-selenium.json
/docs*

archive.tar.gz
/*/dist
*.cjsx.js

/phantomjsdriver.log
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# `sudo:false` for faster builds.
sudo: false
language: node_js
node_js:
- "0.12.10"
env:
- OX_PROJECT=tutor
- OX_PROJECT=coach
- OX_PROJECT=exercises
- OX_PROJECT=shared
before_install:
- "npm install -g npm@^3"
script:
- npm run ci
after_failure:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![dependency status][dependency-image]][dependency-url]
[![dev dependency status][dev-dependency-image]][dev-dependency-url]

The JavaScript client for openstax Tutor.
The Front-end code for Openstax Tutor related projects

## Install

Expand All @@ -14,16 +14,16 @@ The JavaScript client for openstax Tutor.
- If you don’t have `git` installed you can install homebrew and then `brew install git`
1. `cd tutor-js` move into the checked out directory
1. `npm install`
1. `npm start`
1. `npm run serve <project>` *(where <project is one of tutor|coach|exercises)*
1. Point your browser to <http://localhost:8000> to use the mock data in `/api`


## Development

- `npm start` starts up a local development webserver which rebuilds files when changed
- `npm test` runs unit tests
- `npm run serve <project>` starts up a local development webserver which rebuilds files when changed
- `npm test` runs unit tests for all projects
- `npm run coverage` generates a code coverage report
- `gulp prod` builds minified files for production
- `npm run build <project> archive` builds minified files for production

Use `PORT=8000 npm start` to change the default webserver port.

Expand Down
22 changes: 22 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

bin/checkinputs "$@"

export OX_PROJECT=$1
echo Building: $OX_PROJECT
export NODE_ENV=production

[ -d $OX_PROJECT/dist ] && rm -r $OX_PROJECT/dist

webpack --progress --config webpack.config.js

if [ $2 == "archive" ]; then
cd $OX_PROJECT
# credit/blame to: http://stackoverflow.com/questions/8201729/rename-files-to-md5-sum-extension-bash
for F in dist/*.min.*; do
mv $F `md5sum $F | perl -MFile::Basename -ne '($m, $f) = split(/\s+/,$_); $f=basename($f); $f =~ m/(.*?)\.(.*)/; print "dist/$1-$m.$2"'`
done
tar -czf ../archive.tar.gz dist/*
fi
7 changes: 7 additions & 0 deletions bin/checkinputs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ $# -eq 0 ]; then
echo "No project to build was given. usage:"
echo "$0 <tutor|exercises|coach>"
exit 1
fi
10 changes: 10 additions & 0 deletions bin/serve
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

bin/checkinputs "$@"

export OX_PROJECT=$1
echo Serving: $OX_PROJECT

webpack-dev-server --progress --config webpack.config.js
23 changes: 23 additions & 0 deletions bin/tdd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

on_termination() {
echo killing webpack $WEBPACK_PID
kill -TERM $WEBPACK_PID 2>/dev/null
}

bin/checkinputs "$@"

trap on_termination SIGTERM SIGINT

export OX_PROJECT=$1
echo TDD: $OX_PROJECT


webpack-dev-server --config webpack.config.js &
WEBPACK_PID=$!
echo webpack started pid: $WEBPACK_PID


karma start test/karma.config.js --auto-watch --no-single-run
10 changes: 10 additions & 0 deletions bin/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

bin/checkinputs "$@"

export OX_PROJECT=$1
echo Test: $OX_PROJECT

karma start test/karma.config.js --single-run
8 changes: 8 additions & 0 deletions bin/test-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -ev

# travis should be setting the OX_PROJECT variable
# export OX_PROJECT='tutor'

karma start test/karma.config.js --single-run
6 changes: 6 additions & 0 deletions coach/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
*.orig
/.tmp
/dist
/assets
/test-failed-*.png
7 changes: 7 additions & 0 deletions coach/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `sudo:false` for faster builds.
sudo: false
language: node_js
node_js:
- "0.10"
after_failure:
- npm list
132 changes: 132 additions & 0 deletions coach/Gulpfile.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
_ = require 'underscore'
coffeelint = require 'gulp-coffeelint'
del = require 'del'
env = require 'gulp-env'
gulp = require 'gulp'
gutil = require 'gulp-util'
gzip = require 'gulp-gzip'
karma = require 'karma'
rev = require 'gulp-rev'
tar = require 'gulp-tar'
watch = require 'gulp-watch'
webpack = require 'webpack'
webpackServer = require 'webpack-dev-server'
WPExtractText = require 'extract-text-webpack-plugin'

getWebpackConfig = require './webpack.config'

TestRunner = require './test/config/test-runner'

KARMA_DEV_CONFIG =
configFile: __dirname + '/test/karma-dev.config.coffee'
singleRun: false

KARMA_CONFIG =
configFile: __dirname + '/test/config/karma.config.coffee'
singleRun: true

KARMA_COVERAGE_CONFIG =
configFile: __dirname + '/test/config/karma-coverage.config.coffee'
singleRun: true

DIST_DIR = './dist'

# -----------------------------------------------------------------------
# Build Javascript and Styles using webpack
# -----------------------------------------------------------------------
gulp.task '_cleanDist', (done) ->
del(['./dist/*'], done)

gulpWebpack = (name) ->
env(vars:{ NODE_ENV: 'production' })
config = getWebpackConfig(name, process.env.NODE_ENV is 'production')
webpack(config, (err, stats) ->
throw new gutil.PluginError("webpack", err) if err
gutil.log("[webpack]", stats.toString({
# output options
}))
)

gulp.task '_buildMain', _.partial(gulpWebpack, 'main')
gulp.task '_buildMainMin', _.partial(gulpWebpack, 'main.min')
gulp.task '_buildFull', _.partial(gulpWebpack, 'fullBuild')
gulp.task '_buildFullMin', _.partial(gulpWebpack, 'fullBuild.min')
gulp.task '_buildDemo', _.partial(gulpWebpack, 'demo')

gulp.task 'build', ['_cleanDist', '_buildMain', '_buildMainMin', '_buildFull', '_buildFullMin']

gulp.task '_tagRev', ['build'], ->
gulp.src("#{DIST_DIR}/*.min.*")
.pipe(rev())
.pipe(gulp.dest(DIST_DIR))
.pipe(rev.manifest())
.pipe(gulp.dest(DIST_DIR))

# -----------------------------------------------------------------------
# Production
# -----------------------------------------------------------------------

gulp.task '_archive', ['_tagRev'], ->
gulp.src(["#{DIST_DIR}/*"], base: DIST_DIR)
.pipe(tar('archive.tar'))
.pipe(gzip())
.pipe(gulp.dest(DIST_DIR))

# -----------------------------------------------------------------------
# Development
# -----------------------------------------------------------------------
#
gulp.task '_karma', ->
server = new karma.Server(KARMA_DEV_CONFIG)
server.start()

# TODO will rewrite this to fit new config
gulp.task '_webserver', ->
env(vars:{ NODE_ENV: 'development' })
config = getWebpackConfig('devServer', process.env.NODE_ENV is 'production')
server = new webpackServer(webpack(config), config.devServer)
server.listen(config.devServer.port, '0.0.0.0', (err) ->
throw new gutil.PluginError("webpack-dev-server", err) if err
)

# -----------------------------------------------------------------------
# Public Tasks
# -----------------------------------------------------------------------
#
# External tasks called by various people (devs, testers, Travis, production)
#
# TODO: Add this to webpack
gulp.task 'lint', ->
gulp.src(['./src/**/*.{cjsx,coffee}', './*.coffee', './test/**/*.{cjsx,coffee}'])
.pipe(coffeelint())
# Run through both reporters so lint failures are visible and Travis will error
.pipe(coffeelint.reporter())
.pipe(coffeelint.reporter('fail'))

gulp.task 'prod', ['_archive']

gulp.task 'serve', ['_webserver']

gulp.task 'test', ['lint'], (done) ->
server = new karma.Server(KARMA_CONFIG)
server.start()

gulp.task 'coverage', ->
server = new karma.Server(KARMA_COVERAGE_CONFIG)
server.start()

# clean out the dist directory before running since otherwise stale files might be served from there.
# The _webserver task builds and serves from memory with a fallback to files in dist
gulp.task 'dev', ['_cleanDist', '_webserver']

gulp.task 'testrunner', ->
runner = new TestRunner()
watch('{src,test}/**/*', (change) ->
runner.onFileChange(change) unless change.unlink
)

gulp.task 'tdd', ['_cleanDist', '_webserver', 'testrunner']

gulp.task 'demo', ['_buildDemo']

gulp.task 'release', ['build', 'demo']
23 changes: 23 additions & 0 deletions coach/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
See it [here](https://openstax.github.io/concept-coach/).

# To run locally:

you need to have [tutor-server](https://github.com/openstax/tutor-server) running locally. Then,

1. Clone this repo
1. `npm install`
1. `DEV_PORT=3004 gulp tdd`
* Replace with whatever port you'd like
1. In `tutor-server`'s `config/secrets.yml`, add `http://localhost:3004` to the list of `cc-origins`
* Starts around line 20.
1. Restart the `tutor-server`
1. Go to `http://localhost:3004` and the Launch button for Concept Coach should be there!


# To build for release and deployment:

1. Run `npm run release`
* This will switch to gh-pages branch, merge master into it, and then build
1. Commit files and push to github gh-pages branch
1. Tag and make release in github
1. Copy sha hash of tag into webview's `bower.json`
Loading