bundler-download 1.2.0 → 1.3.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 +6 -0
- data/README.md +28 -14
- data/VERSION +1 -1
- data/bundler-download.gemspec +3 -3
- data/lib/bundler-download.rb +5 -1
- data/lib/bundler-download/ext/download.rb +1 -1
- data/lib/bundler/download.rb +2 -0
- data/lib/bundler/downloadfile.rb +31 -12
- data/plugins.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81182c9e860fd1087e7d5b278eb75f7e6acc13c82051e2b606e606e76b18f101
|
4
|
+
data.tar.gz: bdcfd5aff08ff0317c28eecf9afc683c23194d42450e03d36a1aa30aa08b31d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16ebcc18c32c5575242c21981e1cff66b8936e3c827f69e11780527cb87bbfdb6e27928cd70463c79bc8171f4cfe91303b0969db36a1665cf599c5182aa7e839
|
7
|
+
data.tar.gz: b0ff1aa52182581bf77c089862f4daaf55cc4d98da7cc34b97ddb6f4cb303afdd857663e3b97fbef075e852995eb5ed587ee2ee545c21624b4393404bf683ec9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.3.0
|
4
|
+
|
5
|
+
- Setup Bundler default group only when using as an API to avoid loading :development/:test group gems into a production app
|
6
|
+
- Announce that download files are missing for `bundler download show` when a Downloadfile exists but downloads have not been made
|
7
|
+
- Document options (e.g. --keep-existing and --all-operating-systems) in `bundle download help`
|
8
|
+
|
3
9
|
## 1.2.0
|
4
10
|
|
5
11
|
- Get rid of httparty
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# bundler-download - Bundler Plugin
|
1
|
+
# bundler-download - Bundler Plugin - v1.3.0
|
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
5
|
|
6
6
|
## Background
|
7
7
|
|
@@ -24,7 +24,7 @@ If a Ruby Gem needs to depend on one of those gems, it can declare as a standard
|
|
24
24
|
Add [bundler-download](https://rubygems.org/gems/bundler-download) as a standard .gemspec dependency:
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
s.add_dependency('bundler-download', ["
|
27
|
+
s.add_dependency('bundler-download', ["~> 1.3"])
|
28
28
|
```
|
29
29
|
|
30
30
|
Afterwards, ensure there is a [`Downloadfile`](#downloadfile) at the root directory of the gem, including in .gemspec `files`:
|
@@ -68,6 +68,8 @@ The keyword `download` declares a file to download and takes the following argum
|
|
68
68
|
|
69
69
|
## App Bundler Plugin Instructions
|
70
70
|
|
71
|
+
In plugin mode, all gems declared in Gemfile are inspected for presence of Downloadfile regardless of what group they belong to.
|
72
|
+
|
71
73
|
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:
|
72
74
|
|
73
75
|
```
|
@@ -100,7 +102,7 @@ Using tty-cursor 0.7.1
|
|
100
102
|
Using tty-screen 0.8.1
|
101
103
|
Using unicode-display_width 1.7.0
|
102
104
|
Using tty-progressbar 0.17.0
|
103
|
-
Using bundler-download 1.
|
105
|
+
Using bundler-download 1.3.0
|
104
106
|
Using facets 3.1.0
|
105
107
|
Using glimmer 1.0.0
|
106
108
|
bundle-download plugin gem-after-install-all hook:
|
@@ -163,16 +165,19 @@ bundle download help
|
|
163
165
|
Prints:
|
164
166
|
|
165
167
|
```
|
166
|
-
== bundler-download - Bundler Plugin - v1.
|
167
|
-
|
168
|
-
|
169
|
-
bundle download
|
170
|
-
bundle download
|
171
|
-
bundle download
|
172
|
-
bundle download
|
173
|
-
bundle download
|
174
|
-
bundle download
|
175
|
-
bundle download
|
168
|
+
== bundler-download - Bundler Plugin - v1.3.0 ==
|
169
|
+
|
170
|
+
Commands/Subcommands/Options:
|
171
|
+
bundle download help # Provide help by printing usage instructions
|
172
|
+
bundle download usage # (alias for help)
|
173
|
+
bundle download start # Start downloads for current operating system
|
174
|
+
bundle download # (alias for start)
|
175
|
+
bundle download --all-operating-systems # Download files for all operating systems
|
176
|
+
bundle download --keep-existing # Do not redownload already downloaded files
|
177
|
+
bundle download clear # Clear downloads by deleting them under all gems
|
178
|
+
bundle download clean # (alias for clear)
|
179
|
+
bundle download list # List downloads by printing Downloadfile content for all gems
|
180
|
+
bundle download show # Show downloaded files for all gems
|
176
181
|
```
|
177
182
|
|
178
183
|
##### clear (alias: clean)
|
@@ -226,6 +231,8 @@ Showing downloaded files for /Users/User/.rvm/gems/ruby-2.7.1@bundler-download/g
|
|
226
231
|
|
227
232
|
### API
|
228
233
|
|
234
|
+
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)`)
|
235
|
+
|
229
236
|
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.
|
230
237
|
This can be useful when wanting to trigger downloads only on first use while staying transparent should the gem features not be used.
|
231
238
|
|
@@ -236,6 +243,13 @@ require 'bundler-download'
|
|
236
243
|
Bundler::Download.new.exec('download', [])
|
237
244
|
```
|
238
245
|
|
246
|
+
You can also use the `--keep-existing` option to avoid redownload if files were there already:
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
require 'bundler-download'
|
250
|
+
Bundler::Download.new.exec('download', ['--keep-existing'])
|
251
|
+
```
|
252
|
+
|
239
253
|
## Contributing to bundler-download
|
240
254
|
|
241
255
|
* 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.0
|
data/bundler-download.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
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.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.3.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-
|
14
|
+
s.date = "2020-09-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]
|
data/lib/bundler-download.rb
CHANGED
@@ -20,7 +20,11 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'bundler'
|
23
|
-
|
23
|
+
if ENV['BUNDLER_DOWNLOAD_PLUGIN'].to_s.downcase == 'true'
|
24
|
+
require 'bundler/setup'
|
25
|
+
else
|
26
|
+
Bundler.setup(:default)
|
27
|
+
end
|
24
28
|
require 'download'
|
25
29
|
require 'fileutils'
|
26
30
|
require 'os'
|
@@ -52,7 +52,7 @@ module Download
|
|
52
52
|
|
53
53
|
def start(hash={})
|
54
54
|
set_multi(hash)
|
55
|
-
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)
|
56
56
|
|
57
57
|
uri, head_response = final_uri_and_head_response
|
58
58
|
content_length = head_response["content-length"]
|
data/lib/bundler/download.rb
CHANGED
@@ -38,6 +38,8 @@ module Bundler
|
|
38
38
|
keep_existing: args.include?('--keep-existing'),
|
39
39
|
all_operating_systems: args.include?('--all-operating-systems'),
|
40
40
|
)
|
41
|
+
puts "== bundler-download - Bundler Plugin - v#{File.read(File.expand_path('../../../VERSION', __FILE__)).strip} =="
|
42
|
+
puts
|
41
43
|
bundler_downloadfile.send(subcommand)
|
42
44
|
end
|
43
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
|
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.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-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|