publishing_platform_app_config 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea7eb6a338b040aba9272faf3130d42aed758692158ef9a010bf038e5b887ef4
4
- data.tar.gz: 599d4301e0865e826df615ec3f715a326f95bd1bfc5588f6fe2d33cd363b606b
3
+ metadata.gz: 4b2e3bc5b89e3b4a47cf69d695c6dc61d83b10efa3209be95a7903aa7f9e96e1
4
+ data.tar.gz: 8a92dff954b7338cb787cec741c1ade155c71b0ebaa65720e59f81865192c3ac
5
5
  SHA512:
6
- metadata.gz: db2c14514990234c81df6dd6728d3281402401125c51f2328218b98cb50c06c049dac67a968f25f6f0ee52cebae21d2158d7f9d26fb99d3da6a0452077d422e7
7
- data.tar.gz: d1fe89fb6a497fff2a5abdb181edb40633dc1467c11e85a610e3a4957b311281118068f948fb17355a1c8a3ee891c15e4ad3a45729302dae810ac01b63f90bcd
6
+ metadata.gz: 49197ae21a0e92c4c1bcdac435890ee3104f952c14819369678427fa65155b3d8add5205a7bad6e1ccd0c5b6c41d75f9eff3e7c9fe78f2ea0b78af0c4d7a0cb0
7
+ data.tar.gz: 57fb61a4adac41174e0ba782f6e187b4100eba3d4ffee378f4b3551724efd161054e3620065cd9b4b99341060e784b9a36ad51497c45ee06dcc658901d3d43e1
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
8
+ - package-ecosystem: github-actions
9
+ directory: "/"
10
+ schedule:
11
+ interval: daily
12
+ open-pull-requests-limit: 10
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ # This matrix job runs the test suite against multiple Ruby versions
7
+ test_matrix:
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: [3.2, 3.3]
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ bundler-cache: true
19
+ - run: bundle exec rake
20
+
21
+ # Branch protection rules cannot directly depend on status checks from matrix jobs.
22
+ # So instead we define `test` as a dummy job which only runs after the preceding `test_matrix` checks have passed.
23
+ # Solution inspired by: https://github.community/t/status-check-for-a-matrix-jobs/127354/3
24
+ test:
25
+ needs: test_matrix
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - run: echo "All matrix tests have passed 🚀"
29
+
30
+ publish:
31
+ needs: test
32
+ if: ${{ github.ref == 'refs/heads/main' }}
33
+ permissions:
34
+ contents: write
35
+ uses: publishing-platform/publishing-platform-infrastructure/.github/workflows/publish-rubygem.yml@main
36
+ secrets:
37
+ GEM_HOST_API_KEY: ${{ secrets.PUBLISHING_PLATFORM_RUBYGEMS_API_KEY }}
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.4
data/Rakefile CHANGED
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
4
5
  require "rspec/core/rake_task"
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new
7
9
 
8
- task default: :spec
10
+ task default: %i[rubocop spec]
@@ -34,7 +34,7 @@ module PublishingPlatformError
34
34
  raise PublishingPlatformError::AlreadyInitialised if is_configured?
35
35
 
36
36
  if defined?(Sidekiq) && !defined?(Sentry::Sidekiq)
37
- warn "Warning: PublishingPlatformAppConfig is not configured to track Sidekiq errors, install the sentry-sidekiq gem to track them."
37
+ warn "Warning: PublishingPlatformError is not configured to track Sidekiq errors, install the sentry-sidekiq gem to track them."
38
38
  end
39
39
 
40
40
  Sentry.init do |sentry_config|
@@ -0,0 +1,31 @@
1
+ module PublishingPlatformPuma
2
+ def self.configure_rails(config)
3
+ config.port ENV.fetch("PORT", 3000)
4
+
5
+ config.environment ENV.fetch("RAILS_ENV", "development")
6
+
7
+ # `worker_timeout` specifies how many seconds Puma will wait before terminating a worker.
8
+ timeout = if ENV.fetch("RAILS_ENV", "development") == "development"
9
+ 3600
10
+ else
11
+ Integer(ENV.fetch("PUMA_TIMEOUT", 15))
12
+ end
13
+ config.worker_timeout timeout
14
+
15
+ # When changing the min/max threads for Puma, also consider changing ActiveRecord to match.
16
+ max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
17
+ min_threads_count = ENV.fetch("RAILS_MIN_THREADS", max_threads_count)
18
+ config.threads min_threads_count, max_threads_count
19
+
20
+ # `workers` specifies the number of worker processes that Puma will fork.
21
+ # The overall concurrency limit is worker count * max threads per worker.
22
+ config.workers ENV.fetch("WEB_CONCURRENCY", 2)
23
+
24
+ # `preload_app!` tells Puma to load application code before forking worker processes.
25
+ # This reduces RAM wastage by making better use of copy-on-write.
26
+ config.preload_app!
27
+
28
+ # Allow puma to be restarted by `rails restart` command.
29
+ config.plugin :tmp_restart
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PublishingPlatformAppConfig
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -10,15 +10,19 @@ Gem::Specification.new do |spec|
10
10
  spec.summary = "Base configuration for Publishing Platform applications"
11
11
  spec.description = "Base configuration for Publishing Platform applications"
12
12
  spec.license = "MIT"
13
- spec.required_ruby_version = ">= 3.0"
13
+ spec.required_ruby_version = ">= 3.1"
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
16
  spec.bindir = "exe"
17
17
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = %w[lib]
19
19
 
20
+ spec.add_dependency "puma", ">= 5.6", "< 7.0"
20
21
  spec.add_dependency "sentry-rails", "~> 5.3"
21
22
  spec.add_dependency "sentry-ruby", "~> 5.3"
22
23
 
24
+ spec.add_development_dependency "climate_control"
23
25
  spec.add_development_dependency "publishing_platform_rubocop"
26
+ spec.add_development_dependency "rails", "~> 7"
27
+ spec.add_development_dependency "simplecov"
24
28
  end
metadata CHANGED
@@ -1,15 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: publishing_platform_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Publishing Platform
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-08-29 00:00:00.000000000 Z
10
+ date: 2025-01-17 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: puma
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '5.6'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '7.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '5.6'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '7.0'
13
32
  - !ruby/object:Gem::Dependency
14
33
  name: sentry-rails
15
34
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +57,20 @@ dependencies:
38
57
  - - "~>"
39
58
  - !ruby/object:Gem::Version
40
59
  version: '5.3'
60
+ - !ruby/object:Gem::Dependency
61
+ name: climate_control
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
41
74
  - !ruby/object:Gem::Dependency
42
75
  name: publishing_platform_rubocop
43
76
  requirement: !ruby/object:Gem::Requirement
@@ -52,16 +85,45 @@ dependencies:
52
85
  - - ">="
53
86
  - !ruby/object:Gem::Version
54
87
  version: '0'
88
+ - !ruby/object:Gem::Dependency
89
+ name: rails
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '7'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '7'
102
+ - !ruby/object:Gem::Dependency
103
+ name: simplecov
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ type: :development
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
55
116
  description: Base configuration for Publishing Platform applications
56
- email:
57
117
  executables: []
58
118
  extensions: []
59
119
  extra_rdoc_files: []
60
120
  files:
61
- - ".github/workflows/main.yml"
121
+ - ".github/dependabot.yml"
122
+ - ".github/workflows/ci.yml"
62
123
  - ".gitignore"
63
124
  - ".rspec"
64
125
  - ".rubocop.yml"
126
+ - ".ruby-version"
65
127
  - Gemfile
66
128
  - LICENSE
67
129
  - README.md
@@ -72,14 +134,13 @@ files:
72
134
  - lib/publishing_platform_app_config/publishing_platform_content_security_policy.rb
73
135
  - lib/publishing_platform_app_config/publishing_platform_error.rb
74
136
  - lib/publishing_platform_app_config/publishing_platform_error/configuration.rb
137
+ - lib/publishing_platform_app_config/publishing_platform_puma.rb
75
138
  - lib/publishing_platform_app_config/railtie.rb
76
139
  - lib/publishing_platform_app_config/version.rb
77
140
  - publishing_platform_app_config.gemspec
78
- homepage:
79
141
  licenses:
80
142
  - MIT
81
143
  metadata: {}
82
- post_install_message:
83
144
  rdoc_options: []
84
145
  require_paths:
85
146
  - lib
@@ -87,15 +148,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
148
  requirements:
88
149
  - - ">="
89
150
  - !ruby/object:Gem::Version
90
- version: '3.0'
151
+ version: '3.1'
91
152
  required_rubygems_version: !ruby/object:Gem::Requirement
92
153
  requirements:
93
154
  - - ">="
94
155
  - !ruby/object:Gem::Version
95
156
  version: '0'
96
157
  requirements: []
97
- rubygems_version: 3.3.7
98
- signing_key:
158
+ rubygems_version: 3.6.3
99
159
  specification_version: 4
100
160
  summary: Base configuration for Publishing Platform applications
101
161
  test_files: []
@@ -1,27 +0,0 @@
1
- name: Ruby
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
-
8
- pull_request:
9
-
10
- jobs:
11
- build:
12
- runs-on: ubuntu-latest
13
- name: Ruby ${{ matrix.ruby }}
14
- strategy:
15
- matrix:
16
- ruby:
17
- - '3.1.2'
18
-
19
- steps:
20
- - uses: actions/checkout@v3
21
- - name: Set up Ruby
22
- uses: ruby/setup-ruby@v1
23
- with:
24
- ruby-version: ${{ matrix.ruby }}
25
- bundler-cache: true
26
- - name: Run the default task
27
- run: bundle exec rake