Class: Fastlane::Actions::InstallOnDeviceAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/install_on_device.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, lane_context, method_missing, other_action, output, return_value, sample_return_value, sh, step_text

Class Method Details

.authorsObject



67
68
69
# File 'lib/fastlane/actions/install_on_device.rb', line 67

def self.authors
  ["hjanuschka"]
end

.available_optionsObject



31
32
33
34
35
36
37
38
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
# File 'lib/fastlane/actions/install_on_device.rb', line 31

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :extra,
                                 short_option: "-X",
                                 env_name: "FL_IOD_EXTRA",
                                 description: "Extra Commandline arguments passed to ios-deploy",
                                 optional: true,
                                 is_string: true),
    FastlaneCore::ConfigItem.new(key: :device_id,
                                 short_option: "-d",
                                 env_name: "FL_IOD_DEVICE_ID",
                                 description: "id of the device / if not set defaults to first found device",
                                 optional: true,
                                 is_string: true),
    FastlaneCore::ConfigItem.new(key: :skip_wifi,
                                 short_option: "-w",
                                 env_name: "FL_IOD_WIFI",
                                 description: "Do not search for devices via WiFi",
                                 optional: true,
                                 is_string: false),
    FastlaneCore::ConfigItem.new(key: :ipa,
                                 short_option: "-i",
                                 env_name: "FL_IOD_IPA",
                                 description: "The IPA file to put on the device",
                                 optional: true,
                                 is_string: true,
                                 default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] || Dir["*.ipa"].first,
                                 verify_block: proc do |value|
                                   unless Helper.test?
                                     UI.user_error!("Could not find ipa file at path '#{value}'") unless File.exist? value
                                     UI.user_error!("'#{value}' doesn't seem to be an ipa file") unless value.end_with? ".ipa"
                                   end
                                 end)
  ]
end

.categoryObject



88
89
90
# File 'lib/fastlane/actions/install_on_device.rb', line 88

def self.category
  :misc
end

.descriptionObject



27
28
29
# File 'lib/fastlane/actions/install_on_device.rb', line 27

def self.description
  "Installs an .ipa file on a connected iOS-device via usb or wifi"
end

.detailsObject



71
72
73
# File 'lib/fastlane/actions/install_on_device.rb', line 71

def self.details
  "Installs the ipa on the device, if no id is given, the first found iOS device will be used, works via USB or Wi-Fi. This requires `ios-deploy` to be installed please have a look at [ios-deploy](https://github.com/phonegap/ios-deploy). to quickly install it, use `npm -g i ios-deploy`"
end

.example_codeObject



79
80
81
82
83
84
85
86
# File 'lib/fastlane/actions/install_on_device.rb', line 79

def self.example_code
  [
    'install_on_device(
      device_id: "a3be6c9ff7e5c3c6028597513243b0f933b876d4",
      ipa: "./app.ipa"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/fastlane/actions/install_on_device.rb', line 75

def self.is_supported?(platform)
  platform == :ios
end

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fastlane/actions/install_on_device.rb', line 6

def self.run(params)
  unless Helper.test?
    UI.user_error!("ios-deploy not installed, see https://github.com/phonegap/ios-deploy for instructions") if `which ios-deploy`.length == 0
  end
  taxi_cmd = [
    "ios-deploy",
    params[:extra],
    "--bundle",
    params[:ipa]
  ]
  taxi_cmd << "--no-wifi" if params[:skip_wifi]
  taxi_cmd << ["--id", params[:device_id]] if params[:device_id]
  return taxi_cmd.join(" ") if Helper.test?
  Actions.sh(taxi_cmd.join(" "))
  UI.message("Deployed #{params[:ipa]} to device!")
end