rubygems-auto-clone 0.2.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 +26 -0
  3. metadata +42 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 14459c43168554f708436c42826993ab846ef95d57dcac0e5af1c68c7589ea86
4
+ data.tar.gz: ec6387b42ac8bd9ad31f2c60ef21fba289ccf2ab2380767cc8b5ba7500c4b2c9
5
+ SHA512:
6
+ metadata.gz: 93b3d60ed26830e4432471ef894269667e4d74975681f984779ffb482e0569570fc2c81e85361bbdc6aeca4dbd8c7c1e2f6e3429e4bbe488b892456219739f86
7
+ data.tar.gz: 9ecacbc915db161fae7c0009cc32eeef5738dbffc38cb67bdc346bc8f35783387ecc165110edc17871819d44ee964f6afc261d607a1ec1879d279518ec5f6552
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+
3
+ def clone_gem_repository(spec)
4
+ return unless spec
5
+
6
+ urls = [spec.homepage, spec.metadata["source_code_uri"]].compact
7
+
8
+ git_urls = urls.select do |url|
9
+ url && !url.empty? && url.match?(/github\.com|gitlab\.com/) && !url.match?(/\/tree/)
10
+ end.uniq
11
+
12
+ git_urls.each do |git_url|
13
+ puts "#{spec.name}: #{git_url}"
14
+
15
+ # Check if git-goget is available, if so use git goget instead of ghq get
16
+ if system("which git-goget > /dev/null 2>&1")
17
+ system("git goget #{git_url}")
18
+ else
19
+ system("ghq get #{git_url}")
20
+ end
21
+ end
22
+ end
23
+
24
+ Gem.post_install do |installer|
25
+ clone_gem_repository(installer.spec)
26
+ end
metadata ADDED
@@ -0,0 +1,42 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygems-auto-clone
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - SHIBATA Hiroshi
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 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-auto-clone
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: Automatically clone git repositories of installed gems
42
+ test_files: []