Class: AppSendr::Command::Help

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

Defined Under Namespace

Classes: HelpGroup

Instance Attribute Summary

Attributes inherited from Base

#args, #autodetected_app

Class Method Summary collapse

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

Class Method Details

.create_default_groups!Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/appsendr/commands/help.rb', line 31

def self.create_default_groups!
  group 'Commands' do |group|
    group.command 'help',                         'show this usage'
    group.command 'version',                      'show the gem version'
    group.space
    group.command 'list',                         'list your apps'
    group.command 'link',                         'link your app with an exsiting one in appsendr'
    group.command 'create <name>',                'create a new app'
    group.space
    group.command 'url',                         'get the latest version install url. pass --copy to copy to the clipboard'
    group.space
    group.command 'build <active configuration>', 'build your xcode project and deploy'   
    group.command 'build:clean', 'clean your xcode project'        
    group.space
    group.command 'deploy <active configuration>',  'deploy the current build. pass --notify to send notification to all testers'
    group.space
    group.command 'testers',                     'list testers'
    group.command 'testers:add <email> <name>', 'add a tester'
    group.command 'testers:remove <email> ',     'remove a tester'
    group.command 'testers:clear',               'remove all testers'
    group.command 'testers:notify <group>',  'notify testers about the latest build. group is optional.'
    group.command 'testers:devices',  'devices of your testers'
    
    # group.space
    # group.command 'groups',               'list groups'
    # group.command 'groups:add <name>',               'add group'
    # group.command 'groups:remove <name>',               'remove group'
    # group.command 'groups:add_tester <email> <group name>',     'add tester to group'
    # group.command 'groups:remove_tester <email> <group name>',  'remove tester from group'
    
    group.space
    group.command 'collaborators',               'list collaborators'
    group.command 'collaborators:add <email>',   'add collaborators'
    group.command 'collaborators:remove <email>','remove collaborators'
    group.space
    group.command 'auth:login',            'reauthorize account'
  end

end

.group(title, &block) ⇒ Object



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

def self.group(title, &block)
  groups << begin
    group = HelpGroup.new(title)
    yield group
    group
  end
end

.groupsObject



19
20
21
# File 'lib/appsendr/commands/help.rb', line 19

def self.groups
  @groups ||= []
end

Instance Method Details

#indexObject



71
72
73
# File 'lib/appsendr/commands/help.rb', line 71

def index
  display usage
end

#usageObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/appsendr/commands/help.rb', line 79

def usage
  longest_command_length = self.class.groups.map do |group|
    group.map { |g| g.first.length }
  end.flatten.max

  self.class.groups.inject(StringIO.new) do |output, group|
    output.puts "=== %s" % group.title
    output.puts

    group.each do |command, description|
      if command.empty?
        output.puts
      else
        output.puts "%-*s # %s" % [longest_command_length, command, description]
      end
    end

    output.puts
    output
  end.string 
end

#versionObject



75
76
77
# File 'lib/appsendr/commands/help.rb', line 75

def version
  display AppSendr::Client.version
end