Exemplo n.º 1
0
	def OnUpload(self, event):	
		if hasattr(self, 'project'):
			name = self.project.get('name')
			slug = self.project.get('slug')
			log = self.ReadChangelog()
			
			version = None
			release = 'r'
			
			if log:
				match = re.search('(\d+\.?\d*\.?\d*)', log)
				if match:
					version = match.group(1)
					if re.search(version + '\s+\(beta\)', log):
						release = 'b'

			if self.UploadRequirement('Slug', slug) and self.UploadRequirement('Version', version):
				self.zipFile = zipper.ZipFile(ZIP_PATH, 'w')
				self.IterateFiles(self.project, self.CompressFile, version)
				self.zipFile.close()
				
				zipName = name + (version and (' ' + version) or '') + '.zip'
				error = self.UploadFile(slug, version, release, log, zipName)
				os.remove(TEMP_FILE)
				os.remove(ZIP_PATH)
				
				if error:
					Panels.Error(self, 'Error Uploading', error)
				else:
					Panels.Alert(self, 'Upload Successful', 'Version ' + version + ' of ' + name + ' has been successfully uploaded.')
Exemplo n.º 2
0
	def UploadRequirement( self, name, value ):
		if not value or value == '':
			Panels.Error(self, 'Cannot Upload', '"' + name + '" has not been defined.')
		else:
			return True