13
Continuous Delivery and Rails Upgrades @brianauton

Continous Delivery and Rails Upgrades

Embed Size (px)

Citation preview

Continuous Deliveryand Rails Upgrades

@brianauton

● Reliable tests● Fast deploys● No big merges

Rails Upgrade

● Safe for production?● Tests always passing?

source "https://rubygems.org"

gem "rails", "~> 3.2.22"gem "jquery-rails"gem "pdf-reader"gem "prawn"# ...

source "https://rubygems.org"

if ENV["RAILS4"] gem "rails", "~> 4.2.4"else gem "rails", "~> 3.2.22"end

gem "jquery-rails"gem "pdf-reader"gem "prawn"# ...

> cp Gemfile.lock Gemfile.lock.rails3

> RAILS4=y bundle update rails

> cp Gemfile.lock Gemfile.lock.rails4

# config/environment.rb

require File.expand_path('../application', __FILE__)

if ENV["RAILS4"] Rails.application.initialize!else MyApp::Application.initialize!end

> cp Gemfile.lock.rails4 Gemfile.lock> RAILS4=y bundle> RAILS4=y rails console

> cp Gemfile.lock.rails3 Gemfile.lock> bundle> rails console

#!/usr/bin/env/rake# …

if Rails.env.test? || Rails.env.development? require "rspec/core/rake_task" RSpec::Core::RakeTask.new :spec task :default do sh "cp Gemfile.lock.rails3 Gemfile.lock" sh "bundle install --quiet" sh "rspec" sh "cp Gemfile.lock.rails4 Gemfile.lock" sh "RAILS4=y bundle install --quiet" sh "RAILS4=t rspec" sh "cp Gemfile.lock.rails3 Gemfile.lock" sh "bundle install --quiet" endend

# spec/spec_helper.rbrequire 'rspec/rails'RSpec.configure do |config| config.include Devise::TestHelpers, type: :config config.include FactoryGirl::Syntax::Methods config.around(:each, :rails3_only) do |example| pending if ENV["RAILS4"] example.run endend

# spec/models/person_spec.rbit "requires an email address", :rails3_only do # ...end

source "https://rubygems.org"

if ENV["RAILS4"] gem "rails", "~> 4.2.4"else gem "rails", "~> 3.2.22"end

gem "jquery-rails"gem "pdf-reader"gem "prawn"# ...

Continuous Delivery

● No excuse

@brianauton