Class: StandardId::Apple::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- StandardId::Apple::Generators::InstallGenerator
- Defined in:
- lib/generators/standard_id/apple/install/install_generator.rb
Overview
Installs the Apple provider's credentials block in a host Rails app.
Writes config/initializers/standard_id_apple.rb — a separate file from
config/initializers/standard_id.rb on purpose. The provider is opt-in
per app, so its credentials should be removable by deleting one file,
and standard_id's own install generator must stay free to overwrite
its initializer without clobbering these five values.
Initializers load alphabetically, so standard_id.rb runs before
standard_id_apple.rb — the base configuration is already applied by
the time this file sets the social.apple_* fields.
Idempotent: re-running skips an initializer that is already there.
--skip-initializer opts out; --force overwrites.
Constant Summary collapse
- INITIALIZER_PATH =
"config/initializers/standard_id_apple.rb"
Instance Method Summary collapse
Instance Method Details
#copy_initializer ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/generators/standard_id/apple/install/install_generator.rb', line 41 def copy_initializer if [:skip_initializer] say_status("skip", "#{INITIALIZER_PATH} (--skip-initializer)", :yellow) return end if File.exist?(File.join(destination_root, INITIALIZER_PATH)) && ![:force] say_status("identical", "#{INITIALIZER_PATH} (already exists; pass --force to overwrite)", :blue) return end template "initializer.rb.erb", INITIALIZER_PATH, force: [:force] end |
#print_env_hint ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/generators/standard_id/apple/install/install_generator.rb', line 55 def print_env_hint return if [:skip_initializer] say "" say "=" * 79 say "StandardId Apple installed." say "" say "Set these in the host's environment (1Password / DO app spec / .env):" say "" say " APPLE_CLIENT_ID the Services ID (web sign-in)" say " APPLE_MOBILE_CLIENT_ID the iOS bundle ID — optional, web-only apps skip it" say " APPLE_TEAM_ID the 10-character Apple Developer team ID" say " APPLE_KEY_ID the key ID of the Sign In with Apple private key" say " APPLE_PRIVATE_KEY_PEM the .p8 private key contents, PEM, newlines intact" say "" say "APPLE_PRIVATE_KEY_PEM is multi-line. Most secret stores flatten it to" say "literal \\n — if sign-in fails on a JWT signing error, that is why." say "=" * 79 say "" end |