Skip to content

Commit

Permalink
Reduce production gem size
Browse files Browse the repository at this point in the history
Include only files that are needed for the production gem.

Also avoids to use git to allow to build the package in an environment
that does not have git (on purpose).

### Before

173K

```
.dokaz
.github/PULL_REQUEST_TEMPLATE.md
.github/dependabot.yml
.github/workflows/dependency-review.yml
.github/workflows/main.yml
.gitignore
.rspec
.rubocop.yml
.ruby-version
.yardopts
CHANGELOG.md
CODE_OF_CONDUCT.md
Gemfile
Gemfile.lock
LICENSE.txt
README.md
Rakefile
benchmarks/Gemfile
benchmarks/benchmarks.rb
bin/console
bin/setup
lib/memo_wise.rb
lib/memo_wise/internal_api.rb
lib/memo_wise/version.rb
logo/logo.png
memo_wise.gemspec
```

### After

19K

```
CHANGELOG.md
LICENSE.txt
README.md
lib/memo_wise.rb
lib/memo_wise/internal_api.rb
lib/memo_wise/version.rb
```
  • Loading branch information
tagliala committed Sep 17, 2024
1 parent ea62a71 commit 018b18b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

**Gem enhancements:**

- Reduced production gem size by 9 times [[#345](https://github.com/panorama-ed/memo_wise/pull/345)]

_No breaking changes!_

**Project enhancements:**
Expand Down
8 changes: 1 addition & 7 deletions memo_wise.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added
# into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
end
spec.files = Dir.glob('{CHANGELOG.md,LICENSE.txt,README.md,lib/**/*.rb}')
spec.require_paths = ["lib"]

spec.metadata = {
Expand Down

0 comments on commit 018b18b

Please sign in to comment.