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

JENKINS-53361 Copy files using a regular expression #13

Merged
merged 3 commits into from
Jan 8, 2019

Conversation

nrayapati
Copy link
Member

Description

Copy files using a regular expression

See JENKINS-53361.

@nrayapati nrayapati self-assigned this Jan 6, 2019
@nrayapati nrayapati requested review from ghenkes and wwftw January 6, 2019 03:34
this.from = from;
this.into = into;
this.filterRegex = filterRegex;
this.filterBy = filterBy;
if(Util.fixEmpty(filterRegex) != null && Util.fixEmpty(filterBy) == null)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space after the if

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied formatter, which also added braces.
8203a5e. Thank you.

@@ -106,7 +116,7 @@ public GetCallable(GetStep step, TaskListener listener, String into) {

@Override
public Object execute() {
return getService().get(((GetStep) getStep()).getFrom(), into);
return getService().get(((GetStep) getStep()).getFrom(), into, ((GetStep) getStep()).getFilterBy(), ((GetStep) getStep()).getFilterRegex());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a variable for step and just get and cast it once rather than 3 times.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with 8203a5e. Thank you.

this.from = from;
this.into = into;
this.filterRegex = filterRegex;
this.filterBy = filterBy;
if(Util.fixEmpty(filterRegex) != null && Util.fixEmpty(filterBy) == null)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after if

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied formatter, which also added braces.
8203a5e. Thank you.

@@ -98,7 +108,7 @@ public PutCallable(PutStep step, TaskListener listener, String from) {

@Override
public Object execute() {
return getService().put(from, ((PutStep) getStep()).getInto());
return getService().put(from, ((PutStep) getStep()).getInto(), ((PutStep) getStep()).getFilterBy(), ((PutStep) getStep()).getFilterRegex());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add variable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with 8203a5e. Thank you.

@@ -285,6 +285,14 @@ Put a file or directory into the remote host.
|String, *Mandatory*
|file or directory path on the remote node.

|filterBy
|String, *Optional*, Defaults to `name`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it support filtering by that other than name? I'm suggesting to condense these two to one property for now: filterByName, then document it's a regex based filter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tried all the options, but yes it does support all the params those are available on the File object, like path, absolutePath, file, directory, parent, parentFile and so on..

Mostly all the params on the File object http://docs.groovy-lang.org/docs/latest/html/groovy-jdk/java/io/File.html

@nrayapati nrayapati merged commit 020f434 into master Jan 8, 2019
@nrayapati nrayapati deleted the JENKINS-53361 branch January 8, 2019 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants