Class: Fastlane::Actions::ActAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



55
56
57
# File 'lib/fastlane/plugin/act/actions/act_action.rb', line 55

def self.authors
  ["Richard Szalay"]
end

.available_optionsObject



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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/fastlane/plugin/act/actions/act_action.rb', line 59

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :ipa,
                            env_name: "FACELIFT_IPA",
                         description: "Path of the IPA file being modified. Deprecated, use  archive_path",
                            optional: true,
                 conflicting_options: [:archive_path],
                      conflict_block: proc do |value|
                        UI.user_error!("You can't use 'ipa' and 'archive_path' options in one run")
                      end,
                                type: String),

    FastlaneCore::ConfigItem.new(key: :archive_path,
                            env_name: "FACELIFT_ARCHIVE_PATH",
                         description: "Path of the IPA or XCARCHIVE being modified",
                            optional: true,
                 conflicting_options: [:ipa],
                      conflict_block: proc do |value|
                        UI.user_error!("You can't use 'ipa' and 'archive_path' options in one run")
                       end,
                                type: String),

    FastlaneCore::ConfigItem.new(key: :iconset,
                         description: "Path to iconset to swap into the IPA (ignores :plist option)",
                            optional: true,
                                type: String),

    FastlaneCore::ConfigItem.new(key: :plist_file,
                            env_name: "FACELIFT_PLIST_FILE",
                         description: "The name of the plist file to modify, relative to the .app bundle`",
                            optional: true,
                       default_value: "Info.plist",
                                type: String),

    FastlaneCore::ConfigItem.new(key: :plist_values,
                         description: "Hash of plist values to set to the plist file",
                            optional: true,
                                type: Hash),

    FastlaneCore::ConfigItem.new(key: :plist_commands,
                         description: "Array of PlistBuddy commands to invoke",
                            optional: true,
                                type: Array),

    # TODO: :force flag for ignoring command errors and auto-adding plist_values if non-existant


    # Very optional

    FastlaneCore::ConfigItem.new(key: :app_name,
                            env_name: "FACELIFT_APP_NAME",
                         description: "The name of the .app file (including extension), will be extracted if not supplied",
                            optional: true,
                                type: String),

    FastlaneCore::ConfigItem.new(key: :temp_dir,
                            env_name: "FACELIFT_TEMP_DIR",
                         description: "The temporary directory to work from. One will be created if not supplied",
                            optional: true,
                                type: String),

    FastlaneCore::ConfigItem.new(key: :skip_delete_icons,
                              env_name: "FACELIFT_SKIP_DELETE_ICONS",
                           description: "When true, the old icon files will not be deleted from the archive",
                              optional: true,
                         default_value: false,
                                  type: [TrueClass, FalseClass]),

      FastlaneCore::ConfigItem.new(key: :replace_files,
                           description: "Files that should be replaced",
                              optional: true,
                         default_value: false,
                                  type: Hash),

      FastlaneCore::ConfigItem.new(key: :remove_files,
                           description: "Files that should be removed",
                              optional: true,
                         default_value: false,
                                  type: Array)
  ]
end

.descriptionObject



51
52
53
# File 'lib/fastlane/plugin/act/actions/act_action.rb', line 51

def self.description
  "Reconfigures .plists and icons inside a compiled IPA"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


139
140
141
# File 'lib/fastlane/plugin/act/actions/act_action.rb', line 139

def self.is_supported?(platform)
  [:ios].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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fastlane/plugin/act/actions/act_action.rb', line 4

def self.run(params)
  raise "You must supply an :archive_path" unless params[:archive_path] || params[:ipa]

  if params[:ipa] then
    warn "The ipa parameter has been superceded by archive_path and may be removed in a future release"
    params[:archive_path] = params[:ipa]
  end

  params[:archive_path] = File.expand_path params[:archive_path]
  raise "Archive path #{params[:archive_path]} does not exist" unless File.exist? params[:archive_path]

  if File.directory? params[:archive_path] then
    archive = ActHelper::XCArchive.new params[:archive_path], params[:app_name]
  else
    archive = ActHelper::IPAArchive.new params[:archive_path], params[:app_name], params[:temp_dir]
  end

  if params[:plist_file] then
    params[:plist_file] = ActHelper::ArchivePaths.expand(archive, params[:plist_file])
  else
    params[:plist_file] = archive.app_path("Info.plist")
  end

  ActHelper::PlistPatcher.patch(
    archive,
    params[:plist_file],
    params[:plist_values],
    params[:plist_commands]
  ) if params[:plist_values] or params[:plist_commands]

  ActHelper::IconPatcher.patch(
    archive,
    params[:iconset],
    !params[:skip_delete_icons]
  ) if params[:iconset]

  ActHelper::FilePatcher.replace(
    archive,
    params[:replace_files]
  ) if params[:replace_files]

  ActHelper::FilePatcher.remove(
    archive,
    params[:remove_files]
  ) if params[:remove_files]
end