gem-src 0.6.3 → 0.10.1
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 +5 -5
- data/README.md +28 -7
- data/gem-src.gemspec +3 -2
- data/lib/gem/src/irregular_repositories.rb +81 -0
- data/lib/rubygems_plugin.rb +96 -22
- data/plugins.rb +7 -0
- data/spec/gem-src_spec.rb +71 -0
- data/spec/spec_helper.rb +6 -0
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a93c64e073dd8c85650a46788d4b76d85ee40efd455a19d507c0bed311fccbf3
|
4
|
+
data.tar.gz: c4a8915c1a6374551a581709b9fd6946968cd23257f384e05acbcf002a950592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1928ae1489a5240ca0769fa4c14749d9af7ebb1c25f19686ee6f283685ffeee20982c6a4abf270a5602251582473b9c2dfd16b5e6774f76ba3153654ed4fbb97
|
7
|
+
data.tar.gz: d6229ad675d2e53bef4d44bdbba1e20f70d1b2b07748a5eb671f23b9bd226bcfe3e622edc9482ea4cc1640d6e207ebb6af19e8e9319650fe368513e6d7bceb96
|
data/README.md
CHANGED
@@ -1,24 +1,39 @@
|
|
1
1
|
# gem-src
|
2
2
|
|
3
3
|
gem-src is a gem plugin && rbenv plugin that automatically `git clone`s the gem's source right after every `gem install` so you can `git log`, `git grep` and of course write your patch there!
|
4
|
+
Plus, gem-src runs `git init` on each installed gem, and links it to the cloned source repository and the origin repository so that you can easily transfer commits to and from the gem and the repositories.
|
4
5
|
|
6
|
+
***TL;DR***
|
5
7
|
|
6
|
-
|
8
|
+
% git clone https://github.com/amatsuda/gem-src.git "$(rbenv root)/plugins/gem-src"
|
9
|
+
% mkdir ~/src
|
10
|
+
% echo "gemsrc_clone_root: ~/src" >> ~/.gemrc
|
7
11
|
|
8
|
-
|
12
|
+
Then you're all set!
|
9
13
|
|
10
|
-
gem-src is a gem plugin that can be installed via gem install command:
|
11
14
|
|
12
|
-
|
15
|
+
## Installation
|
13
16
|
|
14
|
-
### As an rbenv plugin (recommended)
|
17
|
+
### :star2: As an rbenv plugin (recommended)
|
15
18
|
|
16
19
|
Alternatively, if you're using rbenv, you can install gem-src as an rbenv plugin:
|
17
20
|
|
18
|
-
% git clone https://github.com/amatsuda/gem-src.git
|
21
|
+
% git clone https://github.com/amatsuda/gem-src.git "$(rbenv root)/plugins/gem-src"
|
19
22
|
|
20
23
|
then you get gem-src enabled for all `gem` and `bundle` commands invoked through rbenv.
|
21
24
|
|
25
|
+
### :star2: As a Bundler plugin (experimental, but also recommended)
|
26
|
+
|
27
|
+
gem-src is a bundler plugin that can be installed via bundler plugin install command:
|
28
|
+
|
29
|
+
% bundler plugin install gem-src
|
30
|
+
|
31
|
+
### As a Rubygem
|
32
|
+
|
33
|
+
gem-src is a gem plugin that can be installed via gem install command:
|
34
|
+
|
35
|
+
% gem install gem-src
|
36
|
+
|
22
37
|
## Configuration
|
23
38
|
|
24
39
|
### By default
|
@@ -46,7 +61,7 @@ So, the whole directory structure will be like this.
|
|
46
61
|
Note that you might be cloning the same repository again and again as the gem is updated, or the gem install directory changes.
|
47
62
|
For example, if you're using RVM, each of `~/.rvm/gems/*/gems/*` will have it's Git repo inside "src" directory.
|
48
63
|
|
49
|
-
### Specifying gemsrc_clone_root (strongly recommended)
|
64
|
+
### :star2: Specifying gemsrc_clone_root (strongly recommended)
|
50
65
|
|
51
66
|
Instead of cloning the repo under installed gem directory for each `gem install`, you can specify one single directory to keep all the cloned source repositories.
|
52
67
|
|
@@ -98,6 +113,12 @@ When you firstly installed this gem, you might want to type in this command righ
|
|
98
113
|
% gem pristine --all
|
99
114
|
This will reinstall all the already installed gems, and so will `git clone` all the repos.
|
100
115
|
|
116
|
+
## Skip cloning
|
117
|
+
|
118
|
+
If you want to skip cloning repositories, you can skip cloning by providing an environment variable `GEMSRC_SKIP`:
|
119
|
+
|
120
|
+
% GEMSRC_SKIP=true bundle install
|
121
|
+
|
101
122
|
|
102
123
|
## Contributing
|
103
124
|
|
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.
|
7
|
+
gem.version = '0.10.1'
|
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` }'
|
@@ -19,8 +19,9 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_development_dependency 'rspec', ['>= 0']
|
20
20
|
|
21
21
|
gem.post_install_message = <<-END
|
22
|
-
[gem-src]
|
22
|
+
[gem-src] Installing gem-src as a gem is not recommended. Please consider installing as an rbenv plugin instead.
|
23
23
|
|
24
|
+
If you have not yet configured "gemsrc_clone_root", we strongly recommend you to add the configuration to your .gemrc.
|
24
25
|
e.g.)
|
25
26
|
% echo "gemsrc_clone_root: ~/src" >> ~/.gemrc
|
26
27
|
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Gem
|
2
|
+
class Src
|
3
|
+
IRREGULAR_REPOSITORIES = {
|
4
|
+
'activesupport' => nil,
|
5
|
+
'actionview' => nil,
|
6
|
+
'actionpack' => nil,
|
7
|
+
'activemodel' => nil,
|
8
|
+
'activerecord' => nil,
|
9
|
+
'activerecord-jdbcmysql-adapter' => 'https://github.com/jruby/activerecord-jdbc-adapter',
|
10
|
+
'activerecord-jdbcpostgresql-adapter' => 'https://github.com/jruby/activerecord-jdbc-adapter',
|
11
|
+
'activerecord-jdbcsqlite3-adapter' => 'https://github.com/jruby/activerecord-jdbc-adapter',
|
12
|
+
'activejob' => nil,
|
13
|
+
'actionmailbox' => nil,
|
14
|
+
'actionmailer' => nil,
|
15
|
+
'actioncable' => nil,
|
16
|
+
'actiontext' => nil,
|
17
|
+
'activestorage' => nil,
|
18
|
+
'railties' => nil,
|
19
|
+
'activeresource' => 'https://github.com/rails/activeresource.git',
|
20
|
+
'autoparse' => 'https://github.com/google/autoparse.git',
|
21
|
+
'aws-sdk-rails' => 'https://github.com/aws/aws-sdk-rails.git',
|
22
|
+
'breadcrumbs_on_rails' => 'https://github.com/weppos/breadcrumbs_on_rails',
|
23
|
+
'bson' => 'https://github.com/mongodb/bson-ruby.git',
|
24
|
+
'coffee-script-source' => 'https://github.com/rails/ruby-coffee-script',
|
25
|
+
'compass-core' => 'https://github.com/Compass/compass.git',
|
26
|
+
'compass-import-once' => 'https://github.com/Compass/compass.git',
|
27
|
+
'concurrent-ruby' => 'https://github.com/ruby-concurrency/concurrent-ruby/',
|
28
|
+
'concurrent-ruby-edge' => 'https://github.com/ruby-concurrency/concurrent-ruby/',
|
29
|
+
'concurrent-ruby-ext' => 'https://github.com/ruby-concurrency/concurrent-ruby/',
|
30
|
+
'cool.io' => 'https://github.com/tarcieri/cool.io.git',
|
31
|
+
'cucumber-core' => 'https://github.com/cucumber/cucumber-ruby-core.git',
|
32
|
+
'cucumber-wire' => 'https://github.com/cucumber/cucumber-ruby-wire.git',
|
33
|
+
'diff-lcs' => 'https://github.com/halostatue/diff-lcs.git',
|
34
|
+
'elasticsearch' => 'https://github.com/elastic/elasticsearch-ruby.git',
|
35
|
+
'elasticsearch-api' => 'https://github.com/elastic/elasticsearch-ruby.git',
|
36
|
+
'elasticsearch-extensions' => 'https://github.com/elastic/elasticsearch-ruby.git',
|
37
|
+
'elasticsearch-transport' => 'https://github.com/elastic/elasticsearch-ruby.git',
|
38
|
+
'erubis' => 'https://github.com/kwatch/erubis.git',
|
39
|
+
'flay' => 'https://github.com/seattlerb/flay',
|
40
|
+
'geocoder' => 'https://github.com/alexreisner/geocoder',
|
41
|
+
'hirb' => 'https://github.com/cldwalker/hirb',
|
42
|
+
'houston' => 'https://github.com/nomad/houston',
|
43
|
+
'html2haml' => 'https://github.com/haml/html2haml',
|
44
|
+
'io-console' => 'https://github.com/ruby/io-console',
|
45
|
+
'kaminari-actionview' => nil,
|
46
|
+
'kaminari-activerecord' => nil,
|
47
|
+
'kaminari-core' => nil,
|
48
|
+
'kwalify' => nil,
|
49
|
+
'log4r' => 'https://github.com/colbygk/log4r',
|
50
|
+
'meta_request' => 'https://github.com/dejan/rails_panel',
|
51
|
+
'method_source' => 'https://github.com/banister/method_source',
|
52
|
+
'origin' => 'https://github.com/mongoid/origin',
|
53
|
+
'padrino' => 'https://github.com/padrino/padrino-framework',
|
54
|
+
'padrino-admin' => nil,
|
55
|
+
'padrino-cache' => nil,
|
56
|
+
'padrino-core' => nil,
|
57
|
+
'padrino-gen' => nil,
|
58
|
+
'padrino-helpers' => nil,
|
59
|
+
'padrino-mailer' => nil,
|
60
|
+
'padrino-performance' => nil,
|
61
|
+
'padrino-support' => nil,
|
62
|
+
'paranoia' => 'https://github.com/rubysherpas/paranoia',
|
63
|
+
'pdf-core' => 'https://github.com/prawnpdf/pdf-core',
|
64
|
+
'pg' => nil,
|
65
|
+
'rack-mini-profiler' => 'https://github.com/MiniProfiler/rack-mini-profiler',
|
66
|
+
'raindrops' => 'https://github.com/tmm1/raindrops',
|
67
|
+
'redis-actionpack' => 'https://github.com/redis-store/redis-actionpack',
|
68
|
+
'redis-activesupport' => 'https://github.com/redis-store/redis-activesupport',
|
69
|
+
'redis-rack' => 'https://github.com/redis-store/redis-rack',
|
70
|
+
'redis-rails' => 'https://github.com/redis-store/redis-rails',
|
71
|
+
'rom-mapper' => 'https://github.com/rom-rb/rom-mapper',
|
72
|
+
'rom-repository' => 'https://github.com/rom-rb/rom-repository',
|
73
|
+
'rom-sql' => 'https://github.com/rom-rb/rom-sql',
|
74
|
+
'rouge' => 'https://github.com/jneen/rouge',
|
75
|
+
'rubygems-update' => nil,
|
76
|
+
'spreadsheet' => 'https://github.com/zdavatz/spreadsheet',
|
77
|
+
'thin' => 'https://github.com/macournoyer/thin',
|
78
|
+
'uniform_notifier' => 'https://github.com/flyerhzm/uniform_notifier'
|
79
|
+
}.freeze unless defined? IRREGULAR_REPOSITORIES
|
80
|
+
end
|
81
|
+
end
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -1,27 +1,97 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
4
|
require 'net/https'
|
3
5
|
|
4
6
|
module Gem
|
5
7
|
class Src
|
6
|
-
|
8
|
+
class << self
|
9
|
+
def post_install_hook(installer)
|
10
|
+
return true if installer.class.name == 'Bundler::Source::Path::Installer'
|
11
|
+
return true if !!ENV['GEMSRC_SKIP']
|
12
|
+
|
13
|
+
gem_src = Gem::Src.new installer
|
14
|
+
gem_src.git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri
|
15
|
+
|
16
|
+
gem_src.repositorize_installed_gem
|
17
|
+
|
18
|
+
gem_src.remote_add_src_and_origin
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
7
22
|
|
8
23
|
def initialize(installer)
|
9
|
-
@installer, @tested_repositories = installer, []
|
24
|
+
@installer, @spec, @tested_repositories = installer, installer.spec, []
|
25
|
+
end
|
26
|
+
|
27
|
+
# Guess the git repo from the gemspec and perform git clone
|
28
|
+
def git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri
|
29
|
+
return false if File.exist? clone_dir
|
30
|
+
|
31
|
+
now = Time.now
|
32
|
+
|
33
|
+
if IRREGULAR_REPOSITORIES.key? @spec.name
|
34
|
+
return git_clone IRREGULAR_REPOSITORIES[@spec.name]
|
35
|
+
end
|
36
|
+
|
37
|
+
result = git_clone(source_code_uri_from_metadata) ||
|
38
|
+
git_clone(github_url(source_code_uri_from_metadata)) ||
|
39
|
+
git_clone(@spec.homepage) ||
|
40
|
+
git_clone(github_url(@spec.homepage)) ||
|
41
|
+
git_clone(source_code_uri) ||
|
42
|
+
git_clone(homepage_uri) ||
|
43
|
+
git_clone(github_url(homepage_uri)) ||
|
44
|
+
git_clone(github_organization_uri(@spec.name))
|
45
|
+
|
46
|
+
if verbose?
|
47
|
+
puts "gem-src: #{@spec.name} - !!! Failed to find a repo." if result.nil?
|
48
|
+
puts "gem-src: #{@spec.name} - #{Time.now - now}s"
|
49
|
+
end
|
50
|
+
result
|
51
|
+
end
|
52
|
+
|
53
|
+
# git init the installed gem so that we can directly edit the files there
|
54
|
+
def repositorize_installed_gem
|
55
|
+
if File.directory? gem_dir
|
56
|
+
puts "gem-src: #{@spec.name} - repositorizing..." if verbose?
|
57
|
+
`cd #{gem_dir} && ! git rev-parse --is-inside-work-tree 2> /dev/null && git init && git checkout -qb gem-src_init && git add -A && git commit -m 'Initial commit by gem-src'`
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# git remote add from the installed gem to the cloned repo so that we can easily transfer patches
|
62
|
+
def remote_add_src_and_origin
|
63
|
+
if File.directory?(clone_dir) && File.directory?(gem_dir)
|
64
|
+
puts "gem-src: #{@spec.name} - adding remotes..." if verbose?
|
65
|
+
`cd #{gem_dir} && git remote add src #{clone_dir}`
|
66
|
+
origin = `cd #{clone_dir} && git remote get-url origin`.chomp
|
67
|
+
`cd #{gem_dir} && git config remote.origin.url #{origin}` if origin
|
68
|
+
end
|
10
69
|
end
|
11
70
|
|
71
|
+
private
|
72
|
+
|
12
73
|
def clone_dir
|
13
74
|
@clone_dir ||= if ENV['GEMSRC_CLONE_ROOT']
|
14
|
-
File.expand_path
|
75
|
+
File.expand_path @spec.name, ENV['GEMSRC_CLONE_ROOT']
|
15
76
|
elsif Gem.configuration[:gemsrc_clone_root]
|
16
|
-
File.expand_path
|
77
|
+
File.expand_path @spec.name, Gem.configuration[:gemsrc_clone_root]
|
17
78
|
else
|
18
|
-
gem_dir = installer.respond_to?(:gem_dir) ? installer.gem_dir : File.expand_path(File.join(installer.gem_home, 'gems', installer.spec.full_name))
|
19
79
|
File.join gem_dir, 'src'
|
20
80
|
end
|
21
81
|
end
|
22
82
|
|
83
|
+
def gem_dir
|
84
|
+
if @installer.respond_to?(:gem_dir)
|
85
|
+
@installer.gem_dir
|
86
|
+
elsif @installer.respond_to?(:gem_home) # old rubygems
|
87
|
+
File.expand_path(File.join(@installer.gem_home, 'gems', @spec.full_name))
|
88
|
+
else # bundler
|
89
|
+
File.expand_path(File.join(Gem.dir, 'gems', @spec.full_name))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
23
93
|
def github_url(url)
|
24
|
-
if url =~ /\Ahttps?:\/\/([^.]+)\.github
|
94
|
+
if url =~ /\Ahttps?:\/\/([^.]+)\.github\.(?:com|io)\/(.+)/
|
25
95
|
if $1 == 'www'
|
26
96
|
"https://github.com/#{$2}"
|
27
97
|
elsif $1 == 'wiki'
|
@@ -31,6 +101,9 @@ module Gem
|
|
31
101
|
# https://foo.github.com/bar => https://github.com/foo/bar
|
32
102
|
"https://github.com/#{$1}/#{$2}"
|
33
103
|
end
|
104
|
+
elsif url =~ %r[\A(https?://github\.com/.+/.+)/tree/]
|
105
|
+
# https://github.com/foo/bar/tree/v1.2.3
|
106
|
+
$1
|
34
107
|
end
|
35
108
|
end
|
36
109
|
|
@@ -46,9 +119,13 @@ module Gem
|
|
46
119
|
Net::HTTP.new('github.com', 443).tap {|h| h.use_ssl = true }.request_head(url).code != '404'
|
47
120
|
end
|
48
121
|
|
122
|
+
def source_code_uri_from_metadata
|
123
|
+
@spec.metadata['source_code_uri']
|
124
|
+
end
|
125
|
+
|
49
126
|
def api
|
50
127
|
require 'open-uri'
|
51
|
-
@api ||=
|
128
|
+
@api ||= OpenURI.open_uri("https://rubygems.org/api/v1/gems/#{@spec.name}.yaml", &:read)
|
52
129
|
rescue OpenURI::HTTPError
|
53
130
|
""
|
54
131
|
end
|
@@ -67,10 +144,13 @@ module Gem
|
|
67
144
|
|
68
145
|
def git_clone(repository)
|
69
146
|
return if repository.nil? || repository.empty?
|
147
|
+
return if repository.include? 'rubyforge.org'
|
70
148
|
return if @tested_repositories.include? repository
|
71
149
|
@tested_repositories << repository
|
72
150
|
return if github?(repository) && !github_page_exists?(repository)
|
73
151
|
|
152
|
+
puts "gem-src: #{@spec.name} - Cloning from #{repository}..." if verbose?
|
153
|
+
|
74
154
|
if use_ghq?
|
75
155
|
system 'ghq', 'get', repository
|
76
156
|
else
|
@@ -82,26 +162,20 @@ module Gem
|
|
82
162
|
ENV['GEMSRC_USE_GHQ'] || Gem.configuration[:gemsrc_use_ghq]
|
83
163
|
end
|
84
164
|
|
85
|
-
def git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri
|
86
|
-
return false if File.exist? clone_dir
|
87
|
-
git_clone(installer.spec.homepage) ||
|
88
|
-
git_clone(github_url(installer.spec.homepage)) ||
|
89
|
-
git_clone(source_code_uri) ||
|
90
|
-
git_clone(homepage_uri) ||
|
91
|
-
git_clone(github_url(homepage_uri)) ||
|
92
|
-
git_clone(github_organization_uri(installer.spec.name))
|
93
|
-
end
|
94
|
-
|
95
165
|
def api_uri_for(key)
|
96
166
|
uri = api[Regexp.new("^#{key}_uri: (.*)$"), 1]
|
97
|
-
uri =~ /\
|
167
|
+
uri =~ /\A(?:https?|git):\/\// ? uri : nil
|
98
168
|
end
|
99
|
-
|
169
|
+
|
170
|
+
def verbose?
|
171
|
+
!!ENV['GEMSRC_VERBOSE'] || Gem.configuration[:gemsrc_verbose]
|
172
|
+
end
|
173
|
+
end unless defined?(Src) # for rubygems test suite.
|
100
174
|
end
|
101
175
|
|
176
|
+
require 'gem/src/irregular_repositories'
|
177
|
+
|
102
178
|
|
103
179
|
Gem.post_install do |installer|
|
104
|
-
|
105
|
-
Gem::Src.new(installer).git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri
|
106
|
-
true
|
180
|
+
Gem::Src.post_install_hook installer
|
107
181
|
end
|
data/plugins.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gem::Src do
|
4
|
+
def quick_gem(name, version='2')
|
5
|
+
require 'rubygems/specification'
|
6
|
+
|
7
|
+
spec = Gem::Specification.new do |s|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.name = name
|
10
|
+
s.version = version
|
11
|
+
s.author = 'A User'
|
12
|
+
s.email = 'example@example.com'
|
13
|
+
s.homepage = 'http://example.com'
|
14
|
+
s.summary = "this is a summary"
|
15
|
+
s.description = "This is a test description"
|
16
|
+
|
17
|
+
yield(s) if block_given?
|
18
|
+
end
|
19
|
+
|
20
|
+
Gem::Specification.map # HACK: force specs to (re-)load before we write
|
21
|
+
|
22
|
+
written_path = write_file spec.spec_file do |io|
|
23
|
+
io.write spec.to_ruby_for_cache
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.loaded_from = spec.loaded_from = written_path
|
27
|
+
|
28
|
+
Gem::Specification.add_spec spec.for_cache
|
29
|
+
|
30
|
+
spec
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#clone_dir' do
|
34
|
+
subject do
|
35
|
+
gem = quick_gem 'my_awesome_gem'
|
36
|
+
installer = Gem::Installer.new gem
|
37
|
+
installer.stub(:gem_dir, '~/g/my_awesome_gem')
|
38
|
+
Gem::Src.new installer
|
39
|
+
end
|
40
|
+
context "with ENV['GEMSRC_CLONE_ROOT']" do
|
41
|
+
around do |example|
|
42
|
+
e, g = ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root]
|
43
|
+
ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root] = '~/foo', nil
|
44
|
+
example.run
|
45
|
+
ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root] = e, g
|
46
|
+
end
|
47
|
+
its(:clone_dir) { should == '~/foo/my_awesome_gem' }
|
48
|
+
end
|
49
|
+
|
50
|
+
context "with Gem.configuration[:gemsrc_clone_root]" do
|
51
|
+
around do |example|
|
52
|
+
e, g = ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root]
|
53
|
+
ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root] = nil, '~/bar'
|
54
|
+
example.run
|
55
|
+
ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root] = e, g
|
56
|
+
end
|
57
|
+
its(:clone_dir) { should == '~/bar/my_awesome_gem' }
|
58
|
+
end
|
59
|
+
|
60
|
+
context "without clone_root configuration" do
|
61
|
+
around do |example|
|
62
|
+
e, g = ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root]
|
63
|
+
ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root] = nil, nil
|
64
|
+
example.run
|
65
|
+
ENV['GEMSRC_CLONE_ROOT'], Gem.configuration[:gemsrc_clone_root] = e, g
|
66
|
+
end
|
67
|
+
its(:clone_dir) { should == '~/aho/my_awesome_gem/src' }
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-src
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,13 +38,18 @@ files:
|
|
38
38
|
- Rakefile
|
39
39
|
- etc/rbenv.d/exec/~gem-src.bash
|
40
40
|
- gem-src.gemspec
|
41
|
+
- lib/gem/src/irregular_repositories.rb
|
41
42
|
- lib/rubygems_plugin.rb
|
43
|
+
- plugins.rb
|
44
|
+
- spec/gem-src_spec.rb
|
45
|
+
- spec/spec_helper.rb
|
42
46
|
homepage: https://github.com/amatsuda/gem-src
|
43
47
|
licenses: []
|
44
48
|
metadata: {}
|
45
49
|
post_install_message: |
|
46
|
-
[gem-src]
|
50
|
+
[gem-src] Installing gem-src as a gem is not recommended. Please consider installing as an rbenv plugin instead.
|
47
51
|
|
52
|
+
If you have not yet configured "gemsrc_clone_root", we strongly recommend you to add the configuration to your .gemrc.
|
48
53
|
e.g.)
|
49
54
|
% echo "gemsrc_clone_root: ~/src" >> ~/.gemrc
|
50
55
|
|
@@ -63,9 +68,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
68
|
- !ruby/object:Gem::Version
|
64
69
|
version: '0'
|
65
70
|
requirements: []
|
66
|
-
|
67
|
-
|
68
|
-
signing_key:
|
71
|
+
rubygems_version: 3.2.0.rc.1
|
72
|
+
signing_key:
|
69
73
|
specification_version: 4
|
70
74
|
summary: Gem.post_install { `git clone gem_source src` }
|
71
|
-
test_files:
|
75
|
+
test_files:
|
76
|
+
- spec/gem-src_spec.rb
|
77
|
+
- spec/spec_helper.rb
|