Class: Rwm::Overcommit
- Inherits:
-
Object
- Object
- Rwm::Overcommit
- Defined in:
- lib/rwm/overcommit.rb
Constant Summary collapse
- RWM_HOOKS =
{ "PrePush" => { "CustomScript" => { "enabled" => true } }, "PostCommit" => { "CustomScript" => { "enabled" => true } } }.freeze
- PRE_PUSH_SCRIPT =
"#!/bin/bash\nbundle exec rwm check\n"- POST_COMMIT_SCRIPT =
"#!/bin/bash\n# Only rebuild graph if a Gemfile changed in this commit\nif git diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null | grep -q 'Gemfile'; then\n bundle exec rwm graph\nfi\n"
Instance Method Summary collapse
-
#initialize(workspace_root) ⇒ Overcommit
constructor
A new instance of Overcommit.
-
#setup ⇒ Object
Sets up overcommit: installs hooks, configures .overcommit.yml, creates hook scripts, and signs the config.
Constructor Details
#initialize(workspace_root) ⇒ Overcommit
Returns a new instance of Overcommit.
34 35 36 |
# File 'lib/rwm/overcommit.rb', line 34 def initialize(workspace_root) @root = workspace_root end |
Instance Method Details
#setup ⇒ Object
Sets up overcommit: installs hooks, configures .overcommit.yml, creates hook scripts, and signs the config. Returns true if overcommit was installed successfully.
41 42 43 44 45 46 47 |
# File 'lib/rwm/overcommit.rb', line 41 def setup configure_hooks create_hook_scripts installed = install_hooks sign_config if installed installed end |