Class: Fastlane::Actions::GitCommitAction

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

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, method_missing, other_action, sh, step_text

Class Method Details

.authorsObject



54
55
56
# File 'lib/fastlane/actions/git_commit.rb', line 54

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fastlane/actions/git_commit.rb', line 28

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 description: "The file you want to commit",
                                 is_string: false,
                                 verify_block: proc do |value|
                                   if value.kind_of?(String)
                                     UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
                                   else
                                     value.each do |x|
                                       UI.user_error!("Couldn't find file at path '#{x}'") unless File.exist?(x)
                                     end
                                   end
                                 end),
    FastlaneCore::ConfigItem.new(key: :message,
                                 description: "The commit message that should be used")
  ]
end

.descriptionObject



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

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

.detailsObject



24
25
26
# File 'lib/fastlane/actions/git_commit.rb', line 24

def self.details
  ""
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.is_supported?(platform)
  true
end

.outputObject



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

def self.output
end

.return_valueObject



50
51
52
# File 'lib/fastlane/actions/git_commit.rb', line 50

def self.return_value
  nil
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File '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