gem-src 0.7.0 → 0.8.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.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/gem-src.gemspec +1 -1
- data/lib/rubygems_plugin.rb +31 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ba1c08b26237e18feec53fe531dc1834167c8c4
|
4
|
+
data.tar.gz: a5e99da74ead21538aecb0aa7fdf0ff72aaaa38c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 787bd19f020179c1714f40cb3c9c0356f43aec47b09b73335dd565076d149041fb660888a047e29bb06cc0d1c7fb7ba39212ab727a9138cbb8ac3b2200d906f6
|
7
|
+
data.tar.gz: 6c5b37cc84214c884239d054ecaadcd9c36c0702479daf432520bb101a23128cbf0d8ee1ba4febfed1a90a4da713cca1c06c415731d5588193cd393580a0201c
|
data/README.md
CHANGED
@@ -2,6 +2,14 @@
|
|
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
4
|
|
5
|
+
***TL;DR***
|
6
|
+
|
7
|
+
% git clone https://github.com/amatsuda/gem-src.git ~/.rbenv/plugins/gem-src
|
8
|
+
% mkdir ~/src
|
9
|
+
% echo "gemsrc_clone_root: ~/src" >> ~/.gemrc
|
10
|
+
|
11
|
+
Then you're all set!
|
12
|
+
|
5
13
|
|
6
14
|
## Installation
|
7
15
|
|
@@ -11,7 +19,7 @@ gem-src is a gem plugin that can be installed via gem install command:
|
|
11
19
|
|
12
20
|
% gem install gem-src
|
13
21
|
|
14
|
-
### As an rbenv plugin (recommended)
|
22
|
+
### :star2: As an rbenv plugin (recommended)
|
15
23
|
|
16
24
|
Alternatively, if you're using rbenv, you can install gem-src as an rbenv plugin:
|
17
25
|
|
@@ -46,7 +54,7 @@ So, the whole directory structure will be like this.
|
|
46
54
|
Note that you might be cloning the same repository again and again as the gem is updated, or the gem install directory changes.
|
47
55
|
For example, if you're using RVM, each of `~/.rvm/gems/*/gems/*` will have it's Git repo inside "src" directory.
|
48
56
|
|
49
|
-
### Specifying gemsrc_clone_root (strongly recommended)
|
57
|
+
### :star2: Specifying gemsrc_clone_root (strongly recommended)
|
50
58
|
|
51
59
|
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
60
|
|
@@ -98,6 +106,12 @@ When you firstly installed this gem, you might want to type in this command righ
|
|
98
106
|
% gem pristine --all
|
99
107
|
This will reinstall all the already installed gems, and so will `git clone` all the repos.
|
100
108
|
|
109
|
+
## Skip cloning
|
110
|
+
|
111
|
+
If you want to skip cloning repositories, you can skip cloning by providing an environment variable `GEMSRC_SKIP`:
|
112
|
+
|
113
|
+
% GEMSRC_SKIP=true bundle install
|
114
|
+
|
101
115
|
|
102
116
|
## Contributing
|
103
117
|
|
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.8.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` }'
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
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
|
8
|
+
IRREGULAR_REPOSITORIES = {'activesupport' => nil, 'actionview' => nil, 'actionpack' => nil, 'activemodel' => nil, 'activerecord' => nil, 'activejob' => nil, 'actionmailer' => nil, 'actioncable' => nil, 'railties' => nil, 'activeresource' => 'https://github.com/rails/activeresource.git', 'autoparse' => 'https://github.com/google/autoparse.git', 'aws-sdk-rails' => 'https://github.com/aws/aws-sdk-rails.git', 'bson' => 'https://github.com/mongodb/bson-ruby.git', 'compass-core' => 'https://github.com/Compass/compass.git', 'compass-import-once' => 'https://github.com/Compass/compass.git', 'cool.io' => 'https://github.com/tarcieri/cool.io.git', 'cucumber-core' => 'https://github.com/cucumber/cucumber-ruby-core.git', 'cucumber-wire' => 'https://github.com/cucumber/cucumber-ruby-wire.git', 'diff-lcs' => 'https://github.com/halostatue/diff-lcs.git', 'elasticsearch-api' => 'https://github.com/elastic/elasticsearch-ruby.git', 'elasticsearch-transport' => 'https://github.com/elastic/elasticsearch-ruby.git', 'erubis' => 'https://github.com/kwatch/erubis.git', 'geocoder' => 'https://github.com/alexreisner/geocoder', 'hirb' => 'https://github.com/cldwalker/hirb', 'html2haml' => 'https://github.com/haml/html2haml', 'io-console' => nil, 'meta_request' => 'https://github.com/dejan/rails_panel', 'method_source' => 'https://github.com/banister/method_source', 'origin' => 'https://github.com/mongoid/origin', 'padrino' => 'https://github.com/padrino/padrino-framework', 'padrino-admin' => nil, 'padrino-cache' => nil, 'padrino-core' => nil, 'padrino-gen' => nil, 'padrino-helpers' => nil, 'padrino-mailer' => nil, 'padrino-performance' => nil, 'padrino-support' => nil, 'paranoia' => 'https://github.com/rubysherpas/paranoia', 'pdf-core' => 'https://github.com/prawnpdf/pdf-core', 'pg' => nil, 'rack-mini-profiler' => 'https://github.com/MiniProfiler/rack-mini-profiler', 'raindrops' => 'https://github.com/tmm1/raindrops', 'redis-actionpack' => 'https://github.com/redis-store/redis-actionpack', 'redis-activesupport' => 'https://github.com/redis-store/redis-activesupport', 'redis-rack' => 'https://github.com/redis-store/redis-rack', 'redis-rails' => 'https://github.com/redis-store/redis-rails', 'spreadsheet' => 'https://github.com/zdavatz/spreadsheet', 'thin' => 'https://github.com/macournoyer/thin', 'uniform_notifier' => 'https://github.com/flyerhzm/uniform_notifier'}.freeze
|
9
|
+
|
6
10
|
attr_reader :installer
|
7
11
|
|
8
12
|
def initialize(installer)
|
@@ -21,7 +25,7 @@ module Gem
|
|
21
25
|
end
|
22
26
|
|
23
27
|
def github_url(url)
|
24
|
-
if url =~ /\Ahttps?:\/\/([^.]+)\.github
|
28
|
+
if url =~ /\Ahttps?:\/\/([^.]+)\.github\.(?:com|io)\/(.+)/
|
25
29
|
if $1 == 'www'
|
26
30
|
"https://github.com/#{$2}"
|
27
31
|
elsif $1 == 'wiki'
|
@@ -71,6 +75,8 @@ module Gem
|
|
71
75
|
@tested_repositories << repository
|
72
76
|
return if github?(repository) && !github_page_exists?(repository)
|
73
77
|
|
78
|
+
puts "gem-src: #{installer.spec.name} - Cloning from #{repository}..." if verbose?
|
79
|
+
|
74
80
|
if use_ghq?
|
75
81
|
system 'ghq', 'get', repository
|
76
82
|
else
|
@@ -83,18 +89,40 @@ module Gem
|
|
83
89
|
end
|
84
90
|
|
85
91
|
def git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri
|
92
|
+
return false if skip_clone?
|
86
93
|
return false if File.exist? clone_dir
|
87
|
-
|
94
|
+
|
95
|
+
now = Time.now
|
96
|
+
|
97
|
+
if IRREGULAR_REPOSITORIES.key? installer.spec.name
|
98
|
+
return git_clone IRREGULAR_REPOSITORIES[installer.spec.name]
|
99
|
+
end
|
100
|
+
|
101
|
+
result = git_clone(installer.spec.homepage) ||
|
88
102
|
git_clone(github_url(installer.spec.homepage)) ||
|
89
103
|
git_clone(source_code_uri) ||
|
90
104
|
git_clone(homepage_uri) ||
|
91
105
|
git_clone(github_url(homepage_uri)) ||
|
92
106
|
git_clone(github_organization_uri(installer.spec.name))
|
107
|
+
|
108
|
+
if verbose?
|
109
|
+
puts "gem-src: #{installer.spec.name} - !!! Failed to find a repo." if result.nil?
|
110
|
+
puts "gem-src: #{installer.spec.name} - #{Time.now - now}s"
|
111
|
+
end
|
112
|
+
result
|
93
113
|
end
|
94
114
|
|
95
115
|
def api_uri_for(key)
|
96
116
|
uri = api[Regexp.new("^#{key}_uri: (.*)$"), 1]
|
97
|
-
uri =~ /\
|
117
|
+
uri =~ /\A(?:https?|git):\/\// ? uri : nil
|
118
|
+
end
|
119
|
+
|
120
|
+
def skip_clone?
|
121
|
+
!!ENV['GEMSRC_SKIP']
|
122
|
+
end
|
123
|
+
|
124
|
+
def verbose?
|
125
|
+
!!ENV['GEMSRC_VERBOSE'] || Gem.configuration[:gemsrc_clone_root]
|
98
126
|
end
|
99
127
|
end
|
100
128
|
end
|
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.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -64,9 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.5.1
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Gem.post_install { `git clone gem_source src` }
|
71
71
|
test_files: []
|
72
|
-
has_rdoc:
|