gem-src 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +49 -0
- data/gem-src.gemspec +1 -1
- data/lib/rubygems_plugin.rb +6 -1
- metadata +38 -18
data/README.md
CHANGED
@@ -2,10 +2,59 @@
|
|
2
2
|
|
3
3
|
A gem 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
|
+
|
5
6
|
## Installation
|
6
7
|
|
7
8
|
$ gem install gem-src
|
8
9
|
|
10
|
+
|
11
|
+
## Usage (Configuration)
|
12
|
+
|
13
|
+
### By default
|
14
|
+
|
15
|
+
With this gem installed, every `gem install` you perform will be followed by automatic `git clone` into the installed gem's "src" directory (if the gemspec's "homepage" property points to a Git repo).
|
16
|
+
|
17
|
+
For example, when you execute
|
18
|
+
|
19
|
+
% gem i kaminari
|
20
|
+
and if the gem is installed into `~/.gem/ruby/1.8/kaminari-0.14.1` directory, you'll see Kaminari's full Git repo at `~/.gem/ruby/1.8/kaminari-0.14.1/src` directory.
|
21
|
+
|
22
|
+
So, the whole directory structure will be like this.
|
23
|
+
|
24
|
+
~/.gem/ruby/1.8
|
25
|
+
├── gems
|
26
|
+
│ ├── arel-3.0.2
|
27
|
+
│ │ ├── src
|
28
|
+
│ ├── gem-src-0.2.0
|
29
|
+
│ │ ├── src
|
30
|
+
│ ├── kaminari-0.14.0
|
31
|
+
│ │ ├── src
|
32
|
+
│ ├── kaminari-0.14.1
|
33
|
+
│ │ ├── src
|
34
|
+
...
|
35
|
+
Note that if you're using RVM, each of `~/.rvm/gems/*/gems/*` will have it's Git repo inside "src" directory.
|
36
|
+
|
37
|
+
### GEMSRC_CLONE_ROOT env var
|
38
|
+
|
39
|
+
Instead of cloning the repo under installed gem directory for each `gem install`, you can specify one single directory via `GEMSRC_CLONE_ROOT` environment variable to keep all the cloned repositories.
|
40
|
+
This way, `git clone` will no more be executed per every `gem update`.
|
41
|
+
This option would be more efficient particularly if you're frequently switching RVM gemsets, or using bundler with `--path` per each projects.
|
42
|
+
|
43
|
+
For example,
|
44
|
+
|
45
|
+
% GEMSRC_CLONE_ROOT=~/src gem i active_decorator
|
46
|
+
will clone the Git repo into `~/src/active_decorator` directory if not exists.
|
47
|
+
|
48
|
+
Now, the whole directory structure will be like this.
|
49
|
+
|
50
|
+
~
|
51
|
+
├── src
|
52
|
+
│ ├── active_decorator
|
53
|
+
│ ├── capybara
|
54
|
+
│ ├── i18n_generators
|
55
|
+
...
|
56
|
+
|
57
|
+
|
9
58
|
## Contributing
|
10
59
|
|
11
60
|
1. Fork it
|
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.2.
|
7
|
+
gem.version = '0.2.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` }'
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
3
|
Gem.post_install do |installer|
|
4
|
-
clone_dir =
|
4
|
+
clone_dir = if ENV['GEMSRC_CLONE_ROOT']
|
5
|
+
File.join ENV['GEMSRC_CLONE_ROOT'], installer.spec.name
|
6
|
+
else
|
7
|
+
gem_dir = installer.respond_to?(:gem_dir) ? installer.gem_dir : File.join(installer.gem_home, 'gems', installer.spec.full_name)
|
8
|
+
File.join gem_dir, 'src'
|
9
|
+
end
|
5
10
|
|
6
11
|
if (repo = installer.spec.homepage) && !repo.empty? && !File.exists?(clone_dir)
|
7
12
|
if repo =~ /\Ahttps?:\/\/([^.]+)\.github.com\/(.+)/
|
metadata
CHANGED
@@ -1,23 +1,33 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-src
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Akira Matsuda
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2012-10-16 00:00:00 Z
|
13
19
|
dependencies: []
|
20
|
+
|
14
21
|
description: Gem.post_install { `git clone gem_source src` }
|
15
|
-
email:
|
22
|
+
email:
|
16
23
|
- ronnie@dio.jp
|
17
24
|
executables: []
|
25
|
+
|
18
26
|
extensions: []
|
27
|
+
|
19
28
|
extra_rdoc_files: []
|
20
|
-
|
29
|
+
|
30
|
+
files:
|
21
31
|
- .gitignore
|
22
32
|
- Gemfile
|
23
33
|
- LICENSE.txt
|
@@ -27,26 +37,36 @@ files:
|
|
27
37
|
- lib/rubygems_plugin.rb
|
28
38
|
homepage: https://github.com/amatsuda/gem-src
|
29
39
|
licenses: []
|
40
|
+
|
30
41
|
post_install_message:
|
31
42
|
rdoc_options: []
|
32
|
-
|
43
|
+
|
44
|
+
require_paths:
|
33
45
|
- lib
|
34
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
47
|
none: false
|
36
|
-
requirements:
|
37
|
-
- -
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
|
40
|
-
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
56
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
46
64
|
requirements: []
|
65
|
+
|
47
66
|
rubyforge_project:
|
48
67
|
rubygems_version: 1.8.24
|
49
68
|
signing_key:
|
50
69
|
specification_version: 3
|
51
70
|
summary: Gem.post_install { `git clone gem_source src` }
|
52
71
|
test_files: []
|
72
|
+
|