# Path: mdk/command.py
# class Command(object):
#     """Represents a command"""
# 
#     _arguments = [
#             (
#                 ['foo'],
#                 {
#                     'help': 'I\'m an argument'
#                 }
#             ),
#             (
#                 ['-b', '--bar'],
#                 {
#                     'action': 'store_true',
#                     'help': 'I\'m a flag'
#                 }
#             )
#         ]
#     _description = 'Undocumented command'
# 
#     __C = None
#     __Wp = None
# 
#     def __init__(self, config):
#         self.__C = config
# 
#     def argumentError(self, message):
#         raise CommandArgumentError(message)
# 
#     @property
#     def arguments(self):
#         return self._arguments
# 
#     @property
#     def C(self):
#         return self.__C
# 
#     @property
#     def description(self):
#         return self._description
# 
#     def run(self, args):
#         return True
# 
#     @property
#     def Wp(self):
#         if not self.__Wp:
#             from .workplace import Workplace
#             self.__Wp = Workplace()
#         return self.__Wp
# 
# Path: mdk/tools.py
# def mkdir(path, perms=0o755):
#     """Creates a directory ignoring the OS umask"""
#     oldumask = os.umask(0000)
#     os.mkdir(path, perms)
#     os.umask(oldumask)
# 
# def resolveEditor():
#     """Try to resolve the editor that the user would want to use.
#        This does actually checks if it is executable"""
#     editor = C.get('editor')
#     if not editor:
#         editor = os.environ.get('EDITOR')
#     if not editor:
#         editor = os.environ.get('VISUAL')
#     if not editor and os.path.isfile('/usr/bin/editor'):
#         editor = '/usr/bin/editor'
#     return editor


import os
import re
import shutil
import subprocess
from .. import git
from ..command import Command
from ..tools import mkdir, resolveEditor
                        repo.setConfig('core.bare', 'true')

                if repo.getConfig('remote.origin.url') != d['url']:
                    print('  %s uses an different origin (%s)' % (name, repo.getConfig('remote.origin.url')))
                    if args.fix:
                        print('    Setting remote.origin.url to %s' % d['url'])
                        repo.setConfig('remote.origin.url', d['url'])

                if repo.getConfig('remote.origin.fetch') != '+refs/*:refs/*':
                    print('  %s fetch value is invalid (%s)' % (name, repo.getConfig('remote.origin.fetch')))
                    if args.fix:
                        print('    Setting remote.origin.fetch to %s' % '+refs/*:refs/*')
                        repo.setConfig('remote.origin.fetch', '+refs/*:refs/*')

    def dependencies(self, args):
        """Check that various dependencies are met"""

        print('Checking dependencies')

        # Check binaries.
        hasErrors = False
        for k in ['git', 'php', 'java', 'recess', 'grunt', 'lessc', 'shifter', 'yuidoc']:
            path = self.C.get(k)
            if not path or not os.path.isfile(path):
                print('  The path to \'%s\' is invalid: %s' % (k, path))
                hasErrors = True
        if hasErrors and args.fix:
            print('    Please manually fix the paths in your config file')

        # Checking editor.

# Path: mdk/command.py
# class Command(object):
#     """Represents a command"""
# 
#     _arguments = [
#             (
#                 ['foo'],
#                 {
#                     'help': 'I\'m an argument'
#                 }
#             ),
#             (
#                 ['-b', '--bar'],
#                 {
#                     'action': 'store_true',
#                     'help': 'I\'m a flag'
#                 }
#             )
#         ]
#     _description = 'Undocumented command'
# 
#     __C = None
#     __Wp = None
# 
#     def __init__(self, config):
#         self.__C = config
# 
#     def argumentError(self, message):
#         raise CommandArgumentError(message)
# 
#     @property
#     def arguments(self):
#         return self._arguments
# 
#     @property
#     def C(self):
#         return self.__C
# 
#     @property
#     def description(self):
#         return self._description
# 
#     def run(self, args):
#         return True
# 
#     @property
#     def Wp(self):
#         if not self.__Wp:
#             from .workplace import Workplace
#             self.__Wp = Workplace()
#         return self.__Wp
# 
# Path: mdk/tools.py
# def mkdir(path, perms=0o755):
#     """Creates a directory ignoring the OS umask"""
#     oldumask = os.umask(0000)
#     os.mkdir(path, perms)
#     os.umask(oldumask)
# 
# def resolveEditor():
#     """Try to resolve the editor that the user would want to use.
#        This does actually checks if it is executable"""
#     editor = C.get('editor')
#     if not editor:
#         editor = os.environ.get('EDITOR')
#     if not editor:
#         editor = os.environ.get('VISUAL')
#     if not editor and os.path.isfile('/usr/bin/editor'):
#         editor = '/usr/bin/editor'
#     return editor


# Path: mdk/commands/doctor.py
import os
import re
import shutil
import subprocess
from .. import git
from ..command import Command
from ..tools import mkdir, resolveEditor

                        repo.setConfig('core.bare', 'true')

                if repo.getConfig('remote.origin.url') != d['url']:
                    print('  %s uses an different origin (%s)' % (name, repo.getConfig('remote.origin.url')))
                    if args.fix:
                        print('    Setting remote.origin.url to %s' % d['url'])
                        repo.setConfig('remote.origin.url', d['url'])

                if repo.getConfig('remote.origin.fetch') != '+refs/*:refs/*':
                    print('  %s fetch value is invalid (%s)' % (name, repo.getConfig('remote.origin.fetch')))
                    if args.fix:
                        print('    Setting remote.origin.fetch to %s' % '+refs/*:refs/*')
                        repo.setConfig('remote.origin.fetch', '+refs/*:refs/*')

    def dependencies(self, args):
        """Check that various dependencies are met"""

        print('Checking dependencies')

        # Check binaries.
        hasErrors = False
        for k in ['git', 'php', 'java', 'recess', 'grunt', 'lessc', 'shifter', 'yuidoc']:
            path = self.C.get(k)
            if not path or not os.path.isfile(path):
                print('  The path to \'%s\' is invalid: %s' % (k, path))
                hasErrors = True
        if hasErrors and args.fix:
            print('    Please manually fix the paths in your config file')

        # Checking editor.

        editor = resolveEditor()