bundler-download 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +121 -18
- data/VERSION +1 -1
- data/bin/bundler-download +0 -0
- data/bundler-download.gemspec +17 -16
- data/lib/bundler-download.rb +1 -0
- data/lib/bundler-download/ext/download.rb +10 -0
- data/lib/bundler/download.rb +36 -2
- data/lib/bundler/downloadfile.rb +84 -7
- metadata +65 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c510e683dd2ec94c94ac33ae12c2e5776ac48cb2bba048eaa996a26910e35c94
|
4
|
+
data.tar.gz: 22c912fc084b77506db7170abdbc6292742f294b7ade309ce4c17a770b0fcff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9b624db4e06692595b0a9b5e430d0e7ceb299ad7de6a27d18b6611c28484bcae7bad9e1771c4beffd45e1a586f667920e46ba9d2a3fe86e2bfe1fc8bc8cc229
|
7
|
+
data.tar.gz: c0503acbebf26d166709d97051cfea861f9256799fadd08d5226d5ad84be1ef47617bcd65990d1b57b74ae55a2913e9b179ffdf85ff6263cb01e516f52b5dcb5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.1.0
|
4
|
+
|
5
|
+
- Add a post install message
|
6
|
+
- `bundle download clear` command to remove downloads (alias as `clean` too)
|
7
|
+
- Support `os` option for `download` DSL keyword in `Downloadfile`
|
8
|
+
- `bundle download --all-operating-systems` to download files for all OS'es
|
9
|
+
- `bundle download help` to show instructions (with `usage` as an alias)
|
10
|
+
- `bundle download list` lists downloads for every gem with a Downloadfile
|
11
|
+
- `bundle download show` shows downloaded files for every gem with size stats
|
12
|
+
|
3
13
|
## 1.0.0
|
4
14
|
|
5
15
|
- Initial bundler-download with gem-after-install-all hook and `download` command for gem `Downloadfile`
|
data/README.md
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
# bundler-download - Bundler Plugin
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/bundler-download.svg)](http://badge.fury.io/rb/bundler-download)
|
3
3
|
|
4
|
-
Bundler plugin for auto-downloading
|
4
|
+
Bundler plugin for auto-downloading extra gem files (e.g. large file downloads) specified in [`Downloadfile`](#downloadfile) after `bundle install`.
|
5
5
|
|
6
6
|
## How It Works
|
7
7
|
|
8
|
-
Gems declare the need for extra downloads upon install by Bundler
|
8
|
+
Gems can add a [`Downloadfile`](#downloadfile) at the root to declare the need for extra downloads upon install by Bundler.
|
9
9
|
|
10
|
-
Apps can
|
10
|
+
Apps can add those gems to Bundler `Gemfile` the standard way in addition to installing the [bundler-download](https://rubygems.org/gems/bundler-download) Bundler plugin. Afterwards, when running `bundle install`, bundle-download will automatically download extra files at the end.
|
11
11
|
|
12
12
|
If a Ruby Gem needs to depend on one of those gems, it can declare as a standard dependency in .gemspec
|
13
13
|
|
14
14
|
## Gem Instructions
|
15
15
|
|
16
|
-
Add
|
16
|
+
Add [bundler-download](https://rubygems.org/gems/bundler-download) as a standard .gemspec dependency (and mention in its [instructions](#app-instructions) that apps must add `plugin bundler-download` in "Gemfile" to get the extra downloads):
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
s.add_dependency('bundler', [">=
|
19
|
+
s.add_dependency('bundler-download', [">= 1.1.0"])
|
20
20
|
```
|
21
21
|
|
22
|
-
Afterwards, ensure there is a [`Downloadfile`](#downloadfile) at the root directory of the gem
|
22
|
+
Afterwards, ensure there is a [`Downloadfile`](#downloadfile) at the root directory of the gem, including in .gemspec `files`:
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
s.files = [
|
@@ -31,34 +31,40 @@ Afterwards, ensure there is a [`Downloadfile`](#downloadfile) at the root direct
|
|
31
31
|
|
32
32
|
### Downloadfile
|
33
33
|
|
34
|
-
A gem `Downloadfile` contains download links for files that need to be downloaded relative to the gem directory after install
|
34
|
+
A gem `Downloadfile` contains `download` links for files that need to be downloaded relative to the gem directory after `bundle install`.
|
35
35
|
|
36
|
-
Example
|
36
|
+
Example `Downloadfile`:
|
37
37
|
|
38
38
|
```
|
39
39
|
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.gtk.linux.x86_64_0.4.0.202005172227.jar' # downloads into gem root directory
|
40
40
|
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar',
|
41
41
|
to: 'cef' # downloads into 'cef' directory under the gem installation directory
|
42
42
|
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.win32.win32.x86_64_0.4.0.202005172227.jar',
|
43
|
-
to: 'cef/windows' # downloads into 'cef/windows' directory under the gem installation directory
|
43
|
+
to: 'cef/windows', os: 'windows' # downloads into 'cef/windows' directory under the gem installation directory in Windows OS only
|
44
44
|
```
|
45
45
|
|
46
|
+
The keyword `download` declares a file to download and takes the following arguments:
|
47
|
+
1. Download URL string
|
48
|
+
2. `to:` keyword arg: mentions a local download path relative to the gem installation directory (e.g. 'vendor' or 'lib/ai/data'). It automatically creates the path with all its subdirectories if it does not already exist. If left empty, then the file is downloaded to the gem directory root path.
|
49
|
+
3. `os:` keyword arg (value: `mac` / `windows` / `linux`): limits the operating system under which the download is made. It is `nil` by default, allowing the download to occur in all operating systems.
|
50
|
+
|
46
51
|
## App Instructions
|
47
52
|
|
48
|
-
|
53
|
+
An app can depend on a gem that has a `Downloadfile` by adding the `bundler-download` plugin first (or manually installing via `bundle plugin install bundler-download`) and then including the gem in `Gemfile` like it normally would:
|
49
54
|
|
50
55
|
```
|
51
56
|
plugin 'bundler-download'
|
52
57
|
gem 'some_gem_with_downloadfile'
|
53
58
|
```
|
54
59
|
|
55
|
-
Afterwards, run
|
60
|
+
Afterwards, run:
|
56
61
|
|
57
62
|
```
|
58
63
|
bundle install
|
59
|
-
bundle install
|
60
64
|
```
|
61
65
|
|
66
|
+
(run one extra time if you don't have the `bundler-download` plugin installed yet since the first run would just install the plugin and subsequent runs would activate it)
|
67
|
+
|
62
68
|
You should see something like this:
|
63
69
|
|
64
70
|
```
|
@@ -75,7 +81,7 @@ Using tty-cursor 0.7.1
|
|
75
81
|
Using tty-screen 0.8.1
|
76
82
|
Using unicode-display_width 1.7.0
|
77
83
|
Using tty-progressbar 0.17.0
|
78
|
-
Using bundler-download 1.
|
84
|
+
Using bundler-download 1.1.0
|
79
85
|
Using facets 3.1.0
|
80
86
|
Using glimmer 1.0.0
|
81
87
|
bundle-download plugin gem-after-install-all hook:
|
@@ -90,17 +96,114 @@ Download path: /Users/User/.rvm/gems/ruby-2.7.1@tmp/gems/glimmer-1.0.0/cef/com.m
|
|
90
96
|
Downloading 26% ( 59s ) [============== ]
|
91
97
|
```
|
92
98
|
|
93
|
-
|
99
|
+
After the initial download of files, running `bundle install` again will keep existing downloads without overwriting them unless you use the [`bundle-download`](#bundler-download-command) command to manually redownload files again.
|
94
100
|
|
95
101
|
### Bundler Download Command
|
96
102
|
|
97
|
-
If you would like to redownload
|
103
|
+
If you would like to redownload files for all gems again, overwriting existing downloads, simply run:
|
104
|
+
|
105
|
+
```
|
106
|
+
bundle download
|
107
|
+
```
|
108
|
+
|
109
|
+
#### Options
|
98
110
|
|
99
|
-
|
111
|
+
##### --keep-existing
|
100
112
|
|
101
|
-
If you only want to download files if they
|
113
|
+
If you only want to download files if they did not exist already, you could run:
|
114
|
+
|
115
|
+
```
|
116
|
+
bundle download --keep-existing
|
117
|
+
```
|
118
|
+
|
119
|
+
Example printout:
|
120
|
+
|
121
|
+
```
|
122
|
+
Downloading /Users/User/.rvm/gems/ruby-2.7.1@bundler-download/gems/glimmer-cw-browser-chromium-1.0.0/Downloadfile
|
123
|
+
Download '/Users/User/.rvm/gems/ruby-2.7.1@bundler-download/gems/glimmer-cw-browser-chromium-1.0.0/vendor/jars/mac/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar' already exists! (run `bundle download` to redownload)
|
124
|
+
```
|
102
125
|
|
103
|
-
|
126
|
+
##### --all-operating-systems
|
127
|
+
|
128
|
+
If you want to download files for all operating systems (including ones other than the current platform), you could run:
|
129
|
+
|
130
|
+
```
|
131
|
+
bundle download --all-operating-systems
|
132
|
+
```
|
133
|
+
|
134
|
+
#### Subcommands
|
135
|
+
|
136
|
+
##### help (alias: usage)
|
137
|
+
|
138
|
+
Run the `help` subcommand (or usage) to bring up usage instructions:
|
139
|
+
|
140
|
+
```
|
141
|
+
bundle download help
|
142
|
+
```
|
143
|
+
|
144
|
+
Prints:
|
145
|
+
|
146
|
+
```
|
147
|
+
== bundler-download - Bundler Plugin - v1.1.0 ==
|
148
|
+
Commands/Subcommands:
|
149
|
+
bundle download help # Provide help by printing usage instructions
|
150
|
+
bundle download usage # (alias for help)
|
151
|
+
bundle download start # Start download
|
152
|
+
bundle download # (alias for start)
|
153
|
+
bundle download clear # Clear downloads by deleting them under all gems
|
154
|
+
bundle download clean # (alias for clear)
|
155
|
+
bundle download list # List downloads by printing Downloadfile content for all gems
|
156
|
+
bundle download show # Show downloaded files for all gems
|
157
|
+
```
|
158
|
+
|
159
|
+
##### clear (alias: clean)
|
160
|
+
|
161
|
+
Run the `clear` subcommand to clear downloads by deleting them under all gems:
|
162
|
+
|
163
|
+
```
|
164
|
+
bundle download clear
|
165
|
+
```
|
166
|
+
|
167
|
+
Example printout:
|
168
|
+
|
169
|
+
```
|
170
|
+
Clearing /Users/User/.rvm/gems/ruby-2.7.1@bundler-download/gems/glimmer-cw-browser-chromium-1.0.0/Downloadfile
|
171
|
+
```
|
172
|
+
|
173
|
+
##### list
|
174
|
+
|
175
|
+
Run the `list` subcommand to list downloads by printing Downloadfile content for all gems:
|
176
|
+
|
177
|
+
```
|
178
|
+
bundle download list
|
179
|
+
```
|
180
|
+
|
181
|
+
Example printout:
|
182
|
+
|
183
|
+
```
|
184
|
+
Listing /Users/User/.rvm/gems/ruby-2.7.1@bundler-download/gems/glimmer-cw-browser-chromium-1.0.0/Downloadfile
|
185
|
+
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.gtk.linux.x86_64_0.4.0.202005172227.jar',
|
186
|
+
to: 'vendor/jars/linux', os: 'linux'
|
187
|
+
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar',
|
188
|
+
to: 'vendor/jars/mac', os: 'mac'
|
189
|
+
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.win32.win32.x86_64_0.4.0.202005172227.jar',
|
190
|
+
to: 'vendor/jars/windows', os: 'windows'
|
191
|
+
```
|
192
|
+
|
193
|
+
##### show
|
194
|
+
|
195
|
+
Run the `show` subcommand to show downloaded files for all gems:
|
196
|
+
|
197
|
+
```
|
198
|
+
bundle download show
|
199
|
+
```
|
200
|
+
|
201
|
+
Example printout:
|
202
|
+
|
203
|
+
```
|
204
|
+
Showing downloaded files for /Users/User/.rvm/gems/ruby-2.7.1@bundler-download/gems/glimmer-cw-browser-chromium-1.0.0/Downloadfile
|
205
|
+
54070695 /Users/User/.rvm/gems/ruby-2.7.1@bundler-download/gems/glimmer-cw-browser-chromium-1.0.0/vendor/jars/mac/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar
|
206
|
+
```
|
104
207
|
|
105
208
|
## Contributing to bundler-download
|
106
209
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/bin/bundler-download
CHANGED
File without changes
|
data/bundler-download.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: bundler-download 1.
|
5
|
+
# stub: bundler-download 1.1.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bundler-download".freeze
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.1.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["AndyMaleh".freeze]
|
14
|
-
s.date = "2020-09-
|
15
|
-
s.description = "Bundler plugin for auto-downloading specified extra files
|
14
|
+
s.date = "2020-09-23"
|
15
|
+
s.description = "bundler-download is a Bundler plugin for auto-downloading gem-specified extra files (e.g. large file downloads) on `bundle install` from a `Downloadfile`".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.executables = ["bundler-download".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
@@ -35,32 +35,33 @@ Gem::Specification.new do |s|
|
|
35
35
|
]
|
36
36
|
s.homepage = "http://github.com/AndyObtiva/bundler-download".freeze
|
37
37
|
s.licenses = ["MIT".freeze]
|
38
|
-
s.
|
39
|
-
s.
|
38
|
+
s.post_install_message = "*** bundler-download post install message ***\nSome gems have a Downloadfile! Follow the instructions below to download their files. \nAdd `plugin 'bundler-download'` to Gemfile and run `bundle install` \nor alternatively just run `bundle plugin install bundler-download`. \nAfterwards, run `bundle install` and extra gem files will be downloaded automatically.".freeze
|
39
|
+
s.rubygems_version = "3.1.4".freeze
|
40
|
+
s.summary = "bundler-download is a Bundler plugin for auto-downloading specified extra files on `bundle install`".freeze
|
40
41
|
|
41
42
|
if s.respond_to? :specification_version then
|
42
43
|
s.specification_version = 4
|
43
44
|
end
|
44
45
|
|
45
46
|
if s.respond_to? :add_runtime_dependency then
|
46
|
-
s.add_runtime_dependency(%q<bundler>.freeze, [">= 2.0.0"])
|
47
|
-
s.add_runtime_dependency(%q<
|
48
|
-
s.add_runtime_dependency(%q<
|
49
|
-
s.add_runtime_dependency(%q<
|
47
|
+
s.add_runtime_dependency(%q<bundler>.freeze, [">= 2.0.0", "< 3.0.0"])
|
48
|
+
s.add_runtime_dependency(%q<download>.freeze, [">= 1.1.0", "< 2.0.0"])
|
49
|
+
s.add_runtime_dependency(%q<httparty>.freeze, [">= 0.18.1", "< 2.0.0"])
|
50
|
+
s.add_runtime_dependency(%q<os>.freeze, [">= 1.1.1", "< 2.0.0"])
|
51
|
+
s.add_runtime_dependency(%q<tty-progressbar>.freeze, [">= 0.17.0", "< 2.0.0"])
|
50
52
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
51
|
-
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
52
53
|
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.3.5"])
|
53
54
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
54
55
|
s.add_development_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
|
55
56
|
s.add_development_dependency(%q<pessimize>.freeze, [">= 0"])
|
56
57
|
s.add_development_dependency(%q<rake-tui>.freeze, [">= 0"])
|
57
58
|
else
|
58
|
-
s.add_dependency(%q<bundler>.freeze, [">= 2.0.0"])
|
59
|
-
s.add_dependency(%q<
|
60
|
-
s.add_dependency(%q<
|
61
|
-
s.add_dependency(%q<
|
59
|
+
s.add_dependency(%q<bundler>.freeze, [">= 2.0.0", "< 3.0.0"])
|
60
|
+
s.add_dependency(%q<download>.freeze, [">= 1.1.0", "< 2.0.0"])
|
61
|
+
s.add_dependency(%q<httparty>.freeze, [">= 0.18.1", "< 2.0.0"])
|
62
|
+
s.add_dependency(%q<os>.freeze, [">= 1.1.1", "< 2.0.0"])
|
63
|
+
s.add_dependency(%q<tty-progressbar>.freeze, [">= 0.17.0", "< 2.0.0"])
|
62
64
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
63
|
-
s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
64
65
|
s.add_dependency(%q<jeweler>.freeze, [">= 2.3.5"])
|
65
66
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
66
67
|
s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
|
data/lib/bundler-download.rb
CHANGED
@@ -25,6 +25,16 @@ module Download
|
|
25
25
|
class Object
|
26
26
|
DOWNLOAD_CHUNK_SIZE = 1_048_576
|
27
27
|
|
28
|
+
def os
|
29
|
+
options.to_h[:os]
|
30
|
+
end
|
31
|
+
|
32
|
+
def delete(hash={})
|
33
|
+
set_multi(hash)
|
34
|
+
|
35
|
+
File.delete(file_path) if File.exist?(file_path)
|
36
|
+
end
|
37
|
+
|
28
38
|
def start(hash={})
|
29
39
|
set_multi(hash)
|
30
40
|
return puts("Download '#{file_path}' already exists! (run `bundle download` to redownload)") if options.keys.include?('--keep_existing') && File.exist?(file_path)
|
data/lib/bundler/download.rb
CHANGED
@@ -1,14 +1,42 @@
|
|
1
|
+
# Copyright (c) 2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
module Bundler
|
2
23
|
class Download < Bundler::Plugin::API
|
3
24
|
command "download"
|
4
25
|
|
5
26
|
def exec(command, args)
|
6
27
|
begin
|
28
|
+
subcommand = extract_subcommand(args) || 'start'
|
29
|
+
return puts("Invalid subcommand: #{subcommand} \nValid `bundle download` subcommands are: #{Bundler::Downloadfile::SUBCOMMANDS.join(' / ')}") unless Bundler::Downloadfile::SUBCOMMANDS.include?(subcommand)
|
7
30
|
downloadfiles = Dir.glob(File.join(Gem.dir, 'gems', '**', 'Downloadfile')).to_a
|
8
31
|
puts 'No gems were found with Downloadfile.' if downloadfiles.empty?
|
9
32
|
downloadfiles.each do |downloadfile|
|
10
|
-
|
11
|
-
|
33
|
+
bundler_downloadfile = Bundler::Downloadfile.new(
|
34
|
+
downloadfile,
|
35
|
+
gem_path: File.dirname(downloadfile),
|
36
|
+
keep_existing: args.include?('--keep-existing'),
|
37
|
+
all_operating_systems: args.include?('--all-operating-systems'),
|
38
|
+
)
|
39
|
+
bundler_downloadfile.send(subcommand)
|
12
40
|
end
|
13
41
|
true
|
14
42
|
rescue => e
|
@@ -16,5 +44,11 @@ module Bundler
|
|
16
44
|
false
|
17
45
|
end
|
18
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def extract_subcommand(args)
|
51
|
+
args.detect {|arg| !arg.start_with?('-')}
|
52
|
+
end
|
19
53
|
end
|
20
54
|
end
|
data/lib/bundler/downloadfile.rb
CHANGED
@@ -1,22 +1,99 @@
|
|
1
|
+
# Copyright (c) 2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
module Bundler
|
2
|
-
class Downloadfile
|
23
|
+
class Downloadfile
|
24
|
+
attr_reader :file, :file_content, :gem_path, :keep_existing
|
3
25
|
|
4
|
-
|
26
|
+
HELP = <<~MULTI_LINE_STRING
|
27
|
+
== bundler-download - Bundler Plugin - v#{File.read(File.expand_path('../../../VERSION', __FILE__)).strip} ==
|
28
|
+
Commands/Subcommands:
|
29
|
+
bundle download help # Provide help by printing usage instructions
|
30
|
+
bundle download usage # (alias for help)
|
31
|
+
bundle download start # Start download
|
32
|
+
bundle download # (alias for start)
|
33
|
+
bundle download clear # Clear downloads by deleting them under all gems
|
34
|
+
bundle download clean # (alias for clear)
|
35
|
+
bundle download list # List downloads by printing Downloadfile content for all gems
|
36
|
+
bundle download show # Show downloaded files for all gems
|
37
|
+
MULTI_LINE_STRING
|
38
|
+
|
39
|
+
SUPPORTED_OPERATING_SYSTEMS = %w[mac windows linux]
|
40
|
+
PLATFORM_OS = SUPPORTED_OPERATING_SYSTEMS.detect {|os| OS.send("#{os}?")}
|
41
|
+
SUBCOMMANDS = %w[start clear clean help usage list show]
|
42
|
+
|
43
|
+
def initialize(file, gem_path:, keep_existing: nil, all_operating_systems: nil)
|
44
|
+
@file = file
|
45
|
+
@file_content = File.read(@file)
|
5
46
|
@gem_path = gem_path
|
6
|
-
@file_content = file_content
|
7
47
|
@keep_existing = keep_existing
|
48
|
+
@all_operating_systems = all_operating_systems
|
49
|
+
@downloads = []
|
50
|
+
interpret
|
8
51
|
end
|
9
52
|
|
10
|
-
def download(uri, to:'')
|
53
|
+
def download(uri, to:'', os: nil)
|
11
54
|
directory = File.join(@gem_path, to)
|
12
55
|
FileUtils.mkdir_p(directory)
|
13
|
-
|
56
|
+
os = SUPPORTED_OPERATING_SYSTEMS.detect {|system| os.to_s.downcase == system}
|
57
|
+
options = {os: os}
|
14
58
|
options['--keep_existing'] = nil if @keep_existing
|
15
|
-
::Download.
|
59
|
+
@downloads << ::Download::Object.new(
|
60
|
+
url: uri,
|
61
|
+
path: directory,
|
62
|
+
options: options
|
63
|
+
)
|
16
64
|
end
|
17
65
|
|
18
|
-
def
|
66
|
+
def interpret
|
19
67
|
instance_eval(@file_content)
|
20
68
|
end
|
69
|
+
|
70
|
+
def start
|
71
|
+
puts "Downloading #{file}"
|
72
|
+
@downloads.select {|download| @all_operating_systems || download.os.nil? || download.os == PLATFORM_OS }.each(&:start)
|
73
|
+
end
|
74
|
+
|
75
|
+
def clear
|
76
|
+
puts "Clearing #{file}"
|
77
|
+
@downloads.each(&:delete)
|
78
|
+
end
|
79
|
+
alias clean clear
|
80
|
+
|
81
|
+
def help
|
82
|
+
puts HELP
|
83
|
+
end
|
84
|
+
alias usage help
|
85
|
+
|
86
|
+
def list
|
87
|
+
puts "Listing #{file}"
|
88
|
+
puts @file_content
|
89
|
+
end
|
90
|
+
|
91
|
+
def show
|
92
|
+
puts "Showing downloaded files for #{file}"
|
93
|
+
@downloads.each do |download|
|
94
|
+
file = download.file_path
|
95
|
+
puts "#{File.size(file)} #{file}" if File.exist?(file)
|
96
|
+
end
|
97
|
+
end
|
21
98
|
end
|
22
99
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler-download
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.0.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.0.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,48 +27,89 @@ dependencies:
|
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 2.0.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: download
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.1.0
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.0.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.1.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.0.0
|
27
53
|
- !ruby/object:Gem::Dependency
|
28
54
|
name: httparty
|
29
55
|
requirement: !ruby/object:Gem::Requirement
|
30
56
|
requirements:
|
31
|
-
- - "
|
57
|
+
- - ">="
|
32
58
|
- !ruby/object:Gem::Version
|
33
59
|
version: 0.18.1
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.0.0
|
34
63
|
type: :runtime
|
35
64
|
prerelease: false
|
36
65
|
version_requirements: !ruby/object:Gem::Requirement
|
37
66
|
requirements:
|
38
|
-
- - "
|
67
|
+
- - ">="
|
39
68
|
- !ruby/object:Gem::Version
|
40
69
|
version: 0.18.1
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 2.0.0
|
41
73
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
74
|
+
name: os
|
43
75
|
requirement: !ruby/object:Gem::Requirement
|
44
76
|
requirements:
|
45
|
-
- - "
|
77
|
+
- - ">="
|
46
78
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.1.
|
79
|
+
version: 1.1.1
|
80
|
+
- - "<"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.0
|
48
83
|
type: :runtime
|
49
84
|
prerelease: false
|
50
85
|
version_requirements: !ruby/object:Gem::Requirement
|
51
86
|
requirements:
|
52
|
-
- - "
|
87
|
+
- - ">="
|
53
88
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.1.
|
89
|
+
version: 1.1.1
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 2.0.0
|
55
93
|
- !ruby/object:Gem::Dependency
|
56
94
|
name: tty-progressbar
|
57
95
|
requirement: !ruby/object:Gem::Requirement
|
58
96
|
requirements:
|
59
|
-
- - "
|
97
|
+
- - ">="
|
60
98
|
- !ruby/object:Gem::Version
|
61
99
|
version: 0.17.0
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 2.0.0
|
62
103
|
type: :runtime
|
63
104
|
prerelease: false
|
64
105
|
version_requirements: !ruby/object:Gem::Requirement
|
65
106
|
requirements:
|
66
|
-
- - "
|
107
|
+
- - ">="
|
67
108
|
- !ruby/object:Gem::Version
|
68
109
|
version: 0.17.0
|
110
|
+
- - "<"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 2.0.0
|
69
113
|
- !ruby/object:Gem::Dependency
|
70
114
|
name: rspec
|
71
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +124,6 @@ dependencies:
|
|
80
124
|
- - "~>"
|
81
125
|
- !ruby/object:Gem::Version
|
82
126
|
version: 3.5.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rdoc
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.12'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.12'
|
97
127
|
- !ruby/object:Gem::Dependency
|
98
128
|
name: jeweler
|
99
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,7 +194,8 @@ dependencies:
|
|
164
194
|
- - ">="
|
165
195
|
- !ruby/object:Gem::Version
|
166
196
|
version: '0'
|
167
|
-
description: Bundler plugin for auto-downloading specified
|
197
|
+
description: bundler-download is a Bundler plugin for auto-downloading gem-specified
|
198
|
+
extra files (e.g. large file downloads) on `bundle install` from a `Downloadfile`
|
168
199
|
email: andy.am@gmail.com
|
169
200
|
executables:
|
170
201
|
- bundler-download
|
@@ -189,7 +220,11 @@ homepage: http://github.com/AndyObtiva/bundler-download
|
|
189
220
|
licenses:
|
190
221
|
- MIT
|
191
222
|
metadata: {}
|
192
|
-
post_install_message:
|
223
|
+
post_install_message: "*** bundler-download post install message ***\nSome gems have
|
224
|
+
a Downloadfile! Follow the instructions below to download their files. \nAdd `plugin
|
225
|
+
'bundler-download'` to Gemfile and run `bundle install` \nor alternatively just
|
226
|
+
run `bundle plugin install bundler-download`. \nAfterwards, run `bundle install`
|
227
|
+
and extra gem files will be downloaded automatically."
|
193
228
|
rdoc_options: []
|
194
229
|
require_paths:
|
195
230
|
- lib
|
@@ -204,8 +239,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
239
|
- !ruby/object:Gem::Version
|
205
240
|
version: '0'
|
206
241
|
requirements: []
|
207
|
-
rubygems_version: 3.1.
|
242
|
+
rubygems_version: 3.1.4
|
208
243
|
signing_key:
|
209
244
|
specification_version: 4
|
210
|
-
summary: Bundler plugin for auto-downloading specified extra
|
245
|
+
summary: bundler-download is a Bundler plugin for auto-downloading specified extra
|
246
|
+
files on `bundle install`
|
211
247
|
test_files: []
|