gem-src 0.3.2 → 0.3.3

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 +23 -21
  3. metadata +3 -3
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.3.2'
7
+ gem.version = '0.3.3'
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,30 +1,32 @@
1
1
  require 'rubygems'
2
2
 
3
3
  Gem.post_install do |installer|
4
- clone_dir = if ENV['GEMSRC_CLONE_ROOT']
5
- File.expand_path installer.spec.name, ENV['GEMSRC_CLONE_ROOT']
6
- elsif Gem.configuration[:gemsrc_clone_root]
7
- File.expand_path installer.spec.name, Gem.configuration[:gemsrc_clone_root]
8
- else
9
- gem_dir = installer.respond_to?(:gem_dir) ? installer.gem_dir : File.expand_path(File.join(installer.gem_home, 'gems', installer.spec.full_name))
10
- File.join gem_dir, 'src'
11
- end
4
+ if (repo = installer.spec.homepage) && !repo.empty?
5
+ clone_dir = if ENV['GEMSRC_CLONE_ROOT']
6
+ File.expand_path installer.spec.name, ENV['GEMSRC_CLONE_ROOT']
7
+ elsif Gem.configuration[:gemsrc_clone_root]
8
+ File.expand_path installer.spec.name, Gem.configuration[:gemsrc_clone_root]
9
+ else
10
+ gem_dir = installer.respond_to?(:gem_dir) ? installer.gem_dir : File.expand_path(File.join(installer.gem_home, 'gems', installer.spec.full_name))
11
+ File.join gem_dir, 'src'
12
+ end
12
13
 
13
- if (repo = installer.spec.homepage) && !repo.empty? && !File.exists?(clone_dir)
14
- if repo =~ /\Ahttps?:\/\/([^.]+)\.github.com\/(.+)/
15
- repo = if $1 == 'www'
16
- "https://github.com/#{$2}"
17
- elsif $1 == 'wiki'
18
- # https://wiki.github.com/foo/bar => https://github.com/foo/bar
19
- "https://github.com/#{$2}"
20
- else
21
- # https://foo.github.com/bar => https://github.com/foo/bar
22
- "https://github.com/#{$1}/#{$2}"
14
+ unless File.exists?(clone_dir)
15
+ if repo =~ /\Ahttps?:\/\/([^.]+)\.github.com\/(.+)/
16
+ repo = if $1 == 'www'
17
+ "https://github.com/#{$2}"
18
+ elsif $1 == 'wiki'
19
+ # https://wiki.github.com/foo/bar => https://github.com/foo/bar
20
+ "https://github.com/#{$2}"
21
+ else
22
+ # https://foo.github.com/bar => https://github.com/foo/bar
23
+ "https://github.com/#{$1}/#{$2}"
24
+ end
23
25
  end
24
- end
25
26
 
26
- if !`git ls-remote #{repo} 2> /dev/null`.empty?
27
- `git clone #{repo} #{clone_dir}`
27
+ if !`git ls-remote #{repo} 2> /dev/null`.empty?
28
+ `git clone #{repo} #{clone_dir}`
29
+ end
28
30
  end
29
31
  end
30
32
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-src
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akira Matsuda