sentia_git_hooks 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbc8f581bde0ea1a0e28003675c8226ce7095066
4
- data.tar.gz: d49bba8c9310727ab514dbad1ee29570d55d3517
3
+ metadata.gz: 20d305ec5d38f89f2e3139f309f4228e246bac73
4
+ data.tar.gz: 4ac8ff208cbef4fb0f19f11342771c14802b2c23
5
5
  SHA512:
6
- metadata.gz: a8e6e6fb51ec82f9f8383946b638de9e0bd740aeee962143be9d0d18dac00fd9584e2bef5592f5c639aa896879d639ee12cba7f19308519ef0014e33fbd8c8ba
7
- data.tar.gz: 8adf1757804cae924bf33ccf2a0214be08d924a4ff4bb163f81ad8265bca8c42450c71e0136af7a892d0859270b8436776e50154af89609595f623187ed8243a
6
+ metadata.gz: d35c57e1af17f7892152ee95b094971ae50d21ba16e7d64a4101302467e779acfa580a701acbd5d89a53f7b701db0bb63e3bf24592e33b5e2454bc09ad6d0be9
7
+ data.tar.gz: cf0bd9afe0580ba4406bf0705799d2cabc38a5a7074f496e0e98cf5a426bfd77adc0552793bac0561be39cd1357c2836420c3b7b8440f18ef3afc359cbd367c2
@@ -1,16 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
- dir = File.expand_path "../../lib/scripts/", __FILE__
2
+ scripts_dir = File.expand_path "../../lib/scripts/", __FILE__
3
+ hooks_dir = File.expand_path ".git/hooks", Dir.pwd
3
4
 
4
- command = "cp -n #{dir + '/*'} '.git/hooks/'"
5
+ script_files = Dir.entries(scripts_dir)
6
+ script_files.delete(".")
7
+ script_files.delete("..")
5
8
 
6
- puts "Issuing command: #{command}"
7
9
 
8
- `#{command}`
10
+ script_files.each do |file|
11
+ path_to_script = File.expand_path file, scripts_dir
12
+ path_to_hook = File.expand_path file, hooks_dir
13
+ command = "ln -s '#{path_to_script}' '#{path_to_hook}'"
9
14
 
10
- if $?.exitstatus == 1
11
- puts "Success"
12
- exit 0
13
- else
14
- puts "Failed"
15
- exit 1
15
+ puts "Issuing command: #{command}"
16
+
17
+ `#{command}`
18
+ if $?.exitstatus != 0
19
+ puts "Failed
20
+ If a hook file already exists then we refuse to clobber it,
21
+ you'll have to delete it manually, or have it call the functionality
22
+ in our hook."
23
+ exit 1
24
+ end
16
25
  end
26
+
27
+ puts "Success"
28
+ exit 0
@@ -1,3 +1,3 @@
1
1
  module SentiaGitHooks
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentia_git_hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sia. S.