Class: Fastlane::Actions::FlintSetupAction

Inherits:
FlintAction
  • Object
show all
Defined in:
lib/fastlane/plugin/flint/actions/flint_setup.rb

Class Method Summary collapse

Methods inherited from FlintAction

authors, available_options, description, details, fetch_keystore, is_supported?

Class Method Details

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
# File 'lib/fastlane/plugin/flint/actions/flint_setup.rb', line 8

def self.run(params)
    containing = FastlaneCore::Helper.fastlane_enabled_folder_path
    path = File.join(containing, "Flintfile")
  
    if File.exist?(path)
      FastlaneCore::UI.user_error!("You already have a Flintfile in this directory (#{path})")
      return 0
    end
    
    template = File.read("#{Flint::ROOT}/assets/FlintfileTemplate")
      
    UI.important("Please create a new, private git repository")
    UI.important("to store the keystores there")

    url = UI.input("URL of the Git Repo: ")
      
    template.gsub!("[[GIT_URL]]", url)
    File.write(path, template)
    UI.success("Successfully created '#{path}'. You can open the file using a code editor.")
      
    UI.important("Please mopdify build.gradle file (usually under app/build.gradle):")
    UI.message("Add before `android {` line:")
    UI.message("    // Load keystore")
    UI.message("    def keystorePropertiesFile = rootProject.file(\"keystore.properties\");")
    UI.message("    def keystoreProperties = new Properties()")
    UI.message("    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))")
    UI.message("Add after the closing bracket for `defaultConfig {`:")
    UI.message("    signingConfigs {")
    UI.message("        development {")
    UI.message("            storeFile file(keystoreProperties['storeFile'])")
    UI.message("            storePassword keystoreProperties['storePassword']")
    UI.message("            keyAlias keystoreProperties['keyAlias']")
    UI.message("            keyPassword keystoreProperties['keyPassword']")
    UI.message("       }")
    UI.message("        release {")
    UI.message("            storeFile file(keystoreProperties['storeFile'])")
    UI.message("            storePassword keystoreProperties['storePassword']")
    UI.message("            keyAlias keystoreProperties['keyAlias']")
    UI.message("            keyPassword keystoreProperties['keyPassword']")
    UI.message("       }")
    UI.message("    }")
    UI.important("This will load the appropriate keystore during release builds")
      
    UI.important("You can now run `fastlane flint type:development` and `fastlane flint type:release`")
    UI.message("On the first run for each environment it will create the keystore for you.")
    UI.message("From then on, it will automatically import the existing keystores.")
    UI.message("For more information visit https://docs.fastlane.tools/actions/flint/")

end