Class: Fastlane::Actions::NugetRestoreAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



49
50
51
# File 'lib/fastlane/plugin/xamarin/actions/nuget_restore_action.rb', line 49

def self.authors
  ["Thomas Charriere"]
end

.available_optionsObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fastlane/plugin/xamarin/actions/nuget_restore_action.rb', line 62

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :project_path,
                                 env_name: "NUGET_SOLUTION",
                                 description: "The location of a solution or a packages.config",
                                 optional: false,
                                 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)
  ]

end

.descriptionObject



45
46
47
# File 'lib/fastlane/plugin/xamarin/actions/nuget_restore_action.rb', line 45

def self.description
  "Nuget"
end

.detailsObject



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

def self.details
  "Nuget restore"
end

.is_supported?(platform) ⇒ Boolean



79
80
81
# File 'lib/fastlane/plugin/xamarin/actions/nuget_restore_action.rb', line 79

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

.return_valueObject



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

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

.run(params) ⇒ Object



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

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("restore")
  command.push(params[:project_path])
  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