-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from kpumuk/dmytro/railtie
Moved Rails initialization into a Railtie
- Loading branch information
Showing
13 changed files
with
75 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ engines: | |
|
||
rubocop: | ||
enabled: true | ||
channel: rubocop-0-74 | ||
channel: rubocop-0-75 | ||
|
||
ratings: | ||
paths: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ doc | |
pkg | ||
*.gem | ||
.idea | ||
log/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module MetaTags | ||
class Railtie < Rails::Railtie | ||
initializer 'meta_tags.setup_action_controller' do | ||
ActiveSupport.on_load :action_controller do | ||
ActionController::Base.include MetaTags::ControllerHelper | ||
end | ||
end | ||
|
||
initializer 'meta_tags.setup_action_view' do | ||
ActiveSupport.on_load :action_view do | ||
ActionView::Base.include MetaTags::ViewHelper | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module MetaTags | ||
# Gem version. | ||
VERSION = '2.12.0' | ||
VERSION = '2.13.0' | ||
public_constant :VERSION | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
# Pretend we are a normal Rails application to trigger all the initializers | ||
# that are normally happen during Rails boot process. This is done to properly | ||
# test Railtie used by this gem to properly integrate into the Rails. | ||
# | ||
# TLDR. This is a real Rails application | ||
|
||
require 'rails' | ||
require 'action_controller/railtie' | ||
require 'action_view/railtie' | ||
require 'meta_tags/railtie' | ||
|
||
module MetaTagsRailsApp | ||
class Application < Rails::Application | ||
config.secret_token = '572c86f5ede338bd8aba8dae0fd3a326aabababc98d1e6ce34b9f5' | ||
config.eager_load = false | ||
end | ||
|
||
class MetaTagsController < ActionController::Base | ||
include MetaTags::ControllerHelper | ||
|
||
def index | ||
@page_title = 'title' | ||
@page_keywords = 'key1, key2, key3' | ||
@page_description = 'description' | ||
|
||
render plain: '_rendered_' | ||
end | ||
|
||
public :set_meta_tags, :meta_tags | ||
end | ||
|
||
class MetaTagsView < ActionView::Base | ||
include MetaTags::ViewHelper | ||
end | ||
end | ||
|
||
# Alright, we're all set. Let's boot! | ||
Rails.application.initialize! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters