# Path: main/config.py
# PRODUCTION = os.environ.get('SERVER_SOFTWARE', '').startswith('Google App Eng')
# DEBUG = DEVELOPMENT = not PRODUCTION
#   APPLICATION_ID = app_identity.get_application_id()
#   CURRENT_VERSION_ID = os.environ.get('CURRENT_VERSION_ID')
#   CURRENT_VERSION_NAME = CURRENT_VERSION_ID.split('.')[0]
#   CURRENT_VERSION_TIMESTAMP = long(CURRENT_VERSION_ID.split('.')[1]) >> 28
#     CURRENT_VERSION_TIMESTAMP = calendar.timegm(datetime.utcnow().timetuple())
#   CURRENT_VERSION_DATE = datetime.utcfromtimestamp(CURRENT_VERSION_TIMESTAMP)
#   CONFIG_DB = model.Config.get_master_db()
#   SECRET_KEY = CONFIG_DB.flask_secret_key.encode('ascii')
#   RECAPTCHA_PUBLIC_KEY = CONFIG_DB.recaptcha_public_key
#   RECAPTCHA_PRIVATE_KEY = CONFIG_DB.recaptcha_private_key
#   RECAPTCHA_LIMIT = 8
# DEFAULT_DB_LIMIT = 64
# SIGNIN_RETRY_LIMIT = 4
# STYLES = [
#     'src/style/style.less',
#   ]
# SCRIPTS = [
#     ('libs', [
#         'ext/js/jquery/jquery.js',
#         'ext/js/moment/moment.js',
#         'ext/js/nprogress/nprogress.js',
#         'ext/js/bootstrap/alert.js',
#         'ext/js/bootstrap/button.js',
#         'ext/js/bootstrap/transition.js',
#         'ext/js/bootstrap/collapse.js',
#         'ext/js/bootstrap/dropdown.js',
#         'ext/js/bootstrap/tooltip.js',
#       ]),
#     ('scripts', [
#         'src/script/common/service.coffee',
#         'src/script/common/util.coffee',
#         'src/script/site/app.coffee',
#         'src/script/site/admin.coffee',
#         'src/script/site/profile.coffee',
#         'src/script/site/auth.coffee',
#         'src/script/site/user.coffee',
#       ]),
#   ]


from datetime import datetime
from distutils import spawn
from main import config
import argparse
import json
import os
import platform
import shutil
import socket
import sys
import time
import urllib
import urllib2
import main
  import pip
###############################################################################
def run_clean():
  print_out('CLEAN')
  clean_files()
  make_lib_zip(force=True)
  remove_file_dir(DIR_DST)
  make_dirs(DIR_DST)
  compile_all_dst()
  print_out('DONE')


def run_clean_all():
  print_out('CLEAN ALL')
  remove_file_dir(DIR_BOWER_COMPONENTS)
  remove_file_dir(DIR_NODE_MODULES)
  clean_py_libs()
  clean_files()
  remove_file_dir(FILE_LIB)
  remove_file_dir(FILE_PIP_GUARD)
  remove_file_dir(FILE_NPM_GUARD)
  remove_file_dir(FILE_BOWER_GUARD)


def run_minify():
  print_out('MINIFY')
  clean_files()
  make_lib_zip(force=True)
  remove_file_dir(DIR_MIN)
  make_dirs(DIR_MIN_SCRIPT)


# Path: main/config.py
# PRODUCTION = os.environ.get('SERVER_SOFTWARE', '').startswith('Google App Eng')
# DEBUG = DEVELOPMENT = not PRODUCTION
#   APPLICATION_ID = app_identity.get_application_id()
#   CURRENT_VERSION_ID = os.environ.get('CURRENT_VERSION_ID')
#   CURRENT_VERSION_NAME = CURRENT_VERSION_ID.split('.')[0]
#   CURRENT_VERSION_TIMESTAMP = long(CURRENT_VERSION_ID.split('.')[1]) >> 28
#     CURRENT_VERSION_TIMESTAMP = calendar.timegm(datetime.utcnow().timetuple())
#   CURRENT_VERSION_DATE = datetime.utcfromtimestamp(CURRENT_VERSION_TIMESTAMP)
#   CONFIG_DB = model.Config.get_master_db()
#   SECRET_KEY = CONFIG_DB.flask_secret_key.encode('ascii')
#   RECAPTCHA_PUBLIC_KEY = CONFIG_DB.recaptcha_public_key
#   RECAPTCHA_PRIVATE_KEY = CONFIG_DB.recaptcha_private_key
#   RECAPTCHA_LIMIT = 8
# DEFAULT_DB_LIMIT = 64
# SIGNIN_RETRY_LIMIT = 4
# STYLES = [
#     'src/style/style.less',
#   ]
# SCRIPTS = [
#     ('libs', [
#         'ext/js/jquery/jquery.js',
#         'ext/js/moment/moment.js',
#         'ext/js/nprogress/nprogress.js',
#         'ext/js/bootstrap/alert.js',
#         'ext/js/bootstrap/button.js',
#         'ext/js/bootstrap/transition.js',
#         'ext/js/bootstrap/collapse.js',
#         'ext/js/bootstrap/dropdown.js',
#         'ext/js/bootstrap/tooltip.js',
#       ]),
#     ('scripts', [
#         'src/script/common/service.coffee',
#         'src/script/common/util.coffee',
#         'src/script/site/app.coffee',
#         'src/script/site/admin.coffee',
#         'src/script/site/profile.coffee',
#         'src/script/site/auth.coffee',
#         'src/script/site/user.coffee',
#       ]),
#   ]


# Path: run.py
from datetime import datetime
from distutils import spawn
from main import config
import argparse
import json
import os
import platform
import shutil
import socket
import sys
import time
import urllib
import urllib2
import main
  import pip

###############################################################################
def run_clean():
  print_out('CLEAN')
  clean_files()
  make_lib_zip(force=True)
  remove_file_dir(DIR_DST)
  make_dirs(DIR_DST)
  compile_all_dst()
  print_out('DONE')


def run_clean_all():
  print_out('CLEAN ALL')
  remove_file_dir(DIR_BOWER_COMPONENTS)
  remove_file_dir(DIR_NODE_MODULES)
  clean_py_libs()
  clean_files()
  remove_file_dir(FILE_LIB)
  remove_file_dir(FILE_PIP_GUARD)
  remove_file_dir(FILE_NPM_GUARD)
  remove_file_dir(FILE_BOWER_GUARD)


def run_minify():
  print_out('MINIFY')
  clean_files()
  make_lib_zip(force=True)
  remove_file_dir(DIR_MIN)
  make_dirs(DIR_MIN_SCRIPT)


  for source in config.STYLES: