Skip to content

Reduce gem size by excluding test files#606

Open
yuri-zubov wants to merge 1 commit intoRolifyCommunity:masterfrom
yuri-zubov:reduce-gem-size
Open

Reduce gem size by excluding test files#606
yuri-zubov wants to merge 1 commit intoRolifyCommunity:masterfrom
yuri-zubov:reduce-gem-size

Conversation

@yuri-zubov
Copy link

This pull request updates the *.gemspec file to optimize the gem package size and structure

$ gem build -o before.tar

$ git switch reduce-gem-size

$ gem build -o after.tar

$ du -sh before.tar after.tar
40K	before.tar
24K	after.tar
Metric Before After Saved
Size 40K 24K −16K (⏷ −40%)

whitch files was deleted?

data
-├── gemfiles
-│   ├── activerecord_6.gemfile
-│   ├── activerecord_7.gemfile
-│   ├── mongoid_5.gemfile
-│   ├── mongoid_6.gemfile
-│   └── mongoid_7.gemfile
 ├── lib
 │   ├── generators
 │   │   ├── active_record
 │   │   │   ├── templates
 │   │   │   │   ├── migration.rb
 │   │   │   │   ├── model.rb
 │   │   │   │   └── README
 │   │   │   └── rolify_generator.rb
 │   │   ├── mongoid
 │   │   │   ├── templates
 │   │   │   │   └── README-mongoid
 │   │   │   └── rolify_generator.rb
 │   │   └── rolify
 │   │       ├── templates
 │   │       │   ├── initializer.rb
 │   │       │   ├── README
 │   │       │   ├── role-active_record.rb
 │   │       │   └── role-mongoid.rb
 │   │       ├── rolify_generator.rb
 │   │       └── user_generator.rb
 │   ├── rolify
 │   │   ├── adapters
 │   │   │   ├── active_record
 │   │   │   │   ├── resource_adapter.rb
 │   │   │   │   ├── role_adapter.rb
 │   │   │   │   └── scopes.rb
 │   │   │   ├── mongoid
 │   │   │   │   ├── resource_adapter.rb
 │   │   │   │   ├── role_adapter.rb
 │   │   │   │   └── scopes.rb
 │   │   │   └── base.rb
 │   │   ├── configure.rb
 │   │   ├── dynamic.rb
 │   │   ├── finders.rb
 │   │   ├── matchers.rb
 │   │   ├── railtie.rb
 │   │   ├── resource.rb
 │   │   ├── role.rb
 │   │   ├── utils.rb
 │   │   └── version.rb
 │   └── rolify.rb
-├── spec
-│   ├── generators
-│   │   └── rolify
-│   │       ├── rolify_activerecord_generator_spec.rb
-│   │       └── rolify_mongoid_generator_spec.rb
-│   ├── rolify
-│   │   ├── coverage
-│   │   ├── shared_examples
-│   │   │   ├── shared_examples_for_add_role.rb
-│   │   │   ├── shared_examples_for_callbacks.rb
-│   │   │   ├── shared_examples_for_dynamic.rb
-│   │   │   ├── shared_examples_for_finders.rb
-│   │   │   ├── shared_examples_for_has_all_roles.rb
-│   │   │   ├── shared_examples_for_has_any_role.rb
-│   │   │   ├── shared_examples_for_has_role.rb
-│   │   │   ├── shared_examples_for_only_has_role.rb
-│   │   │   ├── shared_examples_for_remove_role.rb
-│   │   │   ├── shared_examples_for_roles.rb
-│   │   │   └── shared_examples_for_scopes.rb
-│   │   ├── config_spec.rb
-│   │   ├── custom_spec.rb
-│   │   ├── matchers_spec.rb
-│   │   ├── namespace_spec.rb
-│   │   ├── resource_spec.rb
-│   │   ├── resourcifed_and_rolifed_spec.rb
-│   │   ├── role_spec.rb
-│   │   ├── shared_contexts.rb
-│   │   └── utils_spec.rb
-│   ├── support
-│   │   ├── adapters
-│   │   │   ├── utils
-│   │   │   │   ├── active_record.rb
-│   │   │   │   └── mongoid.rb
-│   │   │   ├── active_record.rb
-│   │   │   ├── mongoid_5.yml
-│   │   │   ├── mongoid_6.yml
-│   │   │   ├── mongoid_7.yml
-│   │   │   └── mongoid.rb
-│   │   ├── data.rb
-│   │   ├── schema.rb
-│   │   └── stream_helpers.rb
-│   ├── common_helper.rb
-│   ├── generators_helper.rb
-│   ├── README.rdoc
-│   └── spec_helper.rb
-├── Appraisals
-├── CONTRIBUTORS
-├── Gemfile
-├── Rakefile
 ├── CHANGELOG.rdoc
 ├── LICENSE
 ├── README.md
-├── rolify.gemspec
-└── UPGRADE.rdoc

ps: you can see on rails repo

]

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test_files directive is no longer used by RubyGems.org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant