inspec/support/rebuild_inspec_test_fixture_plugin.sh
Clinton Wolfe 7963131670 Plugins Installer API (#3352)
* Sketch out in comments the unit and functional tests for the installer
* Make a test fixture gem, v0.1.0
* Add a 0.2.0 version of the test fixture gem, this one with a dependency
* Add a fixture with a pre-installed gem
* Correct test-fixture 0.1.0 gem
* Moockup of installed inspec-test-fixture gems
* Uggh add gemspec files to mock installs
* Update gem fixtures, and add a script that does it for me
* Able to load from and list privately managed gems
# Conflicts:
#	lib/inspec/plugin/v2/loader.rb

* Expanded tests, starting on implementation of installer

# Conflicts:
#	test/unit/plugin/v2/loader_test.rb

* Install plugin from local gem file works
* Writes the plugins.json file; needs refactor
* Gem install works; no version pinning
* Install with pinned version works
* Install from path works
* update works
* Validation for uninstall
* Uninstall from path works
* Uninstaller works on gems
* Add search to installer API.


Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-09-19 17:38:13 -04:00

45 lines
No EOL
1.5 KiB
Bash
Executable file

#!/bin/bash
# Unportable assumptions:
# 1. You use rbenv to manage ruby runtimes.
# 2. You are running from project root
eval "$(rbenv init -)"
PLUGIN_SRC_DIR=test/unit/mock/plugins/inspec-test-fixture
FIXTURE_BASE=test/unit/mock/config_dirs
FIXTURE_VERSIONS="1 2"
RUBY_VERSIONS="2.3.1,2.3.0 2.4.2,2.4.0 2.5.1,2.5.0"
# Make two fresh gems
cd $PLUGIN_SRC_DIR
sed -i -e s/0\.2\.0/0.1.0/ lib/inspec-test-fixture/version.rb
bundle exec rake build
sed -i -e s/0\.1\.0/0.2.0/ lib/inspec-test-fixture/version.rb
bundle exec rake build
sed -i -e s/0\.2\.0/0.1.0/ lib/inspec-test-fixture/version.rb
rm -f lib/inspec-test-fixture/version.rb-e
cd ../../../../../
# Purge and re-install the existing gem installs
for fver in $FIXTURE_VERSIONS; do
for info in $RUBY_VERSIONS; do
RUBY_VER=$(echo "$info" | cut -d, -f1)
RUBY_ABI=$(echo "$info" | cut -d, -f2)
GEM_DIR="$FIXTURE_BASE/test-fixture-${fver}-float/gems/$RUBY_ABI"
echo "Reinstalling inspec-test-fixture-0.${fver}.0 for ABI $RUBY_ABI"
rm -rf "$GEM_DIR"
mkdir -p "$GEM_DIR"
rbenv shell "$RUBY_VER"
gem install -N -i "$GEM_DIR $PLUGIN_SRC_DIR/pkg/inspec-test-fixture-0.${fver}.0.gem"
echo
done
done
# Fix ordinal array gemspec....
for info in $RUBY_VERSIONS; do
RUBY_ABI=$(echo $info | cut -d, -f2)
GEM_DIR="$FIXTURE_BASE/test-fixture-${fver}-float/gems/$RUBY_ABI"
cp -v "$GEM_DIR/specifications/ordinal_array-0.2.0.gemspec" "$GEM_DIR/gems/ordinal_array-0.2.0/ordinal_array.gemspec"
done
rbenv shell 2.4.2