Class: Fastlane::Actions::SynxAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



35
36
37
# File 'lib/fastlane/plugin/synx/actions/synx_action.rb', line 35

def self.authors
  ["@afonsograca/@AfonsoGraca"]
end

.available_optionsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/fastlane/plugin/synx/actions/synx_action.rb', line 39

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :xcodeproj,
                                 env_name: "FL_SYNX_PROJECT",
                                 description: "Optional, you must specify the path to your main Xcode project if it is not in the project root directory",
                                 optional: true,
                                 is_string: true,
                                 default_value: nil),
    FastlaneCore::ConfigItem.new(key: :prune,
                                 env_name: "FL_SYNX_PRUNE",
                                 description: "Remove source files and image resources that are not referenced by the the xcode project",
                                 optional: true,
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :no_color,
                                 env_name: "FL_SYNX_NO_COLOR",
                                 description: "Remove all color from the output",
                                 optional: true,
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :no_default_exclusions,
                                 env_name: "FL_SYNX_NO_DEFAULT_EXCLUSIONS",
                                 description: "Do not use the default exclusions of /Libraries, /Frameworks, and /Products",
                                 optional: true,
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :no_sort_by_name,
                                 env_name: "FL_SYNX_NO_SORT_BY_NAME",
                                 description: "Disable sorting groups by name",
                                 optional: true,
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :quiet,
                                 env_name: "FL_SYNX_QUIET",
                                 description: "Silence all output",
                                 optional: true,
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :exclusion,
                                 env_name: "FL_SYNX_EXCLUSION",
                                 description: "Ignore an Xcode group while syncing",
                                 optional: true,
                                 is_string: false,
                                 default_value: nil)
  ]
end

.descriptionObject



27
28
29
# File 'lib/fastlane/plugin/synx/actions/synx_action.rb', line 27

def self.description
  "Organise your Xcode project folder to match your Xcode groups."
end

.detailsObject



31
32
33
# File 'lib/fastlane/plugin/synx/actions/synx_action.rb', line 31

def self.details
  "A command-line tool that reorganizes your Xcode project folder to match your Xcode groups."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/fastlane/plugin/synx/actions/synx_action.rb', line 86

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/synx/actions/synx_action.rb', line 4

def self.run(params)
  require 'shellwords'

  Actions.verify_gem!("synx")

  project_path = params[:xcodeproj]
  project_path ||= Dir["*.xcodeproj"].first
  cmd = []
  cmd << "synx"
  cmd << "--prune" if params[:prune]
  cmd << "--no-color" if params[:no_color]
  cmd << "--no-default-exclusions" if params[:no_default_exclusions]
  cmd << "--no-sort-by-name" if params[:no_sort_by_name]
  cmd << "--quiet" if params[:quiet]
  if params[:exclusion]
    Array(params[:exclusion]).each do |exclusion|
      cmd.concat ["--exclusion", exclusion]
    end
  end
  cmd << project_path
  Actions.sh(Shellwords.join(cmd))
end