Class: Fastlane::Actions::GitStatusAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::GitStatusAction
- Defined in:
- lib/fastlane/plugin/stream_actions/actions/git_status.rb
Documentation collapse
Class Method Summary collapse
Class Method Details
.available_options ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/fastlane/plugin/stream_actions/actions/git_status.rb', line 41 def self. [ FastlaneCore::ConfigItem.new( key: :ext, description: 'Extension' ) ] end |
.description ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/stream_actions/actions/git_status.rb', line 37 def self.description 'Git status' end |
.is_supported?(platform) ⇒ Boolean
50 51 52 |
# File 'lib/fastlane/plugin/stream_actions/actions/git_status.rb', line 50 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fastlane/plugin/stream_actions/actions/git_status.rb', line 4 def self.run(params) UI.user_error!('Extension should be provided') unless params[:ext] untracked_files = sh('git status -s').split("\n").map(&:strip) UI.important("Git Status: #{untracked_files}") deleted_files = select_files_from(files: untracked_files, with_extension: params[:ext], that_start_with: 'D') added_files = select_files_from(files: untracked_files, with_extension: params[:ext], that_start_with: ['A', '??']) renamed_files = select_files_from(files: untracked_files, with_extension: params[:ext], that_start_with: 'R') modified_files = select_files_from(files: untracked_files, with_extension: params[:ext], that_start_with: 'M') renamed_files.each do |renamed_file| content = renamed_file.split.drop(1).join.split('->').map(&:strip) deleted_files << content.first added_files << content.last end { a: added_files, d: deleted_files, m: modified_files } end |
.select_files_from(files:, with_extension:, that_start_with:) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/fastlane/plugin/stream_actions/actions/git_status.rb', line 23 def self.select_files_from(files:, with_extension:, that_start_with:) files.select do |f| f.start_with?(*that_start_with) end.map do |f| f.split.drop(1).join(' ') end.select do |f| f.gsub(/['"]/, '').end_with?(with_extension) end end |