Class: Fastlane::SetupAndroid
- Inherits:
-
Setup
- Object
- Setup
- Fastlane::SetupAndroid
show all
- Defined in:
- lib/fastlane/setup/setup_android.rb
Instance Method Summary
collapse
Methods inherited from Setup
#ask_for_crash_reporting, #is_android?, #is_ios?, #show_analytics
Instance Method Details
#folder ⇒ Object
75
76
77
|
# File 'lib/fastlane/setup/setup_android.rb', line 75
def folder
FastlaneFolder.path
end
|
#generate_appfile ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/fastlane/setup/setup_android.rb', line 23
def generate_appfile
Helper.log.info '------------------------------'
Helper.log.info 'To not re-enter your packagename and issuer every time you run one of the fastlane tools or fastlane, these will be stored in a so-called Appfile.'.green
package_name = ask('Package Name (com.krausefx.app): '.yellow)
puts ""
puts "To automatically upload builds and metadata to Google Play, fastlane needs an issuer and keyfile".yellow
puts "Feel free to just click Enter to skip not provide certain things"
puts "Follow the Setup Guide on how to get the Issuer: https://github.com/fastlane/supply#setup".yellow
puts "The issuer email looks like this: 137123276006-aaaeltp0aqgn2opfb7tk46ovaaa3hv1g@developer.gserviceaccount.com".yellow
issuer = ask('Issuer: '.yellow)
keyfile = ask('Path to the key file: '.yellow)
template = File.read("#{Helper.gem_path('fastlane')}/lib/assets/AppfileTemplateAndroid")
template.gsub!('[[ISSUER]]', issuer)
template.gsub!('[[KEYFILE]]', keyfile)
template.gsub!('[[PACKAGE_NAME]]', package_name)
path = File.join(folder, 'Appfile')
File.write(path, template)
Helper.log.info "Created new file '#{path}'. Edit it to manage your preferred app metadata information.".green
end
|
#generate_fastfile ⇒ Object
45
46
47
48
49
50
51
52
53
|
# File 'lib/fastlane/setup/setup_android.rb', line 45
def generate_fastfile
template = File.read("#{Helper.gem_path('fastlane')}/lib/assets/FastfileTemplateAndroid")
template.gsub!('[[FASTLANE_VERSION]]', Fastlane::VERSION)
path = File.join(folder, 'Fastfile')
File.write(path, template)
Helper.log.info "Created new file '#{path}'. Edit it to manage your own deployment lanes.".green
end
|
#init_supply ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/fastlane/setup/setup_android.rb', line 55
def init_supply
Helper.log.info ""
question = "Do you plan on uploading metadata, screenshots and builds to Google Play using fastlane?".yellow
Helper.log.info question
Helper.log.info "This will download your existing metadata and screenshots into the `fastlane` folder"
if agree(question + " (y/n) ", true)
begin
require 'supply'
require 'supply/setup'
Supply.config = FastlaneCore::Configuration.create(Supply::Options.available_options, {})
Supply::Setup.new.perform_download
rescue => ex
Helper.log.error ex.to_s
Helper.log.error "supply failed, but don't worry, you can launch supply using `supply init` whenever you want.".red
end
else
Helper.log.info "You can run `supply init` to do so at a later point.".green
end
end
|
#run ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/fastlane/setup/setup_android.rb', line 3
def run
if FastlaneFolder.setup? and !Helper.is_test?
Helper.log.info "Fastlane already set up at path #{folder}".yellow
return
end
response = agree('Do you have everything commited in version control? If not please do so now! (y/n)'.yellow, true)
return unless response
FastlaneFolder.create_folder! unless Helper.is_test?
FileUtils.mkdir(File.join(folder, 'actions')) unless File.directory?(File.join(folder, 'actions'))
generate_appfile
generate_fastfile
show_analytics
init_supply
Helper.log.info 'Successfully finished setting up fastlane'.green
end
|