Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 1.69 KB

File metadata and controls

12 lines (8 loc) · 1.69 KB

ChatGPT 4o / o3

Started writing at 8:00pm

Ask me one question at a time so we can develop a thorough, step-by-step spec for this idea. Each question should build on my previous answers, and our end goal is to have a detailed specification I can hand off to a developer. Let’s do this iteratively and dig into every relevant detail. Remember, only one question at a time.

Here’s the idea:

I work with a number of Ruby on Rails projects that use environment variables for configuration. We a file .env that is used for local development. This file is not committed to source control so that our secrets and config values are not disclosed, and so that they are not overwritten by other changes to the shared repo. We also have a file .env.example where we record new keys and default values when they are added to the application.

This leads to a problem where applications break because a new environment variable was added to .env.example and use by the latest version of the code. We don't have a system to notify us when our local .env file is missing values defined in .env.example.

I want a Ruby script that can be run as a git pre-commit hook. It will take a directory as a parameter, and if it is not passed, default to .. The script should read all the keys and values from .env and .env.example. For every key from .env.example that is not defined in .env, prompt the user one at a time if they want to add the missing key with the value from .env.example to their .env file. For every key where the user responds "Y" or "Yes", append to their .env value with that key and the value from .env.example.