Class: Fastlane::Actions::GitAddAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, details, lane_context, method_missing, other_action, output, sample_return_value, sh, step_text

Class Method Details

.authorsObject



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

def self.authors
  ["4brunu"]
end

.available_optionsObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fastlane/actions/git_add.rb', line 24

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 description: "The file you want to add",
                                 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)
  ]
end

.categoryObject



60
61
62
# File 'lib/fastlane/actions/git_add.rb', line 60

def self.category
  :source_control
end

.descriptionObject



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

def self.description
  "Directly add the given file"
end

.example_codeObject



53
54
55
56
57
58
# File 'lib/fastlane/actions/git_add.rb', line 53

def self.example_code
  [
    'git_add(path: "./version.txt")',
    'git_add(path: ["./version.txt", "./changelog.txt"])'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/fastlane/actions/git_add.rb', line 49

def self.is_supported?(platform)
  true
end

.return_valueObject



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

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_add.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 add #{paths}")
  UI.success("Successfully added \"#{params[:path]}\" 💾.")
  return result
end