From 3692cddcd9c1a713a773b1ccc19b419e366b4dd2 Mon Sep 17 00:00:00 2001 From: Michael Herold Date: Sat, 16 Nov 2019 20:18:15 -0600 Subject: Adjust URL in gemspec and add metadata URLs RubyGems.org has recently added the capability to have extra metadata URLs shown on the gem page. These are handy for people who are new to a gem or need to report an issue. --- hashie.gemspec | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hashie.gemspec b/hashie.gemspec index 250ecf2..507f388 100644 --- a/hashie.gemspec +++ b/hashie.gemspec @@ -17,6 +17,15 @@ Gem::Specification.new do |gem| gem.files += Dir['spec/**/*.rb'] gem.test_files = Dir['spec/**/*.rb'] + if gem.respond_to?(:metadata) + gem.metadata = { + 'bug_tracker_uri' => 'https://github.com/hashie/hashie/issues', + 'changelog_uri' => 'https://github.com/hashie/hashie/blob/master/CHANGELOG.md', + 'documentation_uri' => 'https://www.rubydoc.info/gems/hashie', + 'source_code_uri' => 'https://github.com/hashie/hashie' + } + end + gem.add_development_dependency 'rake', '< 11' gem.add_development_dependency 'rspec', '~> 3.0' gem.add_development_dependency 'rspec-pending_for', '~> 0.1' -- cgit v1.2.1 From 565a1ed0de48c2ddca1f2a321e88739049c7922e Mon Sep 17 00:00:00 2001 From: Michael Herold Date: Sat, 16 Nov 2019 20:27:29 -0600 Subject: Exclude tests from the gem release When you're installing a gem in a production environment, you want it to install as fast it can. One of the ways you can speed up the installation of the gem is by making it smaller. We currently ship the test suite with the gem, increasing the size of the built gem significantly. By not shipping the test suite, we can shrink the size of the gem by 38%. Below are the measurements I took for that statement. **The size of the gem with the test suite** $ du -b hashie-4.0.1.gem 80384 hashie-4.0.1.gem **The size of the gem without the test suite** $ du -b hashie-4.0.1.gem 50176 hashie-4.0.1.gem --- CHANGELOG.md | 1 + hashie.gemspec | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1408cb5..259fa31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ scheme are considered to be bugs. ### Miscellaneous +* [#981](https://github.com/hashie/hashie/pull/981): Exclude tests from the gem release to reduce installation size and improve installation speed - [@michaelherold](https://github.com/michaelherold). * Your contribution here. ## [4.0.0] - 2019-10-30 diff --git a/hashie.gemspec b/hashie.gemspec index 507f388..e3c8a8b 100644 --- a/hashie.gemspec +++ b/hashie.gemspec @@ -14,8 +14,6 @@ Gem::Specification.new do |gem| gem.files = %w[.yardopts CHANGELOG.md CONTRIBUTING.md LICENSE README.md UPGRADING.md] gem.files += %w[Rakefile hashie.gemspec] gem.files += Dir['lib/**/*.rb'] - gem.files += Dir['spec/**/*.rb'] - gem.test_files = Dir['spec/**/*.rb'] if gem.respond_to?(:metadata) gem.metadata = { -- cgit v1.2.1 From 729c99b11ad73755840590faee6909c315898a53 Mon Sep 17 00:00:00 2001 From: Michael Herold Date: Sat, 16 Nov 2019 20:37:50 -0600 Subject: Switch to only setting Bundler as a dev dependency Our contributing documentation specifically mentions Bundler so we should set it as a development dependency. --- Gemfile | 27 ++++++++++++++++----------- hashie.gemspec | 4 +--- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 524b968..a254ee7 100644 --- a/Gemfile +++ b/Gemfile @@ -10,20 +10,25 @@ group :development do gem 'pry' gem 'pry-stack_explorer', platforms: %i[ruby_19 ruby_20 ruby_21] gem 'rubocop', '0.52.1' + + group :test do + # ActiveSupport required to test compatibility with ActiveSupport Core Extensions. + # rubocop:disable Bundler/DuplicatedGem + require File.expand_path('../lib/hashie/extensions/ruby_version', __FILE__) + if Hashie::Extensions::RubyVersion.new(RUBY_VERSION) >= + Hashie::Extensions::RubyVersion.new('2.4.0') + gem 'activesupport', '~> 5.x', require: false + else + gem 'activesupport', '~> 4.x', require: false + end + # rubocop:enable Bundler/DuplicatedGem + gem 'rake' + gem 'rspec', '~> 3' + gem 'rspec-pending_for', '~> 0.1' + end end group :test do - # ActiveSupport required to test compatibility with ActiveSupport Core Extensions. - # rubocop:disable Bundler/DuplicatedGem - require File.expand_path('../lib/hashie/extensions/ruby_version', __FILE__) - if Hashie::Extensions::RubyVersion.new(RUBY_VERSION) >= - Hashie::Extensions::RubyVersion.new('2.4.0') - gem 'activesupport', '~> 5.x', require: false - else - gem 'activesupport', '~> 4.x', require: false - end - # rubocop:enable Bundler/DuplicatedGem gem 'codeclimate-test-reporter', '~> 1.0', require: false gem 'danger-changelog', '~> 0.1.0', require: false - gem 'rspec-core', '~> 3.1.7' end diff --git a/hashie.gemspec b/hashie.gemspec index e3c8a8b..dbb438d 100644 --- a/hashie.gemspec +++ b/hashie.gemspec @@ -24,7 +24,5 @@ Gem::Specification.new do |gem| } end - gem.add_development_dependency 'rake', '< 11' - gem.add_development_dependency 'rspec', '~> 3.0' - gem.add_development_dependency 'rspec-pending_for', '~> 0.1' + gem.add_development_dependency 'bundler' end -- cgit v1.2.1 From a193865fde1b4c9548d91b06abea479235fcd556 Mon Sep 17 00:00:00 2001 From: Michael Herold Date: Sat, 16 Nov 2019 20:59:04 -0600 Subject: Improve the setup script We weren't installing the dependencies for the integration tests so the default Rake task was failing upon first run on a new machine. --- CONTRIBUTING.md | 11 +++++++++-- bin/setup | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b96827..7eb5cc0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,12 +23,19 @@ git pull upstream master git checkout -b my-feature-branch ``` -#### Bundle Install and Test +#### Install dependencies + +You can use the setup script to install dependencies for the gem and its integration tests. + +``` +bin/setup +``` + +#### Test Ensure that you can build the project and run tests. ``` -bundle install bundle exec rake ``` diff --git a/bin/setup b/bin/setup index b65ed50..e52c127 100755 --- a/bin/setup +++ b/bin/setup @@ -1,7 +1,12 @@ #!/bin/bash + set -euo pipefail IFS=$'\n\t' bundle install -# Do any other automated setup that you need to do here +for dir in spec/integration/*; do + pushd "$dir" + bundle install + popd +done -- cgit v1.2.1