class Fastlane::Actions::FivCleanInstallAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb, line 102
def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ['Your GitHub/Twitter Name']
end
available_options() click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb, line 41
def self.available_options
  # Define all options your action supports.

  # Below a few examples
  [
    FastlaneCore::ConfigItem.new(
      key: :platform,
      env_name: 'CORDOVA_PLATFORM',
      description: 'Platform to build on. Can be android, ios or browser',
      is_string: true,
      default_value: '',
      verify_block:
        proc do |value|
          unless ['', 'android', 'ios', 'browser'].include? value
            UI.user_error!(
              'Platform should be either android, ios or browser'
            )
          end
        end
    ),
    FastlaneCore::ConfigItem.new(
      key: :plugins,
      env_name: 'REFRESH_PLUGINS',
      description: 'also refresh plugins',
      default_value: false,
      is_string: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :package_manager,
      env_name: 'PACKAGE_MANAGER',
      description:
        'What package manager to use to install dependencies: e.g. yarn | npm',
      is_string: true,
      default_value: 'npm',
      verify_block:
        proc do |value|
          unless ['', 'yarn', 'npm'].include? value
            UI.user_error!(
              'Platform should be either android, ios or browser'
            )
          end
        end
    )
  ]
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb, line 31
def self.description
  'A short description with <= 80 characters of what this action does'
end
details() click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb, line 35
def self.details
  # Optional:
  # this is your chance to provide a more detailed description of this action
  'You can use this action to do cool things...'
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb, line 107
def self.is_supported?(platform)
  platform == :android
end
output() click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb, line 87
def self.output
  # Define the shared values you are going to provide
  # Example
  [
    [
      'FIV_BUILD_IONIC_ANDROID_CUSTOM_VALUE',
      'A description of what this value contains'
    ]
  ]
end
return_value() click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb, line 98
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb, line 9
def self.run(params)
  if params[:platform].to_s == 'ios' ||
       params[:platform].to_s == 'android'
    sh "rm -rf node_modules platforms/#{params[:platform]}"
  elsif params[:platform].to_s == 'browser'
    sh 'rm -rf node_modules www'
  end

  sh 'rm -rf plugins' if params[:plugins]

  sh "#{params[:package_manager]} install"

  if params[:platform].to_s == 'ios' ||
       params[:platform].to_s == 'android'
    sh "ionic cordova platform add #{params[:platform]}"
  end
end