Class: Fastlane::Actions::GitStatusAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/git_status/actions/git_status_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



22
23
24
# File 'lib/fastlane/plugin/git_status/actions/git_status_action.rb', line 22

def self.authors
  ["4brunu"]
end

.available_optionsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fastlane/plugin/git_status/actions/git_status_action.rb', line 34

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 description: "The file or directory you want to see the status",
                                 optional: true,
                                 default_value: '.',
                                 is_string: false,
                                 verify_block: proc do |value|
                                   if value.kind_of?(String)
                                     paths = value.shellescape
                                     UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(paths)
                                   elsif value.kind_of?(Array)
                                     value.each do |x|
                                       UI.user_error!("Couldn't find file at path '#{x}'") unless File.exist?(x)
                                     end
                                   else
                                     UI.user_error!("Wrong param type path '#{value}'")
                                   end
                                 end),
  ]
end

.descriptionObject



18
19
20
# File 'lib/fastlane/plugin/git_status/actions/git_status_action.rb', line 18

def self.description
  "Show the status of one or multiple files/directories"
end

.detailsObject



30
31
32
# File 'lib/fastlane/plugin/git_status/actions/git_status_action.rb', line 30

def self.details
  "Show the status of one or multiple files/directories"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/fastlane/plugin/git_status/actions/git_status_action.rb', line 56

def self.is_supported?(platform)
  true
end

.return_valueObject



26
27
28
# File 'lib/fastlane/plugin/git_status/actions/git_status_action.rb', line 26

def self.return_value
  "The output string of the git status command"
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fastlane/plugin/git_status/actions/git_status_action.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 status --porcelain #{paths}")
  UI.success("git status --porcelain #{paths} \n #{result}")
  return result

end