Class: AppSendr::Command::Collaborators

Inherits:
Build
  • Object
show all
Defined in:
lib/appsendr/commands/collaborators.rb

Overview

Inherhits from Deploy

Instance Attribute Summary

Attributes inherited from Build

#app_dir, #app_path, #configuration, #ipa_path, #provisioning_name, #provisioning_path

Attributes inherited from Base

#args, #autodetected_app

Instance Method Summary collapse

Methods inherited from Build

#clean

Methods inherited from Base

#appsendr, #ask, #confirm, #extract_app, #extract_option, #format_date, #initialize, #option_exists?

Methods included from Helpers

#credentials_file, #credentials_setup?, #display, #error, #has_project_droppr?, #home_directory, #in_project_dir?, #is_file_to_large?, #message, #project_appsendr, #project_appsendr_app, #read_app, #read_app_id, #require_in_project_and_no_droppr, #require_project, #require_project_dir, #require_project_droppr, #running_on_a_mac?, #running_on_windows?, #size_of_file

Constructor Details

This class inherits a constructor from AppSendr::Command::Base

Instance Method Details

#addObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/appsendr/commands/collaborators.rb', line 25

def add
    
    if require_project(2,"add collaborators","an email", true)
        email = args.shift.strip

        begin 
        response = appsendr.add_collaborator(read_app_id,email)
        rescue RestClient::RequestFailed => e
            message "Errors"
            response = JSON.parse(e.http_body)
            response['message'].each{|err|
                display err.join(" ")
            }
        end
        
    end
end

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/appsendr/commands/collaborators.rb', line 4

def index
     if in_project_dir?
            unless has_project_droppr?
                require_project_droppr
                return
            end

            testers = appsendr.collaborators(read_app_id)
            if testers["message"].size > 0
              message "Your collaborators"
              i = 0
              display testers["message"].map {|app, id|
                  "#{i+=1}. #{app['name']} - #{app['email']}"
              }.join("\n")
            else
              display "You have no collaborators."
            end
        end
end

#removeObject



43
44
45
46
47
48
49
50
# File 'lib/appsendr/commands/collaborators.rb', line 43

def remove
    if require_project(1,"remove testers","an email")
        entered_email = args.shift.strip
        
        appsendr.remove_collaborator(read_app_id,entered_email)
        
    end
end