gem-src 0.1.0 → 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. data/gem-src.gemspec +1 -1
  2. data/lib/rubygems_plugin.rb +4 -5
  3. metadata +2 -2
data/gem-src.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "gem-src"
7
- gem.version = '0.1.0'
7
+ gem.version = '0.2.0'
8
8
  gem.authors = ["Akira Matsuda"]
9
9
  gem.email = ["ronnie@dio.jp"]
10
10
  gem.description = 'Gem.post_install { `git clone gem_source src` }'
@@ -1,8 +1,9 @@
1
1
  require 'rubygems'
2
2
 
3
3
  Gem.post_install do |installer|
4
- if installer.spec.homepage && !installer.spec.homepage.empty? && !File.exists?("#{installer.gem_dir}/src")
5
- repo = installer.spec.homepage
4
+ clone_dir = ENV['GEMSRC_CLONE_ROOT'] ? File.join(ENV['GEMSRC_CLONE_ROOT'], installer.spec.name) : File.join(installer.gem_dir, 'src')
5
+
6
+ if (repo = installer.spec.homepage) && !repo.empty? && !File.exists?(clone_dir)
6
7
  if repo =~ /\Ahttps?:\/\/([^.]+)\.github.com\/(.+)/
7
8
  repo = if $1 == 'www'
8
9
  "https://github.com/#{$2}"
@@ -16,9 +17,7 @@ Gem.post_install do |installer|
16
17
  end
17
18
 
18
19
  if !`git ls-remote #{repo} 2> /dev/null`.empty?
19
- Dir.chdir installer.gem_dir do
20
- `git clone #{repo} src`
21
- end
20
+ `git clone #{repo} #{clone_dir}`
22
21
  end
23
22
  end
24
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-src
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-12 00:00:00.000000000 Z
12
+ date: 2012-10-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Gem.post_install { `git clone gem_source src` }
15
15
  email: