chris-huxtable / user_group.cr

Adds System Users and Groups.
ISC License
4 stars 1 forks source link

Crystal 0.34 compatibility. #3

Open didactic-drunk opened 4 years ago

didactic-drunk commented 4 years ago

WIP. Specs pass but a real program doesn't compile.

didactic-drunk commented 4 years ago

How would you like to handle conflicts between System::User/Group and Crystal's?

chris-huxtable commented 4 years ago

Did they FINALLY add something? I am a little afraid to look...

didactic-drunk commented 4 years ago

Yes. It's a class instead of struct.

home vs home_directory.

name and username clash. Crystal uses name for the gecos field.

Maybe keep uid/gid and let crystal have it's own String id methods?

  # The user's username.
  getter username : String

  # The user's identifier.
  getter id : String

  # The user's primary group identifier.
  getter group_id : String

  # The user's real or full name.
  getter name : String

  # The user's home directory.
  getter home_directory : String

  # The user's login shell.
  getter shell : String
didactic-drunk commented 4 years ago

My suggestion:

didactic-drunk commented 4 years ago

Thank you for adding me as a collaborator. I know it can be frustrating having all your work thrown out.

If you have feedback to avoid breaking your code I'm all ears.

If I don't hear from I'll:

  1. Assume you have better things which I hope are less stressful.
  2. Use the plan above and attempt to minimize compatibility problems.
  3. Wait a while.
  4. Bump the major version number for the next release with a warning in README.md.
chris-huxtable commented 4 years ago

Your proposal sounds fine. I would err on the side of aliasing so that existing code doesn't break (Does crystal have an attribute to mark something as deprecated?).

Feel free to email me (in my profile). I tend to prefer private communication and I regularly check it.

didactic-drunk commented 4 years ago

Your proposal sounds fine. I would err on the side of aliasing so that existing code doesn't break (Does crystal have an attribute to mark something as deprecated?).

Yes. Deprecated aliasing will be used for home and anything else not kept.

name and username clash. Crystal uses name for the gecos field. This shard uses it for the username. Deprecation can't solve this issue. I think they only way forward is release a new version letting crystal manage name, bump the major version and hope it doesn't cause conflicts in anyones code.