Need help with hookup?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

tpope
469 Stars 23 Forks MIT License 60 Commits 6 Opened issues

Description

Automate the bundle/migration tedium of Rails with Git hooks

Services available

!
?

Need anything else?

Contributors list

# 31,241
Perl
Haskell
vim-plu...
Vim
27 commits
# 93,161
PHP
chef
CSS
visual-...
4 commits
# 26,778
Ruby
sage
blade
PHP
2 commits
# 45,477
Ruby
Shell
statusb...
C
2 commits
# 78,651
JavaScr...
form-va...
React
HTML
2 commits
# 231,945
React
Shell
autosug...
Node.js
1 commit
# 59,296
GraphQL
Algolia
sequel
Sass
1 commit
# 2,402
React
TypeScr...
vercel
json-vi...
1 commit
# 267,040
CSS
C
jira
timetra...
1 commit
# 352,423
Shell
CSS
HTML
1 commit
# 148,096
Shell
D
Ruby
Linux
1 commit

Hookup

Hookup takes care of Rails tedium like bundling and migrating through Git hooks. It fires after events like

  • pulling in upstream changes
  • switching branches
  • stepping through a bisect
  • conflict in schema

Usage

gem install hookup
cd yourproject
hookup install

Bundling

Each time your current HEAD changes, hookup checks to see if your

Gemfile
,
Gemfile.lock
, or gem spec has changed. If so, it runs
bundle check
, and if that indicates any dependencies are unsatisfied, it runs
bundle install
.

Migrating

Each time your current HEAD changes, hookup checks to see if any migrations have been added, deleted, or modified. Deleted and modified migrations are given the

rake db:migrate:down
treatment, then
rake
db:migrate
is invoked to bring everything else up to date.

Hookup provides a

-C
option to change to a specified directory prior to running
bundle
or
rake
. This should be used if your
Gemfile
and
Rakefile
are in a non-standard location.

To use a non-standard

db
directory (where
schema.rb
and
migrate/
live), add
--schema-dir="database/path"
to the
hookup post-checkout
line in
.git/hooks/post-checkout
.

To force reloading the database if migrating fails, add

--load-schema="rake db:reset"
to the
hookup post-checkout
line in
.git/hooks/post-checkout
.

Schema Resolving

Each time there's a conflict in

db/schema.rb
on the
Rails::Schema.define
line, hookup resolves it in favor of the newer of the two versions.

Skip Hookup

Set the

SKIP_HOOKUP
environment variable to skip hookup.
SKIP_HOOKUP=1 git checkout master

Removing Hookup

hookup remove

ChangeLog

See it on the wiki

License

Copyright (c) Tim Pope. MIT License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.