From 777db9fdc8bf1e69a35807276c2d6b2b6c469a77 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Sun, 20 Sep 2020 17:27:13 +0530 Subject: [PATCH 1/2] Add rubocop-packaging & activate its cops Signed-off-by: Utkarsh Gupta --- .rubocop.yml | 18 ++++++++++++++++++ Gemfile | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..1703cf54 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,18 @@ +require: + - rubocop-packaging + +AllCops: + TargetRubyVersion: 2.5 + DisabledByDefault: true + +Packaging/BundlerSetupInTests: + Enabled: true + +Packaging/GemspecGit: + Enabled: true + +Packaging/RequireHardcodingLib: + Enabled: true + +Packaging/RequireRelativeHardcodingLib: + Enabled: true diff --git a/Gemfile b/Gemfile index 9aaa1739..9935712d 100644 --- a/Gemfile +++ b/Gemfile @@ -18,5 +18,9 @@ else gem 'nokogiri', '~> 1.6.0' end +if RUBY_VERSION >= '2.4' + gem 'rubocop-packaging', '~> 0.5' +end + # Specify your gem's dependencies in jquery-rails.gemspec gemspec From dbe65e7589aadaf3061ef53eb4a70938310f98e6 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Sun, 20 Sep 2020 17:32:02 +0530 Subject: [PATCH 2/2] Drop `git ls-files` in gemspec And also fix other Packaging offenses. Signed-off-by: Utkarsh Gupta --- jquery-rails.gemspec | 3 +-- test/assert_select_jquery_test.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/jquery-rails.gemspec b/jquery-rails.gemspec index 3e7ed276..f1e20a3b 100644 --- a/jquery-rails.gemspec +++ b/jquery-rails.gemspec @@ -20,7 +20,6 @@ Gem::Specification.new do |s| s.add_dependency "rails-dom-testing", ">= 1", "< 3" - s.files = `git ls-files`.split("\n") - s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } + s.files = Dir["{lib,vendor}/**/*", "CHANGELOG.md", "MIT-LICENSE", "README.md", "VERSIONS.md"] s.require_path = 'lib' end diff --git a/test/assert_select_jquery_test.rb b/test/assert_select_jquery_test.rb index 632b0c2d..be1c90ea 100644 --- a/test/assert_select_jquery_test.rb +++ b/test/assert_select_jquery_test.rb @@ -1,6 +1,6 @@ require 'ostruct' +require 'jquery/assert_select' require_relative 'test_helper' -require_relative '../lib/jquery/assert_select' class AssertSelectJQueryTest < ActiveSupport::TestCase include Rails::Dom::Testing::Assertions::SelectorAssertions