Class: Fastlane::Actions::SetBuildNumberRepositoryAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/set_build_number_repository.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



58
59
60
# File 'fastlane/lib/fastlane/actions/set_build_number_repository.rb', line 58

def self.authors
  ["pbrooks", "armadsen", "AndrewSB"]
end

.available_optionsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'fastlane/lib/fastlane/actions/set_build_number_repository.rb', line 38

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :use_hg_revision_number,
                                 env_name: "USE_HG_REVISION_NUMBER",
                                 description: "Use hg revision number instead of hash (ignored for non-hg repos)",
                                 optional: true,
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :xcodeproj,
                                 env_name: "XCODEPROJ_PATH",
                                 description: "explicitly specify which xcodeproj to use",
                                 optional: true,
                                 verify_block: proc do |value|
                                   path = File.expand_path(value)
                                   UI.user_error!("Please pass the path to the project, not the workspace") if path.end_with?(".xcworkspace")
                                   UI.user_error!("Could not find Xcode project at #{path}") unless Helper.test? || File.exist?(path)
                                 end)
  ]
end

.categoryObject



71
72
73
# File 'fastlane/lib/fastlane/actions/set_build_number_repository.rb', line 71

def self.category
  :project
end

.descriptionObject



26
27
28
# File 'fastlane/lib/fastlane/actions/set_build_number_repository.rb', line 26

def self.description
  "Set the build number from the current repository"
end

.detailsObject



30
31
32
33
34
35
36
# File 'fastlane/lib/fastlane/actions/set_build_number_repository.rb', line 30

def self.details
  [
    "This action will set the **build number** according to what the SCM HEAD reports.",
    "Currently supported SCMs are svn (uses root revision), git-svn (uses svn revision) and git (uses short hash) and mercurial (uses short hash or revision number).",
    "There is an option, `:use_hg_revision_number`, which allows to use mercurial revision number instead of hash."
  ].join("\n")
end

.example_codeObject



62
63
64
65
66
67
68
69
# File 'fastlane/lib/fastlane/actions/set_build_number_repository.rb', line 62

def self.example_code
  [
    'set_build_number_repository',
    'set_build_number_repository(
      xcodeproj: "./path/to/MyApp.xcodeproj"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



7
8
9
# File 'fastlane/lib/fastlane/actions/set_build_number_repository.rb', line 7

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.run(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'fastlane/lib/fastlane/actions/set_build_number_repository.rb', line 11

def self.run(params)
  build_number = Fastlane::Actions::GetBuildNumberRepositoryAction.run(
    use_hg_revision_number: params[:use_hg_revision_number]
  )

  Fastlane::Actions::IncrementBuildNumberAction.run(
    build_number: build_number,
    xcodeproj: params[:xcodeproj]
  )
end