Class: Fastlane::Actions::UploadNugetAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::UploadNugetAction
- Defined in:
- lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .get_dotnet_args(params) ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb', line 33 def self. ["CheeryLee"] end |
.available_options ⇒ Object
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 86 87 88 89 90 |
# File 'lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb', line 50 def self. [ FastlaneCore::ConfigItem.new( key: :api_key, env_name: "SF_NUGET_API_KEY", description: "The API key for the server", optional: false, type: String, verify_block: proc do |value| UI.user_error!("The API key for the server must be specified and must not be empty") unless value && !value.empty? end ), FastlaneCore::ConfigItem.new( key: :source, env_name: "SF_NUGET_SERVER", description: "The server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP", optional: false, type: String ), FastlaneCore::ConfigItem.new( key: :timeout, env_name: "SF_PUSHING_TIMEOUT", description: "The timeout for pushing to a server in seconds", optional: true, default_value: 0, type: Integer ), FastlaneCore::ConfigItem.new( key: :path, env_name: "SF_PACKAGE", description: "The file path to the package to be uploaded", optional: false, type: String, verify_block: proc do |value| UI.user_error!("Path to NuGet package is invalid") unless value && !value.empty? UI.user_error!("The provided path doesn't point to NUPKG-file") unless File.exist?(File.(value)) && value.end_with?(".nupkg") end ) ] end |
.category ⇒ Object
92 93 94 |
# File 'lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb', line 92 def self.category :production end |
.description ⇒ Object
29 30 31 |
# File 'lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb', line 29 def self.description "Pushes a package to the server and publishes it" end |
.get_dotnet_args(params) ⇒ Object
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb', line 96 def self.get_dotnet_args(params) args = [] args.append(params[:path]) args.append("--api-key #{params[:api_key]}") args.append("--source #{params[:source]}") args.append("--timeout #{params[:timeout]}") args end |
.is_supported?(platform) ⇒ Boolean
37 38 39 |
# File 'lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb', line 37 def self.is_supported?(platform) true end |
.output ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb', line 41 def self.output [ ["SF_NUGET_API_KEY", "The API key for the server"], ["SF_NUGET_SERVER", "The server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP"], ["SF_PUSHING_TIMEOUT", "The timeout for pushing to a server in seconds"], ["SF_PACKAGE", "The file path to the package to be uploaded"], ] end |
.run(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fastlane/plugin/sapfire/actions/upload_nuget_action.rb', line 7 def self.run(params) UI.user_error!("Can't find dotnet") unless Helper::SapfireHelper.dotnet_specified? dotnet_path = Actions.lane_context[SharedValues::SF_DOTNET_PATH] dotnet_args = get_dotnet_args(params) cmd = "\"#{dotnet_path}\" nuget push #{dotnet_args.join(" ")}" UI.command(cmd) Open3.popen2(cmd) do |_, stdout, wait_thr| until stdout.eof? stdout.each do |l| line = l.force_encoding("utf-8").chomp puts line end end UI.user_error!("NuGet package pushing failed. See the log above.") unless wait_thr.value.success? UI.success("Package has successfully uploaded") if wait_thr.value.success? end end |