当前位置: 首页>>代码示例>>Python>>正文


Python FileUtils.putContents方法代码示例

本文整理汇总了Python中pyaid.file.FileUtils.FileUtils.putContents方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.putContents方法的具体用法?Python FileUtils.putContents怎么用?Python FileUtils.putContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyaid.file.FileUtils.FileUtils的用法示例。


在下文中一共展示了FileUtils.putContents方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _writeGoogleFiles

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
    def _writeGoogleFiles(self):
        vid = self.get(('GOOGLE', 'SITE_VERIFY_ID'))
        if not vid:
            return False

        if not vid.endswith('.html'):
            vid += '.html'

        path = FileUtils.createPath(self.targetWebRootPath, vid, isFile=True)
        FileUtils.putContents(u'google-site-verification: ' + vid, path)
        SiteProcessUtils.createHeaderFile(path, None)
        return True
开发者ID:sernst,项目名称:StaticFlow,代码行数:14,代码来源:Site.py

示例2: _handleCompilationComplete

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
    def _handleCompilationComplete(self, event):
        snap = self._buildSnapshot

        if self._package and event.target.success:

            # If this was an appended package then prior to storing the snapshot the combined
            # platforms should be stored as the result instead of the platforms stored in this
            # particular case
            if 'combinedPlatforms' in snap:
                platforms = snap['combinedPlatforms']
                snap['platforms'] = platforms
                del snap['combinedPlatforms']
            else:
                platforms = snap['platforms']

            # Any package uploads conducted as part of the compilation process should be included
            # in the build snapshot for reference to prevent uploading them again in the future
            output = event.target.output
            if 'urls' in output:
                snap['platformUploads'] = DictUtils.merge(
                    snap['platformUploads'], output['urls'])

            self._storeBuildSnapshot()

            FileUtils.putContents('\t'.join([
                    TimeUtils.getNowDatetime().strftime('[%a %m-%d %H:%M]'),
                    'DSK' if platforms.get(FlexProjectData.AIR_PLATFORM, False) else '---',
                    'AND' if platforms.get(FlexProjectData.ANDROID_PLATFORM, False) else '---',
                    'IOS' if platforms.get(FlexProjectData.IOS_PLATFORM, False) else '---',
                    'WIN' if platforms.get(FlexProjectData.WINDOWS_PLATFORM, False) else '---',
                    'MAC' if platforms.get(FlexProjectData.MAC_PLATFORM, False) else '---',
                    '<<' + snap['versionInfo']['number'] + '>>',
                    '<<' + snap['versionInfo']['label'] + '>>' ]) + '\n',
                self._settingsEditor.buildLogFilePath,
                True )

            self._settingsEditor.reset()
            self._settingsEditor.populate()
            self._updateSettings()

        self._handleRemoteThreadComplete(event)
        self._package = False
开发者ID:sernst,项目名称:CompilerDeck,代码行数:44,代码来源:DeckCompileWidget.py

示例3: updateAppExtensions

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
    def updateAppExtensions(cls, descriptorPath, extensionIDs):
        s = []
        offset = '\n        '
        for eid in extensionIDs:
            s.append('<extensionID>%s</extensionID>' % eid)
        print 'EXTENSIONS:', s
        data = FileUtils.getContents(descriptorPath)
        data = cls.APP_EXTENSION_PATTERN.sub(
            '\g<prefix>' + offset + offset.join(s) + '\n    \g<suffix>', data)

        return FileUtils.putContents(data, descriptorPath)
开发者ID:sernst,项目名称:CompilerDeck,代码行数:13,代码来源:AirUtils.py

示例4: compileCss

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
    def compileCss(cls, site, path):
        outPath = FileUtils.changePathRoot(
            path, site.sourceWebRootPath, site.targetWebRootPath)
        FileUtils.getDirectoryOf(outPath, createIfMissing=True)

        if site.isLocal:
            shutil.copy(path, outPath)
            site.writeLogSuccess(u'COPIED', unicode(path))
        else:
            cmd = cls.modifyNodeCommand([
                FileUtils.createPath(
                    StaticFlowEnvironment.nodePackageManagerPath, 'minify', isFile=True),
                '"%s"' % path,
                '"%s"' % outPath])

            iniDirectory = os.curdir
            os.chdir(os.path.dirname(path))
            result = SystemUtils.executeCommand(cmd)
            if result['code']:
                site.logger.write(unicode(result['error']))
                site.writeLogError(u'CSS compilation failure:', extras={
                    'PATH':path,
                    'ERROR':result['error']})
                os.chdir(iniDirectory)
                return False

            site.writeLogSuccess(u'COMPRESSED', unicode(path))
            os.chdir(iniDirectory)

        source = FileUtils.getContents(outPath)
        if not source:
            return False
        FileUtils.putContents(
            cls._CSS_CDN_IMAGE_RE.sub('url(\g<quote>' + site.cdnRootUrl + '/', source),
            outPath)

        lastModified = FileUtils.getUTCModifiedDatetime(path)
        SiteProcessUtils.createHeaderFile(outPath, lastModified)
        cls.copyToCdnFolder(outPath, site, lastModified)
        return True
开发者ID:sernst,项目名称:StaticFlow,代码行数:42,代码来源:SiteProcessUtils.py

示例5: updateAppIconList

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
    def updateAppIconList(cls, descriptorPath, iconDefs):
        s = []
        offset = '\n        '
        for icon in iconDefs:
            size = icon['size']
            name = icon['name']
            s.append('<image%sx%s>icons/%s</image%sx%s>' % (size, size, name, size, size))

        data = FileUtils.getContents(descriptorPath)
        data = cls.APP_ICON_PATTERN.sub(
            '\g<prefix>' + offset + offset.join(s) + '\n    \g<suffix>', data)

        return FileUtils.putContents(data, descriptorPath)
开发者ID:sernst,项目名称:CompilerDeck,代码行数:15,代码来源:AirUtils.py

示例6: _createReleaseNotes

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
    def _createReleaseNotes(self):
        notes = ReleaseNotesGenerator(
            owner=self.parent(),
            label=self._flexData.getSetting('LABEL', u'Application'),
            versionInfo=self._flexData.versionInfo,
            **self._releaseNotes)

        path = FileUtils.createPath(
            self._flexData.projectPath, 'compiler', 'releaseNotes', isDir=True)
        if not os.path.exists(path):
            os.makedirs(path)

        filename = self._flexData.contentTargetFilename + \
                self._flexData.versionInfoNumber.replace(u'.', u'-') + u'.txt'

        path = FileUtils.createPath(path, filename, isFile=True)
        FileUtils.putContents(notes.generate(), path)

        uploader = BuildPackageUploader(self._flexData, self._bucket)
        url = uploader.uploadFile(path, filename)
        self._log.write('Uploaded release notes to: <a href="%s">%s</a>' % (url, url))

        return notes.text
开发者ID:sernst,项目名称:CompilerDeck,代码行数:25,代码来源:S3DeployerThread.py

示例7: write

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
    def write(self):
        """ Generates the rss.xml file and saves it to the target location. """

        mr = MakoRenderer(self._TEMPLATE, StaticFlowEnvironment.rootTemplatePath, {'rss':self})
        result = mr.render()
        if not mr.success:
            self.page.site.writeErrorLog(mr.errorMessage)
            return False

        result = FileUtils.putContents(result, self.targetPath)
        if result:
            self.page.site.writeLogSuccess(u'CREATED', u'RSS File: "%s"' % self.targetPath)
        else:
            self.page.site.writeErrorLog(u'Unable to write RSS file "%s"' % self.targetPath)
        return result
开发者ID:sernst,项目名称:StaticFlow,代码行数:17,代码来源:RssFileGenerator.py

示例8: write

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
    def write(self):
        """ Generates the sitemap and writes the result to the targetPath """

        mr = MakoRenderer(self._TEMPLATE, StaticFlowEnvironment.rootTemplatePath, {'sitemap':self})
        result = mr.render()

        if not mr.success:
            self.site.writeLogError(unicode(mr.errorMessage))
            return False

        if not FileUtils.putContents(result, self.targetPath):
            self.site.writeLogError(u'Unable to save sitemap file at: "%s"' % self.targetPath)
            return False

        self.site.writeLogSuccess(u'SITEMAP', u'Created sitemap at: "%s"' % self.targetPath)
        return True
开发者ID:sernst,项目名称:StaticFlow,代码行数:18,代码来源:Sitemap.py

示例9: updateAppFilename

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
 def updateAppFilename(cls, descriptorPath, filename, contentFilename):
     data = FileUtils.getContents(descriptorPath)
     data = cls.FILENAME_PATTERN.sub('\g<prefix>' + filename + '\g<suffix>', data)
     data = cls.CONTENT_FILENAME_PATTERN.sub('\g<prefix>' + contentFilename + '.swf\g<suffix>', data)
     return FileUtils.putContents(data, descriptorPath)
开发者ID:sernst,项目名称:CompilerDeck,代码行数:7,代码来源:AirUtils.py

示例10: updateAppId

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
 def updateAppId(cls, descriptorPath, appId):
     data = FileUtils.getContents(descriptorPath)
     data = cls.APP_ID_PATTERN.sub('\g<prefix>' + appId + '\g<suffix>', data)
     return FileUtils.putContents(data, descriptorPath)
开发者ID:sernst,项目名称:CompilerDeck,代码行数:6,代码来源:AirUtils.py

示例11: updateDescriptorNamespace

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
 def updateDescriptorNamespace(cls, descriptorPath, airVersion):
     data = FileUtils.getContents(descriptorPath)
     data = cls.DESCRIPTOR_VERSION_PATTERN.sub('\g<prefix>' + airVersion + '\g<suffix>', data)
     return FileUtils.putContents(data, descriptorPath)
开发者ID:sernst,项目名称:CompilerDeck,代码行数:6,代码来源:AirUtils.py

示例12: write

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import putContents [as 别名]
 def write(self):
     """Doc..."""
     FileUtils.putContents(self._convertDataToText(), self.targetPath)
开发者ID:sernst,项目名称:StaticFlow,代码行数:5,代码来源:RobotFileGenerator.py


注:本文中的pyaid.file.FileUtils.FileUtils.putContents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。