Skip to content

Instantly share code, notes, and snippets.

@Irio
Last active August 29, 2015 14:05
Show Gist options
  • Save Irio/3ca80fd20513b7d22ca0 to your computer and use it in GitHub Desktop.
Save Irio/3ca80fd20513b7d22ca0 to your computer and use it in GitHub Desktop.
Script to migrate Neighborly's payment engines to use Neighborly itself as "dummy app"
# Save this file in the same folder as both
# Neighborly and gem repositories are.
#
# $ ./real_dummy_app.sh neighborly-balanced-bankaccount
GEM_NAME=$1
# luminopolis folder
git clone git@github.com:neighborly/`echo $GEM_NAME`.git
cd neighborly
bundle exec rake db:drop
cd ../`echo $GEM_NAME`
rm -r spec/dummy
git rm -r spec/dummy
git submodule add https://github.com/neighborly/neighborly.git spec/dummy
git add .gitmodules spec/dummy
echo ".env" >> .gitignore
git add .gitignore
echo "language: ruby\ncache: bundler\nscript: './bin/test_suite'" > .travis.yml
git add .travis.yml
echo "source 'https://rubygems.org'\n\ngemfile_url = File.join(File.dirname(__FILE__), 'spec/dummy/Gemfile')\ngemfile_content = File.open(gemfile_url, 'rb') { |f| f.read }\n\ngemspec_gems = %w(\n `echo $GEM_NAME`'\n neighborly-balanced'\n rspec-rails'\n)\neval_gemfile gemfile_url, (gemfile_content.split(\"\\\n\").reject do |line|\n line.empty? || Regexp.union(*gemspec_gems).match(line)\nend.join(\"\\\n\"))\n\ngemspec\ngem 'neighborly-balanced', github: 'neighborly/neighborly-balanced', branch: :master\n" > Gemfile
git add Gemfile
bundle update
curl https://gist.githubusercontent.com/Irio/dc949af6c824803c2f5b/raw/4f1fe21012820d9fdc9ae3108eab53de3987aa29/test_suite.sh > bin/test_suite
chmod +x bin/test_suite
git add bin/test_suite
git commit -m "Use real Neighbor.ly platform as dummy app of test suite"
./bin/test_suite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment