Пример #1
0
    def run(self, args=None):
        self.parse_args(args)

        if self.url:
            try:
                response = request.urlretrieve(self.url)
                self.path = response[0]
            except Exception:
                raise

        move_and_replace(
            extract_file(self.path),
            os.path.join(os.path.dirname(flask_reveal.__file__), 'static/'))
Пример #2
0
    def run(self, args=None):
        self.parse_args(args)

        if self.url:
            try:
                response = request.urlretrieve(self.url)
                self.path = response[0]
            except Exception:
                raise

        move_and_replace(
            extract_file(self.path),
            os.path.join(os.path.dirname(flask_reveal.__file__), 'static/')
        )
Пример #3
0
    def test_helper_move_and_replace(self):
        src_files = sorted(os.listdir(self.source))

        move_and_replace(self.source, self.destination)

        dst_files = sorted(os.listdir(self.destination))

        with open(os.path.join(self.destination, 'replace.txt'), 'r') as f:
            file_content = f.read()

        # The moved directory should not exist because it was moved
        self.assertFalse(os.path.exists(self.source))
        # The replaced file should contain the data from the source file
        self.assertEqual(file_content, 'source')
        # The moved files from source should be equal to the
        # files on destination directory
        self.assertEqual(src_files, dst_files)
Пример #4
0
    def run(self, args=None):
        self.parse_args(args)

        print('Downloading reveal.js...')

        if self.url:
            try:
                response = urlretrieve(self.url)
                self.path = response[0]
            except Exception:
                raise

        print('Installing reveal.js...')

        move_and_replace(
            extract_file(self.path),
            os.path.join(os.path.dirname(flask_reveal.__file__), 'static/')
        )

        print('Installation complete!')