munster 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +14 -0
  3. data/.standard.yml +3 -0
  4. data/CHANGELOG.md +3 -0
  5. data/LICENSE +21 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +39 -0
  8. data/Rakefile +18 -0
  9. data/config/routes.rb +3 -0
  10. data/example/.gitattributes +7 -0
  11. data/example/.gitignore +29 -0
  12. data/example/.ruby-version +1 -0
  13. data/example/Gemfile +32 -0
  14. data/example/Gemfile.lock +208 -0
  15. data/example/README.md +24 -0
  16. data/example/Rakefile +8 -0
  17. data/example/app/assets/images/.keep +0 -0
  18. data/example/app/assets/stylesheets/application.css +1 -0
  19. data/example/app/controllers/application_controller.rb +4 -0
  20. data/example/app/controllers/concerns/.keep +0 -0
  21. data/example/app/helpers/application_helper.rb +4 -0
  22. data/example/app/models/application_record.rb +5 -0
  23. data/example/app/models/concerns/.keep +0 -0
  24. data/example/app/views/layouts/application.html.erb +15 -0
  25. data/example/app/webhooks/test_handler.rb +28 -0
  26. data/example/bin/bundle +109 -0
  27. data/example/bin/rails +4 -0
  28. data/example/bin/rake +4 -0
  29. data/example/bin/setup +33 -0
  30. data/example/config/application.rb +39 -0
  31. data/example/config/boot.rb +5 -0
  32. data/example/config/credentials.yml.enc +1 -0
  33. data/example/config/database.yml +25 -0
  34. data/example/config/environment.rb +7 -0
  35. data/example/config/environments/development.rb +61 -0
  36. data/example/config/environments/production.rb +71 -0
  37. data/example/config/environments/test.rb +52 -0
  38. data/example/config/initializers/assets.rb +14 -0
  39. data/example/config/initializers/content_security_policy.rb +27 -0
  40. data/example/config/initializers/filter_parameter_logging.rb +10 -0
  41. data/example/config/initializers/generators.rb +7 -0
  42. data/example/config/initializers/inflections.rb +18 -0
  43. data/example/config/initializers/munster.rb +7 -0
  44. data/example/config/initializers/permissions_policy.rb +13 -0
  45. data/example/config/locales/en.yml +33 -0
  46. data/example/config/puma.rb +45 -0
  47. data/example/config/routes.rb +5 -0
  48. data/example/config.ru +8 -0
  49. data/example/db/migrate/20240523125859_create_munster_tables.rb +22 -0
  50. data/example/db/schema.rb +24 -0
  51. data/example/db/seeds.rb +9 -0
  52. data/example/lib/assets/.keep +0 -0
  53. data/example/lib/tasks/.keep +0 -0
  54. data/example/log/.keep +0 -0
  55. data/example/public/404.html +67 -0
  56. data/example/public/422.html +67 -0
  57. data/example/public/500.html +66 -0
  58. data/example/public/apple-touch-icon-precomposed.png +0 -0
  59. data/example/public/apple-touch-icon.png +0 -0
  60. data/example/public/favicon.ico +0 -0
  61. data/example/public/robots.txt +1 -0
  62. data/example/test/controllers/.keep +0 -0
  63. data/example/test/fixtures/files/.keep +0 -0
  64. data/example/test/helpers/.keep +0 -0
  65. data/example/test/integration/.keep +0 -0
  66. data/example/test/models/.keep +0 -0
  67. data/example/test/test_helper.rb +15 -0
  68. data/example/tmp/.keep +0 -0
  69. data/example/tmp/pids/.keep +0 -0
  70. data/example/vendor/.keep +0 -0
  71. data/lib/munster/base_handler.rb +67 -0
  72. data/lib/munster/controllers/receive_webhooks_controller.rb +52 -0
  73. data/lib/munster/engine.rb +22 -0
  74. data/lib/munster/install_generator.rb +30 -0
  75. data/lib/munster/jobs/processing_job.rb +14 -0
  76. data/lib/munster/models/received_webhook.rb +23 -0
  77. data/lib/munster/state_machine_enum.rb +125 -0
  78. data/lib/munster/templates/create_munster_tables.rb.erb +23 -0
  79. data/lib/munster/templates/munster.rb +4 -0
  80. data/lib/munster/version.rb +5 -0
  81. data/lib/munster.rb +23 -0
  82. data/lib/tasks/munster_tasks.rake +4 -0
  83. data/sig/munster.rbs +4 -0
  84. metadata +197 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 11f34eb8fe918df292345851086c9190018d344bf73373125a1caec2e34984c8
4
+ data.tar.gz: 51741866e336befe8d663cb27e225f8f9adff3552f3247437a11b3d0d966557d
5
+ SHA512:
6
+ metadata.gz: 565266df3f8b518248b20ba6e5d7f12e420ee3cce7755f1d775a69c8ff3f99ef22db9d016051f23670f2b2e3326e72d17b28f0152641b052bf0a25daa4d04c12
7
+ data.tar.gz: cc689a7151f3dcf888efd826f87697c7cd552d6804b1e082242abffb6d83c2e4285e51feec3c97761ff1e6c6a30ff58d28d7762239af30ea6d6264c2934cb291
data/.editorconfig ADDED
@@ -0,0 +1,14 @@
1
+ # top-most EditorConfig file
2
+ root = true
3
+
4
+ # Unix-style newlines with a newline ending every file
5
+ # Two spaces for indenting
6
+ [*]
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ indent_style = space
10
+ indent_size = 2
11
+ charset = utf-8
12
+ trim_trailing_whitespace = true
13
+ max_line_length = 120
14
+
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0
2
+
3
+ - Initial release
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Cheddar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Stanislav Katkov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Munster
2
+ Munster is a Rails engine that provides a webhook endpoint for receiving and processing webhooks from various services. Engine stores received webhook first and later processes webhook in a separete async process.
3
+
4
+ Source code is extracted from https://cheddar.me/ main service to be used in internal microservices. Code here could be a subject to change while we flesh out details.
5
+
6
+ Due to that, support for this gem is limited.
7
+
8
+ ## Installation
9
+
10
+ Install the gem and add to the application's Gemfile by executing:
11
+
12
+ $ bundle add munster
13
+
14
+ If bundler is not being used to manage dependencies, install the gem by executing:
15
+
16
+ $ gem install munster
17
+
18
+ ## Usage
19
+ Generate migrations and initializer file.
20
+
21
+ `munster:install`
22
+
23
+ Mount munster engine in your routes.
24
+
25
+ `mount Munster::Engine, at: "/webhooks"`
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cheddar-me/munster.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
4
+
5
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
6
+ load "rails/tasks/engine.rake"
7
+
8
+ load "rails/tasks/statistics.rake"
9
+
10
+ require "bundler/gem_tasks"
11
+ require "standard/rake"
12
+
13
+ task :format do
14
+ `bundle exec standardrb --fix`
15
+ `bundle exec magic_frozen_string_literal .`
16
+ end
17
+
18
+ task default: %i[standard]
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Munster::Engine.routes.draw do
2
+ post "/:service_id", to: "receive_webhooks#create", namespace: "munster"
3
+ end
@@ -0,0 +1,7 @@
1
+ # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
+
3
+ # Mark the database schema as having been generated.
4
+ db/schema.rb linguist-generated
5
+
6
+ # Mark any vendored files as having been vendored.
7
+ vendor/* linguist-vendored
@@ -0,0 +1,29 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-*
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore pidfiles, but keep the directory.
21
+ /tmp/pids/*
22
+ !/tmp/pids/
23
+ !/tmp/pids/.keep
24
+
25
+
26
+ /public/assets
27
+
28
+ # Ignore master key for decrypting credentials and more.
29
+ /config/master.key
@@ -0,0 +1 @@
1
+ ruby-3.2.2
data/example/Gemfile ADDED
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
+
6
+ ruby "3.2.2"
7
+
8
+ # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
9
+ gem "rails", "~> 7.0.8", ">= 7.0.8.1"
10
+
11
+ # The modern asset pipeline for Rails [https://github.com/rails/propshaft]
12
+ gem "propshaft"
13
+
14
+ # Use sqlite3 as the database for Active Record
15
+ gem "sqlite3", "~> 1.4"
16
+
17
+ # Use the Puma web server [https://github.com/puma/puma]
18
+ gem "puma", "~> 5.0"
19
+
20
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
21
+ gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
22
+ gem "munster", path: "../"
23
+
24
+ group :development, :test do
25
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
26
+ gem "debug", platforms: %i[mri mingw x64_mingw]
27
+ end
28
+
29
+ group :development do
30
+ # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
31
+ # gem "spring"
32
+ end
@@ -0,0 +1,208 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ munster (0.1.0)
5
+ rails (~> 7.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (7.0.8.1)
11
+ actionpack (= 7.0.8.1)
12
+ activesupport (= 7.0.8.1)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (7.0.8.1)
16
+ actionpack (= 7.0.8.1)
17
+ activejob (= 7.0.8.1)
18
+ activerecord (= 7.0.8.1)
19
+ activestorage (= 7.0.8.1)
20
+ activesupport (= 7.0.8.1)
21
+ mail (>= 2.7.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.0.8.1)
26
+ actionpack (= 7.0.8.1)
27
+ actionview (= 7.0.8.1)
28
+ activejob (= 7.0.8.1)
29
+ activesupport (= 7.0.8.1)
30
+ mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ rails-dom-testing (~> 2.0)
35
+ actionpack (7.0.8.1)
36
+ actionview (= 7.0.8.1)
37
+ activesupport (= 7.0.8.1)
38
+ rack (~> 2.0, >= 2.2.4)
39
+ rack-test (>= 0.6.3)
40
+ rails-dom-testing (~> 2.0)
41
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
+ actiontext (7.0.8.1)
43
+ actionpack (= 7.0.8.1)
44
+ activerecord (= 7.0.8.1)
45
+ activestorage (= 7.0.8.1)
46
+ activesupport (= 7.0.8.1)
47
+ globalid (>= 0.6.0)
48
+ nokogiri (>= 1.8.5)
49
+ actionview (7.0.8.1)
50
+ activesupport (= 7.0.8.1)
51
+ builder (~> 3.1)
52
+ erubi (~> 1.4)
53
+ rails-dom-testing (~> 2.0)
54
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
+ activejob (7.0.8.1)
56
+ activesupport (= 7.0.8.1)
57
+ globalid (>= 0.3.6)
58
+ activemodel (7.0.8.1)
59
+ activesupport (= 7.0.8.1)
60
+ activerecord (7.0.8.1)
61
+ activemodel (= 7.0.8.1)
62
+ activesupport (= 7.0.8.1)
63
+ activestorage (7.0.8.1)
64
+ actionpack (= 7.0.8.1)
65
+ activejob (= 7.0.8.1)
66
+ activerecord (= 7.0.8.1)
67
+ activesupport (= 7.0.8.1)
68
+ marcel (~> 1.0)
69
+ mini_mime (>= 1.1.0)
70
+ activesupport (7.0.8.1)
71
+ concurrent-ruby (~> 1.0, >= 1.0.2)
72
+ i18n (>= 1.6, < 2)
73
+ minitest (>= 5.1)
74
+ tzinfo (~> 2.0)
75
+ builder (3.2.4)
76
+ concurrent-ruby (1.2.3)
77
+ crass (1.0.6)
78
+ date (3.3.4)
79
+ debug (1.9.2)
80
+ irb (~> 1.10)
81
+ reline (>= 0.3.8)
82
+ erubi (1.12.0)
83
+ globalid (1.2.1)
84
+ activesupport (>= 6.1)
85
+ i18n (1.14.5)
86
+ concurrent-ruby (~> 1.0)
87
+ io-console (0.7.2)
88
+ irb (1.13.1)
89
+ rdoc (>= 4.0.0)
90
+ reline (>= 0.4.2)
91
+ loofah (2.22.0)
92
+ crass (~> 1.0.2)
93
+ nokogiri (>= 1.12.0)
94
+ mail (2.8.1)
95
+ mini_mime (>= 0.1.1)
96
+ net-imap
97
+ net-pop
98
+ net-smtp
99
+ marcel (1.0.4)
100
+ method_source (1.1.0)
101
+ mini_mime (1.1.5)
102
+ minitest (5.22.3)
103
+ net-imap (0.4.11)
104
+ date
105
+ net-protocol
106
+ net-pop (0.1.2)
107
+ net-protocol
108
+ net-protocol (0.2.2)
109
+ timeout
110
+ net-smtp (0.5.0)
111
+ net-protocol
112
+ nio4r (2.7.3)
113
+ nokogiri (1.16.5-aarch64-linux)
114
+ racc (~> 1.4)
115
+ nokogiri (1.16.5-arm-linux)
116
+ racc (~> 1.4)
117
+ nokogiri (1.16.5-arm64-darwin)
118
+ racc (~> 1.4)
119
+ nokogiri (1.16.5-x86-linux)
120
+ racc (~> 1.4)
121
+ nokogiri (1.16.5-x86_64-darwin)
122
+ racc (~> 1.4)
123
+ nokogiri (1.16.5-x86_64-linux)
124
+ racc (~> 1.4)
125
+ propshaft (0.8.0)
126
+ actionpack (>= 7.0.0)
127
+ activesupport (>= 7.0.0)
128
+ rack
129
+ railties (>= 7.0.0)
130
+ psych (5.1.2)
131
+ stringio
132
+ puma (5.6.8)
133
+ nio4r (~> 2.0)
134
+ racc (1.7.3)
135
+ rack (2.2.9)
136
+ rack-test (2.1.0)
137
+ rack (>= 1.3)
138
+ rails (7.0.8.1)
139
+ actioncable (= 7.0.8.1)
140
+ actionmailbox (= 7.0.8.1)
141
+ actionmailer (= 7.0.8.1)
142
+ actionpack (= 7.0.8.1)
143
+ actiontext (= 7.0.8.1)
144
+ actionview (= 7.0.8.1)
145
+ activejob (= 7.0.8.1)
146
+ activemodel (= 7.0.8.1)
147
+ activerecord (= 7.0.8.1)
148
+ activestorage (= 7.0.8.1)
149
+ activesupport (= 7.0.8.1)
150
+ bundler (>= 1.15.0)
151
+ railties (= 7.0.8.1)
152
+ rails-dom-testing (2.2.0)
153
+ activesupport (>= 5.0.0)
154
+ minitest
155
+ nokogiri (>= 1.6)
156
+ rails-html-sanitizer (1.6.0)
157
+ loofah (~> 2.21)
158
+ nokogiri (~> 1.14)
159
+ railties (7.0.8.1)
160
+ actionpack (= 7.0.8.1)
161
+ activesupport (= 7.0.8.1)
162
+ method_source
163
+ rake (>= 12.2)
164
+ thor (~> 1.0)
165
+ zeitwerk (~> 2.5)
166
+ rake (13.2.1)
167
+ rdoc (6.6.3.1)
168
+ psych (>= 4.0.0)
169
+ reline (0.5.7)
170
+ io-console (~> 0.5)
171
+ sqlite3 (1.7.3-aarch64-linux)
172
+ sqlite3 (1.7.3-arm-linux)
173
+ sqlite3 (1.7.3-arm64-darwin)
174
+ sqlite3 (1.7.3-x86-linux)
175
+ sqlite3 (1.7.3-x86_64-darwin)
176
+ sqlite3 (1.7.3-x86_64-linux)
177
+ stringio (3.1.0)
178
+ thor (1.3.1)
179
+ timeout (0.4.1)
180
+ tzinfo (2.0.6)
181
+ concurrent-ruby (~> 1.0)
182
+ websocket-driver (0.7.6)
183
+ websocket-extensions (>= 0.1.0)
184
+ websocket-extensions (0.1.5)
185
+ zeitwerk (2.6.14)
186
+
187
+ PLATFORMS
188
+ aarch64-linux
189
+ arm-linux
190
+ arm64-darwin
191
+ x86-linux
192
+ x86_64-darwin
193
+ x86_64-linux
194
+
195
+ DEPENDENCIES
196
+ debug
197
+ munster!
198
+ propshaft
199
+ puma (~> 5.0)
200
+ rails (~> 7.0.8, >= 7.0.8.1)
201
+ sqlite3 (~> 1.4)
202
+ tzinfo-data
203
+
204
+ RUBY VERSION
205
+ ruby 3.2.2p53
206
+
207
+ BUNDLED WITH
208
+ 2.5.6
data/example/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
data/example/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5
+
6
+ require_relative "config/application"
7
+
8
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1 @@
1
+ /* Application styles */
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ end
File without changes
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ primary_abstract_class
5
+ end
File without changes
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Example</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag "application" %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This handler accepts webhooks from our integration tests. This webhook gets dispatched
4
+ # if a banking provider test fails, indicating that the bank might be having an incident
5
+
6
+ class WebhookTestHandler < Munster::BaseHandler
7
+ def self.valid?(request)
8
+ true
9
+ end
10
+
11
+ def self.process(webhook)
12
+ return unless webhook.received?
13
+ webhook.update!(status: "processing")
14
+ wait(5)
15
+ webhook.update!(status: "processed")
16
+ rescue
17
+ webhook.update!(status: "received")
18
+ raise
19
+ end
20
+
21
+ def self.service_id
22
+ :test
23
+ end
24
+
25
+ def self.expose_errors_to_sender?
26
+ true
27
+ end
28
+ end
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../Gemfile", __dir__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
+ env_var_version ||
66
+ cli_arg_version ||
67
+ bundler_requirement_for(lockfile_version)
68
+ end
69
+
70
+ def bundler_requirement_for(version)
71
+ return "#{Gem::Requirement.default}.a" unless version
72
+
73
+ bundler_gem_version = Gem::Version.new(version)
74
+
75
+ bundler_gem_version.approximate_recommendation
76
+ end
77
+
78
+ def load_bundler!
79
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
80
+
81
+ activate_bundler
82
+ end
83
+
84
+ def activate_bundler
85
+ gem_error = activation_error_handling do
86
+ gem "bundler", bundler_requirement
87
+ end
88
+ return if gem_error.nil?
89
+ require_error = activation_error_handling do
90
+ require "bundler/version"
91
+ end
92
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
93
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
94
+ exit 42
95
+ end
96
+
97
+ def activation_error_handling
98
+ yield
99
+ nil
100
+ rescue StandardError, LoadError => e
101
+ e
102
+ end
103
+ end
104
+
105
+ m.load_bundler!
106
+
107
+ if m.invoked_as_script?
108
+ load Gem.bin_path("bundler", "bundle")
109
+ end
data/example/bin/rails ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
data/example/bin/rake ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "rake"
4
+ Rake.application.run