Sha256: 9da5f7945ad2e0b4b8e19d209c185c977877adbd25c812fe5d2dbad4fe6b9f83

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

module FastlaneCore
  class FastlaneFolder
    FOLDER_NAME = 'fastlane'

    # Path to the fastlane folder containing the Fastfile and other configuration files
    def self.path
      value ||= "./#{FOLDER_NAME}/" if File.directory?("./#{FOLDER_NAME}/")
      value ||= "./.#{FOLDER_NAME}/" if File.directory?("./.#{FOLDER_NAME}/") # hidden folder
      value ||= "./" if File.basename(Dir.getwd) == FOLDER_NAME && File.exist?('Fastfile') # inside the folder
      value ||= "./" if File.basename(Dir.getwd) == ".#{FOLDER_NAME}" && File.exist?('Fastfile') # inside the folder and hidden

      value = nil if Helper.is_test? # this is required, as the tests would use the ./fastlane folder otherwise
      return value
    end

    # Path to the Fastfile inside the fastlane folder. This is nil when none is available
    def self.fastfile_path
      path = File.join(self.path || '.', 'Fastfile')
      return path if File.exist?(path)
      return nil
    end

    # Does a fastlane configuration already exist?
    def self.setup?
      return false unless self.fastfile_path
      File.exist?(self.fastfile_path)
    end

    def self.create_folder!(path = nil)
      path = File.join(path || '.', FOLDER_NAME)
      FileUtils.mkdir_p(path)
      UI.success "Created new folder '#{path}'."
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fastlane_core-0.57.1 lib/fastlane_core/fastlane_folder.rb
fastlane_core-0.57.0 lib/fastlane_core/fastlane_folder.rb
fastlane_core-0.56.0 lib/fastlane_core/fastlane_folder.rb
fastlane_core-0.55.1 lib/fastlane_core/fastlane_folder.rb
fastlane_core-0.55.0 lib/fastlane_core/fastlane_folder.rb
fastlane_core-0.54.0 lib/fastlane_core/fastlane_folder.rb