andrewreeman / SpectralSuite

The Unlicense
166 stars 5 forks source link

A script that populates a new pluggin with the requiered boilerplate code. #47

Closed pixmusix closed 8 months ago

pixmusix commented 8 months ago

How to call

--> py  makeSpectral.py -h 
usage: makeSpectral.py [-h] -p PATH -n NAME [-d DESCRIPTION] [-v {True,False}]

Automate SpectralSuite boilerplate for new plugin.

options:
  -h, --help            show this help message and exit
  -p PATH, --path PATH  The relative or absolute path to the directory
                        containing new plugin
  -n NAME, --name NAME  The name of the new plugin
  -d DESCRIPTION, --description DESCRIPTION
                        The description of the new plugin
  -v {True,False}, --verbose {True,False}

Walking through the main() function

def main():
        #Ask for an unpack the arguments into a struct-like object
    args = get_args()
    cmds = Cmd(args.path, args.name, args.description, args.verbose)

        #We populate the new plugin with the boilerplate files
    copy_errors = copy_boilerplate_files_to_new_plugin(cmds.path)
    if cmds.verbose:
        print(f"Populated {cmds.path} with boilerplate files")
        if copy_errors:
            print("- the following files were unsuccessfully moved to f{cmds.path}:")
            for err in copy_errors:
                print(f" -- {err}")

        #A jucebox is a list of handlers that modify our boilerplate files.
        #get_jucebox() is just ensuring each file receives the correct class of modifications
    jucebox = get_jucebox(cmds.name, cmds.description, cmds.path)

        #jucer.crank() does the work of populating in the user provided data and renaming the file
    for j in jucebox:
        if cmds.verbose:
            print(f"Pushing provided values into {j} and renaming file")
        j.crank()
andrewreeman commented 8 months ago

Awesome! I'll take a look now. Thank you very much 🙏

pixmusix commented 8 months ago

I like your use of polymorphism here too. Good ideas.

Thanks Andrew. :smiling_face_with_three_hearts:

I'm happy to merge it into either the 'develop' branch or the currently targeted: 'feature/new-plugin-example' branch. There's merge conflicts with the current branch so to resolve them, just take your changes. There was a few things I mentioned in the comments that I'm happy to change myself or you can.

I'd like to

Then I'd like to start a fresh pull request to the develop branch which just contains

  1. the script
  2. the readme
  3. the changes to SpectralSuiteBuild/Base.jucer

This will leave you with a minimalist PR which has no conflicts. French kiss! Concerning this branch, we can leave it in place for records. It's late here is Australia, but I think I can tackle this tomorrow; keep the momentum alive.

Sounds like a plan?

Thanks again for the contribution

Mate you're welcome. Thanks for making these plugin free and open source. ❤️

PIx ❣️

andrewreeman commented 8 months ago

@pixmusix Your plan sounds good and a fresh PR is a good idea too 👍 Looking forward to it. Thanks again