def do_command(self):
        cwfile_dir = CWFILES_DIR_PATH

        ebextension_dir = fileoperations.project_file_path('.ebextensions')

        if self.app.pargs.remove:
            return remove_cwl_extensions(cwfile_dir, ebextension_dir)

        if not os.path.isdir(ebextension_dir):
            os.makedirs(ebextension_dir)

        for file_name in os.listdir(cwfile_dir):
            source_file = os.path.join(cwfile_dir, file_name)
            destination = os.path.join(ebextension_dir, file_name)

            if fileoperations.file_exists(destination):
                io.log_error(strings['cloudwatch-setup.alreadysetup']
                             .format(filename=destination))
            shutil.copy(source_file, destination)

        io.echo(strings['cloudwatch-setup.text'])
예제 #2
0
 def dockerrun_path(cls):
     return fileoperations.project_file_path(cls.DOCKERRUN_FILENAME)
예제 #3
0
 def dockerignore_path(cls):
     return fileoperations.project_file_path(cls.DOCKERIGNORE_FILENAME)
예제 #4
0
 def test_project_file_path(self, get_project_root):
     get_project_root.side_effect = [os.path.sep]
     expected_file_path = '{}foo'.format(os.path.sep)
     self.assertEqual(fileoperations.project_file_path('foo'),
                      expected_file_path)