Class: BasicInfoHandler
- Inherits:
-
Object
- Object
- BasicInfoHandler
- Defined in:
- lib/mavenReactorService/BasicInfoHandler.rb
Overview
This class will handle groupid, Artifactid and version of a project#
Constant Summary collapse
- @@reactorHandler =
ReactorHandler.new
- @@pomPath =
nil
- @@tempPath =
nil
- @@effective_pom_path =
nil
Instance Method Summary collapse
-
#copyTagsFromEffectivePom(project_directory_path) ⇒ Object
Return effective pom object #.
-
#copyTagsFromOriginalPom(project_directory_path) ⇒ Object
Return original pom object #.
-
#handleDevelopersContributorsMailingLists(project_directory_path) ⇒ Object
This api will handle developers, contributors and mailing lists #.
-
#handleDistributionManagement(project_directory_path) ⇒ Object
This api will handle distribution management #.
-
#handleGrpAndArtifact(project_directory_path) ⇒ Object
This api will handle grpId, artifactid,version, packaging and name #.
-
#handleInceptionYearDescAndOrganization(project_directory_path) ⇒ Object
This api will handle inception year, org and desc #.
- #handleModelVersion(project_directory_path) ⇒ Object
-
#handlePluginRepositories(project_directory_path) ⇒ Object
This api will handle Plugin-Repositories #.
-
#handleProjectUrl(project_directory_path) ⇒ Object
This api will handle url #.
-
#handleProperties(project_directory_path) ⇒ Object
This api will handle properties #.
-
#handleRepositories(project_directory_path) ⇒ Object
This api will handle Repositories #.
-
#handleScmIssueManagementCiManagement(project_directory_path) ⇒ Object
This api will handle scm, issueManagement and ciManagement lists #.
- #renamePom(project_directory_path) ⇒ Object
- #renameTemp(project_directory_path) ⇒ Object
Instance Method Details
#copyTagsFromEffectivePom(project_directory_path) ⇒ Object
Return effective pom object #
34 35 36 37 38 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 34 def copyTagsFromEffectivePom(project_directory_path) @@effective_pom_path = "#{project_directory_path}/effective_pom.xml" pom_doc = @@reactorHandler.parse_xml_from_file(@@effective_pom_path) return pom_doc end |
#copyTagsFromOriginalPom(project_directory_path) ⇒ Object
Return original pom object #
27 28 29 30 31 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 27 def copyTagsFromOriginalPom(project_directory_path) @@pomPath = "#{project_directory_path}/pom.xml" pom_doc = @@reactorHandler.parse_xml_from_file(@@pomPath) return pom_doc end |
#handleDevelopersContributorsMailingLists(project_directory_path) ⇒ Object
This api will handle developers, contributors and mailing lists #
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 76 def handleDevelopersContributorsMailingLists(project_directory_path) effective_pom_doc = copyTagsFromEffectivePom(project_directory_path) developers = effective_pom_doc.at("project/developers") contributors = effective_pom_doc.at("project/contributors") mailingList = effective_pom_doc.at("project/mailingLists") if (!developers.nil?) File.write(@@tempPath, developers, File.size(@@tempPath), mode: 'a') puts "::Developers is added successfully::" end if (!contributors.nil?) File.write(@@tempPath, contributors, File.size(@@tempPath), mode: 'a') puts "::Contributors is added successfully::" end if (!mailingList.nil?) File.write(@@tempPath, mailingList, File.size(@@tempPath), mode: 'a') puts "::Mailing list is added successfully::" end end |
#handleDistributionManagement(project_directory_path) ⇒ Object
This api will handle distribution management #
118 119 120 121 122 123 124 125 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 118 def handleDistributionManagement(project_directory_path) pom_doc = copyTagsFromOriginalPom(project_directory_path) distributionManagement = pom_doc.at("project/distributionManagement") if (!distributionManagement.nil?) File.write(@@tempPath, distributionManagement, File.size(@@tempPath), mode: 'a') puts "::DistributionManagement is added successfully::" end end |
#handleGrpAndArtifact(project_directory_path) ⇒ Object
This api will handle grpId, artifactid,version, packaging and name #
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 10 def handleGrpAndArtifact (project_directory_path) @@tempPath = "#{project_directory_path}/temp.xml" pom_doc = copyTagsFromOriginalPom(project_directory_path) grpId = pom_doc.at("project/groupId") artifactId = pom_doc.at("project/artifactId") version = pom_doc.at("project/version") packaging = pom_doc.at("project/packaging") projectName = pom_doc.at("project/name") File.write(@@tempPath, grpId, File.size(@@tempPath), mode: 'a') File.write(@@tempPath, artifactId, File.size(@@tempPath), mode: 'a') File.write(@@tempPath, version, File.size(@@tempPath), mode: 'a') File.write(@@tempPath, packaging, File.size(@@tempPath), mode: 'a') File.write(@@tempPath, projectName, File.size(@@tempPath), mode: 'a') puts "::Basic info is added successfully::" end |
#handleInceptionYearDescAndOrganization(project_directory_path) ⇒ Object
This api will handle inception year, org and desc #
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 48 def handleInceptionYearDescAndOrganization(project_directory_path) effective_pom_doc = copyTagsFromEffectivePom(project_directory_path) desc = effective_pom_doc.at("project/description") inceptionYear = effective_pom_doc.at("project/inceptionYear") org = effective_pom_doc.at("project/organization") if (!desc.nil?) File.write(@@tempPath, desc, File.size(@@tempPath), mode: 'a') end if (!inceptionYear.nil?) File.write(@@tempPath, inceptionYear, File.size(@@tempPath), mode: 'a') end if (!org.nil?) File.write(@@tempPath, org, File.size(@@tempPath), mode: 'a') end puts "::Description, inception year and org is added successfully::" end |
#handleModelVersion(project_directory_path) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 39 def handleModelVersion(project_directory_path) effective_pom_doc = copyTagsFromEffectivePom(project_directory_path) modelVersion = effective_pom_doc.at("project/modelVersion") if (!modelVersion.nil?) File.write(@@tempPath, modelVersion, File.size(@@tempPath), mode: 'a') end end |
#handlePluginRepositories(project_directory_path) ⇒ Object
This api will handle Plugin-Repositories #
148 149 150 151 152 153 154 155 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 148 def handlePluginRepositories(project_directory_path) effective_pom_doc = copyTagsFromEffectivePom(project_directory_path) repositories = effective_pom_doc.at("project/pluginRepositories") if (!repositories.nil?) File.write(@@tempPath, repositories, File.size(@@tempPath), mode: 'a') puts "::pluginRepositories is added successfully::" end end |
#handleProjectUrl(project_directory_path) ⇒ Object
This api will handle url #
66 67 68 69 70 71 72 73 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 66 def handleProjectUrl(project_directory_path) pom_doc = copyTagsFromOriginalPom(project_directory_path) url = pom_doc.at("project/url") if (!url.nil?) File.write(@@tempPath, url, File.size(@@tempPath), mode: 'a') puts "::Url is added successfully::" end end |
#handleProperties(project_directory_path) ⇒ Object
This api will handle properties #
128 129 130 131 132 133 134 135 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 128 def handleProperties(project_directory_path) effective_pom_doc = copyTagsFromEffectivePom(project_directory_path) properties = effective_pom_doc.at("project/properties") if (!properties.nil?) File.write(@@tempPath, properties, File.size(@@tempPath), mode: 'a') puts "::Prfoperties is added successfully::" end end |
#handleRepositories(project_directory_path) ⇒ Object
This api will handle Repositories #
138 139 140 141 142 143 144 145 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 138 def handleRepositories(project_directory_path) effective_pom_doc = copyTagsFromEffectivePom(project_directory_path) repositories = effective_pom_doc.at("project/repositories") if (!repositories.nil?) File.write(@@tempPath, repositories, File.size(@@tempPath), mode: 'a') puts "::Repositories is added successfully::" end end |
#handleScmIssueManagementCiManagement(project_directory_path) ⇒ Object
This api will handle scm, issueManagement and ciManagement lists #
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 96 def handleScmIssueManagementCiManagement(project_directory_path) tempPath = "#{project_directory_path}/temp.xml" effective_pom_doc = copyTagsFromEffectivePom(project_directory_path) pom_doc = Nokogiri::XML(open(@@pomPath)) scm = pom_doc.at("project/scm") issueManagement = effective_pom_doc.at("project/issueManagement") ciManagement = effective_pom_doc.at("project/ciManagement") if (!scm.nil?) File.write(@@tempPath, scm, File.size(@@tempPath), mode: 'a') puts "::Scm is added successfully::" end if (!issueManagement.nil?) File.write(@@tempPath, issueManagement, File.size(@@tempPath), mode: 'a') puts "::IssueManagement is added successfully::" end if (!ciManagement.nil?) File.write(@@tempPath, ciManagement, File.size(@@tempPath), mode: 'a') puts "::CiManagement is added successfully::" end end |
#renamePom(project_directory_path) ⇒ Object
157 158 159 160 161 162 163 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 157 def renamePom(project_directory_path) begin File.rename("#{project_directory_path}/pom.xml", "#{project_directory_path}/pom_back.xml") rescue renamePom(project_directory_path) end end |
#renameTemp(project_directory_path) ⇒ Object
165 166 167 168 169 170 171 172 |
# File 'lib/mavenReactorService/BasicInfoHandler.rb', line 165 def renameTemp(project_directory_path) begin File.rename("#{project_directory_path}/temp.xml", "#{project_directory_path}/pom.xml") rescue renameTemp(project_directory_path) end puts "Temp is renamed to pom.xml" end |