Sha256: f8c4ef3c780a082feeda6e962dd865eb8e454ea7adfb60715c98450446f2922a

Contents?: true

Size: 1.96 KB

Versions: 2

Compression:

Stored size: 1.96 KB

Contents

#!/usr/bin/env ruby

require_relative '../lib/katapult/version'
require_relative '../lib/katapult/support/binary_util'

u = Katapult::BinaryUtil
version_path = 'lib/katapult/version.rb'


# Intro ########################################################################

at_project_root = File.exists?('lib/katapult.rb')
at_project_root or fail 'Run this script from the Katapult project root.'

puts <<INTRO
Katapult #{Katapult::VERSION}

This script will help you continue development on Katapult: updating the
versions of Ruby and Rails, wiping tmp/ and more.

It will always ask before doing anything.

The script is intended as a one-time updater, but it wont' do harm if run
repeatedly.

INTRO

u.pink "The Ruby version is #{`ruby -v`.chomp}."
puts 'Should katapult use that version? [yN]'
case $stdin.getch
when 'y' then puts 'Ok.'
else
  u.pink 'Please configure the Ruby version in .ruby-version, then re-run this script.'
  exit
end

# Jobs #########################################################################

u.job 'update Bundler' do
  system 'gem install bundler'
end

u.job "update Rails version (current: #{Katapult::RAILS_VERSION})", "#{version_path} updated." do
  print 'Please enter the desired Rails version: '
  rails_v = gets.strip

  version_rb = File.read version_path
  version_rb.gsub! /^(  RAILS_VERSION =).*$/, "\\1 '#{rails_v}'"
  File.open version_path, 'w' do |f|
    f.write version_rb
  end
end

u.job 'update installed gems' do
  system 'bundle update'
end

u.job 'update README' do
  system 'rake update_readme'
end

u.job 'wipe tmp directory' do
  puts 'Wiping ...'
  FileUtils.rm_rf 'tmp'
end

sleep 1
puts <<-DEBUG

This script is done. Now you need to fix whatever was broken by the updates.

The suggested way is to run the following features one by one, fixing issues as
they occur:
  features/basics.feature
  features/binary.feature
  features/model.feature

In order to see the application output of Cucumber tests you may tag them with
@announce-output.
DEBUG

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
katapult-0.4.1 script/update
katapult-0.4.0 script/update