Sha256: 3a8e0059674a9b2bee2af5ba75ad81cd99e117b6c64236aff5ea37a61c79ae7d

Contents?: true

Size: 1.35 KB

Versions: 8

Compression:

Stored size: 1.35 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
      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)
      return if File.directory?(path) # directory is already there
      UI.user_error!("Found a file called 'fastlane' at path '#{path}', please delete it") if File.exist?(path)
      FileUtils.mkdir_p(path)
      UI.success "Created new folder '#{path}'."
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fastlane-2.22.0.beta.20170321010023 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.21.0 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.21.0.beta.20170320010043 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.21.0.beta.20170319010027 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.21.0.beta.20170318010107 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.21.0.beta.20170317010039 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.21.0.beta.20170316010039 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.20.0 fastlane_core/lib/fastlane_core/fastlane_folder.rb