bundler-download 1.1.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +76 -29
- data/VERSION +1 -1
- data/bundler-download.gemspec +9 -11
- data/lib/bundler/download.rb +5 -1
- data/lib/bundler/downloadfile.rb +31 -12
- data/lib/bundler-download/ext/download.rb +18 -4
- data/lib/bundler-download.rb +5 -1
- data/plugins.rb +2 -0
- metadata +11 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b860161609c4b1d4a34cacf44e61390599afa63a01899f5b496f14987a49abd
|
4
|
+
data.tar.gz: 358bd951bd8d0c0391f38f6cc2e10c42d26246cc651145d73851099ba0ff94ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d5fef9c7b0fea7e7e056c33aa88adaaa692d384d3a04c1e82dd276e80464d8ea332c4ce0c42a2751e5d62a24ef75d5ec826b467d20a9c0936235c71d747d8ee
|
7
|
+
data.tar.gz: bfbaa6e691051040bbf71e7a3e94a99d47d6c93737081b1aedb3ce06c58f10b7e66b05d76e717e9eb76f5c68e210563a7c7eb1288332788f2b14c8ac3ab76d73
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.3.1
|
4
|
+
|
5
|
+
- Improve instructions to help ensure correct and successful usage
|
6
|
+
|
7
|
+
## 1.3.0
|
8
|
+
|
9
|
+
- Setup Bundler default group only when using as an API to avoid loading :development/:test group gems into a production app
|
10
|
+
- Announce that download files are missing for `bundler download show` when a Downloadfile exists but downloads have not been made
|
11
|
+
- Document options (e.g. --keep-existing and --all-operating-systems) in `bundle download help`
|
12
|
+
|
13
|
+
## 1.2.0
|
14
|
+
|
15
|
+
- Get rid of httparty
|
16
|
+
- Only download files for Gemfile gems
|
17
|
+
|
3
18
|
## 1.1.0
|
4
19
|
|
5
20
|
- Add a post install message
|
data/README.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
# bundler-download - Bundler Plugin
|
1
|
+
# bundler-download - Bundler Plugin - v1.3.2
|
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 extra gem files (e.g. large file downloads) specified in [`Downloadfile`](#downloadfile) after `bundle install
|
4
|
+
Bundler plugin for auto-downloading extra gem files (e.g. large file downloads) specified in [`Downloadfile`](#downloadfile) after `bundle install`
|
5
|
+
|
6
|
+
## Background
|
7
|
+
|
8
|
+
The RubyGem ecosystem, famous for gems like Rails for web development, Devise for authentication, and Pundit for authorization, enables productivity via code reuse. As such, it is great for quickly adding libraries to your project to automate part of the work or reuse other people's solutions to solved problems.
|
9
|
+
|
10
|
+
That said, you would not want to package extremely large files, like the OpenAI GPT-3 175 billion parameter models, in a RubyGem.
|
11
|
+
|
12
|
+
Enter [bundler-download](https://rubygems.org/gems/bundler-download), a Bundler Plugin that enables downloading extra gem files after installing with `bundle install` by declaring gem downloads in a [Downloadfile](#downloadfile)
|
5
13
|
|
6
14
|
## How It Works
|
7
15
|
|
@@ -13,10 +21,10 @@ If a Ruby Gem needs to depend on one of those gems, it can declare as a standard
|
|
13
21
|
|
14
22
|
## Gem Instructions
|
15
23
|
|
16
|
-
Add [bundler-download](https://rubygems.org/gems/bundler-download) as a standard .gemspec dependency
|
24
|
+
Add [bundler-download](https://rubygems.org/gems/bundler-download) as a standard .gemspec dependency:
|
17
25
|
|
18
26
|
```ruby
|
19
|
-
s.add_dependency('bundler-download', ["
|
27
|
+
s.add_dependency('bundler-download', ["~> 1.3"])
|
20
28
|
```
|
21
29
|
|
22
30
|
Afterwards, ensure there is a [`Downloadfile`](#downloadfile) at the root directory of the gem, including in .gemspec `files`:
|
@@ -29,15 +37,25 @@ Afterwards, ensure there is a [`Downloadfile`](#downloadfile) at the root direct
|
|
29
37
|
]
|
30
38
|
```
|
31
39
|
|
40
|
+
Finally, follow one of two options for having applications obtain downloads:
|
41
|
+
1. Advertise that apps must install `bundler-download` as a Bundler plugin as per the [App Bundler Plugin Instructions](#app-bundler-plugin-instructions) below.
|
42
|
+
2. Use the [API](#api) to automatically trigger downloads on first use of your gem features.
|
43
|
+
|
32
44
|
### Downloadfile
|
33
45
|
|
34
46
|
A gem `Downloadfile` contains `download` links for files that need to be downloaded relative to the gem directory after `bundle install`.
|
35
47
|
|
48
|
+
Downloadfile entries follow this format (keyword args are optional):
|
49
|
+
|
50
|
+
```
|
51
|
+
download url, to: gem_subdirectory, os: os
|
52
|
+
```
|
53
|
+
|
36
54
|
Example `Downloadfile`:
|
37
55
|
|
38
56
|
```
|
39
57
|
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
|
-
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar',
|
58
|
+
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar',
|
41
59
|
to: 'cef' # downloads into 'cef' directory under the gem installation directory
|
42
60
|
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.win32.win32.x86_64_0.4.0.202005172227.jar',
|
43
61
|
to: 'cef/windows', os: 'windows' # downloads into 'cef/windows' directory under the gem installation directory in Windows OS only
|
@@ -48,22 +66,27 @@ The keyword `download` declares a file to download and takes the following argum
|
|
48
66
|
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
67
|
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
68
|
|
51
|
-
## App Instructions
|
69
|
+
## App Bundler Plugin Instructions
|
52
70
|
|
53
|
-
|
71
|
+
In plugin mode, all gems declared in `Gemfile` are inspected for presence of `Downloadfile` regardless of what group they belong to.
|
72
|
+
|
73
|
+
An app can depend on a gem that has a `Downloadfile` by including in `Gemfile` and running:
|
54
74
|
|
55
75
|
```
|
56
|
-
|
57
|
-
gem 'some_gem_with_downloadfile'
|
76
|
+
bundle
|
58
77
|
```
|
59
78
|
|
60
|
-
Afterwards
|
79
|
+
Afterwards install the `bundler-download` plugin via:
|
61
80
|
|
62
81
|
```
|
63
|
-
bundle install
|
82
|
+
bundle plugin install bundler-download
|
64
83
|
```
|
65
84
|
|
66
|
-
|
85
|
+
Finally, `bundle` one extra time to activate the `bundler-download` plugin:
|
86
|
+
|
87
|
+
```
|
88
|
+
bundle
|
89
|
+
```
|
67
90
|
|
68
91
|
You should see something like this:
|
69
92
|
|
@@ -81,7 +104,7 @@ Using tty-cursor 0.7.1
|
|
81
104
|
Using tty-screen 0.8.1
|
82
105
|
Using unicode-display_width 1.7.0
|
83
106
|
Using tty-progressbar 0.17.0
|
84
|
-
Using bundler-download 1.
|
107
|
+
Using bundler-download 1.3.2
|
85
108
|
Using facets 3.1.0
|
86
109
|
Using glimmer 1.0.0
|
87
110
|
bundle-download plugin gem-after-install-all hook:
|
@@ -96,7 +119,7 @@ Download path: /Users/User/.rvm/gems/ruby-2.7.1@tmp/gems/glimmer-1.0.0/cef/com.m
|
|
96
119
|
Downloading 26% ( 59s ) [============== ]
|
97
120
|
```
|
98
121
|
|
99
|
-
After the initial download of files, running `bundle
|
122
|
+
After the initial download of files, running `bundle` again will keep existing downloads without overwriting them unless you use the [`bundle-download`](#bundler-download-command) command to manually redownload files again.
|
100
123
|
|
101
124
|
### Bundler Download Command
|
102
125
|
|
@@ -139,21 +162,24 @@ Run the `help` subcommand (or usage) to bring up usage instructions:
|
|
139
162
|
|
140
163
|
```
|
141
164
|
bundle download help
|
142
|
-
```
|
165
|
+
```
|
143
166
|
|
144
167
|
Prints:
|
145
168
|
|
146
169
|
```
|
147
|
-
== bundler-download - Bundler Plugin - v1.
|
148
|
-
|
149
|
-
|
150
|
-
bundle download
|
151
|
-
bundle download
|
152
|
-
bundle download
|
153
|
-
bundle download
|
154
|
-
bundle download
|
155
|
-
bundle download
|
156
|
-
bundle download
|
170
|
+
== bundler-download - Bundler Plugin - v1.3.2 ==
|
171
|
+
|
172
|
+
Commands/Subcommands/Options:
|
173
|
+
bundle download help # Provide help by printing usage instructions
|
174
|
+
bundle download usage # (alias for help)
|
175
|
+
bundle download start # Start downloads for current operating system
|
176
|
+
bundle download # (alias for start)
|
177
|
+
bundle download --all-operating-systems # Download files for all operating systems
|
178
|
+
bundle download --keep-existing # Do not redownload already downloaded files
|
179
|
+
bundle download clear # Clear downloads by deleting them under all gems
|
180
|
+
bundle download clean # (alias for clear)
|
181
|
+
bundle download list # List downloads by printing Downloadfile content for all gems
|
182
|
+
bundle download show # Show downloaded files for all gems
|
157
183
|
```
|
158
184
|
|
159
185
|
##### clear (alias: clean)
|
@@ -162,7 +188,7 @@ Run the `clear` subcommand to clear downloads by deleting them under all gems:
|
|
162
188
|
|
163
189
|
```
|
164
190
|
bundle download clear
|
165
|
-
```
|
191
|
+
```
|
166
192
|
|
167
193
|
Example printout:
|
168
194
|
|
@@ -176,7 +202,7 @@ Run the `list` subcommand to list downloads by printing Downloadfile content for
|
|
176
202
|
|
177
203
|
```
|
178
204
|
bundle download list
|
179
|
-
```
|
205
|
+
```
|
180
206
|
|
181
207
|
Example printout:
|
182
208
|
|
@@ -184,7 +210,7 @@ Example printout:
|
|
184
210
|
Listing /Users/User/.rvm/gems/ruby-2.7.1@bundler-download/gems/glimmer-cw-browser-chromium-1.0.0/Downloadfile
|
185
211
|
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.gtk.linux.x86_64_0.4.0.202005172227.jar',
|
186
212
|
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',
|
213
|
+
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.cocoa.macosx.x86_64_0.4.0.202005172227.jar',
|
188
214
|
to: 'vendor/jars/mac', os: 'mac'
|
189
215
|
download 'http://dl.maketechnology.io/chromium-cef/rls/repository/plugins/com.make.chromium.cef.win32.win32.x86_64_0.4.0.202005172227.jar',
|
190
216
|
to: 'vendor/jars/windows', os: 'windows'
|
@@ -196,7 +222,7 @@ Run the `show` subcommand to show downloaded files for all gems:
|
|
196
222
|
|
197
223
|
```
|
198
224
|
bundle download show
|
199
|
-
```
|
225
|
+
```
|
200
226
|
|
201
227
|
Example printout:
|
202
228
|
|
@@ -205,6 +231,27 @@ Showing downloaded files for /Users/User/.rvm/gems/ruby-2.7.1@bundler-download/g
|
|
205
231
|
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
232
|
```
|
207
233
|
|
234
|
+
### API
|
235
|
+
|
236
|
+
In API mode, only gems belonging to the default group in Gemfile are inspected for presence of Downloadfile by default. An app may change that though by loading other Bundler groups (e.g. `Bundler.setup(:default, :developemnt)`)
|
237
|
+
|
238
|
+
Apps may choose to integrate with the [bundler-download](https://rubygems.org/gems/bundler-download) gem directly to trigger downloads instead of relying on the plugin.
|
239
|
+
This can be useful when wanting to trigger downloads only on first use while staying transparent should the gem features not be used.
|
240
|
+
|
241
|
+
To do so, simply include this Ruby code to trigger downloads:
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
require 'bundler-download'
|
245
|
+
Bundler::Download.new.exec('download', [])
|
246
|
+
```
|
247
|
+
|
248
|
+
You can also use the `--keep-existing` option to avoid redownload if files were there already:
|
249
|
+
|
250
|
+
```ruby
|
251
|
+
require 'bundler-download'
|
252
|
+
Bundler::Download.new.exec('download', ['--keep-existing'])
|
253
|
+
```
|
254
|
+
|
208
255
|
## Contributing to bundler-download
|
209
256
|
|
210
257
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.2
|
data/bundler-download.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
# Generated by
|
1
|
+
# Generated by juwelier
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: bundler-download 1.
|
5
|
+
# stub: bundler-download 1.3.2 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.3.2"
|
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 = "
|
14
|
+
s.date = "2021-08-27"
|
15
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]
|
@@ -35,8 +35,8 @@ 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.post_install_message = "*** bundler-download post install message ***\nSome gems have a Downloadfile! Follow the instructions below to download their files. \
|
39
|
-
s.rubygems_version = "3.
|
38
|
+
s.post_install_message = "*** bundler-download post install message ***\nSome gems have a Downloadfile! Follow the instructions below to download their files. \nRun `bundle plugin install bundler-download`. \nAfterwards, run `bundle` and extra files are downloaded automatically.\nTo force download of extra files with bundler-download plugin, run `bundle download`\nTo get help with bundler-download plugin, run `bundle download help`\nLearn more at: https://www.rubydoc.info/gems/bundler-download".freeze
|
39
|
+
s.rubygems_version = "3.2.3".freeze
|
40
40
|
s.summary = "bundler-download is a Bundler plugin for auto-downloading specified extra files on `bundle install`".freeze
|
41
41
|
|
42
42
|
if s.respond_to? :specification_version then
|
@@ -46,11 +46,10 @@ Gem::Specification.new do |s|
|
|
46
46
|
if s.respond_to? :add_runtime_dependency then
|
47
47
|
s.add_runtime_dependency(%q<bundler>.freeze, [">= 2.0.0", "< 3.0.0"])
|
48
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
49
|
s.add_runtime_dependency(%q<os>.freeze, [">= 1.1.1", "< 2.0.0"])
|
51
50
|
s.add_runtime_dependency(%q<tty-progressbar>.freeze, [">= 0.17.0", "< 2.0.0"])
|
52
51
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
53
|
-
s.add_development_dependency(%q<
|
52
|
+
s.add_development_dependency(%q<juwelier>.freeze, [">= 2.4.9"])
|
54
53
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
55
54
|
s.add_development_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
|
56
55
|
s.add_development_dependency(%q<pessimize>.freeze, [">= 0"])
|
@@ -58,11 +57,10 @@ Gem::Specification.new do |s|
|
|
58
57
|
else
|
59
58
|
s.add_dependency(%q<bundler>.freeze, [">= 2.0.0", "< 3.0.0"])
|
60
59
|
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
60
|
s.add_dependency(%q<os>.freeze, [">= 1.1.1", "< 2.0.0"])
|
63
61
|
s.add_dependency(%q<tty-progressbar>.freeze, [">= 0.17.0", "< 2.0.0"])
|
64
62
|
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
65
|
-
s.add_dependency(%q<
|
63
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 2.4.9"])
|
66
64
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
67
65
|
s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
|
68
66
|
s.add_dependency(%q<pessimize>.freeze, [">= 0"])
|
data/lib/bundler/download.rb
CHANGED
@@ -27,7 +27,9 @@ module Bundler
|
|
27
27
|
begin
|
28
28
|
subcommand = extract_subcommand(args) || 'start'
|
29
29
|
return puts("Invalid subcommand: #{subcommand} \nValid `bundle download` subcommands are: #{Bundler::Downloadfile::SUBCOMMANDS.join(' / ')}") unless Bundler::Downloadfile::SUBCOMMANDS.include?(subcommand)
|
30
|
-
downloadfiles = Dir.glob(File.join(Gem.dir, 'gems', '**', 'Downloadfile')).to_a
|
30
|
+
downloadfiles = Dir.glob(File.join(Gem.dir, 'gems', '**', 'Downloadfile')).to_a
|
31
|
+
loaded_gems = Gem.loaded_specs.keys
|
32
|
+
downloadfiles = downloadfiles.select {|df| loaded_gems.detect {|gem| File.basename(File.dirname(df)).include?(gem)} }
|
31
33
|
puts 'No gems were found with Downloadfile.' if downloadfiles.empty?
|
32
34
|
downloadfiles.each do |downloadfile|
|
33
35
|
bundler_downloadfile = Bundler::Downloadfile.new(
|
@@ -36,6 +38,8 @@ module Bundler
|
|
36
38
|
keep_existing: args.include?('--keep-existing'),
|
37
39
|
all_operating_systems: args.include?('--all-operating-systems'),
|
38
40
|
)
|
41
|
+
puts "== bundler-download - Bundler Plugin - v#{File.read(File.expand_path('../../../VERSION', __FILE__)).strip} =="
|
42
|
+
puts
|
39
43
|
bundler_downloadfile.send(subcommand)
|
40
44
|
end
|
41
45
|
true
|
data/lib/bundler/downloadfile.rb
CHANGED
@@ -24,16 +24,17 @@ module Bundler
|
|
24
24
|
attr_reader :file, :file_content, :gem_path, :keep_existing
|
25
25
|
|
26
26
|
HELP = <<~MULTI_LINE_STRING
|
27
|
-
|
28
|
-
|
29
|
-
bundle download
|
30
|
-
bundle download
|
31
|
-
bundle download
|
32
|
-
bundle download
|
33
|
-
bundle download
|
34
|
-
bundle download
|
35
|
-
bundle download
|
36
|
-
bundle download
|
27
|
+
Commands/Subcommands/Options:
|
28
|
+
bundle download help # Provide help by printing usage instructions
|
29
|
+
bundle download usage # (alias for help)
|
30
|
+
bundle download start # Start downloads for current operating system
|
31
|
+
bundle download # (alias for start)
|
32
|
+
bundle download --all-operating-systems # Download files for all operating systems
|
33
|
+
bundle download --keep-existing # Do not redownload already downloaded files
|
34
|
+
bundle download clear # Clear downloads by deleting them under all gems
|
35
|
+
bundle download clean # (alias for clear)
|
36
|
+
bundle download list # List downloads by printing Downloadfile content for all gems
|
37
|
+
bundle download show # Show downloaded files for all gems
|
37
38
|
MULTI_LINE_STRING
|
38
39
|
|
39
40
|
SUPPORTED_OPERATING_SYSTEMS = %w[mac windows linux]
|
@@ -90,10 +91,28 @@ module Bundler
|
|
90
91
|
|
91
92
|
def show
|
92
93
|
puts "Showing downloaded files for #{file}"
|
94
|
+
puts '- - -'
|
95
|
+
missing_downloads = false
|
96
|
+
missing_downloads_for_current_platform_os = false
|
93
97
|
@downloads.each do |download|
|
94
|
-
|
95
|
-
|
98
|
+
download_file_entry = download.file_path
|
99
|
+
if File.exist?(download_file_entry)
|
100
|
+
puts "Downloaded: #{File.size(download_file_entry)} #{download_file_entry}"
|
101
|
+
else
|
102
|
+
missing_downloads = true
|
103
|
+
missing_downloads_for_current_platform_os = true if download.os == PLATFORM_OS
|
104
|
+
puts "Not downloaded: #{download_file_entry}"
|
105
|
+
end
|
96
106
|
end
|
107
|
+
message = ''
|
108
|
+
if missing_downloads_for_current_platform_os
|
109
|
+
message += "Downloads are missing for the current operating system (#{PLATFORM_OS}). \nRun `bundle download` to download missing files for current operating system (#{PLATFORM_OS}).\n"
|
110
|
+
else
|
111
|
+
message += "All downloads are present for current operating system (#{PLATFORM_OS})."
|
112
|
+
message += " Optionally, run `bundle download --all-operating-systems` to download files for all operating systems.\n" if missing_downloads
|
113
|
+
end
|
114
|
+
puts message
|
115
|
+
puts
|
97
116
|
end
|
98
117
|
end
|
99
118
|
end
|
@@ -35,13 +35,27 @@ module Download
|
|
35
35
|
File.delete(file_path) if File.exist?(file_path)
|
36
36
|
end
|
37
37
|
|
38
|
+
def final_uri_and_head_response
|
39
|
+
location = url
|
40
|
+
head_response = nil
|
41
|
+
begin
|
42
|
+
uri = URI(location)
|
43
|
+
options = {}
|
44
|
+
options.merge!(use_ssl: true) if location.start_with?('https:')
|
45
|
+
head_response = Net::HTTP.start(uri.hostname, uri.port, options) do |http|
|
46
|
+
http.head(uri)
|
47
|
+
end
|
48
|
+
location = head_response['location'] if head_response['location']
|
49
|
+
end while head_response.is_a?(Net::HTTPRedirection)
|
50
|
+
[uri, head_response]
|
51
|
+
end
|
52
|
+
|
38
53
|
def start(hash={})
|
39
54
|
set_multi(hash)
|
40
|
-
return puts("Download '#{file_path}'
|
55
|
+
return puts("Download already exists: '#{file_path}' (run `bundle download` to redownload)") if options.keys.include?('--keep_existing') && File.exist?(file_path)
|
41
56
|
|
42
|
-
head_response =
|
43
|
-
|
44
|
-
content_length = head_response.headers["content-length"]
|
57
|
+
uri, head_response = final_uri_and_head_response
|
58
|
+
content_length = head_response["content-length"]
|
45
59
|
puts "Download URL: #{uri.to_s}"
|
46
60
|
puts "Download size: #{content_length}"
|
47
61
|
puts "Download path: #{file_path}"
|
data/lib/bundler-download.rb
CHANGED
@@ -20,9 +20,13 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'bundler'
|
23
|
+
if ENV['BUNDLER_DOWNLOAD_PLUGIN'].to_s.downcase == 'true'
|
24
|
+
require 'bundler/setup'
|
25
|
+
else
|
26
|
+
Bundler.setup(:default)
|
27
|
+
end
|
23
28
|
require 'download'
|
24
29
|
require 'fileutils'
|
25
|
-
require 'httparty'
|
26
30
|
require 'os'
|
27
31
|
require 'tty-progressbar'
|
28
32
|
|
data/plugins.rb
CHANGED
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.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -50,26 +50,6 @@ dependencies:
|
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 2.0.0
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: httparty
|
55
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 0.18.1
|
60
|
-
- - "<"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 2.0.0
|
63
|
-
type: :runtime
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 0.18.1
|
70
|
-
- - "<"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 2.0.0
|
73
53
|
- !ruby/object:Gem::Dependency
|
74
54
|
name: os
|
75
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,19 +105,19 @@ dependencies:
|
|
125
105
|
- !ruby/object:Gem::Version
|
126
106
|
version: 3.5.0
|
127
107
|
- !ruby/object:Gem::Dependency
|
128
|
-
name:
|
108
|
+
name: juwelier
|
129
109
|
requirement: !ruby/object:Gem::Requirement
|
130
110
|
requirements:
|
131
111
|
- - ">="
|
132
112
|
- !ruby/object:Gem::Version
|
133
|
-
version: 2.
|
113
|
+
version: 2.4.9
|
134
114
|
type: :development
|
135
115
|
prerelease: false
|
136
116
|
version_requirements: !ruby/object:Gem::Requirement
|
137
117
|
requirements:
|
138
118
|
- - ">="
|
139
119
|
- !ruby/object:Gem::Version
|
140
|
-
version: 2.
|
120
|
+
version: 2.4.9
|
141
121
|
- !ruby/object:Gem::Dependency
|
142
122
|
name: simplecov
|
143
123
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,10 +201,11 @@ licenses:
|
|
221
201
|
- MIT
|
222
202
|
metadata: {}
|
223
203
|
post_install_message: "*** bundler-download post install message ***\nSome gems have
|
224
|
-
a Downloadfile! Follow the instructions below to download their files. \
|
225
|
-
|
226
|
-
|
227
|
-
|
204
|
+
a Downloadfile! Follow the instructions below to download their files. \nRun `bundle
|
205
|
+
plugin install bundler-download`. \nAfterwards, run `bundle` and extra files are
|
206
|
+
downloaded automatically.\nTo force download of extra files with bundler-download
|
207
|
+
plugin, run `bundle download`\nTo get help with bundler-download plugin, run `bundle
|
208
|
+
download help`\nLearn more at: https://www.rubydoc.info/gems/bundler-download"
|
228
209
|
rdoc_options: []
|
229
210
|
require_paths:
|
230
211
|
- lib
|
@@ -239,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
220
|
- !ruby/object:Gem::Version
|
240
221
|
version: '0'
|
241
222
|
requirements: []
|
242
|
-
rubygems_version: 3.
|
223
|
+
rubygems_version: 3.2.3
|
243
224
|
signing_key:
|
244
225
|
specification_version: 4
|
245
226
|
summary: bundler-download is a Bundler plugin for auto-downloading specified extra
|