Sha256: 75f8887135f560e2b48559d2232d40f79e71bf321f528025ca3d6812830bd048
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
module DNGG module Hooks def check_hooks if update_hooks install_billow subs = get_submodule subs.each do |sub| cp_hooks(sub) end end end def install_billow path = `gem which dngg`.split('/dngg.rb')[0] `sudo sh #{path}/res/install_billow.sh` end def update_hooks version = `dngg v` ggsm_path = '.git/dngg' unless File.exist?(ggsm_path) Dir.mkdir(ggsm_path) end config_path = "#{ggsm_path}/VERSION" target_path = '.git/hooks' if !File.exist?(config_path) || version != IO.read(config_path) cp_files(target_path) file = File.new(config_path, 'w') file << version file.close puts '已更新Hooks'.blue return true end false end def cp_hooks(sub) target_path = ".git/modules/#{sub}/hooks" cp_files(target_path) end def cp_files(target_path) path = `gem which dngg`.split('/dngg.rb')[0] `cp #{path}/dngg/hook/commit-msg #{target_path}/commit-msg` `cp #{path}/dngg/hook/pre-commit #{target_path}/pre-commit` end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dngg-0.0.2 | lib/dngg/hook/hooks.rb |
dngg-0.0.1 | lib/dngg/hook/hooks.rb |