move things around
This commit is contained in:
parent
b30d56819e
commit
36cc4d6504
@ -16,7 +16,7 @@ Installs a bunch of scripts into the `scripts` directory of your project:
|
|||||||
|
|
||||||
* `gemfile` which switches between `Gemfile.erb` environments
|
* `gemfile` which switches between `Gemfile.erb` environments
|
||||||
* `install-git-hooks` which will do just what it says
|
* `install-git-hooks` which will do just what it says
|
||||||
* `hooks/pre-commit`, one of the hooks the prior script installs
|
* `hooks`, several git hooks that the prior script symlinks into .git/hooks for you
|
||||||
* `initialize-environment`, which bootstraps your local environment so you can get up and running
|
* `initialize-environment`, which bootstraps your local environment so you can get up and running
|
||||||
|
|
||||||
## Gemfile.erb?!
|
## Gemfile.erb?!
|
||||||
@ -95,6 +95,12 @@ It runs `penchant gemfile remote` then runs `bundle exec rake`. Make sure your d
|
|||||||
tests and performs any other magic necessary before each commit. Your re-environmented Gemfile and Gemfile.lock will be added
|
tests and performs any other magic necessary before each commit. Your re-environmented Gemfile and Gemfile.lock will be added
|
||||||
to your commit if they've changed.
|
to your commit if they've changed.
|
||||||
|
|
||||||
|
### Skipping all that Rake falderal?
|
||||||
|
|
||||||
|
Do it Travis CI style: stick `[ci skip]` in your commit message. That's why the meat of hte git hooks resides in
|
||||||
|
`commit-msg` and not `pre-commit`: you need the commit message before you can determine if the tests should be run
|
||||||
|
based on the commit message. Weird, I know.
|
||||||
|
|
||||||
## How?!
|
## How?!
|
||||||
|
|
||||||
* `gem install penchant`
|
* `gem install penchant`
|
||||||
@ -103,5 +109,6 @@ to your commit if they've changed.
|
|||||||
And then one of the following:
|
And then one of the following:
|
||||||
|
|
||||||
* `penchant install` for a new project (`--dir=WHEREVER` will install the scripts to a directory other than `$PWD/scripts`)
|
* `penchant install` for a new project (`--dir=WHEREVER` will install the scripts to a directory other than `$PWD/scripts`)
|
||||||
|
* `penchant update` to update the installation (`--dir=WHEVEVER` works here, too)
|
||||||
* `penchant convert` for an existing project (`--dir=WHEVEVER` works here, too)
|
* `penchant convert` for an existing project (`--dir=WHEVEVER` works here, too)
|
||||||
|
|
||||||
|
@ -20,6 +20,12 @@ class PenchantCLI < Thor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "update", "Update the installed scripts"
|
||||||
|
method_options :dir => 'script'
|
||||||
|
def update
|
||||||
|
install
|
||||||
|
end
|
||||||
|
|
||||||
desc "convert", "Make an existing project Penchant-isized"
|
desc "convert", "Make an existing project Penchant-isized"
|
||||||
method_options :dir => 'script'
|
method_options :dir => 'script'
|
||||||
def convert
|
def convert
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
module Penchant
|
module Penchant
|
||||||
VERSION = "0.0.5"
|
VERSION = "0.0.6"
|
||||||
end
|
end
|
||||||
|
23
script/hooks/commit-msg
Executable file
23
script/hooks/commit-msg
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
msg=$(cat $1)
|
||||||
|
|
||||||
|
OLD_GIT_DIR=$GIT_DIR
|
||||||
|
|
||||||
|
if [[ "${msg}" != *"[ci skip]"* ]]; then
|
||||||
|
if [ "$(penchant gemfile-env)" != "remote" ]; then
|
||||||
|
penchant gemfile remote
|
||||||
|
fi
|
||||||
|
|
||||||
|
bundle exec rake
|
||||||
|
R=$?
|
||||||
|
if [ $R -ne 0 ]; then exit $R; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(penchant gemfile-env)" != "remote deployment" ]; then
|
||||||
|
unset GIT_DIR
|
||||||
|
penchant gemfile remote --deployment
|
||||||
|
GIT_DIR=$OLD_GIT_DIR
|
||||||
|
git add Gemfile*
|
||||||
|
fi
|
||||||
|
|
4
script/hooks/post-commit
Executable file
4
script/hooks/post-commit
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
penchant gemfile remote --switch-back
|
||||||
|
|
@ -1,15 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
OLD_GIT_DIR=$GIT_DIR
|
# this is now handled in commit-msg, to allow for skipping of test running based on the commit message
|
||||||
|
|
||||||
if [ "$(penchant gemfile-env)" != "remote" ]; then
|
|
||||||
unset GIT_DIR
|
|
||||||
penchant gemfile remote --deployment
|
|
||||||
GIT_DIR=$OLD_GIT_DIR
|
|
||||||
git add Gemfile*
|
|
||||||
fi
|
|
||||||
|
|
||||||
bundle exec rake
|
|
||||||
R=$?
|
|
||||||
if [ $R -ne 0 ]; then exit $R; fi
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user