PortalGun
PortalGun allows developers to regenerate an entire Gemfile with the latest Gem versions based on a particular point in history.
Installation
$ gem install portal_gun
Usage
This gem will allow you to fire up old Rails applications immediately out of the box, impress your friends, or enjoy casual inter-dimensional-ruby-based-time-travel.
Here's the simplest use case you can try today.
If you were to generate a vanilla Rails application right now, this would be your Gemfile out of the box:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
After you've installed PortalGun, all you need to do is cd into the application's directory, and run portal_gun 3.years.ago /path/to/Gemfile
.
In the file Rails.root/Portal_Gemfile
you now have:
#This Gemfile has been generated by PortalGun. If you have any issues please report to https://github.com/schwad/portal_gun
#These are the most stable versions of the three latest minor ruby releases as of this point in time. Uncomment the one you wish to use.
#Note - if the latest is a patch version, you will have to format it before running `bundle install`
#ruby 1.9.3-p547
#ruby 2.1.2
#ruby 2.0.0-p481
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = '#{repo_name}/#{repo_name}' unless repo_name.include?('/')
'https://github.com/#{repo_name}.git'
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.1.0.rc2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.3.9'
# Use Puma as the app server
gem 'puma', '~> 2.8.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '~> 2.5.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.0.1'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails', '~> 3.1.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 2.2.2'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', '~> 2.7.0'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '~> 1.0.4'
gem 'listen', '~> 2.7.1'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', '~> 1.1.2'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', '~> 1.2014.2'
One handy little thing it does there is generate the latest stable versions of the most recent three ruby minor versions
for you to play with (i.e. as of writing it would be 2.4
, 2.3
, 2.2
) to run your application on.
Note that this test case is run against an existing "new" application's gemfile. Where this really shines is against an older Rails application with a decent number of Gems not pointing to specific versions, but a code base that relies on the older versions of those gems.
License
The gem is available as open source under the terms of the MIT License.