set_git_hooks_dir 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ecfe46ec6b24151980cc378bd461c5ef42b8140588d7598c6c402e6bb8d7bb2
4
- data.tar.gz: f4dfacf08113fad7e1336b5ad5f04570137ac8c2e46d6a1ef9084c90fd888223
3
+ metadata.gz: 3637ad5c65ac7fe48a2c7ab69e143e8804c6b87882ccdba405a9e3cb1911e131
4
+ data.tar.gz: a16e8a152237f9ba1decd81cc404dcc8d1b17d8724d6b294c34a4d4f3bcc6e5b
5
5
  SHA512:
6
- metadata.gz: cb04af55c0a6b0a5755405d8837c9c26f05e08e4f66efaddf7eb186d6fa7bc90bc250427896a2944c20ff7f13144b46df30331f94e26fdf9d008ddbd2fb0f5f5
7
- data.tar.gz: 15f3fceb805fb2b461608a0e782441d78c79835fb75b8141fa23d35a6e813846aa5dce3818185af4b65698157de36dc947b4216b452aeb1b8955b52f6f4d3058
6
+ metadata.gz: 44b8cb7180b48f2aebe1946068e855b8cf02d7b0e619ebd7587bba0edbd24f952ccca3b0576f966798bd153eeed6577750978970480cc10cdec5012ee8e4c696
7
+ data.tar.gz: 63b5cd78456dba45cad8d807bf6a95f1ed7cf8572f01fb6344b0189ac7dc840b72656ac1c4657996d7d00eda870f08a710cfebdbf562c00e1d9b42b0e0f51fc7
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rubygems'
3
+ require 'rubygems/installer'
4
4
  require_relative 'set_git_hooks_dir'
5
5
 
6
- Gem.pre_install do
7
- puts 'Setting Git hooks from rubygems plugin'
8
- SetGitHooksDir.setup '.git-hooks'
6
+ Gem.post_install do |installer|
7
+ puts "Setting Git hooks from rubygems plugin #{installer.spec.name}"
8
+ SetGitHooksDir.setup '.git-hooks' if installer.spec.name == 'set_git_hooks_dir'
9
9
  end
data/plugins.rb CHANGED
@@ -1 +1,17 @@
1
- require 'my_plugin'
1
+ # frozen_string_literal: true
2
+
3
+ # bundler adds ./lib to load paths before loading this file so `require` works
4
+ require 'set_git_hooks_dir'
5
+
6
+ # XXX: `bundle install` does not run rubygems install hooks when it does *path* installs. This is because bundler's
7
+ # *path* install only *puts* dependencies in some loadable path and does *not* install them as gem. This means that
8
+ # `bundle install` does not mean `gem install` in terms of gem installation.
9
+ #
10
+ # https://github.com/rubygems/bundler/issues/5429
11
+ #
12
+ # To enable automatic hooks configuration in both `gem install` and
13
+ # `bundle install` cases, this package needs to be installed as a bundler
14
+ # plugin.
15
+
16
+ puts 'Setting Git hooks from bundler plugin'
17
+ SetGitHooksDir.setup '.git-hooks'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: set_git_hooks_dir
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - rhysd
@@ -17,7 +17,6 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - lib/my_plugin.rb
21
20
  - lib/rubygems_plugin.rb
22
21
  - lib/set_git_hooks_dir.rb
23
22
  - plugins.rb
@@ -40,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
39
  - !ruby/object:Gem::Version
41
40
  version: '0'
42
41
  requirements: []
43
- rubygems_version: 3.5.11
42
+ rubygems_version: 3.5.14
44
43
  signing_key:
45
44
  specification_version: 4
46
45
  summary: Deadly simple Git hooks directory setup tool
data/lib/my_plugin.rb DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'set_git_hooks_dir'
4
-
5
- Bundler::Plugin.add_hook('after-install-all') do |deps|
6
- puts 'Setting Git hooks from bundler plugin'
7
- SetGitHooksDir.setup '.git-hooks'
8
- end
9
-
10
- puts 'Setting Git hooks from bundler plugin'
11
- SetGitHooksDir.setup '.git-hooks'
12
-