       JSON.parse result
     .then (task) ->
       buildStateView.setTask(task)
-      
+
 
     .catch (err) ->
       buildStateView.destroy()

      Q.Promise (resolve, reject, notify) =>
        r = request.post {url:"#{@server}/api/tasks",timeout: 1000*60*10}, (err, httpResponse, body)=>
          if err then reject(err) else resolve(body)
        
        form = r.form()
        form.append "access_token","#{atom.config.get('atom-butterfly.puzzleAccessToken')}"
        form.append "builder","cordova-ios"
        form.append "platform","ios"
        
        # 以下四个值需要同时不为空，否则不发送到服务器  如果不填写，那么使用服务器的默认证书
        unless ( (options.Mobileprovision is "") || (options.p12 is "") || (options.p12_password is "") || (options.BundleIdentifier is ""))
          form.append "mobileprovision",fs.createReadStream(options.Mobileprovision)
          form.append "p12",fs.createReadStream(options.p12)
          form.append "p12_password","#{options.p12_password}"
          form.append "bundleIdentifier","#{options.BundleIdentifier}"
        
        # 若不填写，使用默认图标
        unless options.icon is ""
          form.append "icon",fs.createReadStream(options.icon)
        
        # # 下面是库连接，只要一下一个值为空，就是使用默认的github地址进行下载
        unless ((options.repository_url is "") || (options.scheme is ""))
          form.append "scheme","#{options.scheme}"

  sendBuildRequest: (options) ->
    console.log "options:#{options}"
    if options.platform == "android"

      Q.Promise (resolve, reject, notify) =>
        r = request.post {url:"#{@server}/api/tasks",timeout: 1000*60*10}, (err, httpResponse, body)=>
          if err then reject(err) else resolve(body)

        form = r.form()
        form.append "access_token","#{atom.config.get('atom-butterfly.puzzleAccessToken')}"
        form.append "builder","cordova-android"
