Skip to content

Commit

Permalink
Merge pull request #49 from skateman/fix-bower-caching
Browse files Browse the repository at this point in the history
Fix the path to the bower directory to make bower caching work
  • Loading branch information
himdel authored Jan 3, 2017
2 parents 31b87f1 + e1ffc3a commit e36f61b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ sudo: false
cache:
bundler: true
directories:
- vendor/assets/bower_components
- spec/manageiq/vendor/assets/bower_components
before_cache:
- cat bower.json > vendor/assets/bower_components/bower.json
- cat bower.json > spec/manageiq/vendor/assets/bower_components/bower.json
addons:
postgresql: '9.4'
env:
Expand Down
10 changes: 9 additions & 1 deletion tools/ci/before_install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
set -e

git clone https://github.com/ManageIQ/manageiq.git --depth 1 spec/manageiq
# The bower cache already exists under spec/manageiq/vendor/assets/bower_components
# and unfortunately it is not possible to git clone to a non-empty directory.
mkdir -p spec/manageiq
cd spec/manageiq
git init
git remote add origin https://github.com/ManageIQ/manageiq.git
git pull origin master --depth=1
cd -

echo 'unless dependencies.detect { |d| d.name == "manageiq-ui-classic" }' >> spec/manageiq/Gemfile.dev.rb
echo ' gem "manageiq-ui-classic", :path => "'$(/bin/pwd)'"' >> spec/manageiq/Gemfile.dev.rb
echo 'end' >> spec/manageiq/Gemfile.dev.rb
Expand Down
18 changes: 18 additions & 0 deletions tools/ci/setup_js_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
which bower || npm install -g bower

# Check if the bower cache is valid, otherwise delete it
if ! cmp --silent bower.json spec/manageiq/vendor/assets/bower_components/bower.json; then
rm -rf spec/manageiq/vendor/assets/bower_components
fi

if [ -d spec/manageiq/vendor/assets/bower_components ]; then
echo "bower assets installed... moving on."
else
bower install --allow-root -F --config.analytics=false
STATUS=$?
echo bower exit code: $STATUS

# fail the whole test suite if bower install failed
[ $STATUS = 0 ] || exit 1
[ -d spec/manageiq/vendor/assets/bower_components ] || exit 1
fi

0 comments on commit e36f61b

Please sign in to comment.