Sha256: 2085e42bf387f7542a47166fd6090fcf6fb2c919e9e5e9dc7c4c0e4893102d79

Contents?: true

Size: 1.38 KB

Versions: 344

Compression:

Stored size: 1.38 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
      return nil if self.path.nil?

      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

344 entries across 344 versions & 1 rubygems

Version Path
fastlane-2.69.0.beta.20171212010004 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171211010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171210010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171209010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171208010004 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171207010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171206010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.68.2 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171205010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.68.1 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171204010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171203010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171202010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.69.0.beta.20171201010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.68.0 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.68.0.beta.20171130010004 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.68.0.beta.20171129010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.67.0 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.67.0.beta.20171128010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb
fastlane-2.67.0.beta.20171127010003 fastlane_core/lib/fastlane_core/fastlane_folder.rb