Esempio n. 1
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

http://github.com/FMCorz/mdk
"""

import sys
import argparse
from lib import workplace, moodle, tools
from lib.tools import debug

Wp = workplace.Workplace()

# Arguments
parser = argparse.ArgumentParser(
    description='Run a script on a Moodle instance')
parser.add_argument('-a',
                    '--all',
                    action='store_true',
                    help='runs the script on every instances',
                    dest='all')
parser.add_argument('-i',
                    '--integration',
                    action='store_true',
                    help='runs the script on the integration instances',
                    dest='integration')
parser.add_argument('-s',
Esempio n. 2
0
parser.add_argument('-f',
                    '--force',
                    action='store_true',
                    help='force the initialisation')
parser.add_argument('-r',
                    '--run',
                    action='store_true',
                    help='also run the tests')
parser.add_argument('name',
                    metavar='name',
                    default=None,
                    nargs='?',
                    help='name of the instance')
args = parser.parse_args()

Wp = workplace.Workplace(C.get('dirs.storage'))

# Loading instance
M = Wp.resolve(args.name)
if not M:
    debug('This is not a Moodle instance')
    sys.exit(1)

# Check if installed
if not M.get('installed'):
    debug('This instance needs to be installed first')
    sys.exit(1)

# Run cli
try:
    M.initPHPUnit(force=args.force)