Class: PlanMyStuff::Configuration
- Inherits:
-
Object
- Object
- PlanMyStuff::Configuration
- Defined in:
- lib/plan_my_stuff/configuration.rb
Constant Summary collapse
- DEFAULT_CONTROLLERS =
Default controller for each controllable route group. Consuming apps override by assigning values into
controllers; lookups go throughcontroller_forwhich falls back to this table. { 'issues': 'plan_my_stuff/issues', 'comments': 'plan_my_stuff/comments', 'labels': 'plan_my_stuff/labels', 'projects': 'plan_my_stuff/projects', 'project_items': 'plan_my_stuff/project_items', 'testing_projects': 'plan_my_stuff/testing_projects', 'testing_project_items': 'plan_my_stuff/testing_project_items', 'issues/closures': 'plan_my_stuff/issues/closures', 'issues/viewers': 'plan_my_stuff/issues/viewers', 'issues/takes': 'plan_my_stuff/issues/takes', 'issues/testings': 'plan_my_stuff/issues/testings', 'issues/waitings': 'plan_my_stuff/issues/waitings', 'issues/links': 'plan_my_stuff/issues/links', 'issues/approvals': 'plan_my_stuff/issues/approvals', 'project_items/statuses': 'plan_my_stuff/project_items/statuses', 'project_items/assignments': 'plan_my_stuff/project_items/assignments', 'testing_project_items/results': 'plan_my_stuff/testing_project_items/results', 'webhooks/github': 'plan_my_stuff/webhooks/github', 'webhooks/aws': 'plan_my_stuff/webhooks/aws', }.freeze
Instance Attribute Summary collapse
-
#access_token ⇒ String
GitHub PAT with repo and project scopes.
-
#app_name ⇒ String?
Name of the consuming app, stored in metadata (e.g. “Atlas”).
-
#archive_closed_after_days ⇒ Integer
Days after
closed_atat which a non-inactive-closed issue becomes an archive candidate. -
#archived_label ⇒ String
Label name added to archived issues.
-
#archiving_enabled ⇒ Boolean
Whether the archive sweep performs any work.
-
#attachment_repo ⇒ String
Bare repo name (under
config.organization) that stores uploaded attachment binaries. -
#aws_service_identifier ⇒ String?
Suffix matched against ECS event resource ARNs (e.g. ‘rawr-production-2-web’).
-
#cache_enabled ⇒ Boolean
Whether to use Rails.cache for ETag-based HTTP caching of GitHub reads.
-
#cache_version ⇒ String?
Opaque app-supplied version string embedded in every PMS cache key.
-
#comment_custom_fields ⇒ Hash{Symbol => Hash}
Comment-only field definitions, deep-merged on top of shared custom_fields.
-
#controller_rescue ⇒ Proc?
Callback invoked from gem controller
rescueblocks just after the error is logged and just before the user-facing redirect/render. -
#controllers ⇒ Hash{Symbol => String}
Per-route controller overrides.
-
#current_user ⇒ Proc?
Fallback actor for notification events when a caller does not pass
user:. -
#custom_fields ⇒ Hash{Symbol => Hash}
Shared field definitions stored in issue/comment metadata.
-
#default_project_number ⇒ Integer?
Default GitHub Projects V2 number for add_to_project calls.
-
#default_repo ⇒ Symbol?
Default repo key used when callers omit repo: param.
-
#display_name_method ⇒ Symbol
Method called on user object to get display name for comment headers.
-
#eager_load_controllers_on_boot ⇒ Boolean
Whether to eager-load the engine’s controllers on host boot.
-
#github_login_for ⇒ Hash{Object => String}
Hash mapping consuming-app user id to GitHub login.
-
#import_access_token ⇒ String?
Classic GitHub PAT used for the Issues Import API (golden-comet-preview).
-
#inactivity_close_days ⇒ Integer
Days of inactivity after which the sweep auto-closes a waiting issue.
-
#issue_custom_fields ⇒ Hash{Symbol => Hash}
Issue-only field definitions, deep-merged on top of shared custom_fields.
-
#issue_field_names ⇒ Hash{String => String}
Canonical Issue Field name to consumer field name map.
-
#issue_field_values ⇒ Hash{String => Hash{String => String}}
Canonical Issue Field value translations, nested by canonical field name: { ‘Issue Status’ => { ‘Waiting on Reply’ => ‘Awaiting Customer’, … } }.
-
#issue_fields_enabled ⇒ Boolean
Whether GitHub’s Issue Fields (public preview) are wired up for the configured org.
-
#issue_types ⇒ Hash{String => String}
Canonical-name to org-side display-name map for GitHub native issue types.
-
#issues_url_prefix ⇒ String?
URL prefix for building user-facing ticket URLs in the consuming app.
-
#main_branch ⇒ String
Branch name that PRs merge into for “Ready for release” transition.
-
#markdown_options ⇒ Hash
Default options passed to the markdown renderer.
-
#markdown_renderer ⇒ Symbol
Which markdown gem to use: :commonmarker or :redcarpet.
-
#mount_groups ⇒ Hash{Symbol => Boolean}
Per-group route mounting toggles.
-
#organization ⇒ String
GitHub organization name.
-
#parent_controller ⇒ String
Parent class string for
PlanMyStuff::ApplicationController. -
#pipeline_completion_purge_enabled ⇒ Boolean
Whether the pipeline sweep removes aged-out
Completeditems. -
#pipeline_completion_ttl_hours ⇒ Integer
Hours after a project item’s last update at which the sweep removes it from the pipeline if its status is
Completed. -
#pipeline_enabled ⇒ Boolean
Whether the release pipeline feature is enabled.
-
#pipeline_project_number ⇒ Integer?
GitHub Projects V2 number for the pipeline board (falls back to default_project_number).
-
#pipeline_statuses ⇒ Hash{String => String}
Canonical status name to display alias map.
-
#pipeline_testing_field_name ⇒ String
Display name for the
Testingsingle-select custom field on the pipeline project. -
#pipeline_testing_values ⇒ Hash{Symbol => String}
Map of canonical testing field option keys (
:active,:inactive) to display labels. -
#process_aws_webhooks ⇒ Boolean
Whether to process incoming AWS webhook events.
-
#production_branch ⇒ String
Branch name that triggers deployment when a PR merges.
-
#production_commit_sha ⇒ String?
Commit hash of the deploying build, prefix-matched against issue metadata commit_sha.
-
#project_custom_fields ⇒ Hash{Symbol => Hash}
Project-only field definitions, deep-merged on top of shared custom_fields.
-
#reminder_days ⇒ Array<Integer>
Days-since-waiting at which reminder events fire.
-
#reminders_enabled ⇒ Boolean
Whether the reminders sweep performs any work.
-
#repo_nicknames ⇒ Hash{Symbol => String}
Human-readable repo names used as the
to_paramprefix onPlanMyStuff::Issueinstances. -
#repos ⇒ Hash{Symbol => String}
Named repo configs.
-
#sns_topic_arn ⇒ String?
Expected SNS topic ARN for AWS webhook validation.
-
#sns_verifier_class ⇒ Class
Class instantiated per request for SNS signature verification.
-
#sns_verifier_error ⇒ Class
Exception class rescued during SNS signature verification.
-
#support_method ⇒ Symbol, Proc
Determines if a user is support staff.
-
#testing_custom_fields ⇒ Hash{Symbol => Hash}
Testing-project-only field definitions, deep-merged on top of shared custom_fields.
-
#testing_template_project_number ⇒ Integer?
TestingProjects.
-
#user_class ⇒ String
Consuming app’s user model class name, constantized for lookups.
-
#user_id_method ⇒ Symbol
Method called on user object to extract the app-side user ID.
-
#user_inactive_label ⇒ String
Label name applied to issues auto-closed by the inactivity sweep.
-
#waiting_on_approval_label ⇒ String
Label name used to flag issues waiting on pending approvals.
-
#waiting_on_user_label ⇒ String
Label name used to flag issues waiting on an end-user reply.
-
#webhook_secret ⇒ String?
HMAC secret for GitHub webhook signature verification (required when webhooks mounted).
Instance Method Summary collapse
-
#authenticate_with(&block) ⇒ void
Sets the authentication block for engine controllers.
-
#controller_for(key) ⇒ String
Returns the controller path for the given route group, preferring a consuming-app override from
controllersand falling back to the gem default fromDEFAULT_CONTROLLERS. -
#custom_fields_for(context) ⇒ Hash{Symbol => Hash}
Returns the merged custom fields schema for the given context.
- #initialize ⇒ Configuration constructor
-
#repo_nickname_for(key) ⇒ String
Human-readable nickname for a repo key, used as the
to_paramprefix onPlanMyStuff::Issueinstances. -
#validate! ⇒ void
Validates that required configuration options are set.
Constructor Details
#initialize ⇒ Configuration
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/plan_my_stuff/configuration.rb', line 404 def initialize @repos = {} @repo_nicknames = {} @attachment_repo = 'pms-attachments' @user_class = 'User' @display_name_method = :to_s @user_id_method = :id @support_method = :support? @markdown_renderer = :commonmarker @markdown_options = {} @custom_fields = {} @issue_custom_fields = {} @comment_custom_fields = {} @project_custom_fields = {} @testing_custom_fields = {} @issue_types = {} @pipeline_enabled = true @pipeline_statuses = {} @pipeline_testing_field_name = PlanMyStuff::Pipeline::Testing::FIELD_NAME @pipeline_testing_values = PlanMyStuff::Pipeline::Testing::VALUES.dup @issue_field_names = {} @issue_field_values = {} @main_branch = 'main' @production_branch = 'production' @mount_groups = { webhooks: true, issues: true, projects: true } @controllers = {} @parent_controller = '::ApplicationController' @cache_enabled = true @github_login_for = {} @reminders_enabled = true @reminder_days = [1, 3, 7, 10, 14, 18].freeze @inactivity_close_days = 30 @waiting_on_user_label = 'waiting-on-user' @waiting_on_approval_label = 'waiting-on-approval' @user_inactive_label = 'user-inactive' @archiving_enabled = true @archive_closed_after_days = 90 @archived_label = 'archived' @pipeline_completion_purge_enabled = true @pipeline_completion_ttl_hours = 24 @issue_fields_enabled = true @eager_load_controllers_on_boot = false @process_aws_webhooks = Rails.env.production? @sns_verifier_class = ::Aws::SNS::MessageVerifier if defined?(::Aws::SNS::MessageVerifier) @sns_verifier_error = if defined?(::Aws::SNS::MessageVerifier::VerificationError) ::Aws::SNS::MessageVerifier::VerificationError end end |
Instance Attribute Details
#access_token ⇒ String
Returns GitHub PAT with repo and project scopes. Required.
33 34 35 |
# File 'lib/plan_my_stuff/configuration.rb', line 33 def access_token @access_token end |
#app_name ⇒ String?
Returns name of the consuming app, stored in metadata (e.g. “Atlas”).
160 161 162 |
# File 'lib/plan_my_stuff/configuration.rb', line 160 def app_name @app_name end |
#archive_closed_after_days ⇒ Integer
Days after closed_at at which a non-inactive-closed issue becomes an archive candidate.
321 322 323 |
# File 'lib/plan_my_stuff/configuration.rb', line 321 def archive_closed_after_days @archive_closed_after_days end |
#archived_label ⇒ String
Label name added to archived issues. Also used by the sweep as a skip marker to avoid re-archiving the same issue.
328 329 330 |
# File 'lib/plan_my_stuff/configuration.rb', line 328 def archived_label @archived_label end |
#archiving_enabled ⇒ Boolean
Whether the archive sweep performs any work. Defaults to true. Set to false in apps that don’t want auto-archiving of aged-closed issues.
315 316 317 |
# File 'lib/plan_my_stuff/configuration.rb', line 315 def archiving_enabled @archiving_enabled end |
#attachment_repo ⇒ String
Bare repo name (under config.organization) that stores uploaded attachment binaries. Defaults to ‘pms-attachments’. The repo must exist; the uploader does not create it. Attachments commit onto config.main_branch and live under <repo_key_or_name>/issue-<number>/<uuid>.<ext>.
383 384 385 |
# File 'lib/plan_my_stuff/configuration.rb', line 383 def @attachment_repo end |
#aws_service_identifier ⇒ String?
Returns suffix matched against ECS event resource ARNs (e.g. ‘rawr-production-2-web’).
175 176 177 |
# File 'lib/plan_my_stuff/configuration.rb', line 175 def aws_service_identifier @aws_service_identifier end |
#cache_enabled ⇒ Boolean
Whether to use Rails.cache for ETag-based HTTP caching of GitHub reads. Defaults to true; set to false to bypass the cache entirely.
263 264 265 |
# File 'lib/plan_my_stuff/configuration.rb', line 263 def cache_enabled @cache_enabled end |
#cache_version ⇒ String?
Opaque app-supplied version string embedded in every PMS cache key. Bumping this string invalidates all cached entries from the consuming app’s side (e.g. after a deploy or schema change). Defaults to nil.
270 271 272 |
# File 'lib/plan_my_stuff/configuration.rb', line 270 def cache_version @cache_version end |
#comment_custom_fields ⇒ Hash{Symbol => Hash}
Comment-only field definitions, deep-merged on top of shared custom_fields. Context-specific config wins on key conflicts.
127 128 129 |
# File 'lib/plan_my_stuff/configuration.rb', line 127 def comment_custom_fields @comment_custom_fields end |
#controller_rescue ⇒ Proc?
Callback invoked from gem controller rescue blocks just after the error is logged and just before the user-facing redirect/render. Lets consuming apps forward swallowed errors to their monitoring service. Receives the rescued exception.
Example:
config.controller_rescue = ->(error) { MonitoringService.notice_error(error) }
106 107 108 |
# File 'lib/plan_my_stuff/configuration.rb', line 106 def controller_rescue @controller_rescue end |
#controllers ⇒ Hash{Symbol => String}
Per-route controller overrides. Keys are the controllable route symbols defined in DEFAULT_CONTROLLERS; values are fully-qualified controller paths (e.g. ‘my_app/issues’). Unset keys fall back to the gem default. Consuming apps typically subclass the gem controller to add before_actions or tweak responses, then swap their subclass in here.
246 247 248 |
# File 'lib/plan_my_stuff/configuration.rb', line 246 def controllers @controllers end |
#current_user ⇒ Proc?
Fallback actor for notification events when a caller does not pass user:. Set to a proc/lambda that returns the current request user.
Example: config.current_user = -> { Current.user }
95 96 97 |
# File 'lib/plan_my_stuff/configuration.rb', line 95 def current_user @current_user end |
#custom_fields ⇒ Hash{Symbol => Hash}
Shared field definitions stored in issue/comment metadata. Keys are field names, values are hashes with :type and :required. These fields apply to both issues and comments.
113 114 115 |
# File 'lib/plan_my_stuff/configuration.rb', line 113 def custom_fields @custom_fields end |
#default_project_number ⇒ Integer?
Returns default GitHub Projects V2 number for add_to_project calls.
49 50 51 |
# File 'lib/plan_my_stuff/configuration.rb', line 49 def default_project_number @default_project_number end |
#default_repo ⇒ Symbol?
Returns default repo key used when callers omit repo: param.
46 47 48 |
# File 'lib/plan_my_stuff/configuration.rb', line 46 def default_repo @default_repo end |
#display_name_method ⇒ Symbol
Returns method called on user object to get display name for comment headers.
60 61 62 |
# File 'lib/plan_my_stuff/configuration.rb', line 60 def display_name_method @display_name_method end |
#eager_load_controllers_on_boot ⇒ Boolean
Whether to eager-load the engine’s controllers on host boot. Defaults to false (opt-in). When true, the engine walks app/controllers during after_initialize so defined?(PlanMyStuff::SomeController) resolves without first referencing the constant. Enable in host apps that rely on defined? probes against engine controllers in dev mode.
401 402 403 |
# File 'lib/plan_my_stuff/configuration.rb', line 401 def eager_load_controllers_on_boot @eager_load_controllers_on_boot end |
#github_login_for ⇒ Hash{Object => String}
Hash mapping consuming-app user id to GitHub login. Used by the “Take” UI flow to assign the GitHub user when a support user claims an issue. Keys are whatever config.user_id_method returns on the current user.
Example: config.github_login_for = { 1 => ‘some_username’, 2 => ‘octocat’ }
230 231 232 |
# File 'lib/plan_my_stuff/configuration.rb', line 230 def github_login_for @github_login_for end |
#import_access_token ⇒ String?
Classic GitHub PAT used for the Issues Import API (golden-comet-preview). Requires the repo scope (admin-level repository access). Fine-grained tokens are not supported by that endpoint.
40 41 42 |
# File 'lib/plan_my_stuff/configuration.rb', line 40 def import_access_token @import_access_token end |
#inactivity_close_days ⇒ Integer
Days of inactivity after which the sweep auto-closes a waiting issue.
289 290 291 |
# File 'lib/plan_my_stuff/configuration.rb', line 289 def inactivity_close_days @inactivity_close_days end |
#issue_custom_fields ⇒ Hash{Symbol => Hash}
Issue-only field definitions, deep-merged on top of shared custom_fields. Context-specific config wins on key conflicts.
120 121 122 |
# File 'lib/plan_my_stuff/configuration.rb', line 120 def issue_custom_fields @issue_custom_fields end |
#issue_field_names ⇒ Hash{String => String}
Canonical Issue Field name to consumer field name map. Lets a consuming org rename the native issue fields the gem refers to internally (e.g. “Issue Status” -> “Status”) without touching gem code. Applied via PlanMyStuff::IssueFieldTranslation on reads, writes, and filters; unmapped names pass through unchanged.
206 207 208 |
# File 'lib/plan_my_stuff/configuration.rb', line 206 def issue_field_names @issue_field_names end |
#issue_field_values ⇒ Hash{String => Hash{String => String}}
Canonical Issue Field value translations, nested by canonical field name: { ‘Issue Status’ => { ‘Waiting on Reply’ => ‘Awaiting Customer’, … } }. Lets a consuming org rename single-select option labels without touching gem code. Applied via PlanMyStuff::IssueFieldTranslation; unmapped fields / values pass through unchanged.
215 216 217 |
# File 'lib/plan_my_stuff/configuration.rb', line 215 def issue_field_values @issue_field_values end |
#issue_fields_enabled ⇒ Boolean
Whether GitHub’s Issue Fields (public preview) are wired up for the configured org. Defaults to true (opt-out): when false, Issue#issue_fields returns an empty IssueFieldValueSet without making a request and Issue#set_issue_fields! / IssueField.list raise IssueFieldsNotEnabledError. Set to false if your org has not been admitted to the Issue Fields preview, to avoid raw GraphQL errors from GitHub.
392 393 394 |
# File 'lib/plan_my_stuff/configuration.rb', line 392 def issue_fields_enabled @issue_fields_enabled end |
#issue_types ⇒ Hash{String => String}
Canonical-name to org-side display-name map for GitHub native issue types. Lets the consuming app rename the seven canonical types the gem knows about (+“Bug”+, “Feature”, “IT Issue / Hardware”, “Other”, “Performance”, “Question”, “Task”) to whatever their org actually uses. Both Symbol shortcuts (resolved via the gem’s nickname map) and String inputs to Issue.create! / Issue.update! are passed through this map; missing keys fall through unchanged.
Example: config.issue_types = { ‘Bug’ => ‘User Bug’, ‘Feature’ => ‘Enhancement’ } then issue_type: :feature or issue_type: ‘Feature’ both write ‘Enhancement’ to GitHub.
154 155 156 |
# File 'lib/plan_my_stuff/configuration.rb', line 154 def issue_types @issue_types end |
#issues_url_prefix ⇒ String?
Returns URL prefix for building user-facing ticket URLs in the consuming app.
157 158 159 |
# File 'lib/plan_my_stuff/configuration.rb', line 157 def issues_url_prefix @issues_url_prefix end |
#main_branch ⇒ String
Returns branch name that PRs merge into for “Ready for release” transition.
218 219 220 |
# File 'lib/plan_my_stuff/configuration.rb', line 218 def main_branch @main_branch end |
#markdown_options ⇒ Hash
Default options passed to the markdown renderer. Per-call options in Markdown.render merge on top of these.
For :commonmarker - passed as ‘options:` to `Commonmarker.to_html`
e.g. `{ render: { hardbreaks: true } }`
For :redcarpet - :render_options and :renderer are extracted for the HTML renderer;
remaining keys are passed as extensions to `Redcarpet::Markdown.new`
e.g. `{ render_options: { hard_wrap: true, no_styles: true }, autolink: true }`
86 87 88 |
# File 'lib/plan_my_stuff/configuration.rb', line 86 def @markdown_options end |
#markdown_renderer ⇒ Symbol
Returns which markdown gem to use: :commonmarker or :redcarpet.
73 74 75 |
# File 'lib/plan_my_stuff/configuration.rb', line 73 def markdown_renderer @markdown_renderer end |
#mount_groups ⇒ Hash{Symbol => Boolean}
Per-group route mounting toggles. Keys: :webhooks, :issues, :projects. Set a key to false to skip mounting that route group.
237 238 239 |
# File 'lib/plan_my_stuff/configuration.rb', line 237 def mount_groups @mount_groups end |
#organization ⇒ String
Returns GitHub organization name. Required.
43 44 45 |
# File 'lib/plan_my_stuff/configuration.rb', line 43 def organization @organization end |
#parent_controller ⇒ String
Parent class string for PlanMyStuff::ApplicationController. Defaults to ‘::ApplicationController’. Override when the consuming app does not use the ApplicationController name (e.g. ‘ActionController::Base’, ‘RawrApplicationController’). Must be set before the gem’s controllers load - the standard config/initializers/plan_my_stuff.rb location is correct, since Rails resolves the superclass once at class definition time.
256 257 258 |
# File 'lib/plan_my_stuff/configuration.rb', line 256 def parent_controller @parent_controller end |
#pipeline_completion_purge_enabled ⇒ Boolean
Whether the pipeline sweep removes aged-out Completed items. Defaults to true. Set to false to keep items in Completed indefinitely.
335 336 337 |
# File 'lib/plan_my_stuff/configuration.rb', line 335 def pipeline_completion_purge_enabled @pipeline_completion_purge_enabled end |
#pipeline_completion_ttl_hours ⇒ Integer
Hours after a project item’s last update at which the sweep removes it from the pipeline if its status is Completed. Defaults to 24.
342 343 344 |
# File 'lib/plan_my_stuff/configuration.rb', line 342 def pipeline_completion_ttl_hours @pipeline_completion_ttl_hours end |
#pipeline_enabled ⇒ Boolean
Returns whether the release pipeline feature is enabled.
163 164 165 |
# File 'lib/plan_my_stuff/configuration.rb', line 163 def pipeline_enabled @pipeline_enabled end |
#pipeline_project_number ⇒ Integer?
Returns GitHub Projects V2 number for the pipeline board (falls back to default_project_number).
166 167 168 |
# File 'lib/plan_my_stuff/configuration.rb', line 166 def pipeline_project_number @pipeline_project_number end |
#pipeline_statuses ⇒ Hash{String => String}
Canonical status name to display alias map. Allows consuming apps to rename pipeline statuses (e.g. “Started” to “In Progress”).
185 186 187 |
# File 'lib/plan_my_stuff/configuration.rb', line 185 def pipeline_statuses @pipeline_statuses end |
#pipeline_testing_field_name ⇒ String
Display name for the Testing single-select custom field on the pipeline project. Defaults to “Testing”.
191 192 193 |
# File 'lib/plan_my_stuff/configuration.rb', line 191 def pipeline_testing_field_name @pipeline_testing_field_name end |
#pipeline_testing_values ⇒ Hash{Symbol => String}
Map of canonical testing field option keys (:active, :inactive) to display labels. Allows consuming apps to rename the option labels without changing the canonical identifiers.
198 199 200 |
# File 'lib/plan_my_stuff/configuration.rb', line 198 def pipeline_testing_values @pipeline_testing_values end |
#process_aws_webhooks ⇒ Boolean
Whether to process incoming AWS webhook events. Defaults to Rails.env.production?.
348 349 350 |
# File 'lib/plan_my_stuff/configuration.rb', line 348 def process_aws_webhooks @process_aws_webhooks end |
#production_branch ⇒ String
Returns branch name that triggers deployment when a PR merges.
221 222 223 |
# File 'lib/plan_my_stuff/configuration.rb', line 221 def production_branch @production_branch end |
#production_commit_sha ⇒ String?
Returns commit hash of the deploying build, prefix-matched against issue metadata commit_sha.
178 179 180 |
# File 'lib/plan_my_stuff/configuration.rb', line 178 def production_commit_sha @production_commit_sha end |
#project_custom_fields ⇒ Hash{Symbol => Hash}
Project-only field definitions, deep-merged on top of shared custom_fields. Context-specific config wins on key conflicts.
134 135 136 |
# File 'lib/plan_my_stuff/configuration.rb', line 134 def project_custom_fields @project_custom_fields end |
#reminder_days ⇒ Array<Integer>
Days-since-waiting at which reminder events fire. Per-issue override via metadata.reminder_days.
283 284 285 |
# File 'lib/plan_my_stuff/configuration.rb', line 283 def reminder_days @reminder_days end |
#reminders_enabled ⇒ Boolean
Whether the reminders sweep performs any work. Defaults to true. Set to false in apps that don’t want follow-up reminders or inactivity auto-close.
277 278 279 |
# File 'lib/plan_my_stuff/configuration.rb', line 277 def reminders_enabled @reminders_enabled end |
#repo_nicknames ⇒ Hash{Symbol => String}
Human-readable repo names used as the to_param prefix on PlanMyStuff::Issue instances. Symbol-keyed against repos – missing keys fall back to key.to_s.titleize, so only entries that diverge from a simple titleize of the key (e.g. :safety -> “Compliance”) need to be listed.
375 376 377 |
# File 'lib/plan_my_stuff/configuration.rb', line 375 def repo_nicknames @repo_nicknames end |
#repos ⇒ Hash{Symbol => String}
Named repo configs. Set via config.repos = ‘BrandsInsurance/Element’, or assign a whole hash with config.repos = { element: ‘BrandsInsurance/Element’, underwriter: ‘BrandsInsurance/Underwriter’ }.
367 368 369 |
# File 'lib/plan_my_stuff/configuration.rb', line 367 def repos @repos end |
#sns_topic_arn ⇒ String?
Returns expected SNS topic ARN for AWS webhook validation.
172 173 174 |
# File 'lib/plan_my_stuff/configuration.rb', line 172 def sns_topic_arn @sns_topic_arn end |
#sns_verifier_class ⇒ Class
Class instantiated per request for SNS signature verification. Must respond to authenticate!(raw_body).
354 355 356 |
# File 'lib/plan_my_stuff/configuration.rb', line 354 def sns_verifier_class @sns_verifier_class end |
#sns_verifier_error ⇒ Class
Exception class rescued during SNS signature verification.
360 361 362 |
# File 'lib/plan_my_stuff/configuration.rb', line 360 def sns_verifier_error @sns_verifier_error end |
#support_method ⇒ Symbol, Proc
Determines if a user is support staff. Symbol (method name on user) or Proc that receives the user object and returns boolean.
70 71 72 |
# File 'lib/plan_my_stuff/configuration.rb', line 70 def support_method @support_method end |
#testing_custom_fields ⇒ Hash{Symbol => Hash}
Testing-project-only field definitions, deep-merged on top of shared custom_fields. Context-specific config wins on key conflicts.
141 142 143 |
# File 'lib/plan_my_stuff/configuration.rb', line 141 def testing_custom_fields @testing_custom_fields end |
#testing_template_project_number ⇒ Integer?
TestingProjects. When set, TestingProject.create! copies the template (preserving its fields and board layout) instead of bootstrapping fields from scratch. Leave nil to use the default bootstrap-fields path.
54 55 56 |
# File 'lib/plan_my_stuff/configuration.rb', line 54 def testing_template_project_number @testing_template_project_number end |
#user_class ⇒ String
Returns consuming app’s user model class name, constantized for lookups.
57 58 59 |
# File 'lib/plan_my_stuff/configuration.rb', line 57 def user_class @user_class end |
#user_id_method ⇒ Symbol
Returns method called on user object to extract the app-side user ID.
63 64 65 |
# File 'lib/plan_my_stuff/configuration.rb', line 63 def user_id_method @user_id_method end |
#user_inactive_label ⇒ String
Label name applied to issues auto-closed by the inactivity sweep. Removed when an issue is auto-reopened via a user reply.
308 309 310 |
# File 'lib/plan_my_stuff/configuration.rb', line 308 def user_inactive_label @user_inactive_label end |
#waiting_on_approval_label ⇒ String
Label name used to flag issues waiting on pending approvals.
301 302 303 |
# File 'lib/plan_my_stuff/configuration.rb', line 301 def waiting_on_approval_label @waiting_on_approval_label end |
#waiting_on_user_label ⇒ String
Label name used to flag issues waiting on an end-user reply.
295 296 297 |
# File 'lib/plan_my_stuff/configuration.rb', line 295 def waiting_on_user_label @waiting_on_user_label end |
#webhook_secret ⇒ String?
Returns HMAC secret for GitHub webhook signature verification (required when webhooks mounted).
169 170 171 |
# File 'lib/plan_my_stuff/configuration.rb', line 169 def webhook_secret @webhook_secret end |
Instance Method Details
#authenticate_with(&block) ⇒ void
This method returns an undefined value.
Sets the authentication block for engine controllers.
458 459 460 461 462 463 464 |
# File 'lib/plan_my_stuff/configuration.rb', line 458 def authenticate_with(&block) if block @authenticate_with = block else @authenticate_with end end |
#controller_for(key) ⇒ String
Returns the controller path for the given route group, preferring a consuming-app override from controllers and falling back to the gem default from DEFAULT_CONTROLLERS. The returned value always begins with ‘/’ so the isolated engine does not re-prefix it with plan_my_stuff/.
517 518 519 520 |
# File 'lib/plan_my_stuff/configuration.rb', line 517 def controller_for(key) path = controllers[key] || DEFAULT_CONTROLLERS.fetch(key) path.start_with?('/') ? path : "/#{path}" end |
#custom_fields_for(context) ⇒ Hash{Symbol => Hash}
Returns the merged custom fields schema for the given context. Context-specific fields deep-merge on top of shared fields.
494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'lib/plan_my_stuff/configuration.rb', line 494 def custom_fields_for(context) context_fields = case context when :issue then issue_custom_fields when :comment then comment_custom_fields when :project then project_custom_fields when :testing then testing_custom_fields else {} end custom_fields.deep_merge(context_fields) end |
#repo_nickname_for(key) ⇒ String
Human-readable nickname for a repo key, used as the to_param prefix on PlanMyStuff::Issue instances. Falls back to key.to_s.titleize when no explicit entry exists in repo_nicknames.
529 530 531 |
# File 'lib/plan_my_stuff/configuration.rb', line 529 def repo_nickname_for(key) repo_nicknames[key&.to_sym] || key.to_s.titleize end |
#validate! ⇒ void
This method returns an undefined value.
Validates that required configuration options are set.
472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/plan_my_stuff/configuration.rb', line 472 def validate! missing = [] missing << 'access_token' if access_token.nil? || access_token.to_s.strip.empty? missing << 'organization' if organization.nil? || organization.to_s.strip.empty? if missing.present? raise( PlanMyStuff::ConfigurationError, "Missing required PlanMyStuff configuration: #{missing.join(', ')}", ) end validate_repo_nicknames! end |