johnno1962 / injectionforxcode

Runtime Code Injection for Objective-C & Swift
MIT License
6.55k stars 565 forks source link

Tally Time Saved #83

Closed ashfurrow closed 8 years ago

ashfurrow commented 8 years ago

Hey there! Again, love the project. I was thinking it'd be really cool to tally the time saved (or at least number of compile-relaunch cycles).

For example, Text Expander has a neat view to see how much time you've saved (roughly):

screen shot 2016-03-10 at 10 44 38 am

It wouldn't need to be anything as complicated, just in a file somewhere maybe. Thoughts?

johnno1962 commented 8 years ago

Hi Ash, PRs always welcome :+1: Extra points if you could incorporate a billing system of some sort :) 10% of time saved seems reasonable no?

ashfurrow commented 8 years ago

I think that's fair, yeah :wink:

johnno1962 commented 8 years ago

The problem is how to transfer the time saved back into my life. We need some sort of abstract token that relates to time that could be exchanged.

ashfurrow commented 8 years ago

It's a pickle for sure.

Looking through the project, it appears that the best place to add the functionality is in the perl scripts since they do the actual injecting. Probably in injectSource.pl near the end? Storing in a text file seems to be the easiest, probably put it in a dot file in the iOSInjectionProject directory? Or iOSInjectionProject/Logs? I'm thinking of the following few lines:

  1. Open the file, if it exists, and parse the number that was there.
  2. Increment the number (or set to one if it wasn't loaded).
  3. Save the file back.

First time using Perl in six years but I think I can figure that out :wink: Let me know what you think of the details and I'll move ahead (thanks for your guidance, much appreciated :bow:).

johnno1962 commented 8 years ago

Sounds good to me. If you’ve done any Perl at all you’ll know the nature of the beast. The iOSInjectionProject isn’t created util about line 120. I’d not use the Logs directory. That is a symblic link to DerivedData for the project for AppCode.