Class: Fastlane::Actions::GitCommitAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/git_commit.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, details, lane_context, method_missing, other_action, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject


41
42
43
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 41

def self.authors
  ["KrauseFx"]
end

.available_optionsObject


24
25
26
27
28
29
30
31
32
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 24

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 description: "The file you want to commit",
                                 is_string: false),
    FastlaneCore::ConfigItem.new(key: :message,
                                 description: "The commit message that should be used")
  ]
end

.categoryObject


57
58
59
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 57

def self.category
  :source_control
end

.descriptionObject


20
21
22
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 20

def self.description
  "Directly commit the given file with the given message"
end

.example_codeObject


49
50
51
52
53
54
55
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 49

def self.example_code
  [
    'git_commit(path: "./version.txt", message: "Version Bump")',
    'git_commit(path: ["./version.txt", "./changelog.txt"], message: "Version Bump")',
    'git_commit(path: ["./*.txt", "./*.md"], message: "Update documentation")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:


45
46
47
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 45

def self.is_supported?(platform)
  true
end

.outputObject


34
35
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 34

def self.output
end

.return_valueObject


37
38
39
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 37

def self.return_value
  nil
end

.run(params) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
# File 'fastlane/lib/fastlane/actions/git_commit.rb', line 4

def self.run(params)
  if params[:path].kind_of?(String)
    paths = params[:path].shellescape
  else
    paths = params[:path].map(&:shellescape).join(' ')
  end

  result = Actions.sh("git commit -m #{params[:message].shellescape} #{paths}")
  UI.success("Successfully committed \"#{params[:path]}\" 💾.")
  return result
end