diff --git a/.gitignore b/.gitignore index f294155..2e52f7d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ .bundle .config .yardoc -Gemfile.lock InstalledFiles _yardoc coverage @@ -18,3 +17,4 @@ tmp *.swp .rspec vendor/bundle +.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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bfe7a09..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: ruby -rvm: - - 2.1 - - 2.2 - - 2.3.0 -sudo: false -cache: bundler -script: - - bundle exec rspec diff --git a/Gemfile b/Gemfile index 851fabc..7f4f5e9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' + gemspec diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..63cf554 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,248 @@ +PATH + remote: . + specs: + errbit_github_plugin (0.4.0) + errbit_plugin + octokit + 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) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9) + builder (3.3.0) + coderay (1.1.3) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) + 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) + crass (1.0.6) + date (3.4.1) + diff-lcs (1.6.0) + docile (1.4.1) + drb (2.2.1) + errbit_plugin (0.6.0) + erubi (1.13.1) + faraday (2.12.2) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.0) + net-http (>= 0.5.0) + ffi (1.17.1) + ffi (1.17.1-aarch64-linux-gnu) + ffi (1.17.1-aarch64-linux-musl) + ffi (1.17.1-arm-linux-gnu) + ffi (1.17.1-arm-linux-musl) + ffi (1.17.1-arm64-darwin) + ffi (1.17.1-x86-linux-gnu) + ffi (1.17.1-x86-linux-musl) + ffi (1.17.1-x86_64-darwin) + ffi (1.17.1-x86_64-linux-gnu) + ffi (1.17.1-x86_64-linux-musl) + formatador (1.1.0) + guard (2.19.1) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + logger (~> 1.6) + lumberjack (>= 1.0.12, < 2.0) + nenv (~> 0.1) + notiffany (~> 0.0) + ostruct (~> 0.6) + pry (>= 0.13.0) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rspec (4.7.3) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + 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) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.6) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + lumberjack (1.2.10) + method_source (1.1.0) + mini_portile2 (2.8.8) + minitest (5.25.5) + nenv (0.3.0) + net-http (0.6.0) + uri + nokogiri (1.18.5) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + nokogiri (1.18.5-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.5-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.5-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.5-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.5-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.5-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.5-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.5-x86_64-linux-musl) + racc (~> 1.4) + notiffany (0.1.3) + nenv (~> 0.1) + shellany (~> 0.0) + octokit (9.2.0) + faraday (>= 1, < 3) + sawyer (~> 0.9) + ostruct (0.6.1) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + pry (0.15.2) + coderay (~> 1.1) + method_source (~> 1.0) + psych (5.2.3) + date + stringio + public_suffix (6.0.1) + 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) + rake (13.2.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rdoc (6.12.0) + psych (>= 4.0.0) + reline (0.6.0) + io-console (~> 0.5) + 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) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + securerandom (0.4.1) + shellany (0.0.1) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + stringio (3.1.5) + sync (0.5.0) + term-ansicolor (1.11.2) + tins (~> 1.0) + thor (1.3.2) + tins (1.38.0) + bigdecimal + sync + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uri (1.0.3) + 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 + activesupport + bundler + coveralls + errbit_github_plugin! + guard + guard-rspec + rake + rspec + +BUNDLED WITH + 2.6.6 diff --git a/README.md b/README.md index 1cb7efe..1b4b1d4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,4 @@ -# Errbit Github Plugin [![TravisCI][travis-img-url]][travis-ci-url] - -[travis-img-url]: https://travis-ci.org/errbit/errbit_github_plugin.svg?branch=master -[travis-ci-url]: http://travis-ci.org/errbit/errbit_github_plugin +# Errbit GitHub Plugin This plugin provides GitHub issue tracker integration for Errbit and it is the only plugin included by default in Errbit. diff --git a/Rakefile b/Rakefile index 2995527..5263b58 100644 --- a/Rakefile +++ b/Rakefile @@ -1 +1,3 @@ +# frozen_string_literal: true + require "bundler/gem_tasks" diff --git a/app/assets/config/errbit_github_plugin.js b/app/assets/config/errbit_github_plugin.js new file mode 100644 index 0000000..ac907b3 --- /dev/null +++ b/app/assets/config/errbit_github_plugin.js @@ -0,0 +1 @@ +//= link_tree ../images diff --git a/static/github_create.png b/app/assets/images/errbit_github_plugin/github_create.png similarity index 100% rename from static/github_create.png rename to app/assets/images/errbit_github_plugin/github_create.png diff --git a/static/github_goto.png b/app/assets/images/errbit_github_plugin/github_goto.png similarity index 100% rename from static/github_goto.png rename to app/assets/images/errbit_github_plugin/github_goto.png diff --git a/static/github_inactive.png b/app/assets/images/errbit_github_plugin/github_inactive.png similarity index 100% rename from static/github_inactive.png rename to app/assets/images/errbit_github_plugin/github_inactive.png diff --git a/errbit_github_plugin.gemspec b/errbit_github_plugin.gemspec index 90d75c9..f7786bf 100644 --- a/errbit_github_plugin.gemspec +++ b/errbit_github_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_github_plugin/version' @@ -20,6 +21,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.add_dependency 'errbit_plugin' + spec.add_dependency 'railties', ">= 6.1.0" spec.add_dependency 'octokit' spec.add_development_dependency 'rspec' diff --git a/lib/errbit_github_plugin.rb b/lib/errbit_github_plugin.rb index fcddc1e..8b752b6 100644 --- a/lib/errbit_github_plugin.rb +++ b/lib/errbit_github_plugin.rb @@ -1,15 +1,11 @@ +# frozen_string_literal: true + require "errbit_github_plugin/version" -require 'errbit_github_plugin/error' -require 'errbit_github_plugin/issue_tracker' +require "errbit_github_plugin/engine" +require "errbit_github_plugin/error" +require "errbit_github_plugin/issue_tracker" module ErrbitGithubPlugin - def self.root - File.expand_path '../..', __FILE__ - end - - def self.read_static_file(file) - File.read(File.join(self.root, 'static', file)) - end end ErrbitPlugin::Registry.add_issue_tracker(ErrbitGithubPlugin::IssueTracker) diff --git a/lib/errbit_github_plugin/engine.rb b/lib/errbit_github_plugin/engine.rb new file mode 100644 index 0000000..b3fad14 --- /dev/null +++ b/lib/errbit_github_plugin/engine.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require "rails/engine" + +module ErrbitGithubPlugin + class Engine < ::Rails::Engine + initializer :assets do + Rails.application.config.assets.paths << root.join("app", "assets", "images", "errbit_github_plugin") + end + end +end diff --git a/lib/errbit_github_plugin/error.rb b/lib/errbit_github_plugin/error.rb index dc8859f..0b1a1f1 100644 --- a/lib/errbit_github_plugin/error.rb +++ b/lib/errbit_github_plugin/error.rb @@ -1,3 +1,6 @@ +# frozen_string_literal: true + module ErrbitGithubPlugin - class AuthenticationError < Exception; end + class AuthenticationError < Exception + end end diff --git a/lib/errbit_github_plugin/issue_tracker.rb b/lib/errbit_github_plugin/issue_tracker.rb index 3587972..07cc18f 100644 --- a/lib/errbit_github_plugin/issue_tracker.rb +++ b/lib/errbit_github_plugin/issue_tracker.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'octokit' module ErrbitGithubPlugin @@ -5,10 +7,10 @@ class IssueTracker < ErrbitPlugin::IssueTracker LABEL = 'github' - NOTE = 'Please configure your github repository in the GITHUB ' << - 'REPO field above.
Instead of providing your ' << - 'username & password, you can link your Github account to your ' << - 'user profile, and allow Errbit to create issues using your ' << + NOTE = 'Please configure your github repository in the GitHub ' + 'repo field above.
Instead of providing your ' + 'username & password, you can link your GitHub account to your ' + 'user profile, and allow Errbit to create issues using your ' 'OAuth token.' FIELDS = { @@ -33,16 +35,10 @@ def self.fields end def self.icons - @icons ||= { - create: [ - 'image/png', ErrbitGithubPlugin.read_static_file('github_create.png') - ], - goto: [ - 'image/png', ErrbitGithubPlugin.read_static_file('github_goto.png'), - ], - inactive: [ - 'image/png', ErrbitGithubPlugin.read_static_file('github_inactive.png'), - ] + { + create: "github_create.png", + goto: "github_goto.png", + inactive: "github_inactive.png" } end diff --git a/lib/errbit_github_plugin/version.rb b/lib/errbit_github_plugin/version.rb index 05c5a27..6045bea 100644 --- a/lib/errbit_github_plugin/version.rb +++ b/lib/errbit_github_plugin/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ErrbitGithubPlugin - VERSION = '0.3.0' + VERSION = '0.4.0' end diff --git a/spec/issue_tracker_spec.rb b/spec/issue_tracker_spec.rb index 22dd275..1fb144b 100644 --- a/spec/issue_tracker_spec.rb +++ b/spec/issue_tracker_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + describe ErrbitGithubPlugin::IssueTracker do describe '.label' do it 'return LABEL' do @@ -20,24 +22,15 @@ describe '.icons' do it 'puts create icon onto the icons' do - expect(described_class.icons[:create][0]).to eq 'image/png' - expect( - described_class.icons[:create][1] - ).to eq ErrbitGithubPlugin.read_static_file('github_create.png') + expect(described_class.icons[:create]).to eq('github_create.png') end it 'puts goto icon onto the icons' do - expect(described_class.icons[:goto][0]).to eq 'image/png' - expect( - described_class.icons[:goto][1] - ).to eq ErrbitGithubPlugin.read_static_file('github_goto.png') + expect(described_class.icons[:goto]).to eq('github_goto.png') end it 'puts inactive icon onto the icons' do - expect(described_class.icons[:inactive][0]).to eq 'image/png' - expect( - described_class.icons[:inactive][1] - ).to eq ErrbitGithubPlugin.read_static_file('github_inactive.png') + expect(described_class.icons[:inactive]).to eq('github_inactive.png') end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index badea54..ea69401 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + if ENV['COVERAGE'] require 'simplecov' if ENV['CI'] diff --git a/vendor/assets/images/github_create.png b/vendor/assets/images/github_create.png deleted file mode 100644 index 8bc8e9d..0000000 Binary files a/vendor/assets/images/github_create.png and /dev/null differ diff --git a/vendor/assets/images/github_inactive.png b/vendor/assets/images/github_inactive.png deleted file mode 100644 index 1bcffc7..0000000 Binary files a/vendor/assets/images/github_inactive.png and /dev/null differ