orta / cocoapods-keys

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

Generated obj-c class name is not changing after project name is changed in podfile #168

Open zcsipler opened 7 years ago

zcsipler commented 7 years ago

When I started to use cocoapods-keys, for the first try I used the sample code to test, so I added Eidolon as project name.

plugin 'cocoapods-keys', {
    :project => "Eidolon",
    :keys => [
    "SomeTestKey"
    ]}

Then a class was generated, correctly named "EidolonKeys" . Later I wanted to use the real name of my project so I changed it in the podfile:

plugin 'cocoapods-keys', {
    :project => "MyProject",
    :keys => [
    "SomeTestKey"
    ]}

After running either "pod install" or "pod update" still "EidolonKeys" class is generated instead of "MyProjectKeys". I would expect that the name of the generated class is always generated depending on the name which is defined in the podfile, in order to keep consistency with the ci and with other colleges who might be working on the same project. Am I doing something wrong, is it somehow possible to fix this issue?

orta commented 7 years ago

Try run pod deintegrate then pod install again, it shouldn't be keeping it around

zcsipler commented 7 years ago

Just tried ,it doesn't work, still EidolonKeys class is generated :(

orta commented 7 years ago

Is it possible it's doing both?

zcsipler commented 7 years ago

No, the only one class generated is "EidolonKeys", nothing else. And even if I update the podfile with a new key e.g.

plugin 'cocoapods-keys', { :project => "MyProject", :keys => [ "SomeTestKey", "SomeOtherTestKey" ]}

the new property "someOtherTestKey" is inserted in EidolonKeys class. So it definitely updates, only the class name remains the old one

orta commented 7 years ago

Try use Target as well then, it lets you specify the name

If you need to specify a different project name from the target name, use the key :target to specify it.

e.g.

plugin 'cocoapods-keys', {
  :project => "MyProject",
  :target => "MyProject"
  :keys => [
    "SomeTestKey",
    "SomeOtherTestKey"
  ]}
zcsipler commented 7 years ago

I already tried it but didn't help either.

dfeddad commented 7 years ago

I had the same issue today, and found out that changing the project name in the Podfile is not enough for cocoapods-key to pickup the new name, you have to change the name in the YAML file generated by cocoapods-key.

Follow these steps to fix this problem:

The content of the file should look like this:

---
keys:
- Key1
- Key2
-....
path: [PATH_TO_YOUR_PROJECT_FOLDER]
name: [PROJECT_NAME]
jarrodparkes commented 6 years ago

@dfeddad solution worked for me. so did removing the YAML file from ~/.cocoapods/keys

jarrodparkes commented 6 years ago

would it be possible to allow for the customizing of the name of the obfuscated class?

deda9 commented 4 years ago

Perfect, that was awesome, it worked like charm!