Class: Testflight::Cli

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/testflight/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



31
32
33
# File 'lib/testflight/cli.rb', line 31

def source_root
  File.expand_path('../../',__FILE__)
end

Instance Method Details

#checkinObject



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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/testflight/cli.rb', line 38

def checkin
  return unless is_project_folder?

  say("\n\n")
  say("                                                                           \n")
  say("                        TEST FLIGHT CHECK-IN                               \n")
  say("                                                                           \n")
  say("                                                                           \n")
  say("  \\----------------------------------\\                                   \n")
  say("   \\                                  \\        __                        \n")
  say("    \\   Please proceed with your       \\       | \\                      \n")
  say("     >  check-in by answering the       >------|  \\        ______         \n")
  say("    /   following questions:           /       --- \\_____/**|_|_\\____  | \n")
  say("   /                                  /          \\_______ --------- __>-} \n")
  say("  /----------------------------------/              /  \\_____|_____/   |  \n")
  say("                                                   *         |             \n")
  say("                                                            {O}            \n")
  say("                                                                           \n")
  say("                                                                           \n")
  say("    /*\\       /*\\       /*\\       /*\\       /*\\       /*\\       /*\\ \n")
  say("   |***|     |***|     |***|     |***|     |***|     |***|     |***|       \n")
  say("    \\*/       \\*/ ____  \\*/       \\*/       \\*/       \\*/       \\*/ \n")
  say("     |         |  |  |   |         |         |         |         |         \n")
  say("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  \n")
  say("^^^^^^^^^ art by Denis Rabusseau, [email protected] ^^^^^^^^^^^  \n")
  say("\n\n")


  say("\nConfiguring #{Testflight::Config.application_name} #{Testflight::Config.type} for deployment to testflightapp.com...")
  ["Provisioning", "Distributions", "build"].each do |name| 
    create_folder(name)
  end

  @company_name = ask("\nWhat is the name of your company, as it appears in your Apple certificate?")
  @should_increment_bundle = yes_no?("Would you like to automatically increment the build number after every deployment?", "Y")

  if File.exist?("./.git")
    say("\nIt looks like you are using git as your SCM.")
    @should_commit_changes = yes_no?("Would you like to commit and push your changes to git before deployment?", "N")
    if @should_increment_bundle
      @should_tag_build = yes_no?("Would you like to tag every build in git with the version/build number of your application?", "Y")
    end
  end

  #say("\r\nConfiguring Build commands...\n")
  #say("What iOS architecture are you using?")
  #architectures = [
  #  ["1:", "armv5"],
  #  ["2:", "armv6"],
  #  ["3:", "armv7"],
  #]
  #print_table(architectures)
  #num = ask_for_number(3)
  #@architecture = architectures[num-1].last
  @architecture = 'armv7'
  @configuration = 'Release'
  @sdk = 'iphoneos'

  say("\r\nConfiguring testflightapp.com commands...")
  say("Please get your API TOKEN from the following URL: https://testflightapp.com/account/#api")
  @api_token = ask("Paste your API TOKEN here:")

  say("Please get your TEAM TOKEN from the following URL: https://testflightapp.com/dashboard/team/edit")
  @team_token = ask("Paste your TEAM TOKEN here:")

  @teams = ask("\r\nPlease enter your distribution lists as they appear on testflightapp.com (separated with comma):")
  @teams = @teams.split(",").collect{|t| t.strip}

  template 'templates/testflight.yml.erb', "./#{Testflight::Config.path}"

  update_git_ignore

  say("Configuration file '.testflight' has been created. You can edit it manually or run the init command again.")
  say("\r\nOnly a few steps left, but make sure you do them all.")
  say("1). Copy your Ad Hoc Provisioning Profile (.mobileprovision) into the 'Provisioning' folder that was created earlier.")
  say("2). Make sure your Release configuration uses your Ad-Hoc profile. You can follow these instructions to learn more: http://help.testflightapp.com/customer/portal/articles/1333914-how-to-create-an-ipa-xcode-5-")
  say("\r\nOnce you are done, you can run: testflight takeoff")
end

#takeoffObject



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/testflight/cli.rb', line 120

def takeoff
  return unless ready_for_takeoff?


  say("\n\n")
  say("              _______                                                                 \n")
  say("              \\=====/                                                                \n")
  say("                |||                                                                   \n")
  say("                 #                                                                    \n")
  say("                 |                                                                    \n")
  say("    ===========================                                                       \n")
  say("    |  www.testflightapp.com  |                                                       \n")
  say("    ===========================                                                       \n")
  say("    \\        |       |        /                                                      \n")
  say("     \\       |       |       /                                                       \n")
  say("      \\      |       |      /                                                        \n")
  say("       \\     |       |     /                                                         \n")
  say("        ###################                                                           \n")
  say("        ||               ||                                                           \n")
  say("        ||               ||                                                           \n")
  say("        ||               ||                                                           \n")
  say("        ||               ||                                                           \n")
  say("        ||               ||                                                           \n")
  say("        ||               ||          ___                                              \n")
  say("        ||               ||           | \\______________                              \n")
  say("        ||  ####         ||          ====( oooooooooo  O\\__                          \n")
  say("        ||  #  #         ||           (________/=====>______)--                       \n")
  say("        ||  #  #         ||                     OO        O                           \n")
  say("===================================================================================== \n")
  say(" art by Ian Astley, [email protected]                                   \n")
  say("\n\n")

  say("Preparing #{Testflight::Config.application_name} #{Testflight::Config.type} #{Testflight::Config.project_version} for departure to testflightapp.com...")


  @message = ask("\r\nWhat changes did you make in this build (will be used in git commit and notes)?")
  @teams = ask_with_multiple_options("Which team(s) would you like to distirbute the build to? Provide team number(s, separated by a comma)",
                                     Testflight::Config.distribution_lists)

  @notify = yes_no?("\r\nWould you like to notify the team members by email about this build?", "N")
  
  Testflight::Builder.new(:message => @message, :teams => @teams, :notify => @notify, :cold => options['cold'])

  say("                                                                                  \n")
  say("                                                                                  \n")
  say("                                                            ___.----.____         \n")
  say("                                                     __,--(_,-'       ,-'         \n")
  say("                                                 _,-'               ,-'           \n")
  say("                                             _,-'   ()           ,-'              \n")
  say("                                          ,-'    ()           ,-'                 \n")
  say("                                       ,-'    ()           ,-'                    \n")
  say("                                    ,-'  __..--''       ,-'                       \n")
  say("                                 ,-'.--''   ,-'      ,-'                          \n")
  say("              |\\         __..--''        ,-'      ,-':                           \n")
  say("              | \\__..--''     ______  ,-'     _,-'   :                           \n")
  say("         __..--''         ,-'\\_____/-'    _,-'       :                           \n")
  say("__..--''               ,-' ,-'  ,-'   _,-'____/      :                            \n")
  say("`---...___          ,-' ,-'  ,-'  _,-'    _,-'       :                            \n")
  say("          ``````-,-' ,-'  ,-' _,-'    _,-'           :                            \n")
  say("                 \\,-'___,-'--''___,-'-...___         :                           \n")
  say("                                             ```---..:                            \n")
  say("                                                                                  \n")
  say("                                                                                  \n")
  say("                                                                                  \n")
  say("                                                                                  \n")

  say("\r\nCongratulations, your build has been departed! Have a safe flight!")
  say
rescue

  say("                                                                                  \n")
  say("                                                                                  \n")
  say("                                                                                  \n")
  say("                         .-------------------.              ___                   \n")
  say("                        (       OUCH !!!      )            /  /]                  \n")
  say("                         `--------------   --'            /  / ]                  \n")
  say("                                        \\ |      _____,.-'  /__]                 \n")
  say("                                     )   \\|   ,-'             _>                 \n")
  say("                                       (  ` _/            ,.-'`                   \n")
  say("                                      )    / |     _,.-'``                        \n")
  say("                                      (   /. /    |                               \n")
  say("                                       ) ,  /`  ./                                \n")
  say("                                      (  \\_/   //  _                             \n")
  say("                                       ) /    //==(_)                             \n")
  say("                                     _,~'#   (/.                                  \n")
  say("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n")
  say("                                                                                  \n")

  say("\r\nBuild failed")
end