bundler-download 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b860161609c4b1d4a34cacf44e61390599afa63a01899f5b496f14987a49abd
4
- data.tar.gz: 358bd951bd8d0c0391f38f6cc2e10c42d26246cc651145d73851099ba0ff94ee
3
+ metadata.gz: d04b4c772b433e696f88a13fbcce416028a19d832f9a8948aa902d05136d9d8d
4
+ data.tar.gz: f9f6e2c44bee77c11161d84729d6f974e98edf3f24e553306b17ebc14a657621
5
5
  SHA512:
6
- metadata.gz: 8d5fef9c7b0fea7e7e056c33aa88adaaa692d384d3a04c1e82dd276e80464d8ea332c4ce0c42a2751e5d62a24ef75d5ec826b467d20a9c0936235c71d747d8ee
7
- data.tar.gz: bfbaa6e691051040bbf71e7a3e94a99d47d6c93737081b1aedb3ce06c58f10b7e66b05d76e717e9eb76f5c68e210563a7c7eb1288332788f2b14c8ac3ab76d73
6
+ metadata.gz: b8e39265e156c16b7cbf9c1c9be4289c870d5ced259e604a1d9d22118d62eb7f10f826d66218037e77cc6461a0f78b2c3b6090a99cff7a4448a7c6314d6511ba
7
+ data.tar.gz: e90f2dea3ac622f036c5c2637c2b2ea1a2d1f139439c852ac41a9db30a5d5f6148b7059df16b7cd87f3ea27912a6546bcc128626f9bf4f1f0607575e893a63e6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.4.0
4
+
5
+ - Support `Downloadfile` at the root of the app (not just gems)
6
+
3
7
  ## 1.3.1
4
8
 
5
9
  - Improve instructions to help ensure correct and successful usage
data/README.md CHANGED
@@ -1,33 +1,37 @@
1
- # bundler-download - Bundler Plugin - v1.3.2
1
+ # bundler-download - Bundler Plugin - v1.4.0
2
2
  [![Gem Version](https://badge.fury.io/rb/bundler-download.svg)](http://badge.fury.io/rb/bundler-download)
3
3
 
4
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
 
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.
8
+ The Ruby Gem 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
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.
10
+ That said, you would not want to package extremely large files, like the OpenAI GPT-3 175 billion parameter models, in a Ruby Gem.
11
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)
12
+ Enter [bundler-download](https://rubygems.org/gems/bundler-download), a Bundler Plugin that enables downloading extra gem files after installing with `bundle` by declaring gem downloads in a [Downloadfile](#downloadfile)
13
13
 
14
14
  ## How It Works
15
15
 
16
- Gems can add a [`Downloadfile`](#downloadfile) at the root to declare the need for extra downloads upon install by Bundler.
16
+ Apps and gems can add a [`Downloadfile`](#downloadfile) at the root to declare the need for extra downloads upon install by Bundler.
17
17
 
18
- 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.
18
+ Apps can then `bundle` in addition to installing the [bundler-download](https://rubygems.org/gems/bundler-download) Bundler plugin as per instructions below. Afterwards, when running `bundle` again, bundle-download will automatically download extra files mentioned in [Downloadfile](#downloadfile), whether it is in the app directly or in a gem dependency.
19
19
 
20
- If a Ruby Gem needs to depend on one of those gems, it can declare as a standard dependency in .gemspec
20
+ If a Ruby Gem needs to depend on gems that have a [Downloadfile](#downloadfile), it can declare dependency in `.gemspec` just as usual.
21
+
22
+ ## App Instructions
23
+
24
+ App must declare a [`Downloadfile`](#downloadfile) at the root `'.'` path and then follow [App Bundler Plugin Instructions](#app-bundler-plugin-instructions)
21
25
 
22
26
  ## Gem Instructions
23
27
 
24
- Add [bundler-download](https://rubygems.org/gems/bundler-download) as a standard .gemspec dependency:
28
+ Add [bundler-download](https://rubygems.org/gems/bundler-download) as a standard `.gemspec` dependency:
25
29
 
26
30
  ```ruby
27
- s.add_dependency('bundler-download', ["~> 1.3"])
31
+ s.add_dependency('bundler-download', ["~> 1.4"])
28
32
  ```
29
33
 
30
- Afterwards, ensure there is a [`Downloadfile`](#downloadfile) at the root directory of the gem, including in .gemspec `files`:
34
+ Afterwards, ensure there is a [`Downloadfile`](#downloadfile) at the root directory of the gem, including in `.gemspec` `files`:
31
35
 
32
36
  ```ruby
33
37
  s.files = [
@@ -43,7 +47,7 @@ Finally, follow one of two options for having applications obtain downloads:
43
47
 
44
48
  ### Downloadfile
45
49
 
46
- A gem `Downloadfile` contains `download` links for files that need to be downloaded relative to the gem directory after `bundle install`.
50
+ An app or gem `Downloadfile` contains `download` links for files that need to be downloaded relative to the gem directory after `bundle install`.
47
51
 
48
52
  Downloadfile entries follow this format (keyword args are optional):
49
53
 
@@ -70,7 +74,11 @@ The keyword `download` declares a file to download and takes the following argum
70
74
 
71
75
  In plugin mode, all gems declared in `Gemfile` are inspected for presence of `Downloadfile` regardless of what group they belong to.
72
76
 
73
- An app can depend on a gem that has a `Downloadfile` by including in `Gemfile` and running:
77
+ Additionally, the app `'.'` path is insepected for `Downloadfile` at the root of the app.
78
+
79
+ An app can depend on a gem that has a `Downloadfile` by including in `Gemfile`
80
+
81
+ Whether `Downloadfile` lives in app directly or one of its gems, start by running `bundle` in the app root directory:
74
82
 
75
83
  ```
76
84
  bundle
@@ -104,7 +112,7 @@ Using tty-cursor 0.7.1
104
112
  Using tty-screen 0.8.1
105
113
  Using unicode-display_width 1.7.0
106
114
  Using tty-progressbar 0.17.0
107
- Using bundler-download 1.3.2
115
+ Using bundler-download 1.4.0
108
116
  Using facets 3.1.0
109
117
  Using glimmer 1.0.0
110
118
  bundle-download plugin gem-after-install-all hook:
@@ -167,7 +175,7 @@ bundle download help
167
175
  Prints:
168
176
 
169
177
  ```
170
- == bundler-download - Bundler Plugin - v1.3.2 ==
178
+ == bundler-download - Bundler Plugin - v1.4.0 ==
171
179
 
172
180
  Commands/Subcommands/Options:
173
181
  bundle download help # Provide help by printing usage instructions
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
1
+ 1.4.0
@@ -2,11 +2,11 @@
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.3.2 ruby lib
5
+ # stub: bundler-download 1.4.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bundler-download".freeze
9
- s.version = "1.3.2"
9
+ s.version = "1.4.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]
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -27,20 +27,26 @@ 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
31
  loaded_gems = Gem.loaded_specs.keys
32
32
  downloadfiles = downloadfiles.select {|df| loaded_gems.detect {|gem| File.basename(File.dirname(df)).include?(gem)} }
33
+ downloadfiles << 'Downloadfile' if File.exist?('Downloadfile')
33
34
  puts 'No gems were found with Downloadfile.' if downloadfiles.empty?
35
+ help_requested = subcommand == 'help' || subcommand == 'usage'
36
+ help_shown = false
34
37
  downloadfiles.each do |downloadfile|
35
38
  bundler_downloadfile = Bundler::Downloadfile.new(
36
- downloadfile,
37
- gem_path: File.dirname(downloadfile),
39
+ downloadfile,
40
+ gem_path: File.dirname(downloadfile),
38
41
  keep_existing: args.include?('--keep-existing'),
39
42
  all_operating_systems: args.include?('--all-operating-systems'),
40
43
  )
41
- puts "== bundler-download - Bundler Plugin - v#{File.read(File.expand_path('../../../VERSION', __FILE__)).strip} =="
42
- puts
43
- bundler_downloadfile.send(subcommand)
44
+ if !help_requested || !help_shown
45
+ puts "== bundler-download - Bundler Plugin - v#{File.read(File.expand_path('../../../VERSION', __FILE__)).strip} =="
46
+ puts
47
+ bundler_downloadfile.send(subcommand)
48
+ end
49
+ help_shown = true if help_requested
44
50
  end
45
51
  true
46
52
  rescue => e
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -20,7 +20,7 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  module Bundler
23
- class Downloadfile
23
+ class Downloadfile
24
24
  attr_reader :file, :file_content, :gem_path, :keep_existing
25
25
 
26
26
  HELP = <<~MULTI_LINE_STRING
@@ -31,13 +31,13 @@ module Bundler
31
31
  bundle download # (alias for start)
32
32
  bundle download --all-operating-systems # Download files for all operating systems
33
33
  bundle download --keep-existing # Do not redownload already downloaded files
34
- bundle download clear # Clear downloads by deleting them under all gems
34
+ bundle download clear # Clear downloads by deleting them under app/gems
35
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
36
+ bundle download list # List downloads by printing Downloadfile content for app/gems
37
+ bundle download show # Show downloaded files for app/gems
38
38
  MULTI_LINE_STRING
39
39
 
40
- SUPPORTED_OPERATING_SYSTEMS = %w[mac windows linux]
40
+ SUPPORTED_OPERATING_SYSTEMS = %w[mac windows linux]
41
41
  PLATFORM_OS = SUPPORTED_OPERATING_SYSTEMS.detect {|os| OS.send("#{os}?")}
42
42
  SUBCOMMANDS = %w[start clear clean help usage list show]
43
43
 
@@ -105,7 +105,7 @@ module Bundler
105
105
  end
106
106
  end
107
107
  message = ''
108
- if missing_downloads_for_current_platform_os
108
+ if missing_downloads_for_current_platform_os
109
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
110
  else
111
111
  message += "All downloads are present for current operating system (#{PLATFORM_OS})."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-download
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh