Class: FastlaneExt::ProjectController

Inherits:
Object
  • Object
show all
Includes:
Gem
Defined in:
lib/fastlane-ext/project_controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, schemes) ⇒ ProjectController

Returns a new instance of ProjectController.



9
10
11
12
13
14
# File 'lib/fastlane-ext/project_controller.rb', line 9

def initialize(path, schemes)
  raise 'Invalid Path' unless File.directory?(path)

  @project = Xcodeproj::Project.open(path)
  @schemes = schemes
end

Instance Method Details

#build_versionObject



39
40
41
42
# File 'lib/fastlane-ext/project_controller.rb', line 39

def build_version
  value = scheme_value_for_key(@schemes.first, build_version_key)
  Version.new(value)
end

#bump_build_version_patchObject



16
17
18
19
20
# File 'lib/fastlane-ext/project_controller.rb', line 16

def bump_build_version_patch
  value = build_version.to_s
  value[-1] = (value[-1].to_i + 1).to_s
  set_build_version(Version.new(value))
end

#set_build_version(version) ⇒ Object



28
29
30
31
32
# File 'lib/fastlane-ext/project_controller.rb', line 28

def set_build_version(version)
  @schemes.each do |s|
    set_scheme_value_for_key(s, version.to_s, build_version_key)
  end
end

#set_version(version) ⇒ Object



22
23
24
25
26
# File 'lib/fastlane-ext/project_controller.rb', line 22

def set_version(version)
  @schemes.each do |s|
    set_scheme_value_for_key(s, version.to_s, version_key)
  end
end

#versionObject



34
35
36
37
# File 'lib/fastlane-ext/project_controller.rb', line 34

def version
  value = scheme_value_for_key(@schemes.first, version_key)
  Version.new(value)
end