rubygems-deep_fetch 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +78 -0
- data/Rakefile +2 -0
- data/lib/rubygems/commands/deep_fetch_command.rb +72 -0
- data/lib/rubygems_plugin.rb +3 -0
- data/rubygems-deep_fetch.gemspec +22 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MjJhOWIzOTRmOTFlNjgxNzQ3ZTU2Yjk2MmI4M2NhMGU4MjRhYWYxMw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MzExMjE2NmMzOWYxNDkzYTAzZTVhMTgxNDM5YzRlZjBiNDcyOGI0NQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2NlNTliNDFmNDZhNGI2NDY3MzE1YTgxODlkMTEzNWFiZDBjNGRiN2JmY2Y3
|
10
|
+
YTU2ZTUyZDUwMGQyMDdkOTY4YmQ3ZmE4ZWM4N2I0MWQ4YmJhZjg0MmJhOGRm
|
11
|
+
YTU5YThmYjQ2MjcyYzllMDFiMTViOTkxNzVmM2FmMTY0Y2E2ZGU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjU4MDZiN2QwY2EyMDI3NmVhYTQzYjZhYmU3MWM5NjhjNWIxZjJiYmFjNTk3
|
14
|
+
MWU0MjA0YzJkNDZjZjk5MGFkZGYwYTg4ODc4OTM1ZmIzN2JhNWNmOTY5YjI0
|
15
|
+
ZjI5Mjk5YjNmOTUzY2Q3YjBjODBmMGI5OTIyYjhjOWEyNGRjYjY=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Fabien Catteau
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# `rubygems-deep_fetch`
|
2
|
+
|
3
|
+
Adds a `deep_fetch` command to rubygems, fetches a gem and its dependencies.
|
4
|
+
|
5
|
+
The `deep_fetch` command will not fetch the gems already installed.
|
6
|
+
|
7
|
+
This tiny gem command makes it easy to review the gem you are about to install __and its dependencies you miss locally__.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install using rubygems:
|
12
|
+
|
13
|
+
$ gem install rubygems-deep_fetch
|
14
|
+
|
15
|
+
It requires Rubygems 2.0.0 or later becauses it is based on `Gem::DependencyResolver`.
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
This is just like `gem fetch`:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ gem deep_fetch GEMNAME [GEMNAME ...] [options]
|
23
|
+
```
|
24
|
+
|
25
|
+
See `gem help deep_fetch`.
|
26
|
+
|
27
|
+
## Example
|
28
|
+
|
29
|
+
Let's suppose I plan to install a fresh version of `sinatra`. This gem has 3 dependencies:
|
30
|
+
|
31
|
+
```
|
32
|
+
$ gem dependency sinatra --version 1.4.3 --remote
|
33
|
+
Gem sinatra-1.4.3
|
34
|
+
rack (~> 1.4)
|
35
|
+
rack-protection (~> 1.4)
|
36
|
+
tilt (>= 1.3.4, ~> 1.3)
|
37
|
+
```
|
38
|
+
|
39
|
+
`tilt` is already installed on my machine, so I don't care about that one.
|
40
|
+
|
41
|
+
```
|
42
|
+
$ gem list tilt --local | grep tilt
|
43
|
+
tilt (1.4.1)
|
44
|
+
```
|
45
|
+
|
46
|
+
Now, I want to fetch `sinatra` and all the gems I miss locally.
|
47
|
+
|
48
|
+
```
|
49
|
+
$ gem deep_fetch sinatra --version 1.4.3
|
50
|
+
Downloaded sinatra-1.4.3
|
51
|
+
Downloaded rack-1.5.2
|
52
|
+
Downloaded rack-protection-1.5.0
|
53
|
+
|
54
|
+
$ ls *gem -1
|
55
|
+
rack-1.5.2.gem
|
56
|
+
rack-protection-1.5.0.gem
|
57
|
+
sinatra-1.4.3.gem
|
58
|
+
```
|
59
|
+
|
60
|
+
That's it. I can now unpack the gems using `gem unpack` and review them before safely running `gem install`.
|
61
|
+
|
62
|
+
## Bugs
|
63
|
+
|
64
|
+
When used with Rubygems 2.0.0, it will create empty directories like `cache` or `doc`. This bugs comes from Rubygems itself and it has been fixed in 2.1.0. See rubygems/rubygems#482
|
65
|
+
|
66
|
+
## Disclaimer
|
67
|
+
|
68
|
+
No test so far.
|
69
|
+
|
70
|
+
No "platform" option so far.
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
1. Fork it
|
75
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
76
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
77
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
78
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rubygems/command'
|
2
|
+
require 'rubygems/local_remote_options'
|
3
|
+
require 'rubygems/version_option'
|
4
|
+
require 'rubygems/dependency_resolver'
|
5
|
+
|
6
|
+
class Gem::Commands::DeepFetchCommand < Gem::Command
|
7
|
+
|
8
|
+
include Gem::LocalRemoteOptions
|
9
|
+
include Gem::VersionOption
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
super 'deep_fetch', 'Download a gem and its dependencies, place them in the current directory'
|
13
|
+
|
14
|
+
add_bulk_threshold_option
|
15
|
+
add_proxy_option
|
16
|
+
add_source_option
|
17
|
+
add_clear_sources_option
|
18
|
+
|
19
|
+
add_version_option
|
20
|
+
# TODO add_platform_option
|
21
|
+
# TODO add_prerelease_option
|
22
|
+
end
|
23
|
+
|
24
|
+
def arguments # :nodoc:
|
25
|
+
'GEMNAME name of gem to download'
|
26
|
+
end
|
27
|
+
|
28
|
+
def defaults_str # :nodoc:
|
29
|
+
"--version '#{Gem::Requirement.default}'"
|
30
|
+
end
|
31
|
+
|
32
|
+
def description # :nodoc:
|
33
|
+
<<-EOF
|
34
|
+
The deep_fetch command fetches gem files that can be stored for later use
|
35
|
+
or unpacked to examine their contents.
|
36
|
+
|
37
|
+
Unlike the built-in fetch command, deep_fetch command fetches the
|
38
|
+
dependencies but ignores the gems that are already installed.
|
39
|
+
|
40
|
+
deep_fetch is usefull to examine new packages before installing them.
|
41
|
+
EOF
|
42
|
+
end
|
43
|
+
|
44
|
+
def usage # :nodoc:
|
45
|
+
"#{program_name} GEMNAME [GEMNAME ...]"
|
46
|
+
end
|
47
|
+
|
48
|
+
def execute
|
49
|
+
version = options[:version] || Gem::Requirement.default
|
50
|
+
gem_names = get_all_gem_names
|
51
|
+
|
52
|
+
deps = gem_names.map do |gem_name|
|
53
|
+
Gem::Dependency.new gem_name, version
|
54
|
+
end
|
55
|
+
|
56
|
+
resolver = Gem::DependencyResolver.new deps;
|
57
|
+
action_requests = resolver.resolve;
|
58
|
+
|
59
|
+
action_requests.reject do |ar|
|
60
|
+
ar.installed?
|
61
|
+
end.each do |ar|
|
62
|
+
spec = ar.spec
|
63
|
+
full_spec = spec.spec
|
64
|
+
source = spec.source
|
65
|
+
source.download full_spec
|
66
|
+
say "Downloaded #{spec.full_name}"
|
67
|
+
spec.full_name
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
Gem::Specification.new do |gem|
|
3
|
+
gem.name = "rubygems-deep_fetch"
|
4
|
+
gem.version = "0.1.0"
|
5
|
+
|
6
|
+
gem.authors = ["Fabien Catteau"]
|
7
|
+
gem.email = ["fabien.catteau@mingalar.fr"]
|
8
|
+
gem.homepage = "https://github.com/fcat/rubygems-deep_fetch"
|
9
|
+
gem.summary = %q{Fetch a gem along with its dependencies}
|
10
|
+
gem.description = <<desc
|
11
|
+
The `gem deep_fetch` command works like `gem fetch`
|
12
|
+
but it downloads all the gems required to satisfy the dependencies
|
13
|
+
except the ones already available (ie in the cache).
|
14
|
+
desc
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($\)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
|
21
|
+
gem.required_rubygems_version = '>= 2.0.0'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubygems-deep_fetch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabien Catteau
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-04 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: ! " The `gem deep_fetch` command works like `gem fetch`\n but it downloads
|
14
|
+
all the gems required to satisfy the dependencies\n except the ones already available
|
15
|
+
(ie in the cache).\n"
|
16
|
+
email:
|
17
|
+
- fabien.catteau@mingalar.fr
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- lib/rubygems/commands/deep_fetch_command.rb
|
28
|
+
- lib/rubygems_plugin.rb
|
29
|
+
- rubygems-deep_fetch.gemspec
|
30
|
+
homepage: https://github.com/fcat/rubygems-deep_fetch
|
31
|
+
licenses: []
|
32
|
+
metadata: {}
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.0.0
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.0.0
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Fetch a gem along with its dependencies
|
53
|
+
test_files: []
|