/** * Validates team memberes configured via {@link org.shipkit.gradle.configuration.ShipkitConfiguration.Team#getDevelopers()} * and {@link org.shipkit.gradle.configuration.ShipkitConfiguration.Team#getContributors()} */ public static void validateTeamMembers(Collection<String> teamMembers) throws InvalidInput { for (String member : teamMembers) { parsePerson(member); } }
private static InvalidInput invalidInput(String notation) { return new InvalidInput("Invalid value of team member: '" + notation + "'" + "\nIt should be: 'GITHUB_USER:FULL_NAME'" + "\nExample of correct notation: 'mockitoguy:Szczepan Faber'" + "\nSee Javadoc for ShipkitConfiguration.Team class."); } }
/** * See {@link #getContributors()} */ public void setContributors(Collection<String> contributors) { validateTeamMembers(contributors); configuration.put("team.contributors", contributors); } }
/** * Parses single person notation provided via {@link org.shipkit.gradle.configuration.ShipkitConfiguration.Team#getDevelopers()} * and {@link org.shipkit.gradle.configuration.ShipkitConfiguration.Team#getContributors()} */ public static TeamMember parsePerson(String notation) throws InvalidInput { notNull(notation, "Team member notation cannot be null"); String[] split = notation.split(":"); if (split.length != 2) { throw invalidInput(notation); } TeamMember person = new TeamMember(split[0], split[1]); if (person.gitHubUser.trim().isEmpty() || person.name.trim().isEmpty()) { throw invalidInput(notation); } return person; }
/** * Parses single person notation provided via {@link ReleaseConfiguration.Team#getDevelopers()} * and {@link ReleaseConfiguration.Team#getContributors()} */ public static TeamMember parsePerson(String notation) throws InvalidInput { notNull(notation, "Team member notation cannot be null"); String[] split = notation.split(":"); if (split.length != 2) { throw invalidInput(notation); } TeamMember person = new TeamMember(split[0], split[1]); if (person.gitHubUser.trim().isEmpty() || person.name.trim().isEmpty()) { throw invalidInput(notation); } return person; }
/** * Validates team memberes configured via {@link ReleaseConfiguration.Team#getDevelopers()} * and {@link ReleaseConfiguration.Team#getContributors()} */ public static void validateTeamMembers(Collection<String> teamMembers) throws InvalidInput { for (String member : teamMembers) { parsePerson(member); } }
/** * See {@link #getDevelopers()} */ public void setDevelopers(Collection<String> developers) { validateTeamMembers(developers); configuration.put("team.developers", developers); }
private static InvalidInput invalidInput(String notation) { return new InvalidInput("Invalid value of team member: '" + notation + "'" + "\nIt should be: 'GITHUB_USER:FULL_NAME'" + "\nExample of correct notation: 'szczepiq:Szczepan Faber'" + "\nSee Javadoc for ReleaseConfiguration.Team class."); } }
/** * Parses single person notation provided via {@link org.shipkit.gradle.configuration.ShipkitConfiguration.Team#getDevelopers()} * and {@link org.shipkit.gradle.configuration.ShipkitConfiguration.Team#getContributors()} */ public static TeamMember parsePerson(String notation) throws InvalidInput { notNull(notation, "Team member notation cannot be null"); String[] split = notation.split(":"); if (split.length != 2) { throw invalidInput(notation); } TeamMember person = new TeamMember(split[0], split[1]); if (person.gitHubUser.trim().isEmpty() || person.name.trim().isEmpty()) { throw invalidInput(notation); } return person; }
/** * Validates team memberes configured via {@link org.shipkit.gradle.configuration.ShipkitConfiguration.Team#getDevelopers()} * and {@link org.shipkit.gradle.configuration.ShipkitConfiguration.Team#getContributors()} */ public static void validateTeamMembers(Collection<String> teamMembers) throws InvalidInput { for (String member : teamMembers) { parsePerson(member); } }
/** * See {@link #getDevelopers()} */ public void setDevelopers(Collection<String> developers) { validateTeamMembers(developers); store.put("team.developers", developers); }
private static InvalidInput invalidInput(String notation) { return new InvalidInput("Invalid value of team member: '" + notation + "'" + "\nIt should be: 'GITHUB_USER:FULL_NAME'" + "\nExample of correct notation: 'mockitoguy:Szczepan Faber'" + "\nSee Javadoc for ShipkitConfiguration.Team class."); } }
private static Map<String, Contributor> transform(Collection<String> contributors, String githubUrl) { Map<String, Contributor> contributorMap = new HashMap<>(); for (String contributor : contributors) { TeamMember member = TeamParser.parsePerson(contributor); contributorMap.put(member.name, new DefaultContributor(member.name, member.gitHubUser, githubUrl + "/" + member.gitHubUser)); } return contributorMap; }
/** * See {@link #getContributors()} */ public void setContributors(Collection<String> contributors) { validateTeamMembers(contributors); store.put("team.contributors", contributors); }
private static Map<String, Contributor> transform(Collection<String> contributors, String githubUrl) { Map<String, Contributor> contributorMap = new HashMap<>(); for (String contributor : contributors) { TeamMember member = TeamParser.parsePerson(contributor); contributorMap.put(member.name, new DefaultContributor(member.name, member.gitHubUser, githubUrl + "/" + member.gitHubUser)); } return contributorMap; }
/** * See {@link #getContributors()} */ public void setContributors(Collection<String> contributors) { validateTeamMembers(contributors); store.put("team.contributors", contributors); }
static Map<String, Contributor> contributorsMap(Collection<String> contributorsFromConfiguration, ProjectContributorsSet contributorsFromGitHub, Collection<String> developers) { Map<String, Contributor> out = new HashMap<String, Contributor>(); for (String contributor : contributorsFromConfiguration) { TeamMember member = TeamParser.parsePerson(contributor); out.put(member.name, new DefaultContributor(member.name, member.gitHubUser, "http://github.com/" + member.gitHubUser)); } for (ProjectContributor projectContributor : contributorsFromGitHub.getAllContributors()) { out.put(projectContributor.getName(), projectContributor); } for (String developer : developers) { TeamMember member = TeamParser.parsePerson(developer); out.put(member.name, new DefaultContributor(member.name, member.gitHubUser, "http://github.com/" + member.gitHubUser)); } return out; }
/** * See {@link #getDevelopers()} */ public void setDevelopers(Collection<String> developers) { validateTeamMembers(developers); store.put("team.developers", developers); }
Node developers = root.appendNode("developers"); for (String notation : conf.getTeam().getDevelopers()) { TeamMember person = parsePerson(notation); Node d = developers.appendNode("developer"); d.appendNode("id", person.gitHubUser); for (String notation : allContributors) { if (!devs.contains(notation)) { TeamMember person = parsePerson(notation); Node d = contributors.appendNode("contributor"); d.appendNode("name", person.name);
Node developers = root.appendNode("developers"); for (String notation : conf.getTeam().getDevelopers()) { TeamMember person = parsePerson(notation); Node d = developers.appendNode("developer"); d.appendNode("id", person.gitHubUser); for (String notation : allContributors) { if (!devs.contains(notation)) { TeamMember person = parsePerson(notation); Node d = contributors.appendNode("contributor"); d.appendNode("name", person.name);