Skip to content

Commit

Permalink
Merge pull request #1250 from marmelab/clean-makefile-travis
Browse files Browse the repository at this point in the history
[RFR] Clean makefile & travis.yml
  • Loading branch information
Phocea authored Nov 18, 2016
2 parents b815032 + 291cc9b commit b98f5b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ env:
- CXX=g++-4.8
- secure: Yp3LrtligD2LVcYK7xep9vPbOV9kDFixeY/TySYZM62WikYrKNUg54MHXI0FsbJ29Ay62W40uC6gIkWMq1cO1Ensj2Y4PzlFSM042vB8axHwJV6oMCNy4vHv1plt7vTXIv8+JSN0x3gPO4hhD4K39liKC5eARZLe3ObbcSsAgbU=
- secure: dTO5DS3+XnjOub7MHyKeU6YdCIBEExOcaq57u3yx7JnLy9/eNrDXEe+oQUhRCb/w8egnqd8Nvmkq9095IQe8r+/zzR1AAE69affM1oPnP0n+LzvukjJDgm/ZYYLY9SY0EOZ4TNmKuT89gECYeCMp/dFAQdPNEBsmjtbk09/Kqyg=
- TZ=Europe/Paris
- DISPLAY=:99.0
addons:
sauce_connect: true
hosts:
Expand All @@ -20,13 +22,9 @@ language: node_js
node_js:
- "4"
before_install:
- "export TZ=Europe/Paris" # Change timezone to test Date function more accurately
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- gem update --system
- gem install compass
before_script:
- "./node_modules/protractor/bin/webdriver-manager update"
branches:
only:
- master
40 changes: 20 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@ install:
./node_modules/protractor/bin/webdriver-manager update --versions.chrome=2.24

run: examples/blog/build
@cp node_modules/fakerest/dist/FakeRest.min.js examples/blog/build/fakerest.js
@cp node_modules/sinon/pkg/sinon-server-1.14.1.js examples/blog/build/sinon-server.js
@./node_modules/webpack-dev-server/bin/webpack-dev-server.js --colors --inline --hot --devtool cheap-module-inline-source-map --content-base examples/blog --port 8000
cp node_modules/fakerest/dist/FakeRest.min.js examples/blog/build/fakerest.js
cp node_modules/sinon/pkg/sinon-server-1.14.1.js examples/blog/build/sinon-server.js
./node_modules/webpack-dev-server/bin/webpack-dev-server.js --colors --inline --hot --devtool cheap-module-inline-source-map --content-base examples/blog --port 8000

examples/blog/build:
@mkdir examples/blog/build
mkdir examples/blog/build

transpile:
@mkdir -p lib/
@rm -rf lib/*
@./node_modules/.bin/babel src/javascripts -d lib/javascripts --source-maps > /dev/null
@cd src && rsync -R `find . -name *.html` ../lib # copy all HTML files keeping structure from src to lib
@cp -Rf ./src/sass/ lib/
mkdir -p lib/
rm -rf lib/*
./node_modules/.bin/babel src/javascripts -d lib/javascripts --source-maps > /dev/null
cd src && rsync -R `find . -name *.html` ../lib # copy all HTML files keeping structure from src to lib
cp -Rf ./src/sass/ lib/

build:
@make transpile
@NODE_ENV=production ./node_modules/webpack/bin/webpack.js -p --optimize-minimize --optimize-occurence-order --optimize-dedupe --progress --devtool --source-map
@cp -Rf build examples/blog/
make transpile
NODE_ENV=production ./node_modules/webpack/bin/webpack.js -p --optimize-minimize --optimize-occurence-order --optimize-dedupe --progress --devtool --source-map
cp -Rf build examples/blog/
@echo "Files build/ng-admin.min.css and build/ng-admin.min.js updated (with minification)"

test: test-unit test-e2e

test-unit:
@./node_modules/.bin/karma start src/javascripts/test/karma.conf.js --single-run
./node_modules/.bin/karma start src/javascripts/test/karma.conf.js --single-run

test-e2e: prepare-test-e2e
@./node_modules/.bin/protractor src/javascripts/test/protractor.conf.js
./node_modules/.bin/protractor src/javascripts/test/protractor.conf.js

prepare-test-e2e:
@echo "Preparing files for e2e tests"
@NODE_ENV=test ./node_modules/webpack/bin/webpack.js -p --optimize-minimize --optimize-occurence-order --optimize-dedupe
@cp examples/blog/*.js src/javascripts/test/fixtures/examples/blog
@cp examples/blog/*.html src/javascripts/test/fixtures/examples/blog
@sed -i.bak 's|http://localhost:8000/|/|g' src/javascripts/test/fixtures/examples/blog/index.html
@cp node_modules/fakerest/dist/FakeRest.min.js src/javascripts/test/fixtures/examples/blog/build/fakerest.js
@cp node_modules/sinon/pkg/sinon-server-1.14.1.js src/javascripts/test/fixtures/examples/blog/build/sinon-server.js
NODE_ENV=test ./node_modules/webpack/bin/webpack.js -p --optimize-minimize --optimize-occurence-order --optimize-dedupe
cp examples/blog/*.js src/javascripts/test/fixtures/examples/blog
cp examples/blog/*.html src/javascripts/test/fixtures/examples/blog
sed -i.bak 's|http://localhost:8000/|/|g' src/javascripts/test/fixtures/examples/blog/index.html
cp node_modules/fakerest/dist/FakeRest.min.js src/javascripts/test/fixtures/examples/blog/build/fakerest.js
cp node_modules/sinon/pkg/sinon-server-1.14.1.js src/javascripts/test/fixtures/examples/blog/build/sinon-server.js

publish: build
npm publish

0 comments on commit b98f5b3

Please sign in to comment.