While developing a serialization gem I needed to compare my current code with previous gem versions.
(Un)fortunately bundler
does not allow to install several versions of the same gem to prevent conflicts on class names.
The purpose of this script is to wrap a gem into a namespace/module named.
You should set in the main script:
- L7 TARGET_DIR: the dir where the gems will be extracted
- L8 PKG_DIR : the dir where the .gem files will be downloaded
- L11 GEM_SOURCE : public/private gem repository
- L12 GEM_NAME : the name of the gem
- L13 GEM_MAIN_MODULE : the name of the main module wrapping the gem
- L14 GEM_VERSIONS : array of gem versions to download
The output will allow you to use:
require 'v010-my_gem'
class MyClass < V010::MyGem
# some code here
end
You will be able to install multiple versions in your Gemfile with local paths:
# benchmark_app/Gemfile
# Current gem version in development
gem 'jsonschema_serializer', path: '../'
gem 'v005-jsonschema_serializer', path: '../versions/jsonschema_serializer-0.0.5'