Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for tasks to specify parameters #254

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

dmarlow
Copy link
Contributor

@dmarlow dmarlow commented Jun 29, 2018

Description

This removes the ability to specify multiple tasks (which is a non-backwards compatible change). This parses the values passed in and splats it as arguments to the task's action.

Related Issue

#112

Motivation and Context

Existing properties and parameters makes it difficult to cleanly specify task arguments. Having the ability to define parameters at the task level allows for cleaner scripts.

How Has This Been Tested?

Ran all tests included in the psake project. Ran tests from Powershell command line, Powershell scripts and batch command line to ensure parameterization works as intended.

Some more info available here: https://github.com/dmarlow/psake/wiki/Task-Parameters

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Regarding the unchecked items in the checklist. I left out tweaking documentation until these changes have been discussed and approved as something that will be added.

This allows you to specify parameters at the task level.
@devblackops devblackops self-requested a review July 2, 2018 16:25
@devblackops
Copy link
Member

Thanks for the contribution @dmarlow!

Removing the ability to specify multiple tasks is indeed a breaking change. I haven't went over the code in detail yet but did you look at ways to keep that ability yet pass in arguments?

@dmarlow
Copy link
Contributor Author

dmarlow commented Jul 2, 2018

How would we know which parameters are meant for which tasks if more than one task is allowed? I guess maybe pass the same parameters to both tasks? I'll need to poke around some more, maybe redesign things.

I'm kind of torn on the ability to specify multiple tasks, personally. It doesn't fit the model with how most command line applications work. Typically, when specifying multiple tasks (or commands), you'd delimit them in successive calls. For example: cd folder && rm *.tmp or cd folder; rm *.tmp. Seems like that's how psake should operate, but I get how that deviates from how it operates today. The ability to script psake should be up to the command environment. Meaning, it should not embedded as an ability within psake directly (personal opinion, obviously).

I understand that's definitely a breaking change, but maybe one worth having? This allows for greater flexibility in allowing tasks to be chained like proper command line applications.

@stale
Copy link

stale bot commented Aug 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 23, 2019
@devblackops devblackops added pinned and removed stale labels Aug 23, 2019
@UberDoodles
Copy link
Contributor

The ability to specify multiple tasks is very important to our implementation; I wouldn't want to see it removed unless it was absolutely necessary.

I think it should be possible to implement task parameters without removing that functionality though. Currently, psake accepts an array of task names (strings). It could theoretically be changed instead to accept a hashtable, or an array of hashtables, which contain task names and associated parameters (in the form of a hashtable perhaps).

So you might call it something like this :

[hashtable]$tasks = @{
"Build-Project"=@{"ProjectName"="TestProject.csproj";"ProjectPath"="C:\SomeFolder"};
"Deploy-Project"=@{"ProjectName"="TestProject"}
}

.\psake.ps1 psakeFile.ps1 $tasks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants