Class: Fastlane::Actions::FivCleanInstallAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



88
89
90
91
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb', line 88

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["Your GitHub/Twitter Name"]
end

.available_optionsObject



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
# 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|
        UI.user_error!("Platform should be either android, ios or browser") unless ['', 'android', 'ios', 'browser'].include? value
      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|
        UI.user_error!("Platform should be either android, ios or browser") unless ['', 'yarn', 'npm'].include? value
      end
    ),
  ]
end

.descriptionObject



31
32
33
# 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

.detailsObject



35
36
37
38
39
# 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) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb', line 93

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

.outputObject



76
77
78
79
80
81
82
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb', line 76

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_valueObject



84
85
86
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb', line 84

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb', line 8

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

  if params[:plugins]
    sh "rm -rf plugins"  
  end

  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