This is a generic guidline that applies mostly to Ruby on Rails and Postgres, but can be usefull for running any database migrations in CI.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark/ips' | |
require "json" | |
require "oj" | |
require "hanami/utils/json" | |
require "multi_json" | |
MultiJson.adapter = :oj | |
puts "MultiJson.current_adapter => #{MultiJson.current_adapter}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Heroku DB upgrade notes | |
heroku addons:create heroku-postgresql:standard-0 -r production | |
heroku ps:scale web=0 worker=0 -r production | |
heroku maintenance:on -r production | |
heroku pg:backups:capture -r production | |
heroku pg:copy DATABASE_URL __NEW_DB_URL__ -r production | |
heroku pg:promote __NEW_DB_URL__ -r production | |
heroku ps:scale web=1 worker=1 -r production | |
heroku maintenance:off -r production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'json' | |
require 'uri' | |
@token = '' | |
def list_files | |
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago | |
params = { | |
token: @token, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies: | |
pre: | |
- pip install mozdownload mozinstall | |
- mozdownload --version latest --destination firefox.tar.bz2 | |
- mozinstall firefox.tar.bz2 | |
- wget -O geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.18.0/geckodriver-v0.18.0-linux64.tar.gz | |
- gunzip -c geckodriver.tar.gz | tar xopf - | |
- chmod +x geckodriver && mv geckodriver /home/ubuntu/bin/ | |
machine: | |
environment: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
source "https://rubygems.org" | |
gem "oga" | |
gem "pry" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'digest' | |
require 'set' | |
require 'pathname' | |
require 'fileutils' | |
uniques = Set.new | |
user = `whoami`.sub("\n","") | |
trash = Pathname.new("/Users/#{user}/.Trash/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AllCops: | |
Exclude: | |
- script/* | |
- db/* | |
- tmp/* | |
- vendor/* | |
Include: | |
- tasks/*.rake | |
RunRailsCops: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :red_green_refactor, halt_on_fail: true do | |
guard :rspec, failed_mode: :keep, all_after_pass: true do | |
watch('spec/spec_helper.rb') { "spec" } | |
watch('spec/factories/factories.rb') { "spec" } | |
watch('config/routes.rb') { "spec/routing" } | |
watch('app/controllers/application_controller.rb') { "spec/controllers" } | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } |
- add
prepare-commit-msg
it to ./.git/hooks/ - Make it executable (chmod +x filename)
It should prepend [#STORY_ID]
into your commit message when the editor pops up.
Your branch must be in this format to work: branch-description-blabla-STORY_ID
it skips the prepaend if:
- The branch doesn't end in a story id (integer)
- The original commit message starts with "Merge"
NewerOlder