From b73c8ead620b2634fff7dff06f274174fc37a8c1 Mon Sep 17 00:00:00 2001 From: Nathan Johnson Date: Tue, 12 Nov 2024 20:29:15 +0000 Subject: [PATCH 1/5] feat: RepositoryProvider.revision now public property Signed-off-by: Nathan Johnson --- .../groovy/nextflow/scm/RepositoryProvider.groovy | 2 +- .../groovy/nextflow/scm/RepositoryProviderTest.groovy | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy b/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy index 75a6d2798e..092da9e980 100644 --- a/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy @@ -65,7 +65,7 @@ abstract class RepositoryProvider { /** * The name of the commit/branch/tag */ - protected String revision + String revision RepositoryProvider setCredentials(String userName, String password) { config.user = userName diff --git a/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy b/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy index 659cd38390..2ce24fdb45 100644 --- a/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy @@ -108,4 +108,15 @@ class RepositoryProviderTest extends Specification { and: 1 * conn.setRequestProperty('Authorization', "Basic ${'foo:bar'.bytes.encodeBase64()}") } + + def 'should have public revision property' () { + given: + def provider = Spy(RepositoryProvider) + when: + provider.revision = 'branch_or_tag' + then: + provider.revision == 'branch_or_tag' + provider.hasProperty('revision') ? true : false + } + } From 4ff1048b5396bf7523402da79e013f19a0e73c76 Mon Sep 17 00:00:00 2001 From: Nathan Johnson Date: Thu, 14 Nov 2024 14:12:07 +0000 Subject: [PATCH 2/5] feat: added public getters for RepositoryProvider.config/project Signed-off-by: Nathan Johnson --- .../main/groovy/nextflow/scm/RepositoryProvider.groovy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy b/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy index 092da9e980..a6930a4293 100644 --- a/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy @@ -78,6 +78,14 @@ abstract class RepositoryProvider { return this } + String getProject() { + return this.project + } + + ProviderConfig getConfig() { + return this.config + } + boolean hasCredentials() { getUser() && getPassword() } From 2860a636faaeaee6ae608caf6bb4d76d8fba6eee Mon Sep 17 00:00:00 2001 From: Nathan Johnson Date: Thu, 14 Nov 2024 15:24:09 +0000 Subject: [PATCH 3/5] test: removed unnecessary test Signed-off-by: Nathan Johnson --- .../scm/RepositoryProviderTest.groovy | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy b/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy index 2ce24fdb45..779ac47c8b 100644 --- a/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy @@ -24,35 +24,35 @@ import spock.lang.Specification */ class RepositoryProviderTest extends Specification { - def 'should create repository provider object' () { + def 'should create repository provider object'() { def provider when: - provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('github'),'project/x') + provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('github'), 'project/x') then: provider instanceof GithubRepositoryProvider provider.endpointUrl == 'https://api.github.com/repos/project/x' when: - provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('gitlab'),'project/y') + provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('gitlab'), 'project/y') then: provider instanceof GitlabRepositoryProvider provider.endpointUrl == 'https://gitlab.com/api/v4/projects/project%2Fy' when: - provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('bitbucket'),'project/z') + provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('bitbucket'), 'project/z') then: provider instanceof BitbucketRepositoryProvider provider.endpointUrl == 'https://bitbucket.org/api/2.0/repositories/project/z' when: - provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('local', [path:'/user/data']),'local/w') + provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('local', [path: '/user/data']), 'local/w') then: provider.endpointUrl == 'file:/user/data/w' } - def 'should set credentials' () { + def 'should set credentials'() { given: def config = Mock(ProviderConfig) @@ -67,7 +67,7 @@ class RepositoryProviderTest extends Specification { } - def 'should hide creds' () { + def 'should hide creds'() { given: def provider = Spy(RepositoryProvider) @@ -86,7 +86,7 @@ class RepositoryProviderTest extends Specification { } - def 'should auth using credentials' () { + def 'should auth using credentials'() { given: def provider = Spy(RepositoryProvider) and: @@ -108,15 +108,4 @@ class RepositoryProviderTest extends Specification { and: 1 * conn.setRequestProperty('Authorization', "Basic ${'foo:bar'.bytes.encodeBase64()}") } - - def 'should have public revision property' () { - given: - def provider = Spy(RepositoryProvider) - when: - provider.revision = 'branch_or_tag' - then: - provider.revision == 'branch_or_tag' - provider.hasProperty('revision') ? true : false - } - -} +} \ No newline at end of file From d8d56a3138e8a2cd444ab390706a2e7dd47bc5a0 Mon Sep 17 00:00:00 2001 From: Nathan Johnson Date: Fri, 15 Nov 2024 08:34:10 +0000 Subject: [PATCH 4/5] feat: added public RepositoryProvider.getRevision Signed-off-by: Nathan Johnson --- .../src/main/groovy/nextflow/scm/RepositoryProvider.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy b/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy index a6930a4293..dc87b2f827 100644 --- a/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy @@ -65,7 +65,7 @@ abstract class RepositoryProvider { /** * The name of the commit/branch/tag */ - String revision + protected String revision RepositoryProvider setCredentials(String userName, String password) { config.user = userName @@ -73,6 +73,10 @@ abstract class RepositoryProvider { return this } + String getRevision() { + return this.revision + } + RepositoryProvider setRevision(String revision) { this.revision = revision return this From be2da4b52ea0de007013494180d356bc3bb08899 Mon Sep 17 00:00:00 2001 From: Nathan Johnson Date: Fri, 15 Nov 2024 08:41:06 +0000 Subject: [PATCH 5/5] chore: reverted whitespace changes Signed-off-by: Nathan Johnson --- .../nextflow/scm/RepositoryProviderTest.groovy | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy b/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy index 779ac47c8b..659cd38390 100644 --- a/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/scm/RepositoryProviderTest.groovy @@ -24,35 +24,35 @@ import spock.lang.Specification */ class RepositoryProviderTest extends Specification { - def 'should create repository provider object'() { + def 'should create repository provider object' () { def provider when: - provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('github'), 'project/x') + provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('github'),'project/x') then: provider instanceof GithubRepositoryProvider provider.endpointUrl == 'https://api.github.com/repos/project/x' when: - provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('gitlab'), 'project/y') + provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('gitlab'),'project/y') then: provider instanceof GitlabRepositoryProvider provider.endpointUrl == 'https://gitlab.com/api/v4/projects/project%2Fy' when: - provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('bitbucket'), 'project/z') + provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('bitbucket'),'project/z') then: provider instanceof BitbucketRepositoryProvider provider.endpointUrl == 'https://bitbucket.org/api/2.0/repositories/project/z' when: - provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('local', [path: '/user/data']), 'local/w') + provider = RepositoryFactory.newRepositoryProvider(new ProviderConfig('local', [path:'/user/data']),'local/w') then: provider.endpointUrl == 'file:/user/data/w' } - def 'should set credentials'() { + def 'should set credentials' () { given: def config = Mock(ProviderConfig) @@ -67,7 +67,7 @@ class RepositoryProviderTest extends Specification { } - def 'should hide creds'() { + def 'should hide creds' () { given: def provider = Spy(RepositoryProvider) @@ -86,7 +86,7 @@ class RepositoryProviderTest extends Specification { } - def 'should auth using credentials'() { + def 'should auth using credentials' () { given: def provider = Spy(RepositoryProvider) and: @@ -108,4 +108,4 @@ class RepositoryProviderTest extends Specification { and: 1 * conn.setRequestProperty('Authorization', "Basic ${'foo:bar'.bytes.encodeBase64()}") } -} \ No newline at end of file +}