bundle_filter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 412499166f103f8273e09aed2e8d1c238ad71a9dd4e3184f3b299d0a236dee5f
4
+ data.tar.gz: f0e44c5a8e4422726b2eaf4cb8fe251d0b7ab2371a0cfc4891185aeb696f9da5
5
+ SHA512:
6
+ metadata.gz: 5de48543cd8c0835588ad897bc2d8cc326eac833915b450e6bc275a433631efb1cf460789c1b1ba258c778146ccb5fa0060b08b804a9e7c481ac4545b5942b9a
7
+ data.tar.gz: 0f58a9e494a9fbff59f2cad25ee4395b500cdf1e6cc19a8c9aa4475e1fe62068af75704c90184816664fcb80a1859f578ba2cfea1aec7d2ff92083478fbf95ee
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Diogo Fernandes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # BundleFilter
2
+
3
+ A filter for bundle that removes useless info when run bundle
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ plugin 'bundle_filter'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ After install, every time you execute:
16
+
17
+ $ bundle install
18
+
19
+ this plugin will remove useless info from bundle install like unchanged gems "Using gem x.y.z"
20
+
21
+ ## To-do
22
+
23
+ New features that can be interesting to add
24
+ - Set config file to give freedom to user select which show up
25
+ - Remove or simplify "Complete" final mensage
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dfop02/bundle_filter.
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,14 @@
1
+ class Bundler::CLI
2
+ def install
3
+ SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
4
+
5
+ %w[clean deployment frozen no-cache no-prune path shebang system without with].each do |option|
6
+ remembered_flag_deprecation(option)
7
+ end
8
+
9
+ require_relative "install"
10
+ Bundler.settings.temporary(no_install: false) do
11
+ Install.new(options.dup).run
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ module BundleFilter
2
+ class Configuration
3
+ PRETTY = true
4
+ STYLE = 'boxes'
5
+
6
+ class << self
7
+ def pretty
8
+ PRETTY
9
+ end
10
+
11
+ def style
12
+ STYLE
13
+ end
14
+
15
+ def default_style?
16
+ STYLE == 'default'
17
+ end
18
+
19
+ def boxes_style?
20
+ STYLE == 'boxes'
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ class Bundler::Source::Git
2
+ def install(spec, options = {})
3
+ force = options[:force]
4
+
5
+ print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}" unless BundleFilter::Configuration.pretty
6
+
7
+ if (requires_checkout? && !@copied) || force
8
+ Bundler.ui.debug " * Checking out revision: #{ref}"
9
+ git_proxy.copy_to(install_path, submodules)
10
+ serialize_gemspecs_in(install_path)
11
+ @copied = true
12
+ end
13
+
14
+ generate_bin_options = { :disable_extensions => !Bundler.rubygems.spec_missing_extensions?(spec), :build_args => options[:build_args] }
15
+ generate_bin(spec, generate_bin_options)
16
+
17
+ requires_checkout? ? spec.post_install_message : nil
18
+ end
19
+ end
@@ -0,0 +1,96 @@
1
+ class Bundler::CLI::Install
2
+ def run
3
+ Bundler.ui.level = "warn" if options[:quiet]
4
+
5
+ warn_if_root
6
+
7
+ Bundler.self_manager.install_locked_bundler_and_restart_with_it_if_needed
8
+
9
+ Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Bundler::FREEBSD
10
+
11
+ # Disable color in deployment mode
12
+ Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
13
+
14
+ check_for_options_conflicts
15
+
16
+ check_trust_policy
17
+
18
+ if options[:deployment] || options[:frozen] || Bundler.frozen_bundle?
19
+ unless Bundler.default_lockfile.exist?
20
+ flag = "--deployment flag" if options[:deployment]
21
+ flag ||= "--frozen flag" if options[:frozen]
22
+ flag ||= "deployment setting"
23
+ raise ProductionError, "The #{flag} requires a #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}. Please make " \
24
+ "sure you have checked your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} into version control " \
25
+ "before deploying."
26
+ end
27
+
28
+ options[:local] = true if Bundler.app_cache.exist?
29
+
30
+ Bundler.settings.set_command_option :deployment, true if options[:deployment]
31
+ Bundler.settings.set_command_option :frozen, true if options[:frozen]
32
+ end
33
+
34
+ # When install is called with --no-deployment, disable deployment mode
35
+ if options[:deployment] == false
36
+ Bundler.settings.set_command_option :frozen, nil
37
+ options[:system] = true
38
+ end
39
+
40
+ normalize_settings
41
+
42
+ Bundler::Fetcher.disable_endpoint = options["full-index"]
43
+
44
+ if options["binstubs"]
45
+ Bundler::SharedHelpers.major_deprecation 2,
46
+ "The --binstubs option will be removed in favor of `bundle binstubs --all`"
47
+ end
48
+
49
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
50
+
51
+ definition = Bundler.definition
52
+ definition.validate_runtime!
53
+
54
+ installer = Installer.install(Bundler.root, definition, options)
55
+
56
+ Bundler.settings.temporary(cache_all_platforms: options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
57
+ Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
58
+ end
59
+
60
+ complete_msg = "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
61
+
62
+ puts BundleFilter::Configuration.style
63
+ if BundleFilter::Configuration.default_style?
64
+ Bundler.ui.confirm complete_msg
65
+ elsif BundleFilter::Configuration.boxes_style?
66
+ box_style = ("-" * complete_msg.length).insert(0, '|').insert(-1, '|')
67
+ Bundler.ui.confirm box_style
68
+ Bundler.ui.confirm complete_msg.insert(0, '|').insert(-1, '|')
69
+ Bundler.ui.confirm box_style
70
+ end
71
+
72
+ Bundler::CLI::Common.output_without_groups_message(:install)
73
+
74
+ # disable final message
75
+ # if Bundler.use_system_gems?
76
+ # Bundler.ui.confirm "Use `bundle info [gemname]` to see where a bundled gem is installed."
77
+ # else
78
+ # relative_path = Bundler.configured_bundle_path.base_path_relative_to_pwd
79
+ # Bundler.ui.confirm "Bundled gems are installed into `#{relative_path}`"
80
+ # end
81
+
82
+ Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
83
+
84
+ warn_ambiguous_gems
85
+
86
+ if CLI::Common.clean_after_install?
87
+ require_relative "clean"
88
+ Bundler::CLI::Clean.new(options).run
89
+ end
90
+
91
+ Bundler::CLI::Common.output_fund_metadata_summary
92
+ rescue Gem::InvalidSpecificationException
93
+ Bundler.ui.warn "You have one or more invalid gemspecs that need to be fixed."
94
+ raise
95
+ end
96
+ end
@@ -0,0 +1,6 @@
1
+ class Bundler::Source::Metadata
2
+ def install(spec, _opts = {})
3
+ print_using_message "Using #{version_message(spec)}" unless BundleFilter::Configuration.pretty
4
+ nil
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ class Bundler::Source::Path
2
+ def install(spec, options = {})
3
+ using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}"
4
+ using_message += " and installing its executables" unless spec.executables.empty?
5
+ print_using_message using_message unless BundleFilter::Configuration.pretty
6
+ generate_bin(spec, :disable_extensions => true)
7
+ nil # no post-install message
8
+ end
9
+ end
@@ -0,0 +1,72 @@
1
+ class Bundler::Source::Rubygems
2
+ def install(spec, options = {})
3
+ force = options[:force]
4
+ ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
5
+
6
+ if ensure_builtin_gems_cached && spec.default_gem? && !cached_path(spec)
7
+ cached_built_in_gem(spec) unless spec.remote
8
+ force = true
9
+ end
10
+
11
+ if installed?(spec) && !force
12
+ # Hide message when gem already installed and not changed
13
+ print_using_message "Using #{version_message(spec, options[:previous_spec])}" unless BundleFilter::Configuration.pretty
14
+ return nil # no post-install message
15
+ end
16
+
17
+ if spec.remote
18
+ # Check for this spec from other sources
19
+ uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq
20
+ Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
21
+ end
22
+
23
+ path = fetch_gem_if_possible(spec, options[:previous_spec])
24
+ raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
25
+
26
+ return if Bundler.settings[:no_install]
27
+
28
+ install_path = rubygems_dir
29
+ bin_path = Bundler.system_bindir
30
+
31
+ require_relative "../rubygems_gem_installer"
32
+
33
+ installer = Bundler::RubyGemsGemInstaller.at(
34
+ path,
35
+ :security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
36
+ :install_dir => install_path.to_s,
37
+ :bin_dir => bin_path.to_s,
38
+ :ignore_dependencies => true,
39
+ :wrappers => true,
40
+ :env_shebang => true,
41
+ :build_args => options[:build_args],
42
+ :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
43
+ :bundler_extension_cache_path => extension_cache_path(spec)
44
+ )
45
+
46
+ if spec.remote
47
+ s = begin
48
+ installer.spec
49
+ rescue Gem::Package::FormatError
50
+ Bundler.rm_rf(path)
51
+ raise
52
+ rescue Gem::Security::Exception => e
53
+ raise SecurityError,
54
+ "The gem #{File.basename(path, ".gem")} can't be installed because " \
55
+ "the security policy didn't allow it, with the message: #{e.message}"
56
+ end
57
+
58
+ spec.__swap__(s)
59
+ end
60
+
61
+ message = "Installing #{version_message(spec, options[:previous_spec])}"
62
+ message += " with native extensions" if spec.extensions.any?
63
+ Bundler.ui.confirm message
64
+
65
+ installed_spec = installer.install
66
+
67
+ spec.full_gem_path = installed_spec.full_gem_path
68
+ spec.loaded_from = installed_spec.loaded_from
69
+
70
+ spec.post_install_message
71
+ end
72
+ end
@@ -0,0 +1,9 @@
1
+ class Bundler::Source
2
+ def print_using_message(message)
3
+ if !message.include?("(was ") && Bundler.feature_flag.suppress_install_using_messages?
4
+ Bundler.ui.debug message
5
+ else
6
+ Bundler.ui.info message
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module BundleFilter
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'bundler'
2
+ require 'bundle_filter/configuration'
3
+ require 'bundle_filter/cli'
4
+ require 'bundle_filter/source'
5
+ require 'bundle_filter/rubygems'
6
+ require 'bundle_filter/metadata'
7
+ require 'bundle_filter/git'
8
+ require 'bundle_filter/path'
9
+
10
+ module BundleFilter
11
+ Bundler::Plugin.add_hook('before-install-all') do |dependencies|
12
+ # Hooks just to load plugin and replace files before run installs
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundle_filter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Diogo Fernandes
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A filter for bundle that removes useless info when run bundle.
14
+ email:
15
+ - diogofernandesop@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files:
19
+ - README.md
20
+ - LICENSE
21
+ files:
22
+ - LICENSE
23
+ - README.md
24
+ - lib/bundle_filter.rb
25
+ - lib/bundle_filter/cli.rb
26
+ - lib/bundle_filter/configuration.rb
27
+ - lib/bundle_filter/git.rb
28
+ - lib/bundle_filter/install.rb
29
+ - lib/bundle_filter/metadata.rb
30
+ - lib/bundle_filter/path.rb
31
+ - lib/bundle_filter/rubygems.rb
32
+ - lib/bundle_filter/source.rb
33
+ - lib/bundle_filter/version.rb
34
+ homepage: https://github.com/dfop02/bundle_filter
35
+ licenses:
36
+ - MIT
37
+ metadata:
38
+ allowed_push_host: https://rubygems.org
39
+ bug_tracker_uri: https://github.com/dfop02/bundle_filter/issues
40
+ changelog_uri: https://github.com/dfop02/bundle_filter/blob/0.1.0/Changelog.md
41
+ homepage_uri: https://github.com/dfop02/bundle_filter
42
+ documentation_uri: https://rspec.info/documentation/
43
+ source_code_uri: https://github.com/dfop02/bundle_filter
44
+ post_install_message:
45
+ rdoc_options:
46
+ - "--charset=UTF-8"
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.3.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.1.4
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: Filter bundle install output.
64
+ test_files: []