rubygems-ghq 0.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rubygems_plugin.rb +25 -0
  3. metadata +42 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e18c544dbf91557968c970b4819651a5d2be7c6ce00822c06249b7a6e357edbe
4
+ data.tar.gz: 51b306abd1d200178201737fb10c9605127c0c9a69e94c4ae915970646a47a9c
5
+ SHA512:
6
+ metadata.gz: 3b19c605f023211e57d72dbce38444f731e8c85884513ddadb4c2423f47d1b12d6f3b7f9a01eef60fd9b9c9600f726f05bb27444d8903042d63c5afe578b879e
7
+ data.tar.gz: 81f3c54c105633f15b5b4f15462bf0c829795ac163ca5a144b7b97482daaad878e59b1d19d313b29ec8f871af5b012da86cb654f2c647b5694c244cfb64e0f97
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+
3
+ # Define common functionality as a method
4
+ def clone_gem_repository(spec)
5
+ return unless spec
6
+
7
+ # Get git repository URL from homepage and source_code_uri
8
+ urls = [spec.homepage, spec.metadata["source_code_uri"]].compact
9
+
10
+ # Filter URLs (non-empty, GitHub/GitLab only, no "/tree" paths)
11
+ git_urls = urls.select do |url|
12
+ url && !url.empty? && url.match?(/github\.com|gitlab\.org/) && !url.match?(/\/tree/)
13
+ end.uniq
14
+
15
+ # Clone each found repository using ghq
16
+ git_urls.each do |git_url|
17
+ puts "Cloning repository for #{spec.name}: #{git_url}"
18
+ system("ghq get #{git_url}")
19
+ end
20
+ end
21
+
22
+ # Register hook to be called after gem installation
23
+ Gem.post_install do |installer|
24
+ clone_gem_repository(installer.spec)
25
+ end
metadata ADDED
@@ -0,0 +1,42 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygems-ghq
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - SHIBATA Hiroshi
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-03-05 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: A RubyGems plugin that automatically clones git repositories of gems
13
+ after installation
14
+ email:
15
+ - hsbt@ruby-lang.org
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/rubygems_plugin.rb
21
+ homepage: https://github.com/hsbt/rubygems-ghq
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.7.0.dev
40
+ specification_version: 4
41
+ summary: Clone git repositories of installed gems with ghq
42
+ test_files: []