Class: Fastlane::Actions::NugetInstallAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



57
58
59
# File 'lib/fastlane/plugin/xamarin/actions/nuget_install_action.rb', line 57

def self.authors
  ["Thomas Charriere"]
end

.available_optionsObject



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
# File 'lib/fastlane/plugin/xamarin/actions/nuget_install_action.rb', line 70

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :config_file_path,
                                 env_name: "NUGET_CONFIGFILEPATH",
                                 description: "Identifies the packages.config file that lists the packages to install",
                                 optional: true,
                                 type: String),

    FastlaneCore::ConfigItem.new(key: :package_id,
                                 env_name: "NUGET_PACKAGEID",
                                 description: "The package to install (using the latest version)",
                                 optional: true,
                                 type: String),

    FastlaneCore::ConfigItem.new(key: :nuget,
                                 env_name: "NUGET_PATH",
                                 description: "Path to `nuget`. Default value is found by using `which nuget`",
                                 optional: true,
                                 type: String),

    FastlaneCore::ConfigItem.new(key: :output_directory,
                                 env_name: "NUGET_OUTPUT_DIRECTORY",
                                 description: "Specifies the folder in which packages are installed. If no folder is specified, the current folder is used",
                                 optional: true,
                                 type: String),
  ]

end

.descriptionObject



53
54
55
# File 'lib/fastlane/plugin/xamarin/actions/nuget_install_action.rb', line 53

def self.description
  "Nuget"
end

.detailsObject



65
66
67
# File 'lib/fastlane/plugin/xamarin/actions/nuget_install_action.rb', line 65

def self.details
  "Nuget restore"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/fastlane/plugin/xamarin/actions/nuget_install_action.rb', line 99

def self.is_supported?(platform)
  [:android, :ios].include?(platform)
end

.return_valueObject



61
62
63
# File 'lib/fastlane/plugin/xamarin/actions/nuget_install_action.rb', line 61

def self.return_value
  # If your method provides a return value, you can describe here what it does
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
50
51
# File 'lib/fastlane/plugin/xamarin/actions/nuget_install_action.rb', line 4

def self.run(params)
  
  nuget = params[:nuget] || FastlaneCore::CommandExecutor.which('nuget')

  if nuget.nil?
      UI.error("Could not find nuget")
      return
  end

  if FastlaneCore::Globals.verbose?
    FastlaneCore::PrintTable.print_values(
      config: params,
      title: "Summary of parameters passed"
    )
  end        
  command = Array.new

  command.push(nuget)
  command.push("install")
  command.push(params[:config_file_path] || params[:package_id])
  command.push("-OutputDirectory") unless params[:output_directory].nil?
  command.push(params[:output_directory]) unless params[:output_directory].nil?

  command.push("-Verbosity")
  if FastlaneCore::Globals.verbose?
    command.push("detailed")
  else
    command.push("normal")
  end
  command.push("-NonInteractive")


  exit_status = 0
  result = FastlaneCore::CommandExecutor.execute(command: command,
                                  print_command: true,
                                  print_all: FastlaneCore::Globals.verbose?,
                                  error: proc do |error_output|
                                    exit_status = $?.exitstatus
                                  end)

  if exit_status == 0
    UI.success("Successfully executed nuget")
  else
    UI.user_error!("Uhh ohh - failed executing nuget")
  end
  

end