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



102
103
104
105
# 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_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
75
76
77
78
79
80
81
82
83
84
85
# 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

.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



107
108
109
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_clean_install.rb', line 107

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

.outputObject



87
88
89
90
91
92
93
94
95
96
# 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_valueObject



98
99
100
# 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) ⇒ Object



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 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