Method: Fastlane::Setup#write_fastfile!

Defined in:
fastlane/lib/fastlane/setup/setup.rb

#write_fastfile!Object



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'fastlane/lib/fastlane/setup/setup.rb', line 186

def write_fastfile!
  # Write the Fastfile
  fastfile_file_name = "Fastfile"
  fastfile_file_name += ".swift" if self.is_swift_fastfile

  fastfile_path = File.join(FastlaneCore::FastlaneFolder.path, fastfile_file_name)
  self.fastfile_content.gsub!("[[LANES]]", "") # since we always keep it until writing out
  File.write(fastfile_path, self.fastfile_content) # remove trailing spaces before platform ends

  appfile_file_name = "Appfile"
  appfile_file_name += ".swift" if self.is_swift_fastfile
  appfile_path = File.join(FastlaneCore::FastlaneFolder.path, appfile_file_name)
  self.appfile_content.gsub!("[[TEAMS]]", "")

  File.write(appfile_path, self.appfile_content)

  add_or_update_gemfile(update_gemfile_if_needed: true)

  UI.header("✅  Successfully generated fastlane configuration")
  UI.message("Generated Fastfile at path `#{fastfile_path}`")
  UI.message("Generated Appfile at path `#{appfile_path}`")
  UI.message("Gemfile and Gemfile.lock at path `#{gemfile_path}`")

  UI.message("Please check the newly generated configuration files into git along with your project")
  UI.message("This way everyone in your team can benefit from your fastlane setup")
  continue_with_enter
end