joel74 / POSH-LTM-Rest

PowerShell module and scripts for working with F5's LTM REST API
MIT License
78 stars 49 forks source link

Splitting methods into files #8

Closed jangins101 closed 8 years ago

jangins101 commented 9 years ago

Do you think it would be useful to split each of the methods into individual files containing the functions? That way, new files could be added to the project and the .psm1 file could just dot source all the .ps1 files (maybe in a subfolder too).

joel74 commented 9 years ago

It's an interesting idea, but it would kind of defeat the point of having a module, if we're then having to keep up with 20+ individual function files. Is the concern that the module file is too monolithic and difficult to work with? Thanks.

jangins101 commented 9 years ago

Yea. I've been working on a module for some stuff I'm doing at work, and found that having the psm1 file import all ps1 files in the module directory made it easy to insert new methods into the module, and finding a method quickly is doable. That way, you still get the benefit of having a portable module while maintaining each method individually.

I figure another thing would be if someone wanted to add a method, they could just add a new file and submit a merge request back into the master.

joel74 commented 9 years ago

Hi. Sorry for the delay getting back to you. It might be something I want to do in the future, so I'll leave this issue open for now. Thanks.

vercellone commented 8 years ago

+1 vote for splitting

vercellone commented 8 years ago

Commit c3aedc650296172b8ed3d019b8da6bd604b4240c provides a preview of splitting functions into individual .ps1 files.

joel74 commented 8 years ago

Thanks. Let me chew on this for a little bit and review what you've committed.

joel74 commented 8 years ago

I like this and I want to move forward with it. I'm wondering, though, about the \Public and \Private groupings. Is the thinking that scripts/functions in the Public group would be made exportable and ones in the Private group would be hidden?

vercellone commented 8 years ago

Yes, exactly. Private functions are internal, not exported. I observed this in @proxb's PoshRSJob repo and intend to adopt it for other projects.