Skip to content

Commit

Permalink
ref: Rewrite extends loading in Engine (#15)
Browse files Browse the repository at this point in the history
* Remove unneded dependency

* update chrome setup

* Move config.to_prepare in the initializer
  • Loading branch information
alecslupu authored Apr 5, 2024
1 parent 79f2a5f commit a3e77fb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,19 @@ jobs:
name: Create test app
- run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
name: Create the screenshots folder
- uses: nanasess/[email protected]
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: 119.0.6045.105
- name: List Chrome
shell: "bash"
run: apt list --installed | grep chrome
- name: Remove Chrome
shell: "bash"
run: sudo apt remove google-chrome-stable
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: 119.0.6045.105

- run: RAILS_ENV=test bundle exec rails assets:precompile
name: Precompile assets
working-directory: ./spec/decidim_dummy_app/
Expand Down
20 changes: 7 additions & 13 deletions lib/decidim/phone_authorization_handler/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@ module PhoneAuthorizationHandler
class Engine < ::Rails::Engine
isolate_namespace Decidim::PhoneAuthorizationHandler

config.to_prepare do
Decidim::Proposals::ProposalSerializer.prepend(Decidim::PhoneAuthorizationHandler::Extends::ProposalSerializerExtend)

Decidim::Exporters::CSV.prepend(Decidim::PhoneAuthorizationHandler::Extends::CSVExporterExtend)
Decidim::Exporters::Excel.prepend(Decidim::PhoneAuthorizationHandler::Extends::ExcelExporterExtend)
Decidim::Exporters::JSON.prepend(Decidim::PhoneAuthorizationHandler::Extends::JSONExporterExtend)
end

initializer "decidim.phone_authorization_handler" do
require "decidim/exporters/serializer"
require "decidim/exporters/csv"
require "decidim/exporters/json"
require "decidim/exporters/excel"
require "decidim/proposals/proposal_serializer"
config.to_prepare do
Decidim::Proposals::ProposalSerializer.prepend(Decidim::PhoneAuthorizationHandler::Extends::ProposalSerializerExtend)

Decidim::Exporters::CSV.prepend(Decidim::PhoneAuthorizationHandler::Extends::CSVExporterExtend)
Decidim::Exporters::Excel.prepend(Decidim::PhoneAuthorizationHandler::Extends::ExcelExporterExtend)
Decidim::Exporters::JSON.prepend(Decidim::PhoneAuthorizationHandler::Extends::JSONExporterExtend)
end
end
end
end
Expand Down

0 comments on commit a3e77fb

Please sign in to comment.