precompiled_gems 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: 3420dc4d69bb5f6f532f4914022143f8e46f29e271c4c550ed5bfd485c8c28f4
4
+ data.tar.gz: 87e92466b521adc3c5a386f260f7e0077b8c7ff78647583436fd0700404fc746
5
+ SHA512:
6
+ metadata.gz: 83d92dcbedd07d8558f3914164959310b02e6dcdecefdc8bc7674a63c73fed890b2bf18a4643bbdf13cc04f7d550dd005e672330c0dbdbfda969530ff69200a5
7
+ data.tar.gz: fb40b5fe23c4df03e2c957c156912c5364afcb5b1d889afc3294a19fffb35ab672ba7d55d7231f6165e9a411f9070aa5df93cf673c96b22f3e2fdb4d3c644d16
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "precompiled_gems" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["chin.edouard@gmail.com"](mailto:"chin.edouard@gmail.com").
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Edouard CHIN
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler"
4
+
5
+ module PrecompiledGems
6
+ module DslPatch
7
+ def precompiled_gems!
8
+ PrecompiledGems.enabled = true
9
+ end
10
+
11
+ def gem(name, *args)
12
+ super(PrecompiledGems.takeover(name), *args)
13
+ end
14
+ end
15
+
16
+ module CompactIndexClientPatch
17
+ def info(name)
18
+ super(PrecompiledGems.takeover(name))
19
+ end
20
+ end
21
+
22
+ module EndpointSpecificationPatch
23
+ def build_dependency(name, *args)
24
+ super(PrecompiledGems.takeover(name), *args)
25
+ end
26
+ end
27
+
28
+ module SharedHelpersPatch
29
+ def ensure_same_dependencies(*)
30
+ # No-op. Will figure this out later.
31
+ end
32
+ end
33
+
34
+ module KernelGemPatch
35
+ def gem(name, *args)
36
+ super(PrecompiledGems.takeover(name), *args)
37
+ end
38
+ end
39
+ end
40
+
41
+ Bundler::Dsl.prepend(PrecompiledGems::DslPatch)
42
+ Bundler::CompactIndexClient.prepend(PrecompiledGems::CompactIndexClientPatch)
43
+ Bundler::EndpointSpecification.prepend(PrecompiledGems::EndpointSpecificationPatch)
44
+ Bundler::SharedHelpers.singleton_class.prepend(PrecompiledGems::SharedHelpersPatch)
45
+ Kernel.prepend(PrecompiledGems::KernelGemPatch)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrecompiledGems
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "precompiled_gems/version"
4
+ require_relative "precompiled_gems/patches"
5
+
6
+ module PrecompiledGems
7
+ extend self
8
+
9
+ attr_accessor :enabled
10
+ self.enabled = false
11
+
12
+ def takeover(original_gem)
13
+ return original_gem unless enabled
14
+
15
+ return list.fetch(original_gem, original_gem)
16
+ end
17
+
18
+ def list
19
+ {
20
+ "bigdecimal" => "ed-precompiled_bigdecimal",
21
+ "websocket-driver" => "ed3-precompiled_websocket-driver",
22
+ "prism" => "ed-precompiled_prism",
23
+ "nio4r" => "ed-precompiled_nio4r",
24
+ "erb" => "ed-precompiled_erb",
25
+ "racc" => "ed-precompiled_racc",
26
+ "date" => "ed-precompiled_date",
27
+ "stringio" => "ed-precompiled_stringio",
28
+ "json" => "ed-precompiled_json",
29
+ "io-console" => "ed-precompiled_io-console",
30
+ "bootsnap" => "ed-precompiled_bootsnap",
31
+ "puma" => "ed2-precompiled_puma",
32
+ "bindex" => "ed-precompiled_bindex",
33
+ "msgpack" => "ed-precompiled_msgpack",
34
+ "debug" => "ed2-precompiled_debug",
35
+ "bcrypt_pbkdf" => "ed-precompiled_bcrypt_pbkdf",
36
+ "ed25519" => "ed-precompiled_ed25519",
37
+ }
38
+ end
39
+ end
data/plugins.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/precompiled_gems"
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/precompiled_gems/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "precompiled_gems"
7
+ spec.version = PrecompiledGems::VERSION
8
+ spec.authors = ["Shopify"]
9
+ spec.email = ["rails@shopify.com"]
10
+
11
+ spec.summary = "Speed up Bundler by installing popular gems with precompiled binaries"
12
+ spec.description = <<~MSG
13
+ A bundler plugin that hijacks the resolution to use gems with precompiled binaries instead
14
+ of their original one.
15
+
16
+ For example, adding `gem 'bigdecimal'` in your Gemfile, will instead download a different
17
+ gem that is exactly similar to the bigdecimal one but without having to compile it during
18
+ install.
19
+
20
+ This project is experimental, use at your own risk
21
+ MSG
22
+ spec.homepage = "https://github.com/shopify/precompiled_gems"
23
+ spec.license = "MIT"
24
+ spec.required_ruby_version = ">= 3.2.0", "< 4"
25
+
26
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
27
+ spec.metadata["homepage_uri"] = spec.homepage
28
+ spec.metadata["source_code_uri"] = "https://github.com/shopify/precompiled_gems"
29
+
30
+ spec.files = ["plugins.rb", "LICENSE.txt", "CODE_OF_CONDUCT.md", "precompiled_gems.gemspec"] + Dir.glob("lib/**/*")
31
+ spec.bindir = "exe"
32
+ spec.executables = []
33
+ spec.require_paths = ["lib"]
34
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: precompiled_gems
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Shopify
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: |
13
+ A bundler plugin that hijacks the resolution to use gems with precompiled binaries instead
14
+ of their original one.
15
+
16
+ For example, adding `gem 'bigdecimal'` in your Gemfile, will instead download a different
17
+ gem that is exactly similar to the bigdecimal one but without having to compile it during
18
+ install.
19
+
20
+ This project is experimental, use at your own risk
21
+ email:
22
+ - rails@shopify.com
23
+ executables: []
24
+ extensions: []
25
+ extra_rdoc_files: []
26
+ files:
27
+ - CODE_OF_CONDUCT.md
28
+ - LICENSE.txt
29
+ - lib/precompiled_gems.rb
30
+ - lib/precompiled_gems/patches.rb
31
+ - lib/precompiled_gems/version.rb
32
+ - plugins.rb
33
+ - precompiled_gems.gemspec
34
+ homepage: https://github.com/shopify/precompiled_gems
35
+ licenses:
36
+ - MIT
37
+ metadata:
38
+ allowed_push_host: https://rubygems.org
39
+ homepage_uri: https://github.com/shopify/precompiled_gems
40
+ source_code_uri: https://github.com/shopify/precompiled_gems
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 3.2.0
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '4'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubygems_version: 3.6.9
59
+ specification_version: 4
60
+ summary: Speed up Bundler by installing popular gems with precompiled binaries
61
+ test_files: []