Class: AppSendr::Command::Groups

Inherits:
Base
  • Object
show all
Defined in:
lib/appsendr/commands/groups.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #autodetected_app

Instance Method Summary collapse

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



21
22
23
24
25
26
27
28
29
# File 'lib/appsendr/commands/groups.rb', line 21

def add
    if in_project_dir?
        name = args.join(" ").strip
        appsendr.add_group(read_app_id,name)
        message "Group added"
    else
    	error("You are not in a project directory")
    end
end

#add_testerObject

<group> #<email>



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/appsendr/commands/groups.rb', line 41

def add_tester #<group> #<email>
    
    if in_project_dir?
        email = args.shift.strip
        name = args.join(" ").strip
        appsendr.add_group_tester(read_app_id,name, email)
        message "Added tester to group"
    else
    	error("You are not in a project directory")
    end
end

#indexObject

output testers



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

def index #output testers
      if in_project_dir?

      	groups = appsendr.groups(read_app_id)
      	    if groups["message"].size > 0
      	      message "Your groups"
      	      i = 0
      	      display groups["message"].map {|app, id|
      	          "#{i+=1}. #{app['name'].ljust(35)}"
      	      }.join("\n")
      	    else
      	      display "You have no groups."
      	    end
      else
      	error("You are not in a project directory")
      end
end

#removeObject



31
32
33
34
35
36
37
38
39
# File 'lib/appsendr/commands/groups.rb', line 31

def remove
    if in_project_dir?
        name = args.join(" ").strip
        appsendr.remove_group(read_app_id,name)
        message "Removed group"
    else
    	error("You are not in a project directory")
    end
end

#remove_testerObject

<group> #<email>



52
53
54
55
56
57
58
59
60
61
# File 'lib/appsendr/commands/groups.rb', line 52

def remove_tester #<group> #<email> 
    if in_project_dir?
        email = args.shift.strip
        name = args.join(" ").strip
        appsendr.remove_group_tester(read_app_id,name, email)
        message "Added tester to group"
    else
    	error("You are not in a project directory")
    end
end