Exemple #1
0
  def edit(self, name):
    if not name:
      raise error.License(error.WRONG_ARGUMENT, "You need to pass a non-empty license name to the edit method")

    name = name.upper()

    path = fs.join(AIRSTRIP_LICENSES, name)
    if not name in self.licenses:
      self.licenses[name] = EMPTY_LICENSE.replace('{name}', name)
      fs.writefile(path, self.licenses[name])
    sh('open "%s"' % path, output = False)
Exemple #2
0
  def __init__(self):
    if not fs.exists(AIRSTRIP_RC_PATH):
      fs.writefile(AIRSTRIP_RC_PATH, json.dumps(EMPTY_RC, indent = 2))

    try:
      self.rc = json.loads(fs.readfile(AIRSTRIP_RC_PATH))
    except:
      raise error.AirRC(error.BROKEN, "Your airstrip rc file (%s) is horked! Please rm or fix it" % AIRSTRIP_RC_PATH)

    if not self.rc['version'] == API:
      self.__ask__()
Exemple #3
0
def inreplace(filepath, find, replace):
  p = fs.join(environ.pwd, filepath)
  pun = fs.readfile(p)
  pun = pun.replace(find, replace)
  fs.writefile(p, pun)
Exemple #4
0
 def set(self, key, value):
   if key:
     self.rc[key] = value
   fs.writefile(AIRSTRIP_RC_PATH, json.dumps(self.rc, indent = 2))