Class: Fastlane::FastlaneFolder

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/fastlane_folder.rb

Constant Summary collapse

FOLDER_NAME =
'fastlane'

Class Method Summary collapse

Class Method Details

.create_folder!(path = nil) ⇒ Object



20
21
22
23
24
# File 'lib/fastlane/fastlane_folder.rb', line 20

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

.pathObject

Path to the fastlane folder containing the Fastfile and other configuration files



6
7
8
9
10
11
12
# File 'lib/fastlane/fastlane_folder.rb', line 6

def self.path
  return "./#{FOLDER_NAME}/" if File.directory?("./#{FOLDER_NAME}/")
  return "./.#{FOLDER_NAME}/" if File.directory?("./.#{FOLDER_NAME}/") # hidden folder
  return './' if File.basename(Dir.getwd) == FOLDER_NAME && File.exist?('Fastfile') # inside the folder
  return './' if File.basename(Dir.getwd) == ".#{FOLDER_NAME}" && File.exist?('Fastfile') # inside the folder and hidden
  nil
end

.setup?Boolean

Does a fastlane configuration already exist?

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/fastlane/fastlane_folder.rb', line 15

def self.setup?
  return false unless path
  File.exist?(File.join(path, "Fastfile"))
end