From 41af33a160a92c77beff52e9889dd51b56fac07c Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:04:40 +0100 Subject: [PATCH 01/83] Remove duplicates from .gitignore --- .gitignore | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.gitignore b/.gitignore index 9c779e8..555aadd 100644 --- a/.gitignore +++ b/.gitignore @@ -16,8 +16,3 @@ test/tmp test/version_tmp tmp .ruby-version - -# YARD artifacts -.yardoc -_yardoc -doc/ From e36fca749b57cba5320dabeb09363ed1d3a30c87 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:04:58 +0100 Subject: [PATCH 02/83] Add .idea to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 555aadd..dfd8891 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ test/tmp test/version_tmp tmp .ruby-version +.idea From 65dbbd5b3ea67f302bfd0cc87767e0e5b4861f43 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:06:16 +0100 Subject: [PATCH 03/83] Fix markdown --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d575f0e..605a368 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # ErrbitPlugin [![Build Status](https://travis-ci.org/errbit/errbit_plugin.svg?branch=master)](https://travis-ci.org/errbit/errbit_plugin) + ErrbitPlugin provides a set of base classes that you can extend to create Errbit plugins. ## Creating plugins + ErrbitPlugins are Ruby gems that extend the functionality of Errbit. To get started, create a Ruby gem and add 'errbit_plugin' as a dependency in your gem's gemspec. @@ -11,18 +13,20 @@ Now you can start adding plugins. At the moment, there is only one kind of plugin you can create, and that is the issue tracker. ### Issue Trackers + An issue tracker plugin is a Ruby class that enables you to link errors within errbit to an issue in an external issue tracker like Github. An app within errbit can be associated an issue tracker or not. When there is an association, errbit users can choose 'create issue' from an error page which will both create an issue on the external issue tracker out of the given error and link that issue to the errbit error. Likewise, a user can also choose 'close issue' -to close the issue on the external issue tracker, if your plugin provides a +to close the issue on the external issue tracker, if your plugin provides a method to do so. Your issue tracker plugin is responsible for providing the interface defined by ErrbitPlugin::IssueTracker. All of the required methods must be implemented and the class must extend ErrbitPlugin::IssueTracker. Here's an example: + ```ruby class MyIssueTracker < ErrbitPlugin::IssueTracker @@ -122,8 +126,6 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker end ``` - - ## Contributing Discuss any changes you'd like to make with the authors on the mailing list, or From 1e885e8bf58c8bff1cf4b050eebd41c542a710d8 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:06:36 +0100 Subject: [PATCH 04/83] Github -> GitHub --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 605a368..f3857f5 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ plugin you can create, and that is the issue tracker. ### Issue Trackers An issue tracker plugin is a Ruby class that enables you to link errors within -errbit to an issue in an external issue tracker like Github. An app within +errbit to an issue in an external issue tracker like GitHub. An app within errbit can be associated an issue tracker or not. When there is an association, errbit users can choose 'create issue' from an error page which will both create an issue on the external issue tracker out of the given error and link From 76c5580250d044ebc7be1804d44057853806d0b5 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:06:54 +0100 Subject: [PATCH 05/83] Remove Guardfile --- Guardfile | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 Guardfile diff --git a/Guardfile b/Guardfile deleted file mode 100644 index 3a3ce84..0000000 --- a/Guardfile +++ /dev/null @@ -1,8 +0,0 @@ -# A sample Guardfile -# More info at https://github.com/guard/guard#readme - -guard 'rspec' do - watch(%r{^spec/.+_spec\.rb$}) - watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } - watch('spec/spec_helper.rb') { "spec" } -end From f575792e27f62f08fd6cdf76f1414159942d5a0d Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:07:08 +0100 Subject: [PATCH 06/83] Remove travis config --- .travis.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b41822f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: ruby -env: - - COVERAGE=true -before_install: - - gem install bundler -script: bundle exec rspec spec -rvm: - - 2.1 - - 2.2 - - 2.3.0 - - rbx-2 - - ruby-head -matrix: - allow_failures: - - rvm: ruby-head From 13b5069fe17c365d35fc8013b46a6fe035182b78 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:07:38 +0100 Subject: [PATCH 07/83] Fix homepage in gemspec --- errbit_plugin.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/errbit_plugin.gemspec b/errbit_plugin.gemspec index c1ae05b..b4ea4b9 100644 --- a/errbit_plugin.gemspec +++ b/errbit_plugin.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.email = ["stevecrozz@gmail.com"] spec.description = %q{Base to create an errbit plugin} spec.summary = %q{Base to create an errbit plugin} - spec.homepage = "http://github.com/errbit/errbit" + spec.homepage = "https://github.com/errbit/errbit_plugin" spec.license = "MIT" spec.files = `git ls-files`.split($/) From 941b15ca5f3395bbb7a4b223b3120ed6bf1cfc6b Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:08:40 +0100 Subject: [PATCH 08/83] Add rubocop config --- .rubocop.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..e69de29 From e4565cdd89720554b874b84bf9c8f0dbbb917e5e Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:09:55 +0100 Subject: [PATCH 09/83] Configure rubocop --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index e69de29..8e010a0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -0,0 +1,3 @@ +AllCops: + TargetRubyVersion: 3.1 + NewCops: enable From 8e0c700aec02a1ffd1f83d1a23b8b3f4768e5db0 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:11:08 +0100 Subject: [PATCH 10/83] Rubocop: Style/FrozenStringLiteralComment --- Gemfile | 1 + Rakefile | 1 + errbit_plugin.gemspec | 1 + lib/errbit_plugin.rb | 1 + lib/errbit_plugin/issue_tracker.rb | 1 + lib/errbit_plugin/issue_trackers/none.rb | 1 + lib/errbit_plugin/registry.rb | 1 + lib/errbit_plugin/validate_issue_tracker.rb | 1 + lib/errbit_plugin/version.rb | 1 + spec/errbit_plugin/registry_spec.rb | 1 + spec/errbit_plugin/validate_issue_tracker_spec.rb | 1 + spec/spec_helper.rb | 1 + 12 files changed, 12 insertions(+) diff --git a/Gemfile b/Gemfile index 7eb2841..86dff92 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true source 'https://rubygems.org' # Specify your gem's dependencies in errbit_plugin.gemspec diff --git a/Rakefile b/Rakefile index 2995527..bb28611 100644 --- a/Rakefile +++ b/Rakefile @@ -1 +1,2 @@ +# frozen_string_literal: true require "bundler/gem_tasks" diff --git a/errbit_plugin.gemspec b/errbit_plugin.gemspec index b4ea4b9..cf4a11a 100644 --- a/errbit_plugin.gemspec +++ b/errbit_plugin.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 +# frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'errbit_plugin/version' diff --git a/lib/errbit_plugin.rb b/lib/errbit_plugin.rb index fb7699b..c889550 100644 --- a/lib/errbit_plugin.rb +++ b/lib/errbit_plugin.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "errbit_plugin/version" require "errbit_plugin/registry" require "errbit_plugin/issue_tracker" diff --git a/lib/errbit_plugin/issue_tracker.rb b/lib/errbit_plugin/issue_tracker.rb index 83b5131..e61c8c5 100644 --- a/lib/errbit_plugin/issue_tracker.rb +++ b/lib/errbit_plugin/issue_tracker.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ErrbitPlugin # abstract class for issue trackers class IssueTracker diff --git a/lib/errbit_plugin/issue_trackers/none.rb b/lib/errbit_plugin/issue_trackers/none.rb index 6726ea5..42c9ff2 100644 --- a/lib/errbit_plugin/issue_trackers/none.rb +++ b/lib/errbit_plugin/issue_trackers/none.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ErrbitPlugin class NoneIssueTracker < IssueTracker def self.label; 'none'; end diff --git a/lib/errbit_plugin/registry.rb b/lib/errbit_plugin/registry.rb index 1ab9519..45d6abd 100644 --- a/lib/errbit_plugin/registry.rb +++ b/lib/errbit_plugin/registry.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ErrbitPlugin class IncompatibilityError < StandardError; end class AlreadyRegisteredError < StandardError; end diff --git a/lib/errbit_plugin/validate_issue_tracker.rb b/lib/errbit_plugin/validate_issue_tracker.rb index 246934d..3ea70ea 100644 --- a/lib/errbit_plugin/validate_issue_tracker.rb +++ b/lib/errbit_plugin/validate_issue_tracker.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ErrbitPlugin class ValidateIssueTracker def initialize(klass) diff --git a/lib/errbit_plugin/version.rb b/lib/errbit_plugin/version.rb index 8729aef..1fe8862 100644 --- a/lib/errbit_plugin/version.rb +++ b/lib/errbit_plugin/version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ErrbitPlugin VERSION = '0.6.0' end diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index 982b193..16337b9 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe ErrbitPlugin::Registry do diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 1b73870..75f8c4e 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe ErrbitPlugin::ValidateIssueTracker do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 92338c7..509b4bc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true if ENV['COVERAGE'] require 'simplecov' if ENV['CI'] From cdd68d89d7042090aeaf8acdabe0722b1769d8bf Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:12:32 +0100 Subject: [PATCH 11/83] Rubocop: Layout/EmptyLineAfterMagicComment --- Gemfile | 1 + Rakefile | 1 + errbit_plugin.gemspec | 1 + lib/errbit_plugin.rb | 1 + lib/errbit_plugin/issue_tracker.rb | 1 + lib/errbit_plugin/issue_trackers/none.rb | 1 + lib/errbit_plugin/registry.rb | 1 + lib/errbit_plugin/validate_issue_tracker.rb | 1 + lib/errbit_plugin/version.rb | 1 + spec/errbit_plugin/registry_spec.rb | 1 + spec/errbit_plugin/validate_issue_tracker_spec.rb | 1 + spec/spec_helper.rb | 1 + 12 files changed, 12 insertions(+) diff --git a/Gemfile b/Gemfile index 86dff92..e30f880 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ # frozen_string_literal: true + source 'https://rubygems.org' # Specify your gem's dependencies in errbit_plugin.gemspec diff --git a/Rakefile b/Rakefile index bb28611..5263b58 100644 --- a/Rakefile +++ b/Rakefile @@ -1,2 +1,3 @@ # frozen_string_literal: true + require "bundler/gem_tasks" diff --git a/errbit_plugin.gemspec b/errbit_plugin.gemspec index cf4a11a..775a828 100644 --- a/errbit_plugin.gemspec +++ b/errbit_plugin.gemspec @@ -1,5 +1,6 @@ # coding: utf-8 # frozen_string_literal: true + lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'errbit_plugin/version' diff --git a/lib/errbit_plugin.rb b/lib/errbit_plugin.rb index c889550..4a54ca1 100644 --- a/lib/errbit_plugin.rb +++ b/lib/errbit_plugin.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "errbit_plugin/version" require "errbit_plugin/registry" require "errbit_plugin/issue_tracker" diff --git a/lib/errbit_plugin/issue_tracker.rb b/lib/errbit_plugin/issue_tracker.rb index e61c8c5..aaf9200 100644 --- a/lib/errbit_plugin/issue_tracker.rb +++ b/lib/errbit_plugin/issue_tracker.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module ErrbitPlugin # abstract class for issue trackers class IssueTracker diff --git a/lib/errbit_plugin/issue_trackers/none.rb b/lib/errbit_plugin/issue_trackers/none.rb index 42c9ff2..6bd59a8 100644 --- a/lib/errbit_plugin/issue_trackers/none.rb +++ b/lib/errbit_plugin/issue_trackers/none.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module ErrbitPlugin class NoneIssueTracker < IssueTracker def self.label; 'none'; end diff --git a/lib/errbit_plugin/registry.rb b/lib/errbit_plugin/registry.rb index 45d6abd..35b1b88 100644 --- a/lib/errbit_plugin/registry.rb +++ b/lib/errbit_plugin/registry.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module ErrbitPlugin class IncompatibilityError < StandardError; end class AlreadyRegisteredError < StandardError; end diff --git a/lib/errbit_plugin/validate_issue_tracker.rb b/lib/errbit_plugin/validate_issue_tracker.rb index 3ea70ea..bbb8c58 100644 --- a/lib/errbit_plugin/validate_issue_tracker.rb +++ b/lib/errbit_plugin/validate_issue_tracker.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module ErrbitPlugin class ValidateIssueTracker def initialize(klass) diff --git a/lib/errbit_plugin/version.rb b/lib/errbit_plugin/version.rb index 1fe8862..daad883 100644 --- a/lib/errbit_plugin/version.rb +++ b/lib/errbit_plugin/version.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module ErrbitPlugin VERSION = '0.6.0' end diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index 16337b9..edd44cb 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe ErrbitPlugin::Registry do diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 75f8c4e..1d3e6a3 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe ErrbitPlugin::ValidateIssueTracker do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 509b4bc..3c75cb1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + if ENV['COVERAGE'] require 'simplecov' if ENV['CI'] From 4428d60253ea0578edf0f47e3de23b0e104d5e94 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:13:40 +0100 Subject: [PATCH 12/83] Rubocop: Style/Encoding --- errbit_plugin.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/errbit_plugin.gemspec b/errbit_plugin.gemspec index 775a828..6dba960 100644 --- a/errbit_plugin.gemspec +++ b/errbit_plugin.gemspec @@ -1,4 +1,3 @@ -# coding: utf-8 # frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) From e02583e547ca11949e70e4c040d7f6873f5c2b67 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:17:26 +0100 Subject: [PATCH 13/83] gemspec: add required_ruby_version >= 3.1.0 --- errbit_plugin.gemspec | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/errbit_plugin.gemspec b/errbit_plugin.gemspec index 6dba960..965a982 100644 --- a/errbit_plugin.gemspec +++ b/errbit_plugin.gemspec @@ -5,20 +5,35 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'errbit_plugin/version' Gem::Specification.new do |spec| - spec.name = "errbit_plugin" - spec.version = ErrbitPlugin::VERSION - spec.authors = ["Stephen Crosby"] - spec.email = ["stevecrozz@gmail.com"] - spec.description = %q{Base to create an errbit plugin} - spec.summary = %q{Base to create an errbit plugin} - spec.homepage = "https://github.com/errbit/errbit_plugin" - spec.license = "MIT" + spec.name = "errbit_plugin" + spec.version = ErrbitPlugin::VERSION + spec.authors = ["Stephen Crosby"] + spec.email = ["stevecrozz@gmail.com"] - spec.files = `git ls-files`.split($/) - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.description = %q{Base to create an errbit plugin} + spec.summary = %q{Base to create an errbit plugin} + spec.homepage = "https://github.com/errbit/errbit_plugin" + spec.license = "MIT" + + spec.required_ruby_version = ">= 3.1.0" - spec.add_development_dependency "bundler", "~> 1.3" - spec.add_development_dependency "rake" + spec.metadata["rubygems_mfa_required"] = "true" + spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues" + spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md" + spec.metadata["documentation_uri"] = "#{spec.homepage}/blob/master/README.md" + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = spec.homepage + + # 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. + gemspec = File.basename(__FILE__) + spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls| + ls.readlines("\x0", chomp: true).reject do |f| + (f == gemspec) || + f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile]) + end + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] end From 9350d0463366fd4ae16b8c216d2bb56cd41161c0 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:18:39 +0100 Subject: [PATCH 14/83] Add rake to Gemfile --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index e30f880..eb8a5ea 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ source 'https://rubygems.org' # Specify your gem's dependencies in errbit_plugin.gemspec gemspec +gem 'rake' gem 'rspec' gem 'guard' gem 'guard-rspec' From b1836507ddb4de54ed1a95d62b7a2e207ef9ae7f Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:18:56 +0100 Subject: [PATCH 15/83] Remove .coveralls.yml --- .coveralls.yml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index 901a8ae..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,2 +0,0 @@ -service_name: travis-pro -repo_token: gNB8KeAdYQKNW2YC4uut6Zh2ToBnPyMqB From 95fcb72d219487326c0c844fd763b56e171da53d Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:19:55 +0100 Subject: [PATCH 16/83] Configure rspec --- .rspec | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .rspec diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..34c5164 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper From 461a754ee6c7d9a2e394187a2b676c856984c50c Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:20:19 +0100 Subject: [PATCH 17/83] Add .ruby-version --- .gitignore | 2 +- .ruby-version | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .ruby-version diff --git a/.gitignore b/.gitignore index dfd8891..c390756 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,5 @@ spec/reports test/tmp test/version_tmp tmp -.ruby-version + .idea diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..9cec716 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.1.6 From f7aa8290b1b5049577bfe067650f9ebed4b619d1 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:20:49 +0100 Subject: [PATCH 18/83] Remove guard and guard-rspec gems --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index eb8a5ea..0e39ff2 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,4 @@ gemspec gem 'rake' gem 'rspec' -gem 'guard' -gem 'guard-rspec' gem 'coveralls', :require => false From 75459a358018581850372414053ff3a3d61b4652 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 10:21:34 +0100 Subject: [PATCH 19/83] Add Gemfile.lock --- .gitignore | 1 - Gemfile.lock | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index c390756..dcf7ea1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ .bundle .config .yardoc -Gemfile.lock InstalledFiles _yardoc coverage diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..735d90b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,66 @@ +PATH + remote: . + specs: + errbit_plugin (0.6.0) + +GEM + remote: https://rubygems.org/ + specs: + bigdecimal (3.1.9) + coveralls (0.8.23) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (>= 0.19.4, < 2.0) + tins (~> 1.6) + diff-lcs (1.6.0) + docile (1.4.1) + json (2.10.2) + rake (13.2.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.3) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + sync (0.5.0) + term-ansicolor (1.11.2) + tins (~> 1.0) + thor (1.3.2) + tins (1.38.0) + bigdecimal + sync + +PLATFORMS + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + ruby + x86-linux-gnu + x86-linux-musl + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + coveralls + errbit_plugin! + rake + rspec + +BUNDLED WITH + 2.6.5 From 641eefb2b5674a7a6e258c8c46106e449ebb42e0 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:30:21 +0100 Subject: [PATCH 20/83] Rubocop: Style/StringLiterals --- .rubocop.yml | 5 + Gemfile | 8 +- errbit_plugin.gemspec | 4 +- lib/errbit_plugin/issue_trackers/none.rb | 16 +- lib/errbit_plugin/registry.rb | 2 +- lib/errbit_plugin/version.rb | 2 +- spec/errbit_plugin/registry_spec.rb | 22 +-- .../validate_issue_tracker_spec.rb | 164 +++++++++--------- spec/spec_helper.rb | 12 +- 9 files changed, 120 insertions(+), 115 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 8e010a0..ef6d21f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,8 @@ AllCops: TargetRubyVersion: 3.1 NewCops: enable + +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + ConsistentQuotesInMultiline: false diff --git a/Gemfile b/Gemfile index 0e39ff2..98adfd0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ # frozen_string_literal: true -source 'https://rubygems.org' +source "https://rubygems.org" # Specify your gem's dependencies in errbit_plugin.gemspec gemspec -gem 'rake' -gem 'rspec' -gem 'coveralls', :require => false +gem "rake" +gem "rspec" +gem "coveralls", :require => false diff --git a/errbit_plugin.gemspec b/errbit_plugin.gemspec index 965a982..3e0c00b 100644 --- a/errbit_plugin.gemspec +++ b/errbit_plugin.gemspec @@ -1,8 +1,8 @@ # frozen_string_literal: true -lib = File.expand_path('../lib', __FILE__) +lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'errbit_plugin/version' +require "errbit_plugin/version" Gem::Specification.new do |spec| spec.name = "errbit_plugin" diff --git a/lib/errbit_plugin/issue_trackers/none.rb b/lib/errbit_plugin/issue_trackers/none.rb index 6bd59a8..86067ce 100644 --- a/lib/errbit_plugin/issue_trackers/none.rb +++ b/lib/errbit_plugin/issue_trackers/none.rb @@ -2,29 +2,29 @@ module ErrbitPlugin class NoneIssueTracker < IssueTracker - def self.label; 'none'; end + def self.label; "none"; end def self.note - 'When no issue tracker has been configured, you will be able to ' << - 'leave comments on errors.' + "When no issue tracker has been configured, you will be able to " << + "leave comments on errors." end def self.fields; {}; end def self.icons @icons ||= { - create: ['image/png', read_static_file('none_create.png')], - goto: ['image/png', read_static_file('none_create.png')], - inactive: ['image/png', read_static_file('none_inactive.png')], + create: ["image/png", read_static_file("none_create.png")], + goto: ["image/png", read_static_file("none_create.png")], + inactive: ["image/png", read_static_file("none_inactive.png")], } end def self.read_static_file(file) File.read(File.expand_path(File.join( - File.dirname(__FILE__), '..', '..', '..', 'static', file))) + File.dirname(__FILE__), "..", "..", "..", "static", file))) end ## # The NoneIssueTracker is mark like configured? false because it not valid # like a real IssueTracker def configured?; false; end def errors; {}; end - def url; ''; end + def url; ""; end def create_issue(*); false; end def close_issue(*); false; end end diff --git a/lib/errbit_plugin/registry.rb b/lib/errbit_plugin/registry.rb index 35b1b88..ef08598 100644 --- a/lib/errbit_plugin/registry.rb +++ b/lib/errbit_plugin/registry.rb @@ -20,7 +20,7 @@ def self.add_issue_tracker(klass) if validate.valid? @issue_trackers[key] = klass else - raise IncompatibilityError.new(validate.errors.join('; ')) + raise IncompatibilityError.new(validate.errors.join("; ")) end end diff --git a/lib/errbit_plugin/version.rb b/lib/errbit_plugin/version.rb index daad883..29ef160 100644 --- a/lib/errbit_plugin/version.rb +++ b/lib/errbit_plugin/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ErrbitPlugin - VERSION = '0.6.0' + VERSION = "0.6.0" end diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index edd44cb..717ae5d 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require "spec_helper" describe ErrbitPlugin::Registry do before do @@ -10,7 +10,7 @@ let(:tracker) { tracker = Class.new(ErrbitPlugin::IssueTracker) do def self.label - 'something' + "something" end end tracker @@ -22,16 +22,16 @@ def self.label allow(ErrbitPlugin::ValidateIssueTracker) .to receive(:new) .with(tracker) - .and_return(double(:valid? => true, :message => '')) + .and_return(double(:valid? => true, :message => "")) end - it 'add new issue_tracker plugin' do + it "add new issue_tracker plugin" do ErrbitPlugin::Registry.add_issue_tracker(tracker) expect(ErrbitPlugin::Registry.issue_trackers).to eq({ - 'something' => tracker + "something" => tracker }) end context "with already issue_tracker with this key" do - it 'raise ErrbitPlugin::AlreadyRegisteredError' do + it "raise ErrbitPlugin::AlreadyRegisteredError" do ErrbitPlugin::Registry.add_issue_tracker(tracker) expect { ErrbitPlugin::Registry.add_issue_tracker(tracker) @@ -41,26 +41,26 @@ def self.label end context "with an IssueTracker not valid" do - it 'raise an IncompatibilityError' do + it "raise an IncompatibilityError" do allow(ErrbitPlugin::ValidateIssueTracker) .to receive(:new) .with(tracker) - .and_return(double(:valid? => false, :message => 'foo', :errors => [])) + .and_return(double(:valid? => false, :message => "foo", :errors => [])) expect { ErrbitPlugin::Registry.add_issue_tracker(tracker) }.to raise_error(ErrbitPlugin::IncompatibilityError) end - it 'puts the errors in the exception message' do + it "puts the errors in the exception message" do allow(ErrbitPlugin::ValidateIssueTracker) .to receive(:new) .with(tracker) - .and_return(double(:valid? => false, :message => 'foo', :errors => ['one', 'two'])) + .and_return(double(:valid? => false, :message => "foo", :errors => ["one", "two"])) begin ErrbitPlugin::Registry.add_issue_tracker(tracker) rescue ErrbitPlugin::IncompatibilityError => e - expect(e.message).to eq('one; two') + expect(e.message).to eq("one; two") end end end diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 1d3e6a3..c47f93b 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -1,47 +1,47 @@ # frozen_string_literal: true -require 'spec_helper' +require "spec_helper" describe ErrbitPlugin::ValidateIssueTracker do describe "#valid?" do context "with a complete class" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; 'foo'; end - def self.note; 'foo'; end - def self.fields; ['foo']; end + def self.label; "foo"; end + def self.note; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def configured?; true; end def errors; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end - def url; 'http'; end + def create_issue; "http"; end + def close_issue; "http"; end + def url; "http"; end end - it 'valid' do + it "valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be true end end context "with class not inherit from ErrbitPlugin::IssueTracker" do klass = Class.new do - def self.label; 'foo'; end - def self.note; 'foo'; end - def self.fields; ['foo']; end + def self.label; "foo"; end + def self.note; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def initialize(params); end def configured?; true; end def errors; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end - def url; 'http'; end + def create_issue; "http"; end + def close_issue; "http"; end + def url; "http"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'says :not_inherited' do + it "says :not_inherited" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:not_inherited]] @@ -50,21 +50,21 @@ def url; 'http'; end context "with no label method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.note; 'foo'; end - def self.fields; ['foo']; end + def self.note; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def configured?; true; end def errors; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end - def url; 'http'; end + def create_issue; "http"; end + def close_issue; "http"; end + def url; "http"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'say not implement label method' do + it "say not implement label method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:class_method_missing, :label]] @@ -73,21 +73,21 @@ def url; 'http'; end context "with no icons method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.note; 'foo'; end - def self.fields; ['foo']; end - def self.label; 'alabel'; end + def self.note; "foo"; end + def self.fields; ["foo"]; end + def self.label; "alabel"; end def configured?; true; end def errors; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end - def url; 'http'; end + def create_issue; "http"; end + def close_issue; "http"; end + def url; "http"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'say not implement icons method' do + it "say not implement icons method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:class_method_missing, :icons]] @@ -96,21 +96,21 @@ def url; 'http'; end context "without fields method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; 'foo'; end - def self.note; 'foo'; end + def self.label; "foo"; end + def self.note; "foo"; end def self.icons; {}; end def configured?; true; end def errors; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end - def url; 'http'; end + def create_issue; "http"; end + def close_issue; "http"; end + def url; "http"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'say not implement fields method' do + it "say not implement fields method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:class_method_missing, :fields]] @@ -119,21 +119,21 @@ def url; 'http'; end context "without configured? method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; 'foo'; end - def self.note; 'foo'; end - def self.fields; ['foo']; end + def self.label; "foo"; end + def self.note; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def errors; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end - def url; 'http'; end + def create_issue; "http"; end + def close_issue; "http"; end + def url; "http"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'say not implement configured? method' do + it "say not implement configured? method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:instance_method_missing, :configured?]] @@ -142,21 +142,21 @@ def url; 'http'; end context "without errors method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; 'foo'; end - def self.note; 'foo'; end - def self.fields; ['foo']; end + def self.label; "foo"; end + def self.note; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def configured?; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end - def url; 'http'; end + def create_issue; "http"; end + def close_issue; "http"; end + def url; "http"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'say not implement errors method' do + it "say not implement errors method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:instance_method_missing, :errors]] @@ -165,20 +165,20 @@ def url; 'http'; end context "without create_issue method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; 'foo'; end - def self.note; 'foo'; end - def self.fields; ['foo']; end + def self.label; "foo"; end + def self.note; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def configured?; true; end def errors; true; end - def close_issue; 'http'; end - def url; 'http'; end + def close_issue; "http"; end + def url; "http"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'say not implement create_issue method' do + it "say not implement create_issue method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:instance_method_missing, :create_issue]] @@ -188,20 +188,20 @@ def url; 'http'; end context "without close_issue method" do # this is an optional method klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; 'foo'; end - def self.note; 'foo'; end - def self.fields; ['foo']; end + def self.label; "foo"; end + def self.note; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def configured?; true; end def errors; true; end - def create_issue; 'http'; end - def url; 'http'; end + def create_issue; "http"; end + def url; "http"; end end - it 'is valid' do + it "is valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be true end - it 'not say not implement close_issue method' do + it "not say not implement close_issue method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).not_to eql [[:instance_method_missing, :close_issue]] @@ -210,21 +210,21 @@ def url; 'http'; end context "without url method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; 'foo'; end - def self.note; 'foo'; end - def self.fields; ['foo']; end + def self.label; "foo"; end + def self.note; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def configured?; true; end def errors; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end + def create_issue; "http"; end + def close_issue; "http"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'say not implement url method' do + it "say not implement url method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:instance_method_missing, :url]] @@ -233,21 +233,21 @@ def close_issue; 'http'; end context "without note method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; 'foo'; end - def self.fields; ['foo']; end + def self.label; "foo"; end + def self.fields; ["foo"]; end def self.icons; {}; end def configured?; true; end def errors; true; end - def create_issue; 'http'; end - def close_issue; 'http'; end - def url; 'foo'; end + def create_issue; "http"; end + def close_issue; "http"; end + def url; "foo"; end end - it 'not valid' do + it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end - it 'say not implement note method' do + it "say not implement note method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? expect(is.errors).to eql [[:class_method_missing, :note]] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3c75cb1..0aac2fc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -if ENV['COVERAGE'] - require 'simplecov' - if ENV['CI'] - require 'coveralls' +if ENV["COVERAGE"] + require "simplecov" + if ENV["CI"] + require "coveralls" Coveralls.wear! SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, @@ -14,7 +14,7 @@ SimpleCov.start end -require 'errbit_plugin' +require "errbit_plugin" RSpec.configure do |config| config.run_all_when_everything_filtered = true @@ -24,5 +24,5 @@ # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 - config.order = 'random' + config.order = "random" end From e5280cf340414b10a943b68c4aecf86a2cec9a80 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:31:12 +0100 Subject: [PATCH 21/83] Rubocop: Style/HashSyntax --- Gemfile | 2 +- spec/errbit_plugin/registry_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 98adfd0..341cc3c 100644 --- a/Gemfile +++ b/Gemfile @@ -7,4 +7,4 @@ gemspec gem "rake" gem "rspec" -gem "coveralls", :require => false +gem "coveralls", require: false diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index 717ae5d..b405dbc 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -22,7 +22,7 @@ def self.label allow(ErrbitPlugin::ValidateIssueTracker) .to receive(:new) .with(tracker) - .and_return(double(:valid? => true, :message => "")) + .and_return(double(valid?: true, message: "")) end it "add new issue_tracker plugin" do ErrbitPlugin::Registry.add_issue_tracker(tracker) @@ -45,7 +45,7 @@ def self.label allow(ErrbitPlugin::ValidateIssueTracker) .to receive(:new) .with(tracker) - .and_return(double(:valid? => false, :message => "foo", :errors => [])) + .and_return(double(valid?: false, message: "foo", errors: [])) expect { ErrbitPlugin::Registry.add_issue_tracker(tracker) }.to raise_error(ErrbitPlugin::IncompatibilityError) @@ -55,7 +55,7 @@ def self.label allow(ErrbitPlugin::ValidateIssueTracker) .to receive(:new) .with(tracker) - .and_return(double(:valid? => false, :message => "foo", :errors => ["one", "two"])) + .and_return(double(valid?: false, message: "foo", errors: ["one", "two"])) begin ErrbitPlugin::Registry.add_issue_tracker(tracker) From 9fcf5a883756f9a9b6f8169cc6c1ad351db275f8 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:33:06 +0100 Subject: [PATCH 22/83] Add standard gem --- .standard.yml | 0 Gemfile | 1 + Gemfile.lock | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .standard.yml diff --git a/.standard.yml b/.standard.yml new file mode 100644 index 0000000..e69de29 diff --git a/Gemfile b/Gemfile index 341cc3c..d79be8d 100644 --- a/Gemfile +++ b/Gemfile @@ -7,4 +7,5 @@ gemspec gem "rake" gem "rspec" +gem "standard" gem "coveralls", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 735d90b..d6e3e74 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,6 +6,7 @@ PATH GEM remote: https://rubygems.org/ specs: + ast (2.4.2) bigdecimal (3.1.9) coveralls (0.8.23) json (>= 1.8, < 3) @@ -16,7 +17,16 @@ GEM diff-lcs (1.6.0) docile (1.4.1) json (2.10.2) + language_server-protocol (3.17.0.4) + lint_roller (1.1.0) + parallel (1.26.3) + parser (3.3.7.1) + ast (~> 2.4.1) + racc + racc (1.8.1) + rainbow (3.1.1) rake (13.2.1) + regexp_parser (2.10.0) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -30,11 +40,41 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.2) + rubocop (1.73.2) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.38.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.39.0) + parser (>= 3.3.1.0) + rubocop-performance (1.24.0) + lint_roller (~> 1.1) + rubocop (>= 1.72.1, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + ruby-progressbar (1.13.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) + standard (1.47.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.73.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.7) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.7.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.24.0) sync (0.5.0) term-ansicolor (1.11.2) tins (~> 1.0) @@ -42,6 +82,9 @@ GEM tins (1.38.0) bigdecimal sync + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) PLATFORMS aarch64-linux-gnu @@ -61,6 +104,7 @@ DEPENDENCIES errbit_plugin! rake rspec + standard BUNDLED WITH 2.6.5 From 1151a8220b0544a25a5771443ce6e5d875b3bbc7 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:33:18 +0100 Subject: [PATCH 23/83] Configure standard --- .standard.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.standard.yml b/.standard.yml index e69de29..72b2693 100644 --- a/.standard.yml +++ b/.standard.yml @@ -0,0 +1 @@ +ruby_version: 3.1 From a38ac18248c9fe06778b64db382c5880a00caadd Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:42:17 +0100 Subject: [PATCH 24/83] Rubocop --- .rubocop.yml | 7 ++++ lib/errbit_plugin/issue_trackers/none.rb | 47 ++++++++++++++++++------ 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ef6d21f..e29afdd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,3 +6,10 @@ Style/StringLiterals: Enabled: true EnforcedStyle: double_quotes ConsistentQuotesInMultiline: false + +Bundler/OrderedGems: + Enabled: false + +Style/SingleLineMethods: + Enabled: true + AllowIfMethodIsEmpty: false diff --git a/lib/errbit_plugin/issue_trackers/none.rb b/lib/errbit_plugin/issue_trackers/none.rb index 86067ce..d87a880 100644 --- a/lib/errbit_plugin/issue_trackers/none.rb +++ b/lib/errbit_plugin/issue_trackers/none.rb @@ -2,12 +2,18 @@ module ErrbitPlugin class NoneIssueTracker < IssueTracker - def self.label; "none"; end + def self.label + "none" + end + def self.note - "When no issue tracker has been configured, you will be able to " << - "leave comments on errors." + "When no issue tracker has been configured, you will be able to leave comments on errors." + end + + def self.fields + {} end - def self.fields; {}; end + def self.icons @icons ||= { create: ["image/png", read_static_file("none_create.png")], @@ -15,18 +21,37 @@ def self.icons inactive: ["image/png", read_static_file("none_inactive.png")], } end + def self.read_static_file(file) - File.read(File.expand_path(File.join( - File.dirname(__FILE__), "..", "..", "..", "static", file))) + File.read( + File.expand_path( + File.join(File.dirname(__FILE__), "..", "..", "..", "static", file) + ) + ) end + ## # The NoneIssueTracker is mark like configured? false because it not valid # like a real IssueTracker - def configured?; false; end - def errors; {}; end - def url; ""; end - def create_issue(*); false; end - def close_issue(*); false; end + def configured? + false + end + + def errors + {} + end + + def url + "" + end + + def create_issue(*) + false + end + + def close_issue(*) + false + end end end From 7278d8a6aa11701829e31173afe4142c4ae8f5f5 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:42:25 +0100 Subject: [PATCH 25/83] Rubocop --- .../validate_issue_tracker_spec.rb | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index c47f93b..8bb5173 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -4,18 +4,43 @@ describe ErrbitPlugin::ValidateIssueTracker do describe "#valid?" do - context "with a complete class" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; "foo"; end - def self.note; "foo"; end - def self.fields; ["foo"]; end - def self.icons; {}; end - def configured?; true; end - def errors; true; end - def create_issue; "http"; end - def close_issue; "http"; end - def url; "http"; end + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end end it "valid" do From 1a5b4d4cb00427fb0c82ce1357073f138c513a46 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:46:12 +0100 Subject: [PATCH 26/83] Rubocop --- .../validate_issue_tracker_spec.rb | 48 +++++++++++++++---- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 8bb5173..fb31c5e 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -50,16 +50,44 @@ def url context "with class not inherit from ErrbitPlugin::IssueTracker" do klass = Class.new do - def self.label; "foo"; end - def self.note; "foo"; end - def self.fields; ["foo"]; end - def self.icons; {}; end - def initialize(params); end - def configured?; true; end - def errors; true; end - def create_issue; "http"; end - def close_issue; "http"; end - def url; "http"; end + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def initialize(params) + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end end it "not valid" do From 0295cee2dc6fef75c76b9e4763e2c32cc3d40c86 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:47:41 +0100 Subject: [PATCH 27/83] Rubocop --- .../validate_issue_tracker_spec.rb | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index fb31c5e..da1541e 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -103,14 +103,37 @@ def url context "with no label method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.note; "foo"; end - def self.fields; ["foo"]; end - def self.icons; {}; end - def configured?; true; end - def errors; true; end - def create_issue; "http"; end - def close_issue; "http"; end - def url; "http"; end + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end end it "not valid" do From adfe4d1062ff9efaec9ce6916afc84051bbeceaa Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:49:48 +0100 Subject: [PATCH 28/83] Rubocop --- .../validate_issue_tracker_spec.rb | 78 +++++++++++++++---- 1 file changed, 62 insertions(+), 16 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index da1541e..525c646 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -149,14 +149,37 @@ def url context "with no icons method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.note; "foo"; end - def self.fields; ["foo"]; end - def self.label; "alabel"; end - def configured?; true; end - def errors; true; end - def create_issue; "http"; end - def close_issue; "http"; end - def url; "http"; end + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.label + "alabel" + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end end it "not valid" do @@ -172,14 +195,37 @@ def url; "http"; end context "without fields method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; "foo"; end - def self.note; "foo"; end - def self.icons; {}; end - def configured?; true; end - def errors; true; end - def create_issue; "http"; end - def close_issue; "http"; end - def url; "http"; end + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end end it "not valid" do From 70792e8f5dd10837dba184fde6c30abe3e5b4325 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:54:37 +0100 Subject: [PATCH 29/83] Add checksums --- Gemfile.lock | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index d6e3e74..119e395 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -106,5 +106,42 @@ DEPENDENCIES rspec standard +CHECKSUMS + ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 + bigdecimal (3.1.9) sha256=2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc + coveralls (0.8.23) sha256=ac63872cc7ace7274f26f29caf4edabba6eb0bb3970627d83a1e76478b7564d7 + diff-lcs (1.6.0) sha256=a1e7f7b272962f8fc769358ad00001b87cdcf32ba349d6c70c6b544613d2da2e + docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e + errbit_plugin (0.6.0) + json (2.10.2) sha256=34e0eada93022b2a0a3345bb0b5efddb6e9ff5be7c48e409cfb54ff8a36a8b06 + language_server-protocol (3.17.0.4) sha256=c484626478664fd13482d8180947c50a8590484b1258b99b7aedb3b69df89669 + lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 + parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef + parser (3.3.7.1) sha256=7dbe61618025519024ac72402a6677ead02099587a5538e84371b76659e6aca1 + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a + rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d + regexp_parser (2.10.0) sha256=cb6f0ddde88772cd64bff1dbbf68df66d376043fe2e66a9ef77fcb1b0c548c61 + rspec (3.13.0) sha256=d490914ac1d5a5a64a0e1400c1d54ddd2a501324d703b8cfe83f458337bab993 + rspec-core (3.13.3) sha256=25136507f4f9cf2e8977a2851e64e438b4331646054e345998714108745cdfe4 + rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58 + rspec-mocks (3.13.2) sha256=2327335def0e1665325a9b617e3af9ae20272741d80ac550336309a7c59abdef + rspec-support (3.13.2) sha256=cea3a2463fd9b84b9dcc9685efd80ea701aa8f7b3decb3b3ce795ed67737dbec + rubocop (1.73.2) sha256=35cd1b1365ba97234323fe771abcecd09c9b77098464cd726c76aa7d9bc12b5d + rubocop-ast (1.39.0) sha256=b6ba0f677ceced033b81c69405ac8931f4963116c572b8da5e15a03619a8236c + rubocop-performance (1.24.0) sha256=e5bd39ff3e368395b9af886927cc37f5892f43db4bd6c8526594352d5b4440b5 + ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 + simplecov (0.16.1) sha256=8724f0911bbb2b7a3c11155e6d57987cad311f9e5ce7b305b1e2e67fdc73dee9 + simplecov-html (0.10.2) sha256=f65306e2695913c007ddc8d31d6318f37ae074f2ee1cea1647b3bf4c94ca30d2 + standard (1.47.0) sha256=b0da6b71d8dec53e760c7216b723e3507ebdcd6962f7ce7c37c016a36c7cc190 + standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b + standard-performance (1.7.0) sha256=c46a9aef3348c0cfc03053ed9a1c1f73b967f7e4edcdf30dac0101b143897314 + sync (0.5.0) sha256=668356cc07c59ac7ed9ecf34fec3929831f179c07adb1f3e1c3b7a1609a638fd + term-ansicolor (1.11.2) sha256=4b00c63f21d496055045240907da30de077e8c6502b2ba7e8638509d689e5083 + thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda + tins (1.38.0) sha256=99acd138b73d5b1b2dd8e72f1707ac0905c8f63f729ddd7c746d2d3c3803886d + unicode-display_width (3.1.4) sha256=8caf2af1c0f2f07ec89ef9e18c7d88c2790e217c482bfc78aaa65eadd5415ac1 + unicode-emoji (4.0.4) sha256=2c2c4ef7f353e5809497126285a50b23056cc6e61b64433764a35eff6c36532a + BUNDLED WITH 2.6.5 From b865b87dfcb1575e28e03549cd25ff95909328e2 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:55:29 +0100 Subject: [PATCH 30/83] Rubocop --- .../validate_issue_tracker_spec.rb | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 525c646..b91ac51 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -241,14 +241,37 @@ def url context "without configured? method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; "foo"; end - def self.note; "foo"; end - def self.fields; ["foo"]; end - def self.icons; {}; end - def errors; true; end - def create_issue; "http"; end - def close_issue; "http"; end - def url; "http"; end + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end end it "not valid" do From 071d6eb16c5193f7922a13e32ada0bd26463522a Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:56:41 +0100 Subject: [PATCH 31/83] Rubocop --- .../validate_issue_tracker_spec.rb | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index b91ac51..2cd76f4 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -287,14 +287,37 @@ def url context "without errors method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; "foo"; end - def self.note; "foo"; end - def self.fields; ["foo"]; end - def self.icons; {}; end - def configured?; true; end - def create_issue; "http"; end - def close_issue; "http"; end - def url; "http"; end + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end end it "not valid" do From dac9b7c3999e6de439a9c9da3fdf71b54a6dc38b Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 11:58:07 +0100 Subject: [PATCH 32/83] Rubocop --- .../validate_issue_tracker_spec.rb | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 2cd76f4..969963a 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -333,14 +333,37 @@ def url context "without create_issue method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; "foo"; end - def self.note; "foo"; end - def self.fields; ["foo"]; end - def self.icons; {}; end - def configured?; true; end - def errors; true; end - def close_issue; "http"; end - def url; "http"; end + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def close_issue + "http" + end + + def url + "http" + end end it "not valid" do From 3a1d79d527e27c37bcd5ee0218a1badf3dfac7f1 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:00:13 +0100 Subject: [PATCH 33/83] Rubocop --- .../validate_issue_tracker_spec.rb | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 969963a..d6dacb8 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -369,6 +369,7 @@ def url it "not valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false end + it "say not implement create_issue method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? @@ -379,19 +380,43 @@ def url context "without close_issue method" do # this is an optional method klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; "foo"; end - def self.note; "foo"; end - def self.fields; ["foo"]; end - def self.icons; {}; end - def configured?; true; end - def errors; true; end - def create_issue; "http"; end - def url; "http"; end + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def url + "http" + end end it "is valid" do expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be true end + it "not say not implement close_issue method" do is = ErrbitPlugin::ValidateIssueTracker.new(klass) is.valid? @@ -402,12 +427,19 @@ def url; "http"; end context "without url method" do klass = Class.new(ErrbitPlugin::IssueTracker) do def self.label; "foo"; end + def self.note; "foo"; end + def self.fields; ["foo"]; end + def self.icons; {}; end + def configured?; true; end + def errors; true; end + def create_issue; "http"; end + def close_issue; "http"; end end From 4f3c9ab0ca42d5d7dbbb5767ecf7414d6422ae13 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:01:12 +0100 Subject: [PATCH 34/83] Rubocop --- .../validate_issue_tracker_spec.rb | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index d6dacb8..04c50aa 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -456,14 +456,37 @@ def close_issue; "http"; end context "without note method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; "foo"; end - def self.fields; ["foo"]; end - def self.icons; {}; end - def configured?; true; end - def errors; true; end - def create_issue; "http"; end - def close_issue; "http"; end - def url; "foo"; end + def self.label + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "foo" + end end it "not valid" do From 15b05adb3d2ff8d33cf59800cd1b15c027daf39c Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:02:40 +0100 Subject: [PATCH 35/83] Rubocop --- .../validate_issue_tracker_spec.rb | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 04c50aa..411b96c 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -426,21 +426,37 @@ def url context "without url method" do klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label; "foo"; end + def self.label + "foo" + end - def self.note; "foo"; end + def self.note + "foo" + end - def self.fields; ["foo"]; end + def self.fields + ["foo"] + end - def self.icons; {}; end + def self.icons + {} + end - def configured?; true; end + def configured? + true + end - def errors; true; end + def errors + true + end - def create_issue; "http"; end + def create_issue + "http" + end - def close_issue; "http"; end + def close_issue + "http" + end end it "not valid" do From 242ead20341aa1e2462574212a253e9d51204b42 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:04:03 +0100 Subject: [PATCH 36/83] Add GitHub Action for actionlint --- .github/workflows/actionlint.yml | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/actionlint.yml diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 0000000..c9350ae --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,39 @@ +name: Action Lint + +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "0 21 * * 6" + +permissions: + contents: read + +jobs: + actionlint: + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + + - uses: raven-actions/actionlint@v2 + id: actionlint + with: + pyflakes: false + + - name: actionlint Summary + if: ${{ steps.actionlint.outputs.exit-code != 0 }} + run: | + echo "Used actionlint version ${{ steps.actionlint.outputs.version-semver }}" + echo "Used actionlint release ${{ steps.actionlint.outputs.version-tag }}" + echo "actionlint ended with ${{ steps.actionlint.outputs.exit-code }} exit code" + echo "actionlint ended because '${{ steps.actionlint.outputs.exit-message }}'" + echo "actionlint found ${{ steps.actionlint.outputs.total-errors }} errors" + echo "actionlint checked ${{ steps.actionlint.outputs.total-files }} files" + echo "actionlint cache used: ${{ steps.actionlint.outputs.cache-hit }}" + # shellcheck disable=SC2242 + exit ${{ steps.actionlint.outputs.exit-code }} From 856e22c0c23e45b89dd1f5661b5590d395fea967 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:04:29 +0100 Subject: [PATCH 37/83] Fix branches --- .github/workflows/actionlint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index c9350ae..cd283b5 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -3,10 +3,10 @@ name: Action Lint on: push: branches: - - main + - master pull_request: branches: - - main + - master schedule: - cron: "0 21 * * 6" From 35ddd893b141f60a8a8643b2df88822a3c5593e0 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:06:59 +0100 Subject: [PATCH 38/83] Remove broken badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3857f5..c9b7898 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ErrbitPlugin [![Build Status](https://travis-ci.org/errbit/errbit_plugin.svg?branch=master)](https://travis-ci.org/errbit/errbit_plugin) +# ErrbitPlugin ErrbitPlugin provides a set of base classes that you can extend to create Errbit plugins. From 923b7f37e42ced2d3e6f540dd19f75fc75590403 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:08:56 +0100 Subject: [PATCH 39/83] Cleanup --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c9b7898..bc2fcc4 100644 --- a/README.md +++ b/README.md @@ -29,14 +29,13 @@ the class must extend ErrbitPlugin::IssueTracker. Here's an example: ```ruby class MyIssueTracker < ErrbitPlugin::IssueTracker - # A unique label for your tracker plugin used internally by errbit def self.label - 'my-tracker' + "my-tracker" end def self.note - 'a note about this tracker that users will see' + "a note about this tracker that users will see" end # Form fields that will be presented to the administrator when setting up @@ -60,9 +59,9 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker # and the binary icon data. def self.icons @icons ||= { - create: [ 'image/png', File.read('./path/to/create.png') ], - goto: [ 'image/png', File.read('./path/to/goto.png') ], - inactive: [ 'image/png', File.read('./path/to/inactive.png') ], + create: ["image/png", File.read("./path/to/create.png")], + goto: ["image/png", File.read("./path/to/goto.png")], + inactive: ["image/png", File.read("./path/to/inactive.png")], } end @@ -80,7 +79,7 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker if options[:username] {} else - { field_one: 'username must be present' } + {field_one: "username must be present"} end end @@ -92,7 +91,7 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker def create_issue(title, body, user: {}) # Create an issue! Then update the problem to link it. - 'http://sometracker.com/my/issue/123' + "https://sometracker.com/my/issue/123" end # This method is optional. Errbit will create body text for your issue by @@ -107,7 +106,7 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker # @see http://apidock.com/rails/ActionController/Base/render_to_string def render_body_args # In this example, we want to render a special file - ['/path/to/some/template', formats: [:rdoc]] + ["/path/to/some/template", formats: [:rdoc]] end # This method is optional, and is where you actually go close the issue on @@ -121,7 +120,7 @@ class MyIssueTracker < ErrbitPlugin::IssueTracker # The URL for your remote issue tracker def url - 'http://some-remote-tracker.com' + "https://some-remote-tracker.com" end end ``` From e12226f31d68ac1a1e6bec8b0ab863d2791a7eab Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:09:24 +0100 Subject: [PATCH 40/83] github -> GitHub --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc2fcc4..b586790 100644 --- a/README.md +++ b/README.md @@ -128,4 +128,4 @@ end ## Contributing Discuss any changes you'd like to make with the authors on the mailing list, or -by opening a github issue. +by opening a GitHub issue. From c3038803aa1764267690a926ece3bcffdf69e3c4 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:33:10 +0100 Subject: [PATCH 41/83] Update --- Gemfile | 2 +- Gemfile.lock | 36 +++++-------------- spec/errbit_plugin/registry_spec.rb | 2 +- .../validate_issue_tracker_spec.rb | 2 +- spec/spec_helper.rb | 31 +++++++--------- 5 files changed, 25 insertions(+), 48 deletions(-) diff --git a/Gemfile b/Gemfile index d79be8d..e92d854 100644 --- a/Gemfile +++ b/Gemfile @@ -8,4 +8,4 @@ gemspec gem "rake" gem "rspec" gem "standard" -gem "coveralls", require: false +gem "simplecov", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 119e395..9687dbf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,13 +7,6 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.2) - bigdecimal (3.1.9) - coveralls (0.8.23) - json (>= 1.8, < 3) - simplecov (~> 0.16.1) - term-ansicolor (~> 1.3) - thor (>= 0.19.4, < 2.0) - tins (~> 1.6) diff-lcs (1.6.0) docile (1.4.1) json (2.10.2) @@ -58,11 +51,12 @@ GEM rubocop (>= 1.72.1, < 2.0) rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (1.13.0) - simplecov (0.16.1) + simplecov (0.22.0) docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) standard (1.47.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) @@ -75,13 +69,6 @@ GEM standard-performance (1.7.0) lint_roller (~> 1.1) rubocop-performance (~> 1.24.0) - sync (0.5.0) - term-ansicolor (1.11.2) - tins (~> 1.0) - thor (1.3.2) - tins (1.38.0) - bigdecimal - sync unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) @@ -100,16 +87,14 @@ PLATFORMS x86_64-linux-musl DEPENDENCIES - coveralls errbit_plugin! rake rspec + simplecov standard CHECKSUMS ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 - bigdecimal (3.1.9) sha256=2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc - coveralls (0.8.23) sha256=ac63872cc7ace7274f26f29caf4edabba6eb0bb3970627d83a1e76478b7564d7 diff-lcs (1.6.0) sha256=a1e7f7b272962f8fc769358ad00001b87cdcf32ba349d6c70c6b544613d2da2e docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e errbit_plugin (0.6.0) @@ -131,15 +116,12 @@ CHECKSUMS rubocop-ast (1.39.0) sha256=b6ba0f677ceced033b81c69405ac8931f4963116c572b8da5e15a03619a8236c rubocop-performance (1.24.0) sha256=e5bd39ff3e368395b9af886927cc37f5892f43db4bd6c8526594352d5b4440b5 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 - simplecov (0.16.1) sha256=8724f0911bbb2b7a3c11155e6d57987cad311f9e5ce7b305b1e2e67fdc73dee9 - simplecov-html (0.10.2) sha256=f65306e2695913c007ddc8d31d6318f37ae074f2ee1cea1647b3bf4c94ca30d2 + simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5 + simplecov-html (0.13.1) sha256=5dab0b7ee612e60e9887ad57693832fdf4695b4c0c859eaea5f95c18791ef10b + simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428 standard (1.47.0) sha256=b0da6b71d8dec53e760c7216b723e3507ebdcd6962f7ce7c37c016a36c7cc190 standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b standard-performance (1.7.0) sha256=c46a9aef3348c0cfc03053ed9a1c1f73b967f7e4edcdf30dac0101b143897314 - sync (0.5.0) sha256=668356cc07c59ac7ed9ecf34fec3929831f179c07adb1f3e1c3b7a1609a638fd - term-ansicolor (1.11.2) sha256=4b00c63f21d496055045240907da30de077e8c6502b2ba7e8638509d689e5083 - thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda - tins (1.38.0) sha256=99acd138b73d5b1b2dd8e72f1707ac0905c8f63f729ddd7c746d2d3c3803886d unicode-display_width (3.1.4) sha256=8caf2af1c0f2f07ec89ef9e18c7d88c2790e217c482bfc78aaa65eadd5415ac1 unicode-emoji (4.0.4) sha256=2c2c4ef7f353e5809497126285a50b23056cc6e61b64433764a35eff6c36532a diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index b405dbc..9d0481f 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -describe ErrbitPlugin::Registry do +RSpec.describe ErrbitPlugin::Registry do before do ErrbitPlugin::Registry.clear_issue_trackers end diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/validate_issue_tracker_spec.rb index 411b96c..5b69c80 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/validate_issue_tracker_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -describe ErrbitPlugin::ValidateIssueTracker do +RSpec.describe ErrbitPlugin::ValidateIssueTracker do describe "#valid?" do context "with a complete class" do klass = Class.new(ErrbitPlugin::IssueTracker) do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0aac2fc..35ae743 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,28 +1,23 @@ # frozen_string_literal: true -if ENV["COVERAGE"] - require "simplecov" - if ENV["CI"] - require "coveralls" - Coveralls.wear! - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ - SimpleCov::Formatter::HTMLFormatter, - Coveralls::SimpleCov::Formatter - ] - end +require "simplecov" + +SimpleCov.start do + enable_coverage :branch - SimpleCov.start + primary_coverage :branch end require "errbit_plugin" RSpec.configure do |config| - config.run_all_when_everything_filtered = true - config.filter_run :focus + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = "random" + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end end From 7453f73718f04f524c9e7565eda7eafbde115ebe Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:35:24 +0100 Subject: [PATCH 42/83] Run RSpec on GitHub Actions --- .github/workflows/rspec.yml | 34 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/rspec.yml diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml new file mode 100644 index 0000000..ef1c6a0 --- /dev/null +++ b/.github/workflows/rspec.yml @@ -0,0 +1,34 @@ +name: RSpec + +on: + push: + branches: + - master + pull_request: + branches: + - master + schedule: + - cron: "0 21 * * 6" + +jobs: + rspec: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + ruby: ["3.1", "3.2", "3.3", "3.4"] + + steps: + - uses: actions/checkout@v4 + - run: rm -f Gemfile.lock + - run: rm -f .ruby-version + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + rubygems: latest + bundler: latest + bundler-cache: true + + - run: bundle exec rspec diff --git a/.gitignore b/.gitignore index dcf7ea1..9863661 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ test/version_tmp tmp .idea +.rspec_status From ba80ac84ddf29b42588abeb7d60e45e4c7c43f7c Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:37:13 +0100 Subject: [PATCH 43/83] Update bundler --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9687dbf..39df658 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -126,4 +126,4 @@ CHECKSUMS unicode-emoji (4.0.4) sha256=2c2c4ef7f353e5809497126285a50b23056cc6e61b64433764a35eff6c36532a BUNDLED WITH - 2.6.5 + 2.6.6 From 28210572c77bf74a638d593914454ba637fc2a9a Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:40:01 +0100 Subject: [PATCH 44/83] Cleanup --- errbit_plugin.gemspec | 4 ++-- lib/errbit_plugin/issue_trackers/none.rb | 2 +- lib/errbit_plugin/registry.rb | 1 + lib/errbit_plugin/validate_issue_tracker.rb | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/errbit_plugin.gemspec b/errbit_plugin.gemspec index 3e0c00b..d1b80ce 100644 --- a/errbit_plugin.gemspec +++ b/errbit_plugin.gemspec @@ -10,8 +10,8 @@ Gem::Specification.new do |spec| spec.authors = ["Stephen Crosby"] spec.email = ["stevecrozz@gmail.com"] - spec.description = %q{Base to create an errbit plugin} - spec.summary = %q{Base to create an errbit plugin} + spec.description = "Base to create an Errbit plugin" + spec.summary = "Base to create an Errbit plugin" spec.homepage = "https://github.com/errbit/errbit_plugin" spec.license = "MIT" diff --git a/lib/errbit_plugin/issue_trackers/none.rb b/lib/errbit_plugin/issue_trackers/none.rb index d87a880..4b8ec7a 100644 --- a/lib/errbit_plugin/issue_trackers/none.rb +++ b/lib/errbit_plugin/issue_trackers/none.rb @@ -18,7 +18,7 @@ def self.icons @icons ||= { create: ["image/png", read_static_file("none_create.png")], goto: ["image/png", read_static_file("none_create.png")], - inactive: ["image/png", read_static_file("none_inactive.png")], + inactive: ["image/png", read_static_file("none_inactive.png")] } end diff --git a/lib/errbit_plugin/registry.rb b/lib/errbit_plugin/registry.rb index ef08598..adda68d 100644 --- a/lib/errbit_plugin/registry.rb +++ b/lib/errbit_plugin/registry.rb @@ -2,6 +2,7 @@ module ErrbitPlugin class IncompatibilityError < StandardError; end + class AlreadyRegisteredError < StandardError; end module Registry diff --git a/lib/errbit_plugin/validate_issue_tracker.rb b/lib/errbit_plugin/validate_issue_tracker.rb index bbb8c58..a7c1fc7 100644 --- a/lib/errbit_plugin/validate_issue_tracker.rb +++ b/lib/errbit_plugin/validate_issue_tracker.rb @@ -19,11 +19,11 @@ def valid? private def good_inherit? - unless @klass.ancestors.include?(ErrbitPlugin::IssueTracker) + if @klass.ancestors.include?(ErrbitPlugin::IssueTracker) + true + else add_errors(:not_inherited) false - else - true end end @@ -57,7 +57,7 @@ def instance @instance ||= @klass.new({}) end - def add_errors(key, value=nil) + def add_errors(key, value = nil) @errors << [key, value].compact end end From 8b60061a973f7d06aff285bbabd11a957f907940 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:42:14 +0100 Subject: [PATCH 45/83] Cleanup --- lib/errbit_plugin.rb | 2 +- .../{issue_trackers/none.rb => none_issue_tracker.rb} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lib/errbit_plugin/{issue_trackers/none.rb => none_issue_tracker.rb} (100%) diff --git a/lib/errbit_plugin.rb b/lib/errbit_plugin.rb index 4a54ca1..f1cd222 100644 --- a/lib/errbit_plugin.rb +++ b/lib/errbit_plugin.rb @@ -4,4 +4,4 @@ require "errbit_plugin/registry" require "errbit_plugin/issue_tracker" require "errbit_plugin/validate_issue_tracker" -require "errbit_plugin/issue_trackers/none" +require "errbit_plugin/none_issue_tracker" diff --git a/lib/errbit_plugin/issue_trackers/none.rb b/lib/errbit_plugin/none_issue_tracker.rb similarity index 100% rename from lib/errbit_plugin/issue_trackers/none.rb rename to lib/errbit_plugin/none_issue_tracker.rb From 8baa114861c80b8759ce0e082c7e38405db5ea95 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 12:42:46 +0100 Subject: [PATCH 46/83] Bump version --- Gemfile.lock | 4 ++-- lib/errbit_plugin/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 39df658..a64dd7f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - errbit_plugin (0.6.0) + errbit_plugin (0.7.0) GEM remote: https://rubygems.org/ @@ -97,7 +97,7 @@ CHECKSUMS ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 diff-lcs (1.6.0) sha256=a1e7f7b272962f8fc769358ad00001b87cdcf32ba349d6c70c6b544613d2da2e docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e - errbit_plugin (0.6.0) + errbit_plugin (0.7.0) json (2.10.2) sha256=34e0eada93022b2a0a3345bb0b5efddb6e9ff5be7c48e409cfb54ff8a36a8b06 language_server-protocol (3.17.0.4) sha256=c484626478664fd13482d8180947c50a8590484b1258b99b7aedb3b69df89669 lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 diff --git a/lib/errbit_plugin/version.rb b/lib/errbit_plugin/version.rb index 29ef160..9762eac 100644 --- a/lib/errbit_plugin/version.rb +++ b/lib/errbit_plugin/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ErrbitPlugin - VERSION = "0.6.0" + VERSION = "0.7.0" end From 28e82141fbabdb1b276233a53480edd1549072fd Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 14:23:00 +0100 Subject: [PATCH 47/83] Refactoring --- lib/errbit_plugin.rb | 2 +- lib/errbit_plugin/issue_tracker.rb | 40 ++++++++++++++++++- ..._tracker.rb => issue_tracker_validator.rb} | 5 ++- lib/errbit_plugin/registry.rb | 12 +++--- 4 files changed, 50 insertions(+), 9 deletions(-) rename lib/errbit_plugin/{validate_issue_tracker.rb => issue_tracker_validator.rb} (97%) diff --git a/lib/errbit_plugin.rb b/lib/errbit_plugin.rb index f1cd222..3fb352d 100644 --- a/lib/errbit_plugin.rb +++ b/lib/errbit_plugin.rb @@ -3,5 +3,5 @@ require "errbit_plugin/version" require "errbit_plugin/registry" require "errbit_plugin/issue_tracker" -require "errbit_plugin/validate_issue_tracker" +require "errbit_plugin/issue_tracker_validator" require "errbit_plugin/none_issue_tracker" diff --git a/lib/errbit_plugin/issue_tracker.rb b/lib/errbit_plugin/issue_tracker.rb index aaf9200..b7415d8 100644 --- a/lib/errbit_plugin/issue_tracker.rb +++ b/lib/errbit_plugin/issue_tracker.rb @@ -1,12 +1,50 @@ # frozen_string_literal: true module ErrbitPlugin - # abstract class for issue trackers + # Abstract class for issue trackers class IssueTracker attr_reader :options def initialize(options) @options = options end + + class << self + def label + raise NoMethodError, "The ErrbitPlugin::IssueTracker.label method is abstract, an implementation of it must be provided in the subclass" + end + + def note + raise NoMethodError, "The ErrbitPlugin::IssueTracker.note method is abstract, an implementation of it must be provided in the subclass" + end + + def fields + raise NoMethodError, "The ErrbitPlugin::IssueTracker.fields method is abstract, an implementation of it must be provided in the subclass" + end + + def icons + raise NoMethodError, "The ErrbitPlugin::IssueTracker.icons method is abstract, an implementation of it must be provided in the subclass" + end + end + + def configured? + raise NoMethodError, "The ErrbitPlugin::IssueTracker#configured? method is abstract, an implementation of it must be provided in the subclass" + end + + def errors + raise NoMethodError, "The ErrbitPlugin::IssueTracker#errors method is abstract, an implementation of it must be provided in the subclass" + end + + def create_issue + raise NoMethodError, "The ErrbitPlugin::IssueTracker#create_issue method is abstract, an implementation of it must be provided in the subclass" + end + + def close_issue + raise NoMethodError, "The ErrbitPlugin::IssueTracker#close_issue method is abstract, an implementation of it must be provided in the subclass" + end + + def url + raise NoMethodError, "The ErrbitPlugin::IssueTracker#url method is abstract, an implementation of it must be provided in the subclass" + end end end diff --git a/lib/errbit_plugin/validate_issue_tracker.rb b/lib/errbit_plugin/issue_tracker_validator.rb similarity index 97% rename from lib/errbit_plugin/validate_issue_tracker.rb rename to lib/errbit_plugin/issue_tracker_validator.rb index a7c1fc7..ac12874 100644 --- a/lib/errbit_plugin/validate_issue_tracker.rb +++ b/lib/errbit_plugin/issue_tracker_validator.rb @@ -1,12 +1,13 @@ # frozen_string_literal: true module ErrbitPlugin - class ValidateIssueTracker + class IssueTrackerValidator + attr_reader :errors + def initialize(klass) @klass = klass @errors = [] end - attr_reader :errors def valid? valid_inherit = good_inherit? diff --git a/lib/errbit_plugin/registry.rb b/lib/errbit_plugin/registry.rb index adda68d..083f928 100644 --- a/lib/errbit_plugin/registry.rb +++ b/lib/errbit_plugin/registry.rb @@ -1,9 +1,11 @@ # frozen_string_literal: true module ErrbitPlugin - class IncompatibilityError < StandardError; end + class IncompatibilityError < StandardError + end - class AlreadyRegisteredError < StandardError; end + class AlreadyRegisteredError < StandardError + end module Registry @issue_trackers = {} @@ -16,12 +18,12 @@ def self.add_issue_tracker(klass) "issue_tracker '#{key}' already registered" end - validate = ValidateIssueTracker.new(klass) + validator = IssueTrackerValidator.new(klass) - if validate.valid? + if validator.valid? @issue_trackers[key] = klass else - raise IncompatibilityError.new(validate.errors.join("; ")) + raise IncompatibilityError.new(validator.errors.join("; ")) end end From 502baefa8ce7b9cf51660026a605e35cd1a524fc Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 14:33:11 +0100 Subject: [PATCH 48/83] Refactoring --- spec/errbit_plugin/registry_spec.rb | 119 +++++++++++++++++++++------- 1 file changed, 90 insertions(+), 29 deletions(-) diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index 9d0481f..0845f18 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -3,56 +3,76 @@ require "spec_helper" RSpec.describe ErrbitPlugin::Registry do - before do - ErrbitPlugin::Registry.clear_issue_trackers - end + before { ErrbitPlugin::Registry.clear_issue_trackers } - let(:tracker) { - tracker = Class.new(ErrbitPlugin::IssueTracker) do + let(:tracker) do + Class.new(ErrbitPlugin::IssueTracker) do def self.label "something" end end - tracker - } + end describe ".add_issue_tracker" do - context "with issue_tracker class valid" do - before do - allow(ErrbitPlugin::ValidateIssueTracker) - .to receive(:new) - .with(tracker) - .and_return(double(valid?: true, message: "")) - end - it "add new issue_tracker plugin" do - ErrbitPlugin::Registry.add_issue_tracker(tracker) - expect(ErrbitPlugin::Registry.issue_trackers).to eq({ - "something" => tracker - }) + context "when issue tracker is valid" do + context "when issue tracker is not registered" do + let(:issue_tracker_validator) do + instance_double(ErrbitPlugin::IssueTrackerValidator, + valid?: true, + errors: []) + end + + before do + expect(ErrbitPlugin::IssueTrackerValidator) + .to receive(:new) + .with(tracker) + .and_return(issue_tracker_validator) + end + + it "add new issue_tracker plugin" do + ErrbitPlugin::Registry.add_issue_tracker(tracker) + + expect(ErrbitPlugin::Registry.issue_trackers).to eq({"something" => tracker}) + end end - context "with already issue_tracker with this key" do + + context "when issue tracker is already registered" do + let(:issue_tracker_validator) do + instance_double(ErrbitPlugin::IssueTrackerValidator, + valid?: true, + errors: []) + end + + before { ErrbitPlugin::Registry.add_issue_tracker(tracker) } + it "raise ErrbitPlugin::AlreadyRegisteredError" do - ErrbitPlugin::Registry.add_issue_tracker(tracker) - expect { + expect do ErrbitPlugin::Registry.add_issue_tracker(tracker) - }.to raise_error(ErrbitPlugin::AlreadyRegisteredError) + end.to raise_error(ErrbitPlugin::AlreadyRegisteredError) end end end - context "with an IssueTracker not valid" do + context "when issue tracker is not valid" do + let(:issue_tracker_validator) do + instance_double(ErrbitPlugin::IssueTrackerValidator, + valid?: false, + errors: []) + end + it "raise an IncompatibilityError" do - allow(ErrbitPlugin::ValidateIssueTracker) + expect(ErrbitPlugin::IssueTrackerValidator) .to receive(:new) .with(tracker) - .and_return(double(valid?: false, message: "foo", errors: [])) - expect { + .and_return(issue_tracker_validator) + + expect do ErrbitPlugin::Registry.add_issue_tracker(tracker) - }.to raise_error(ErrbitPlugin::IncompatibilityError) + end.to raise_error(ErrbitPlugin::IncompatibilityError) end it "puts the errors in the exception message" do - allow(ErrbitPlugin::ValidateIssueTracker) + expect(ErrbitPlugin::IssueTrackerValidator) .to receive(:new) .with(tracker) .and_return(double(valid?: false, message: "foo", errors: ["one", "two"])) @@ -63,6 +83,47 @@ def self.label expect(e.message).to eq("one; two") end end + end end + + # before do + # ErrbitPlugin::Registry.clear_issue_trackers + # end + # + # let(:tracker) { + # tracker = Class.new(ErrbitPlugin::IssueTracker) do + # def self.label + # "something" + # end + # end + # tracker + # } + # + # describe ".add_issue_tracker" do + # context "with an IssueTracker not valid" do + # it "raise an IncompatibilityError" do + # allow(ErrbitPlugin::ValidateIssueTracker) + # .to receive(:new) + # .with(tracker) + # .and_return(double(valid?: false, message: "foo", errors: [])) + # expect { + # ErrbitPlugin::Registry.add_issue_tracker(tracker) + # }.to raise_error(ErrbitPlugin::IncompatibilityError) + # end + # + # it "puts the errors in the exception message" do + # allow(ErrbitPlugin::ValidateIssueTracker) + # .to receive(:new) + # .with(tracker) + # .and_return(double(valid?: false, message: "foo", errors: ["one", "two"])) + # + # begin + # ErrbitPlugin::Registry.add_issue_tracker(tracker) + # rescue ErrbitPlugin::IncompatibilityError => e + # expect(e.message).to eq("one; two") + # end + # end + # end + # end end From 01466f2bae29dc8fd87cf428d9ed00b9732830d4 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 14:34:08 +0100 Subject: [PATCH 49/83] Refactoring --- spec/errbit_plugin/registry_spec.rb | 59 ++++++++++++++--------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index 0845f18..ff70c6c 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -54,36 +54,35 @@ def self.label end context "when issue tracker is not valid" do - let(:issue_tracker_validator) do - instance_double(ErrbitPlugin::IssueTrackerValidator, - valid?: false, - errors: []) - end - - it "raise an IncompatibilityError" do - expect(ErrbitPlugin::IssueTrackerValidator) - .to receive(:new) - .with(tracker) - .and_return(issue_tracker_validator) - - expect do - ErrbitPlugin::Registry.add_issue_tracker(tracker) - end.to raise_error(ErrbitPlugin::IncompatibilityError) - end - - it "puts the errors in the exception message" do - expect(ErrbitPlugin::IssueTrackerValidator) - .to receive(:new) - .with(tracker) - .and_return(double(valid?: false, message: "foo", errors: ["one", "two"])) - - begin - ErrbitPlugin::Registry.add_issue_tracker(tracker) - rescue ErrbitPlugin::IncompatibilityError => e - expect(e.message).to eq("one; two") - end - end - + # let(:issue_tracker_validator) do + # instance_double(ErrbitPlugin::IssueTrackerValidator, + # valid?: false, + # errors: []) + # end + + # it "raise an IncompatibilityError" do + # expect(ErrbitPlugin::IssueTrackerValidator) + # .to receive(:new) + # .with(tracker) + # .and_return(issue_tracker_validator) + # + # expect do + # ErrbitPlugin::Registry.add_issue_tracker(tracker) + # end.to raise_error(ErrbitPlugin::IncompatibilityError) + # end + + # it "puts the errors in the exception message" do + # expect(ErrbitPlugin::IssueTrackerValidator) + # .to receive(:new) + # .with(tracker) + # .and_return(double(valid?: false, message: "foo", errors: ["one", "two"])) + # + # begin + # ErrbitPlugin::Registry.add_issue_tracker(tracker) + # rescue ErrbitPlugin::IncompatibilityError => e + # expect(e.message).to eq("one; two") + # end + # end end end From d6ceeb5fa95b9c2ea5257bdab1937158f45791dc Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 14:35:04 +0100 Subject: [PATCH 50/83] Rename --- ...te_issue_tracker_spec.rb => issue_tracker_validator_spec.rb} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/errbit_plugin/{validate_issue_tracker_spec.rb => issue_tracker_validator_spec.rb} (99%) diff --git a/spec/errbit_plugin/validate_issue_tracker_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb similarity index 99% rename from spec/errbit_plugin/validate_issue_tracker_spec.rb rename to spec/errbit_plugin/issue_tracker_validator_spec.rb index 5b69c80..7c6d024 100644 --- a/spec/errbit_plugin/validate_issue_tracker_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe ErrbitPlugin::ValidateIssueTracker do +RSpec.describe ErrbitPlugin::IssueTrackerValidator do describe "#valid?" do context "with a complete class" do klass = Class.new(ErrbitPlugin::IssueTracker) do From 10a25f8ccfaff6f5bf296b991d85575715b89b7c Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:04:51 +0100 Subject: [PATCH 51/83] Refactoring --- spec/errbit_plugin/registry_spec.rb | 112 +++++++++++----------------- 1 file changed, 43 insertions(+), 69 deletions(-) diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index ff70c6c..b6c5dc3 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -54,75 +54,49 @@ def self.label end context "when issue tracker is not valid" do - # let(:issue_tracker_validator) do - # instance_double(ErrbitPlugin::IssueTrackerValidator, - # valid?: false, - # errors: []) - # end - - # it "raise an IncompatibilityError" do - # expect(ErrbitPlugin::IssueTrackerValidator) - # .to receive(:new) - # .with(tracker) - # .and_return(issue_tracker_validator) - # - # expect do - # ErrbitPlugin::Registry.add_issue_tracker(tracker) - # end.to raise_error(ErrbitPlugin::IncompatibilityError) - # end - - # it "puts the errors in the exception message" do - # expect(ErrbitPlugin::IssueTrackerValidator) - # .to receive(:new) - # .with(tracker) - # .and_return(double(valid?: false, message: "foo", errors: ["one", "two"])) - # - # begin - # ErrbitPlugin::Registry.add_issue_tracker(tracker) - # rescue ErrbitPlugin::IncompatibilityError => e - # expect(e.message).to eq("one; two") - # end - # end + context "raise IncompatibilityError if tracker is not valid" do + let(:issue_tracker_validator) do + instance_double(ErrbitPlugin::IssueTrackerValidator, + valid?: false, + errors: []) + end + + before do + expect(ErrbitPlugin::IssueTrackerValidator) + .to receive(:new) + .with(tracker) + .and_return(issue_tracker_validator) + end + + it "raise an IncompatibilityError" do + expect do + ErrbitPlugin::Registry.add_issue_tracker(tracker) + end.to raise_error(ErrbitPlugin::IncompatibilityError) + end + end + + context "show errors in the exception message" do + let(:issue_tracker_validator) do + instance_double(ErrbitPlugin::IssueTrackerValidator, + valid?: false, + errors: ["one", "two"]) + end + + before do + expect(ErrbitPlugin::IssueTrackerValidator) + .to receive(:new) + .with(tracker) + .and_return(issue_tracker_validator) + end + + it "puts the errors in the exception message" do + begin + ErrbitPlugin::Registry.add_issue_tracker(tracker) + rescue ErrbitPlugin::IncompatibilityError => e + expect(e.message).to eq("one; two") + end + end + end end end - - # before do - # ErrbitPlugin::Registry.clear_issue_trackers - # end - # - # let(:tracker) { - # tracker = Class.new(ErrbitPlugin::IssueTracker) do - # def self.label - # "something" - # end - # end - # tracker - # } - # - # describe ".add_issue_tracker" do - # context "with an IssueTracker not valid" do - # it "raise an IncompatibilityError" do - # allow(ErrbitPlugin::ValidateIssueTracker) - # .to receive(:new) - # .with(tracker) - # .and_return(double(valid?: false, message: "foo", errors: [])) - # expect { - # ErrbitPlugin::Registry.add_issue_tracker(tracker) - # }.to raise_error(ErrbitPlugin::IncompatibilityError) - # end - # - # it "puts the errors in the exception message" do - # allow(ErrbitPlugin::ValidateIssueTracker) - # .to receive(:new) - # .with(tracker) - # .and_return(double(valid?: false, message: "foo", errors: ["one", "two"])) - # - # begin - # ErrbitPlugin::Registry.add_issue_tracker(tracker) - # rescue ErrbitPlugin::IncompatibilityError => e - # expect(e.message).to eq("one; two") - # end - # end - # end - # end end From e2dc6f658bdade176b4f2688538da0588b7eb806 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:06:15 +0100 Subject: [PATCH 52/83] Refactoring --- spec/errbit_plugin/registry_spec.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index b6c5dc3..9b25b97 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -54,7 +54,7 @@ def self.label end context "when issue tracker is not valid" do - context "raise IncompatibilityError if tracker is not valid" do + context "raise IncompatibilityError" do let(:issue_tracker_validator) do instance_double(ErrbitPlugin::IssueTrackerValidator, valid?: false, @@ -90,11 +90,9 @@ def self.label end it "puts the errors in the exception message" do - begin - ErrbitPlugin::Registry.add_issue_tracker(tracker) - rescue ErrbitPlugin::IncompatibilityError => e - expect(e.message).to eq("one; two") - end + ErrbitPlugin::Registry.add_issue_tracker(tracker) + rescue ErrbitPlugin::IncompatibilityError => e + expect(e.message).to eq("one; two") end end end From 8a4e78dbb62ffbc11471eaebf4ca761cfc4c8b2c Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:07:42 +0100 Subject: [PATCH 53/83] Refactoring --- .../issue_tracker_validator_spec.rb | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 7c6d024..d411484 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -44,7 +44,7 @@ def url end it "valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be true + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be true end end @@ -91,11 +91,11 @@ def url end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "says :not_inherited" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:not_inherited]] end @@ -137,11 +137,11 @@ def url end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "say not implement label method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:class_method_missing, :label]] end @@ -183,11 +183,11 @@ def url end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "say not implement icons method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:class_method_missing, :icons]] end @@ -229,11 +229,11 @@ def url end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "say not implement fields method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:class_method_missing, :fields]] end @@ -275,11 +275,11 @@ def url end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "say not implement configured? method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:instance_method_missing, :configured?]] end @@ -321,11 +321,11 @@ def url end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "say not implement errors method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:instance_method_missing, :errors]] end @@ -367,11 +367,11 @@ def url end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "say not implement create_issue method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:instance_method_missing, :create_issue]] end @@ -414,11 +414,11 @@ def url end it "is valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be true + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be true end it "not say not implement close_issue method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).not_to eql [[:instance_method_missing, :close_issue]] end @@ -460,11 +460,11 @@ def close_issue end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "say not implement url method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:instance_method_missing, :url]] end @@ -506,11 +506,11 @@ def url end it "not valid" do - expect(ErrbitPlugin::ValidateIssueTracker.new(klass).valid?).to be false + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false end it "say not implement note method" do - is = ErrbitPlugin::ValidateIssueTracker.new(klass) + is = ErrbitPlugin::IssueTrackerValidator.new(klass) is.valid? expect(is.errors).to eql [[:class_method_missing, :note]] end From f126bb8283ca6f9ebd0e7e814b487ae9ba2f08bb Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:16:59 +0100 Subject: [PATCH 54/83] Add tests --- spec/errbit_plugin/issue_tracker_spec.rb | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 spec/errbit_plugin/issue_tracker_spec.rb diff --git a/spec/errbit_plugin/issue_tracker_spec.rb b/spec/errbit_plugin/issue_tracker_spec.rb new file mode 100644 index 0000000..4936320 --- /dev/null +++ b/spec/errbit_plugin/issue_tracker_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe ErrbitPlugin::IssueTracker do + let(:options) { {} } + + subject { described_class.new(options) } + + describe "#options" do + it { expect(subject.options).to eq({}) } + end + + describe "#configured?" do + let(:message) { "The ErrbitPlugin::IssueTracker#configured? method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { subject.configured? }.to raise_error(NoMethodError, message) } + end + + describe "#errors" do + let(:message) { "The ErrbitPlugin::IssueTracker#errors method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { subject.errors }.to raise_error(NoMethodError, message) } + end + + describe "#create_issue" do + let(:message) { "The ErrbitPlugin::IssueTracker#create_issue method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { subject.create_issue }.to raise_error(NoMethodError, message) } + end + + describe "#close_issue" do + let(:message) { "The ErrbitPlugin::IssueTracker#close_issue method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { subject.close_issue }.to raise_error(NoMethodError, message) } + end + + describe "#url" do + let(:message) { "The ErrbitPlugin::IssueTracker#url method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { subject.url }.to raise_error(NoMethodError, message) } + end +end From 9c95214956f5697201cb55a4ab8824c48c7775cc Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:17:25 +0100 Subject: [PATCH 55/83] Update --- lib/errbit_plugin/issue_tracker.rb | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/errbit_plugin/issue_tracker.rb b/lib/errbit_plugin/issue_tracker.rb index b7415d8..78d4ced 100644 --- a/lib/errbit_plugin/issue_tracker.rb +++ b/lib/errbit_plugin/issue_tracker.rb @@ -9,24 +9,6 @@ def initialize(options) @options = options end - class << self - def label - raise NoMethodError, "The ErrbitPlugin::IssueTracker.label method is abstract, an implementation of it must be provided in the subclass" - end - - def note - raise NoMethodError, "The ErrbitPlugin::IssueTracker.note method is abstract, an implementation of it must be provided in the subclass" - end - - def fields - raise NoMethodError, "The ErrbitPlugin::IssueTracker.fields method is abstract, an implementation of it must be provided in the subclass" - end - - def icons - raise NoMethodError, "The ErrbitPlugin::IssueTracker.icons method is abstract, an implementation of it must be provided in the subclass" - end - end - def configured? raise NoMethodError, "The ErrbitPlugin::IssueTracker#configured? method is abstract, an implementation of it must be provided in the subclass" end @@ -46,5 +28,23 @@ def close_issue def url raise NoMethodError, "The ErrbitPlugin::IssueTracker#url method is abstract, an implementation of it must be provided in the subclass" end + + class << self + def label + raise NoMethodError, "The ErrbitPlugin::IssueTracker.label method is abstract, an implementation of it must be provided in the subclass" + end + + def note + raise NoMethodError, "The ErrbitPlugin::IssueTracker.note method is abstract, an implementation of it must be provided in the subclass" + end + + def fields + raise NoMethodError, "The ErrbitPlugin::IssueTracker.fields method is abstract, an implementation of it must be provided in the subclass" + end + + def icons + raise NoMethodError, "The ErrbitPlugin::IssueTracker.icons method is abstract, an implementation of it must be provided in the subclass" + end + end end end From 25a7938326ee26394aaa167cbadb09d1a691964e Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:19:45 +0100 Subject: [PATCH 56/83] Add tests --- spec/errbit_plugin/issue_tracker_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/errbit_plugin/issue_tracker_spec.rb b/spec/errbit_plugin/issue_tracker_spec.rb index 4936320..4aec2bc 100644 --- a/spec/errbit_plugin/issue_tracker_spec.rb +++ b/spec/errbit_plugin/issue_tracker_spec.rb @@ -40,4 +40,28 @@ it { expect { subject.url }.to raise_error(NoMethodError, message) } end + + describe ".label" do + let(:message) { "The ErrbitPlugin::IssueTracker.label method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { described_class.label }.to raise_error(NoMethodError, message) } + end + + describe ".note" do + let(:message) { "The ErrbitPlugin::IssueTracker.note method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { described_class.note }.to raise_error(NoMethodError, message) } + end + + describe ".fields" do + let(:message) { "The ErrbitPlugin::IssueTracker.fields method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { described_class.fields }.to raise_error(NoMethodError, message) } + end + + describe ".icons" do + let(:message) { "The ErrbitPlugin::IssueTracker.icons method is abstract, an implementation of it must be provided in the subclass" } + + it { expect { described_class.icons }.to raise_error(NoMethodError, message) } + end end From 9b17ea05dbcd32aa0235cb3216af3f0fab72e0a8 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:24:35 +0100 Subject: [PATCH 57/83] Add tests --- spec/errbit_plugin/none_issue_tracker_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 spec/errbit_plugin/none_issue_tracker_spec.rb diff --git a/spec/errbit_plugin/none_issue_tracker_spec.rb b/spec/errbit_plugin/none_issue_tracker_spec.rb new file mode 100644 index 0000000..ce42bbe --- /dev/null +++ b/spec/errbit_plugin/none_issue_tracker_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe ErrbitPlugin::NoneIssueTracker do + let(:options) { {} } + + subject { described_class.new(options) } + + it { expect(subject).to be_an(ErrbitPlugin::IssueTracker) } +end From 03dfb4216e4a127ff623e015b9c1db2d5a47e443 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:28:56 +0100 Subject: [PATCH 58/83] Add tests --- spec/errbit_plugin/none_issue_tracker_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/errbit_plugin/none_issue_tracker_spec.rb b/spec/errbit_plugin/none_issue_tracker_spec.rb index ce42bbe..d5f142e 100644 --- a/spec/errbit_plugin/none_issue_tracker_spec.rb +++ b/spec/errbit_plugin/none_issue_tracker_spec.rb @@ -8,4 +8,14 @@ subject { described_class.new(options) } it { expect(subject).to be_an(ErrbitPlugin::IssueTracker) } + + it { expect(subject.configured?).to eq(false) } + + it { expect(subject.errors).to eq({}) } + + it { expect(subject.url).to eq("") } + + it { expect(subject.create_issue).to eq(false) } + + it { expect(subject.close_issue).to eq(false) } end From bc9be475787a0a8246953e12e137b3a05644183e Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 17 Mar 2025 15:30:20 +0100 Subject: [PATCH 59/83] More tests --- spec/errbit_plugin/none_issue_tracker_spec.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/errbit_plugin/none_issue_tracker_spec.rb b/spec/errbit_plugin/none_issue_tracker_spec.rb index d5f142e..bff8796 100644 --- a/spec/errbit_plugin/none_issue_tracker_spec.rb +++ b/spec/errbit_plugin/none_issue_tracker_spec.rb @@ -18,4 +18,26 @@ it { expect(subject.create_issue).to eq(false) } it { expect(subject.close_issue).to eq(false) } + + it { expect(described_class.label).to eq("none") } + + it { expect(described_class.note).to eq("When no issue tracker has been configured, you will be able to leave comments on errors.") } + + it { expect(described_class.fields).to eq({}) } + + # def self.icons + # @icons ||= { + # create: ["image/png", read_static_file("none_create.png")], + # goto: ["image/png", read_static_file("none_create.png")], + # inactive: ["image/png", read_static_file("none_inactive.png")] + # } + # end + # + # def self.read_static_file(file) + # File.read( + # File.expand_path( + # File.join(File.dirname(__FILE__), "..", "..", "..", "static", file) + # ) + # ) + # end end From af86ef317ce9dae6d9afdffad7114f9797e75270 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 14:58:40 +0100 Subject: [PATCH 60/83] Rewrite --- lib/errbit_plugin/issue_tracker_validator.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/errbit_plugin/issue_tracker_validator.rb b/lib/errbit_plugin/issue_tracker_validator.rb index ac12874..c87f6f8 100644 --- a/lib/errbit_plugin/issue_tracker_validator.rb +++ b/lib/errbit_plugin/issue_tracker_validator.rb @@ -24,16 +24,18 @@ def good_inherit? true else add_errors(:not_inherited) + false end end def implements_instance_methods? impl = [:configured?, :errors, :create_issue, :url].map do |method| - if instance.respond_to?(method) + if @klass.instance_methods(false).include?(method) true else add_errors(:instance_method_missing, method) + false end end @@ -43,10 +45,11 @@ def implements_instance_methods? def implements_class_methods? impl = [:label, :fields, :note, :icons].map do |method| - if @klass.respond_to?(method) + if @klass.methods(false).include?(method) true else add_errors(:class_method_missing, method) + false end end From 0a0a8f352cc7613c863e2c8062ac1f015babaebf Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 15:25:09 +0100 Subject: [PATCH 61/83] Fix tests --- spec/errbit_plugin/registry_spec.rb | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/spec/errbit_plugin/registry_spec.rb b/spec/errbit_plugin/registry_spec.rb index 9b25b97..4ed8099 100644 --- a/spec/errbit_plugin/registry_spec.rb +++ b/spec/errbit_plugin/registry_spec.rb @@ -10,6 +10,38 @@ def self.label "something" end + + def self.note + "note" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end end end From 12a3a718671f708d12c3dd007326a8e9d1a1119a Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 15:25:23 +0100 Subject: [PATCH 62/83] Validate :close_issue method too --- lib/errbit_plugin/issue_tracker_validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/errbit_plugin/issue_tracker_validator.rb b/lib/errbit_plugin/issue_tracker_validator.rb index c87f6f8..27b90b2 100644 --- a/lib/errbit_plugin/issue_tracker_validator.rb +++ b/lib/errbit_plugin/issue_tracker_validator.rb @@ -30,7 +30,7 @@ def good_inherit? end def implements_instance_methods? - impl = [:configured?, :errors, :create_issue, :url].map do |method| + impl = [:configured?, :errors, :create_issue, :close_issue, :url].map do |method| if @klass.instance_methods(false).include?(method) true else From 1cb54aa95bd57ea92c46160e5171bd1622ea2b1f Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 15:27:20 +0100 Subject: [PATCH 63/83] Update tests --- .../issue_tracker_validator_spec.rb | 936 +++++++++--------- 1 file changed, 468 insertions(+), 468 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index d411484..de2855a 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -43,477 +43,477 @@ def url end end - it "valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be true - end - end - - context "with class not inherit from ErrbitPlugin::IssueTracker" do - klass = Class.new do - def self.label - "foo" - end - - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def initialize(params) - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "says :not_inherited" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:not_inherited]] - end - end - - context "with no label method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "say not implement label method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:class_method_missing, :label]] - end - end - - context "with no icons method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.label - "alabel" - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "say not implement icons method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:class_method_missing, :icons]] - end - end - - context "without fields method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.note - "foo" - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "say not implement fields method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:class_method_missing, :fields]] - end - end - - context "without configured? method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "say not implement configured? method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:instance_method_missing, :configured?]] - end - end - - context "without errors method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def configured? - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "say not implement errors method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:instance_method_missing, :errors]] - end - end - - context "without create_issue method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "say not implement create_issue method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:instance_method_missing, :create_issue]] - end - end - - context "without close_issue method" do - # this is an optional method - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def url - "http" - end - end - it "is valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be true - end - - it "not say not implement close_issue method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).not_to eql [[:instance_method_missing, :close_issue]] - end - end - - context "without url method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "say not implement url method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:instance_method_missing, :url]] + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(true) end end - context "without note method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "foo" - end - end - - it "not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - end - - it "say not implement note method" do - is = ErrbitPlugin::IssueTrackerValidator.new(klass) - is.valid? - expect(is.errors).to eql [[:class_method_missing, :note]] - end - end + # context "with class not inherit from ErrbitPlugin::IssueTracker" do + # klass = Class.new do + # def self.label + # "foo" + # end + # + # def self.note + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.icons + # {} + # end + # + # def initialize(params) + # end + # + # def configured? + # true + # end + # + # def errors + # true + # end + # + # def create_issue + # "http" + # end + # + # def close_issue + # "http" + # end + # + # def url + # "http" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "says :not_inherited" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:not_inherited]] + # end + # end + + # context "with no label method" do + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.note + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.icons + # {} + # end + # + # def configured? + # true + # end + # + # def errors + # true + # end + # + # def create_issue + # "http" + # end + # + # def close_issue + # "http" + # end + # + # def url + # "http" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "say not implement label method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:class_method_missing, :label]] + # end + # end + + # context "with no icons method" do + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.note + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.label + # "alabel" + # end + # + # def configured? + # true + # end + # + # def errors + # true + # end + # + # def create_issue + # "http" + # end + # + # def close_issue + # "http" + # end + # + # def url + # "http" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "say not implement icons method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:class_method_missing, :icons]] + # end + # end + + # context "without fields method" do + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.label + # "foo" + # end + # + # def self.note + # "foo" + # end + # + # def self.icons + # {} + # end + # + # def configured? + # true + # end + # + # def errors + # true + # end + # + # def create_issue + # "http" + # end + # + # def close_issue + # "http" + # end + # + # def url + # "http" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "say not implement fields method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:class_method_missing, :fields]] + # end + # end + + # context "without configured? method" do + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.label + # "foo" + # end + # + # def self.note + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.icons + # {} + # end + # + # def errors + # true + # end + # + # def create_issue + # "http" + # end + # + # def close_issue + # "http" + # end + # + # def url + # "http" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "say not implement configured? method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:instance_method_missing, :configured?]] + # end + # end + + # context "without errors method" do + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.label + # "foo" + # end + # + # def self.note + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.icons + # {} + # end + # + # def configured? + # true + # end + # + # def create_issue + # "http" + # end + # + # def close_issue + # "http" + # end + # + # def url + # "http" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "say not implement errors method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:instance_method_missing, :errors]] + # end + # end + + # context "without create_issue method" do + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.label + # "foo" + # end + # + # def self.note + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.icons + # {} + # end + # + # def configured? + # true + # end + # + # def errors + # true + # end + # + # def close_issue + # "http" + # end + # + # def url + # "http" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "say not implement create_issue method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:instance_method_missing, :create_issue]] + # end + # end + + # context "without close_issue method" do + # # this is an optional method + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.label + # "foo" + # end + # + # def self.note + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.icons + # {} + # end + # + # def configured? + # true + # end + # + # def errors + # true + # end + # + # def create_issue + # "http" + # end + # + # def url + # "http" + # end + # end + # + # it "is valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be true + # end + # + # it "not say not implement close_issue method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).not_to eql [[:instance_method_missing, :close_issue]] + # end + # end + + # context "without url method" do + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.label + # "foo" + # end + # + # def self.note + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.icons + # {} + # end + # + # def configured? + # true + # end + # + # def errors + # true + # end + # + # def create_issue + # "http" + # end + # + # def close_issue + # "http" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "say not implement url method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:instance_method_missing, :url]] + # end + # end + + # context "without note method" do + # klass = Class.new(ErrbitPlugin::IssueTracker) do + # def self.label + # "foo" + # end + # + # def self.fields + # ["foo"] + # end + # + # def self.icons + # {} + # end + # + # def configured? + # true + # end + # + # def errors + # true + # end + # + # def create_issue + # "http" + # end + # + # def close_issue + # "http" + # end + # + # def url + # "foo" + # end + # end + # + # it "not valid" do + # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false + # end + # + # it "say not implement note method" do + # is = ErrbitPlugin::IssueTrackerValidator.new(klass) + # is.valid? + # expect(is.errors).to eql [[:class_method_missing, :note]] + # end + # end end end From a8ee4db023e71daa4ac7bc5683e42a4e2e3371b4 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 15:30:35 +0100 Subject: [PATCH 64/83] Update tests --- .../issue_tracker_validator_spec.rb | 106 +++++++++--------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index de2855a..dd5796d 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -48,58 +48,60 @@ def url end end - # context "with class not inherit from ErrbitPlugin::IssueTracker" do - # klass = Class.new do - # def self.label - # "foo" - # end - # - # def self.note - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.icons - # {} - # end - # - # def initialize(params) - # end - # - # def configured? - # true - # end - # - # def errors - # true - # end - # - # def create_issue - # "http" - # end - # - # def close_issue - # "http" - # end - # - # def url - # "http" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "says :not_inherited" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:not_inherited]] - # end - # end + context "with class not inherit from ErrbitPlugin::IssueTracker" do + klass = Class.new do + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def initialize(*) + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "says :not_inherited" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:not_inherited]]) + end + end # context "with no label method" do # klass = Class.new(ErrbitPlugin::IssueTracker) do From caa9f123d39491de0436d92da3a070f39889ad97 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 15:34:29 +0100 Subject: [PATCH 65/83] More tests --- .../issue_tracker_validator_spec.rb | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index dd5796d..8558da1 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -103,51 +103,53 @@ def url end end - # context "with no label method" do - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.note - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.icons - # {} - # end - # - # def configured? - # true - # end - # - # def errors - # true - # end - # - # def create_issue - # "http" - # end - # - # def close_issue - # "http" - # end - # - # def url - # "http" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "say not implement label method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:class_method_missing, :label]] - # end - # end + context "with no label method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement label method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:class_method_missing, :label]]) + end + end # context "with no icons method" do # klass = Class.new(ErrbitPlugin::IssueTracker) do From 7a4f936015772a730b5ac58e5385f786596e6c80 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 15:37:54 +0100 Subject: [PATCH 66/83] Update tests --- .../issue_tracker_validator_spec.rb | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 8558da1..9edbd5e 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -151,51 +151,53 @@ def url end end - # context "with no icons method" do - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.note - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.label - # "alabel" - # end - # - # def configured? - # true - # end - # - # def errors - # true - # end - # - # def create_issue - # "http" - # end - # - # def close_issue - # "http" - # end - # - # def url - # "http" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "say not implement icons method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:class_method_missing, :icons]] - # end - # end + context "with no icons method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.label + "alabel" + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement icons method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:class_method_missing, :icons]]) + end + end # context "without fields method" do # klass = Class.new(ErrbitPlugin::IssueTracker) do From 8e90b7d5385ff2f1f94f886ad81498be15ea1bfa Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 16:54:17 +0100 Subject: [PATCH 67/83] Update tests --- .../issue_tracker_validator_spec.rb | 190 +++++++++--------- 1 file changed, 97 insertions(+), 93 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 9edbd5e..0124e5c 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -103,7 +103,7 @@ def url end end - context "with no label method" do + context "without .label method" do klass = Class.new(ErrbitPlugin::IssueTracker) do def self.note "foo" @@ -151,7 +151,7 @@ def url end end - context "with no icons method" do + context "without .icons method" do klass = Class.new(ErrbitPlugin::IssueTracker) do def self.note "foo" @@ -199,51 +199,101 @@ def url end end - # context "without fields method" do - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.label - # "foo" - # end - # - # def self.note - # "foo" - # end - # - # def self.icons - # {} - # end - # - # def configured? - # true - # end - # - # def errors - # true - # end - # - # def create_issue - # "http" - # end - # - # def close_issue - # "http" - # end - # - # def url - # "http" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "say not implement fields method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:class_method_missing, :fields]] - # end - # end + context "without .fields method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement fields method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:class_method_missing, :fields]]) + end + end + + context "without .note method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "foo" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement note method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:class_method_missing, :note]]) + end + end # context "without configured? method" do # klass = Class.new(ErrbitPlugin::IssueTracker) do @@ -475,51 +525,5 @@ def url # expect(is.errors).to eql [[:instance_method_missing, :url]] # end # end - - # context "without note method" do - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.label - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.icons - # {} - # end - # - # def configured? - # true - # end - # - # def errors - # true - # end - # - # def create_issue - # "http" - # end - # - # def close_issue - # "http" - # end - # - # def url - # "foo" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "say not implement note method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:class_method_missing, :note]] - # end - # end end end From 340535177a30247d07138e5f9460ae50c6031741 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 16:59:02 +0100 Subject: [PATCH 68/83] Update tests --- .../issue_tracker_validator_spec.rb | 384 +++++++++--------- 1 file changed, 192 insertions(+), 192 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 0124e5c..4938530 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -103,198 +103,6 @@ def url end end - context "without .label method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "is not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) - end - - it "say not implement label method" do - validator = ErrbitPlugin::IssueTrackerValidator.new(klass) - - validator.valid? - - expect(validator.errors).to eq([[:class_method_missing, :label]]) - end - end - - context "without .icons method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.note - "foo" - end - - def self.fields - ["foo"] - end - - def self.label - "alabel" - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "is not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) - end - - it "say not implement icons method" do - validator = ErrbitPlugin::IssueTrackerValidator.new(klass) - - validator.valid? - - expect(validator.errors).to eq([[:class_method_missing, :icons]]) - end - end - - context "without .fields method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.note - "foo" - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "http" - end - end - - it "is not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) - end - - it "say not implement fields method" do - validator = ErrbitPlugin::IssueTrackerValidator.new(klass) - - validator.valid? - - expect(validator.errors).to eq([[:class_method_missing, :fields]]) - end - end - - context "without .note method" do - klass = Class.new(ErrbitPlugin::IssueTracker) do - def self.label - "foo" - end - - def self.fields - ["foo"] - end - - def self.icons - {} - end - - def configured? - true - end - - def errors - true - end - - def create_issue - "http" - end - - def close_issue - "http" - end - - def url - "foo" - end - end - - it "is not valid" do - expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) - end - - it "say not implement note method" do - validator = ErrbitPlugin::IssueTrackerValidator.new(klass) - - validator.valid? - - expect(validator.errors).to eq([[:class_method_missing, :note]]) - end - end - # context "without configured? method" do # klass = Class.new(ErrbitPlugin::IssueTracker) do # def self.label @@ -525,5 +333,197 @@ def url # expect(is.errors).to eql [[:instance_method_missing, :url]] # end # end + + context "without .label method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement label method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:class_method_missing, :label]]) + end + end + + context "without .note method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "foo" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement note method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:class_method_missing, :note]]) + end + end + + context "without .fields method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement fields method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:class_method_missing, :fields]]) + end + end + + context "without .icons method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.label + "alabel" + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement icons method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:class_method_missing, :icons]]) + end + end end end From 4221a9d4792e7e7685944731b82382adcaa48561 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 17:02:13 +0100 Subject: [PATCH 69/83] Update tests --- .../issue_tracker_validator_spec.rb | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 4938530..29bda33 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -103,51 +103,53 @@ def url end end - # context "without configured? method" do - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.label - # "foo" - # end - # - # def self.note - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.icons - # {} - # end - # - # def errors - # true - # end - # - # def create_issue - # "http" - # end - # - # def close_issue - # "http" - # end - # - # def url - # "http" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "say not implement configured? method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:instance_method_missing, :configured?]] - # end - # end + context "without #configured? method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement configured? method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:instance_method_missing, :configured?]]) + end + end # context "without errors method" do # klass = Class.new(ErrbitPlugin::IssueTracker) do From bb471be58c01f61983793d5abe6ae4395d470a9c Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 17:03:42 +0100 Subject: [PATCH 70/83] Update tests --- .../issue_tracker_validator_spec.rb | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 29bda33..5af8772 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -151,51 +151,53 @@ def url end end - # context "without errors method" do - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.label - # "foo" - # end - # - # def self.note - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.icons - # {} - # end - # - # def configured? - # true - # end - # - # def create_issue - # "http" - # end - # - # def close_issue - # "http" - # end - # - # def url - # "http" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "say not implement errors method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:instance_method_missing, :errors]] - # end - # end + context "without #errors method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement errors method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:instance_method_missing, :errors]]) + end + end # context "without create_issue method" do # klass = Class.new(ErrbitPlugin::IssueTracker) do From dbda04a7584f156684d1bcaed9b44b3fe54dec20 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 17:05:14 +0100 Subject: [PATCH 71/83] Update tests --- .../issue_tracker_validator_spec.rb | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 5af8772..4151231 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -199,51 +199,53 @@ def url end end - # context "without create_issue method" do - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.label - # "foo" - # end - # - # def self.note - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.icons - # {} - # end - # - # def configured? - # true - # end - # - # def errors - # true - # end - # - # def close_issue - # "http" - # end - # - # def url - # "http" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "say not implement create_issue method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:instance_method_missing, :create_issue]] - # end - # end + context "without create_issue method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def close_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement create_issue method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:instance_method_missing, :create_issue]]) + end + end # context "without close_issue method" do # # this is an optional method From 6d6bf0d5172baac5d3275ea7204005805b963a28 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 17:09:11 +0100 Subject: [PATCH 72/83] Update tests --- .../issue_tracker_validator_spec.rb | 95 ++++++++++--------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 4151231..9efaf2d 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -199,7 +199,7 @@ def url end end - context "without create_issue method" do + context "without #create_issue method" do klass = Class.new(ErrbitPlugin::IssueTracker) do def self.label "foo" @@ -247,52 +247,53 @@ def url end end - # context "without close_issue method" do - # # this is an optional method - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.label - # "foo" - # end - # - # def self.note - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.icons - # {} - # end - # - # def configured? - # true - # end - # - # def errors - # true - # end - # - # def create_issue - # "http" - # end - # - # def url - # "http" - # end - # end - # - # it "is valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be true - # end - # - # it "not say not implement close_issue method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).not_to eql [[:instance_method_missing, :close_issue]] - # end - # end + context "without #close_issue method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def url + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement close_issue method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:instance_method_missing, :close_issue]]) + end + end # context "without url method" do # klass = Class.new(ErrbitPlugin::IssueTracker) do From adfb7a50e50efddcefc93352db3c42cfa6cd7940 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 17:10:34 +0100 Subject: [PATCH 73/83] Update tests --- .../issue_tracker_validator_spec.rb | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/spec/errbit_plugin/issue_tracker_validator_spec.rb b/spec/errbit_plugin/issue_tracker_validator_spec.rb index 9efaf2d..63eff1c 100644 --- a/spec/errbit_plugin/issue_tracker_validator_spec.rb +++ b/spec/errbit_plugin/issue_tracker_validator_spec.rb @@ -295,51 +295,53 @@ def url end end - # context "without url method" do - # klass = Class.new(ErrbitPlugin::IssueTracker) do - # def self.label - # "foo" - # end - # - # def self.note - # "foo" - # end - # - # def self.fields - # ["foo"] - # end - # - # def self.icons - # {} - # end - # - # def configured? - # true - # end - # - # def errors - # true - # end - # - # def create_issue - # "http" - # end - # - # def close_issue - # "http" - # end - # end - # - # it "not valid" do - # expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to be false - # end - # - # it "say not implement url method" do - # is = ErrbitPlugin::IssueTrackerValidator.new(klass) - # is.valid? - # expect(is.errors).to eql [[:instance_method_missing, :url]] - # end - # end + context "without #url method" do + klass = Class.new(ErrbitPlugin::IssueTracker) do + def self.label + "foo" + end + + def self.note + "foo" + end + + def self.fields + ["foo"] + end + + def self.icons + {} + end + + def configured? + true + end + + def errors + true + end + + def create_issue + "http" + end + + def close_issue + "http" + end + end + + it "is not valid" do + expect(ErrbitPlugin::IssueTrackerValidator.new(klass).valid?).to eq(false) + end + + it "say not implement url method" do + validator = ErrbitPlugin::IssueTrackerValidator.new(klass) + + validator.valid? + + expect(validator.errors).to eq([[:instance_method_missing, :url]]) + end + end context "without .label method" do klass = Class.new(ErrbitPlugin::IssueTracker) do From 4db6c4109f3562e813a36eabbcba70d83fe7c3a9 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 17:16:18 +0100 Subject: [PATCH 74/83] Remove dead code --- lib/errbit_plugin/issue_tracker_validator.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/errbit_plugin/issue_tracker_validator.rb b/lib/errbit_plugin/issue_tracker_validator.rb index 27b90b2..b811e44 100644 --- a/lib/errbit_plugin/issue_tracker_validator.rb +++ b/lib/errbit_plugin/issue_tracker_validator.rb @@ -57,10 +57,6 @@ def implements_class_methods? impl.all? { |value| value == true } end - def instance - @instance ||= @klass.new({}) - end - def add_errors(key, value = nil) @errors << [key, value].compact end From a1e8fd07e59b77fba39a215621e0ea381825b3ab Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 19:22:49 +0100 Subject: [PATCH 75/83] Configure simplecov gem --- spec/spec_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 35ae743..040f26d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,6 +6,8 @@ enable_coverage :branch primary_coverage :branch + + add_filter "spec/" end require "errbit_plugin" From afb150983623d5403299c021dfff3e495b56e394 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 18 Mar 2025 20:00:36 +0100 Subject: [PATCH 76/83] RSpec: order random --- .rspec | 1 + 1 file changed, 1 insertion(+) diff --git a/.rspec b/.rspec index 34c5164..6c6110e 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,4 @@ --format documentation --color --require spec_helper +--order random From bbb9d69385d16652a6056348fa46a2b387ecbe68 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Fri, 21 Mar 2025 18:31:07 +0100 Subject: [PATCH 77/83] Convert to rails engine --- Gemfile.lock | 142 ++++++++++++++++-- .../images/errbit_plugin}/fake_create.png | Bin .../images/errbit_plugin}/fake_inactive.png | Bin .../images/errbit_plugin}/none_create.png | Bin .../images/errbit_plugin}/none_inactive.png | Bin errbit_plugin.gemspec | 2 + lib/errbit_plugin.rb | 1 + lib/errbit_plugin/engine.rb | 9 ++ lib/errbit_plugin/none_issue_tracker.rb | 16 +- 9 files changed, 148 insertions(+), 22 deletions(-) rename {static => app/assets/images/errbit_plugin}/fake_create.png (100%) rename {static => app/assets/images/errbit_plugin}/fake_inactive.png (100%) rename {static => app/assets/images/errbit_plugin}/none_create.png (100%) rename {static => app/assets/images/errbit_plugin}/none_inactive.png (100%) create mode 100644 lib/errbit_plugin/engine.rb diff --git a/Gemfile.lock b/Gemfile.lock index a64dd7f..a154c18 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,24 +2,111 @@ PATH remote: . specs: errbit_plugin (0.7.0) + railties (>= 6.1.0) GEM remote: https://rubygems.org/ specs: + actionpack (7.2.2.1) + actionview (= 7.2.2.1) + activesupport (= 7.2.2.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.2) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activesupport (7.2.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) ast (2.4.2) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9) + builder (3.3.0) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) + crass (1.0.6) + date (3.4.1) diff-lcs (1.6.0) docile (1.4.1) + drb (2.2.1) + erubi (1.13.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) json (2.10.2) language_server-protocol (3.17.0.4) lint_roller (1.1.0) + logger (1.6.6) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + minitest (5.25.5) + nokogiri (1.18.5-arm64-darwin) + racc (~> 1.4) parallel (1.26.3) parser (3.3.7.1) ast (~> 2.4.1) racc + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio racc (1.8.1) + rack (3.1.12) + rack-session (2.1.0) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) + rack (>= 1.3) + rackup (2.2.1) + rack (>= 3) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) + rdoc (6.12.0) + psych (>= 4.0.0) regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -51,6 +138,7 @@ GEM rubocop (>= 1.72.1, < 2.0) rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (1.13.0) + securerandom (0.4.1) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) @@ -69,22 +157,18 @@ GEM standard-performance (1.7.0) lint_roller (~> 1.1) rubocop-performance (~> 1.24.0) + stringio (3.1.5) + thor (1.3.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) + useragent (0.16.11) + zeitwerk (2.6.18) PLATFORMS - aarch64-linux-gnu - aarch64-linux-musl - arm-linux-gnu - arm-linux-musl arm64-darwin - ruby - x86-linux-gnu - x86-linux-musl - x86_64-darwin - x86_64-linux-gnu - x86_64-linux-musl DEPENDENCIES errbit_plugin! @@ -94,19 +178,51 @@ DEPENDENCIES standard CHECKSUMS + actionpack (7.2.2.1) sha256=17b2160a7bcbd5a569d06b1ae54a4bb5ccc7ba0815d73ff5768100a79dc1f734 + actionview (7.2.2.1) sha256=69fc880cf3d8b1baf21b048cf7bb68f1eef08760ff8104d7d60a6a1be8b359a5 + activesupport (7.2.2.1) sha256=842bcbf8a92977f80fb4750661a237cf5dd4fdd442066b3c35e88afb488647f5 ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 + base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 + benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a + bigdecimal (3.1.9) sha256=2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc + builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f + concurrent-ruby (1.3.5) sha256=813b3e37aca6df2a21a3b9f1d497f8cbab24a2b94cab325bffe65ee0f6cbebc6 + connection_pool (2.5.0) sha256=233b92f8d38e038c1349ccea65dd3772727d669d6d2e71f9897c8bf5cd53ebfc + crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d + date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f diff-lcs (1.6.0) sha256=a1e7f7b272962f8fc769358ad00001b87cdcf32ba349d6c70c6b544613d2da2e docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e + drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340 errbit_plugin (0.7.0) + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 + i18n (1.14.7) sha256=ceba573f8138ff2c0915427f1fc5bdf4aa3ab8ae88c8ce255eb3ecf0a11a5d0f + io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 + irb (1.15.1) sha256=d9bca745ac4207a8b728a52b98b766ca909b86ff1a504bcde3d6f8c84faae890 json (2.10.2) sha256=34e0eada93022b2a0a3345bb0b5efddb6e9ff5be7c48e409cfb54ff8a36a8b06 language_server-protocol (3.17.0.4) sha256=c484626478664fd13482d8180947c50a8590484b1258b99b7aedb3b69df89669 lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 + logger (1.6.6) sha256=dd618d24e637715472732e7eed02e33cfbdf56deaad225edd0f1f89d38024017 + loofah (2.24.0) sha256=61e6a710883abb8210887f3dc868cf3ed66594c509d9ff6987621efa6651ee1e + minitest (5.25.5) sha256=391b6c6cb43a4802bfb7c93af1ebe2ac66a210293f4a3fb7db36f2fc7dc2c756 + nokogiri (1.18.5-arm64-darwin) sha256=df7731e550a7653c003ed142cc8bc3c611c15fae3b7be4ff317b61dfe32842d9 parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef parser (3.3.7.1) sha256=7dbe61618025519024ac72402a6677ead02099587a5538e84371b76659e6aca1 + pp (0.6.2) sha256=947ec3120c6f92195f8ee8aa25a7b2c5297bb106d83b41baa02983686577b6ff + prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193 + psych (5.2.3) sha256=84a54bb952d14604fea22d99938348814678782f58b12648fcdfa4d2fce859ee racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rack (3.1.12) sha256=00d83055c89273eb13679ab562767b8826955aa6c4371d7d161deb975c50c540 + rack-session (2.1.0) sha256=437c3916535b58ef71c816ce4a2dee0a01c8a52ae6077dc2b6cd19085760a290 + rack-test (2.2.0) sha256=005a36692c306ac0b4a9350355ee080fd09ddef1148a5f8b2ac636c720f5c463 + rackup (2.2.1) sha256=f737191fd5c5b348b7f0a4412a3b86383f88c43e13b8217b63d4c8d90b9e798d + rails-dom-testing (2.2.0) sha256=e515712e48df1f687a1d7c380fd7b07b8558faa26464474da64183a7426fa93b + rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560 + railties (7.2.2.1) sha256=e3f11bf116dd6d0d874522843ccc70ec0f89fbfed3e9c2ee48a4778cd042fe1f rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d + rdoc (6.12.0) sha256=7d6f706e070bffa5d18a448f24076cbfb34923a99c1eab842aa18e6ca69f56e0 regexp_parser (2.10.0) sha256=cb6f0ddde88772cd64bff1dbbf68df66d376043fe2e66a9ef77fcb1b0c548c61 + reline (0.6.0) sha256=57620375dcbe56ec09bac7192bfb7460c716bbf0054dc94345ecaa5438e539d2 rspec (3.13.0) sha256=d490914ac1d5a5a64a0e1400c1d54ddd2a501324d703b8cfe83f458337bab993 rspec-core (3.13.3) sha256=25136507f4f9cf2e8977a2851e64e438b4331646054e345998714108745cdfe4 rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58 @@ -116,14 +232,20 @@ CHECKSUMS rubocop-ast (1.39.0) sha256=b6ba0f677ceced033b81c69405ac8931f4963116c572b8da5e15a03619a8236c rubocop-performance (1.24.0) sha256=e5bd39ff3e368395b9af886927cc37f5892f43db4bd6c8526594352d5b4440b5 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 + securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5 simplecov-html (0.13.1) sha256=5dab0b7ee612e60e9887ad57693832fdf4695b4c0c859eaea5f95c18791ef10b simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428 standard (1.47.0) sha256=b0da6b71d8dec53e760c7216b723e3507ebdcd6962f7ce7c37c016a36c7cc190 standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b standard-performance (1.7.0) sha256=c46a9aef3348c0cfc03053ed9a1c1f73b967f7e4edcdf30dac0101b143897314 + stringio (3.1.5) sha256=bca92461515a131535743bc81d5559fa1de7d80cff9a654d6c0af6f9f27e35c8 + thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda + tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b unicode-display_width (3.1.4) sha256=8caf2af1c0f2f07ec89ef9e18c7d88c2790e217c482bfc78aaa65eadd5415ac1 unicode-emoji (4.0.4) sha256=2c2c4ef7f353e5809497126285a50b23056cc6e61b64433764a35eff6c36532a + useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 + zeitwerk (2.6.18) sha256=bd2d213996ff7b3b364cd342a585fbee9797dbc1c0c6d868dc4150cc75739781 BUNDLED WITH 2.6.6 diff --git a/static/fake_create.png b/app/assets/images/errbit_plugin/fake_create.png similarity index 100% rename from static/fake_create.png rename to app/assets/images/errbit_plugin/fake_create.png diff --git a/static/fake_inactive.png b/app/assets/images/errbit_plugin/fake_inactive.png similarity index 100% rename from static/fake_inactive.png rename to app/assets/images/errbit_plugin/fake_inactive.png diff --git a/static/none_create.png b/app/assets/images/errbit_plugin/none_create.png similarity index 100% rename from static/none_create.png rename to app/assets/images/errbit_plugin/none_create.png diff --git a/static/none_inactive.png b/app/assets/images/errbit_plugin/none_inactive.png similarity index 100% rename from static/none_inactive.png rename to app/assets/images/errbit_plugin/none_inactive.png diff --git a/errbit_plugin.gemspec b/errbit_plugin.gemspec index d1b80ce..d48478c 100644 --- a/errbit_plugin.gemspec +++ b/errbit_plugin.gemspec @@ -36,4 +36,6 @@ Gem::Specification.new do |spec| spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] + + spec.add_dependency "railties", ">= 6.1.0" end diff --git a/lib/errbit_plugin.rb b/lib/errbit_plugin.rb index 3fb352d..1225c9d 100644 --- a/lib/errbit_plugin.rb +++ b/lib/errbit_plugin.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "errbit_plugin/version" +require "errbit_plugin/engine" require "errbit_plugin/registry" require "errbit_plugin/issue_tracker" require "errbit_plugin/issue_tracker_validator" diff --git a/lib/errbit_plugin/engine.rb b/lib/errbit_plugin/engine.rb new file mode 100644 index 0000000..4aa1706 --- /dev/null +++ b/lib/errbit_plugin/engine.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module ErrbitPlugin + class Engine < ::Rails::Engine + initializer :assets do + Rails.application.config.assets.paths << root.join("app", "assets", "images", "errbit_plugin") + end + end +end diff --git a/lib/errbit_plugin/none_issue_tracker.rb b/lib/errbit_plugin/none_issue_tracker.rb index 4b8ec7a..8ccf249 100644 --- a/lib/errbit_plugin/none_issue_tracker.rb +++ b/lib/errbit_plugin/none_issue_tracker.rb @@ -15,21 +15,13 @@ def self.fields end def self.icons - @icons ||= { - create: ["image/png", read_static_file("none_create.png")], - goto: ["image/png", read_static_file("none_create.png")], - inactive: ["image/png", read_static_file("none_inactive.png")] + { + create: "none_create.png", + goto: "none_create.png", + inactive: "none_inactive.png" } end - def self.read_static_file(file) - File.read( - File.expand_path( - File.join(File.dirname(__FILE__), "..", "..", "..", "static", file) - ) - ) - end - ## # The NoneIssueTracker is mark like configured? false because it not valid # like a real IssueTracker From d194efe2f117f4e0ff8fe2bbe0089274d42f425c Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Fri, 21 Mar 2025 18:32:02 +0100 Subject: [PATCH 78/83] Fix engine --- lib/errbit_plugin/engine.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/errbit_plugin/engine.rb b/lib/errbit_plugin/engine.rb index 4aa1706..55044d8 100644 --- a/lib/errbit_plugin/engine.rb +++ b/lib/errbit_plugin/engine.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "rails/engine" + module ErrbitPlugin class Engine < ::Rails::Engine initializer :assets do From 519cb07cdbdd844cdd259dcbe92f9c496c3e84e2 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Sun, 23 Mar 2025 21:30:43 +0100 Subject: [PATCH 79/83] Update --- lib/errbit_plugin/engine.rb | 2 +- lib/errbit_plugin/none_issue_tracker.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/errbit_plugin/engine.rb b/lib/errbit_plugin/engine.rb index 55044d8..6690638 100644 --- a/lib/errbit_plugin/engine.rb +++ b/lib/errbit_plugin/engine.rb @@ -5,7 +5,7 @@ module ErrbitPlugin class Engine < ::Rails::Engine initializer :assets do - Rails.application.config.assets.paths << root.join("app", "assets", "images", "errbit_plugin") + Rails.application.config.assets.paths << root.join("app", "assets", "images") end end end diff --git a/lib/errbit_plugin/none_issue_tracker.rb b/lib/errbit_plugin/none_issue_tracker.rb index 8ccf249..23a013f 100644 --- a/lib/errbit_plugin/none_issue_tracker.rb +++ b/lib/errbit_plugin/none_issue_tracker.rb @@ -16,9 +16,9 @@ def self.fields def self.icons { - create: "none_create.png", - goto: "none_create.png", - inactive: "none_inactive.png" + create: "errbit_plugin/none_create.png", + goto: "errbit_plugin/none_create.png", + inactive: "errbit_plugin/none_inactive.png" } end From 2054efc3a381f1467bcc5c1cbebc08917b1993ef Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Sun, 23 Mar 2025 21:32:57 +0100 Subject: [PATCH 80/83] Update tests --- spec/errbit_plugin/none_issue_tracker_spec.rb | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/spec/errbit_plugin/none_issue_tracker_spec.rb b/spec/errbit_plugin/none_issue_tracker_spec.rb index bff8796..49265ed 100644 --- a/spec/errbit_plugin/none_issue_tracker_spec.rb +++ b/spec/errbit_plugin/none_issue_tracker_spec.rb @@ -25,19 +25,11 @@ it { expect(described_class.fields).to eq({}) } - # def self.icons - # @icons ||= { - # create: ["image/png", read_static_file("none_create.png")], - # goto: ["image/png", read_static_file("none_create.png")], - # inactive: ["image/png", read_static_file("none_inactive.png")] - # } - # end - # - # def self.read_static_file(file) - # File.read( - # File.expand_path( - # File.join(File.dirname(__FILE__), "..", "..", "..", "static", file) - # ) - # ) - # end + it do + expect(described_class.icons).to eq({ + create: "errbit_plugin/none_create.png", + goto: "errbit_plugin/none_create.png", + inactive: "errbit_plugin/none_inactive.png" + }) + end end From a5c1447d1a91bf50a0a5ff2a885cb3145a53e1d3 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Sun, 23 Mar 2025 21:59:16 +0100 Subject: [PATCH 81/83] Update --- lib/errbit_plugin/engine.rb | 4 +++- spec/errbit_plugin/engine_spec.rb | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 spec/errbit_plugin/engine_spec.rb diff --git a/lib/errbit_plugin/engine.rb b/lib/errbit_plugin/engine.rb index 6690638..337e4cb 100644 --- a/lib/errbit_plugin/engine.rb +++ b/lib/errbit_plugin/engine.rb @@ -3,9 +3,11 @@ require "rails/engine" module ErrbitPlugin - class Engine < ::Rails::Engine + class Engine < Rails::Engine + # :nocov: initializer :assets do Rails.application.config.assets.paths << root.join("app", "assets", "images") end + # :nocov: end end diff --git a/spec/errbit_plugin/engine_spec.rb b/spec/errbit_plugin/engine_spec.rb new file mode 100644 index 0000000..07951ca --- /dev/null +++ b/spec/errbit_plugin/engine_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe ErrbitPlugin::Engine do + it { expect(described_class.ancestors).to include(Rails::Engine) } +end From d9225a69541f53547e3a14b889b476076273d1b7 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 24 Mar 2025 00:20:48 +0100 Subject: [PATCH 82/83] Update --- app/assets/config/errbit_plugin.js | 1 + lib/errbit_plugin/engine.rb | 2 +- lib/errbit_plugin/none_issue_tracker.rb | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 app/assets/config/errbit_plugin.js diff --git a/app/assets/config/errbit_plugin.js b/app/assets/config/errbit_plugin.js new file mode 100644 index 0000000..ac907b3 --- /dev/null +++ b/app/assets/config/errbit_plugin.js @@ -0,0 +1 @@ +//= link_tree ../images diff --git a/lib/errbit_plugin/engine.rb b/lib/errbit_plugin/engine.rb index 337e4cb..6b3a5b2 100644 --- a/lib/errbit_plugin/engine.rb +++ b/lib/errbit_plugin/engine.rb @@ -6,7 +6,7 @@ module ErrbitPlugin class Engine < Rails::Engine # :nocov: initializer :assets do - Rails.application.config.assets.paths << root.join("app", "assets", "images") + Rails.application.config.assets.paths << root.join("app", "assets", "images", "errbit_plugin") end # :nocov: end diff --git a/lib/errbit_plugin/none_issue_tracker.rb b/lib/errbit_plugin/none_issue_tracker.rb index 23a013f..8ccf249 100644 --- a/lib/errbit_plugin/none_issue_tracker.rb +++ b/lib/errbit_plugin/none_issue_tracker.rb @@ -16,9 +16,9 @@ def self.fields def self.icons { - create: "errbit_plugin/none_create.png", - goto: "errbit_plugin/none_create.png", - inactive: "errbit_plugin/none_inactive.png" + create: "none_create.png", + goto: "none_create.png", + inactive: "none_inactive.png" } end From 0c0595f5b96a8f6f17d0db7d7b536c4b75ca3063 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Mon, 24 Mar 2025 00:27:59 +0100 Subject: [PATCH 83/83] Fix tests --- spec/errbit_plugin/none_issue_tracker_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/errbit_plugin/none_issue_tracker_spec.rb b/spec/errbit_plugin/none_issue_tracker_spec.rb index 49265ed..150a047 100644 --- a/spec/errbit_plugin/none_issue_tracker_spec.rb +++ b/spec/errbit_plugin/none_issue_tracker_spec.rb @@ -27,9 +27,9 @@ it do expect(described_class.icons).to eq({ - create: "errbit_plugin/none_create.png", - goto: "errbit_plugin/none_create.png", - inactive: "errbit_plugin/none_inactive.png" + create: "none_create.png", + goto: "none_create.png", + inactive: "none_inactive.png" }) end end