Skip to content

Commit

Permalink
Merge ddda9c5 into b40e3a6
Browse files Browse the repository at this point in the history
  • Loading branch information
shanecav84 committed Jan 25, 2019
2 parents b40e3a6 + ddda9c5 commit a817e36
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ gemfile:
- gemfiles/rails5_0.gemfile
- gemfiles/rails5_1.gemfile
- gemfiles/rails5_2.gemfile
- gemfiles/rails6_0.gemfile
matrix:
exclude:
- rvm: 2.1.10
Expand All @@ -34,11 +35,19 @@ matrix:
gemfile: gemfiles/rails5_1.gemfile
- rvm: 2.1.10
gemfile: gemfiles/rails5_2.gemfile
- rvm: 2.1.10
gemfile: gemfiles/rails6_0.gemfile
- rvm: 2.2.9
gemfile: gemfiles/rails6_0.gemfile
- rvm: 2.3.6
gemfile: gemfiles/rails6_0.gemfile
# rails <=4.1 segfaults with ruby 2.4+
- rvm: 2.4.3
gemfile: gemfiles/rails4_0.gemfile
- rvm: 2.4.3
gemfile: gemfiles/rails4_1.gemfile
- rvm: 2.4.3
gemfile: gemfiles/rails6_0.gemfile
- rvm: 2.5.0
gemfile: gemfiles/rails4_0.gemfile
- rvm: 2.5.0
Expand Down
3 changes: 2 additions & 1 deletion docs/notifiers/google_chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ The Incoming WebHook URL on Google Chats.

*String, optional*

Your application name, shown in the notification. Defaults to `Rails.application.class.parent_name.underscore`.
Your application name, shown in the notification. Defaults to `Rails.application.class.module_parent_name.underscore` for Rails versions >= 6;
`Rails.application.class.parent_name.underscore` otherwise.
3 changes: 2 additions & 1 deletion docs/notifiers/mattermost.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ Url of your gitlab or github with your organisation name for issue creation link

*String, optional*

Your application name used for issue creation link. Defaults to ```Rails.application.class.parent_name.underscore```.
Your application name used for issue creation link. Defaults to `Rails.application.class.module_parent_name.underscore` for Rails versions >= 6;
`Rails.application.class.parent_name.underscore` otherwise.
3 changes: 2 additions & 1 deletion docs/notifiers/teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ Url of your Jira instance, adds button for Create Issue screen. Defaults to nil

*String, optional*

Your application name used for git issue creation link. Defaults to `Rails.application.class.parent_name.underscore`.
Your application name used for git issue creation link. Defaults to `Rails.application.class.module_parent_name.underscore` for Rails versions >= 6;
`Rails.application.class.parent_name.underscore` otherwise.
6 changes: 3 additions & 3 deletions exception_notification.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- test`.split("\n")
s.require_path = 'lib'

s.add_dependency('actionmailer', '>= 4.0', '< 6')
s.add_dependency('activesupport', '>= 4.0', '< 6')
s.add_dependency("actionmailer", ">= 4.0", "< 7")
s.add_dependency("activesupport", ">= 4.0", "< 7")

s.add_development_dependency 'appraisal', '~> 2.2.0'
s.add_development_dependency 'aws-sdk-sns', '~> 1'
Expand All @@ -28,7 +28,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'httparty', '~> 0.10.2'
s.add_development_dependency 'mock_redis', '~> 0.18.0'
s.add_development_dependency 'mocha', '>= 0.13.0'
s.add_development_dependency 'rails', '>= 4.0', '< 6'
s.add_development_dependency "rails", ">= 4.0", "< 7"
s.add_development_dependency 'resque', '~> 1.8.0'
s.add_development_dependency 'rubocop', '0.50.0'
# Sidekiq 3.2.2 does not support Ruby 1.9.
Expand Down
7 changes: 7 additions & 0 deletions gemfiles/rails6_0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 6.0.0.beta1"

gemspec path: "../"
8 changes: 7 additions & 1 deletion lib/exception_notifier/google_chat_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ def errors_count
end

def rails_app_name
Rails.application.class.parent_name.underscore if defined?(Rails)
if defined?(Rails)
if ::Gem::Version.new(Rails.version) >= ::Gem::Version.new('6.0')
Rails.application.class.module_parent_name.underscore
else
Rails.application.class.parent_name.underscore
end
end
end

def controller_text
Expand Down
12 changes: 11 additions & 1 deletion lib/exception_notifier/mattermost_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def call(exception, options = {})

@env = @options.delete(:env)

@application_name = @options.delete(:app_name) || Rails.application.class.parent_name.underscore
@application_name = @options.delete(:app_name) || rails_app_name
@gitlab_url = @options.delete(:git_url)
@username = @options.delete(:username) || 'Exception Notifier'
@avatar = @options.delete(:avatar)
Expand Down Expand Up @@ -159,5 +159,15 @@ def hash_presentation(hash)

text.join("\n")
end

def rails_app_name
if defined?(Rails)
if ::Gem::Version.new(Rails.version) >= ::Gem::Version.new('6.0')
Rails.application.class.module_parent_name.underscore
else
Rails.application.class.parent_name.underscore
end
end
end
end
end
12 changes: 11 additions & 1 deletion lib/exception_notifier/teams_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def call(exception, options = {})

@env = @options.delete(:env)

@application_name = @options.delete(:app_name) || Rails.application.class.parent_name.underscore
@application_name = @options.delete(:app_name) || rails_app_name
@gitlab_url = @options.delete(:git_url)
@jira_url = @options.delete(:jira_url)

Expand Down Expand Up @@ -174,5 +174,15 @@ def hash_presentation(hash)

text.join(" \n")
end

def rails_app_name
if defined?(Rails)
if ::Gem::Version.new(Rails.version) >= ::Gem::Version.new('6.0')
Rails.application.class.module_parent_name.underscore
else
Rails.application.class.parent_name.underscore
end
end
end
end
end

0 comments on commit a817e36

Please sign in to comment.