orta / cocoapods-keys

A key value store for storing per-developer environment and application keys
MIT License
1.55k stars 92 forks source link

Adding "--output-directory" option for the generate command. #146

Closed robbiehanson closed 8 years ago

robbiehanson commented 8 years ago

Motivation:

We're using cocoapods-keys in a project, and we automatically generate the .h/.m files during the build process (via a build script). This allows the developer to change key/value pairs as needed, and a simple "Build-and-Run" will automatically "do the right thing".

I.E. if they've changed a key/value pair, then simply compiling in Xcode, will automatically re-generate the corresponding XKeys.m file with the updated value. This helps reduce the cognitive overhead of using the system for the development team:

Steps before:

Steps after:

Although this currently works, it's less than optimal, as modifying the .h/.m files everytime results in recompiling several files every build. This added feature allows the user to direct the generated .h/.m files elsewhere. Which enables use of diff tool, and thus can avoid overwriting files unnecessarily.

Once this pull request is merged, I can also add a wiki page that demonstrates:

segiddins commented 8 years ago

Just curious, why isn't the --project-directory option used by commands such as install and update sufficient?

robbiehanson commented 8 years ago

If I understand correctly, the --project-directory is to specify where the project itself resides. The --output-directory says where to put the generated .h/.m files.

For example, let's say I have a project here: ~/Foo/Foo.xcworkspace

Normally then, running the pod keys generate command will create the following files:

But if I instead run pod keys generate --output-directory=/Users/robbie/Foo/Temp/, it will instead create:

This allows me to execute the following in a build script (executed as part of the Pods/Keys Target, and run BEFORE compiling the source files):

Side note: the --project-directory option doesn't seem to be working for pod keys commands. See issue #145

segiddins commented 8 years ago

Hmm, I don't really see the benefit to this? It installs where it does now because that's the directory the generated pod needs to have its source files in