Exemple #1
0
        /// <summary>
        /// Creates a bundle that simply uploads and runs a (<c>string</c>) script.
        /// </summary>
        /// <param name="script">The script text.</param>
        /// <returns>The <see cref="CommandBundle"/>.</returns>
        public static CommandBundle FromScript(string script)
        {
            var bundle = new CommandBundle("./script.sh");

            bundle.AddFile("script.sh", script, isExecutable: true);

            return(bundle);
        }
Exemple #2
0
        /// <summary>
        /// Adds a text file to be uploaded before executing the command.
        /// </summary>
        /// <param name="path">The file path relative to the directory where the command will be executed.</param>
        /// <param name="text">The file text.</param>
        /// <param name="isExecutable">Optionally specifies that the file is to be marked as executable.</param>
        /// <param name="linuxCompatible">
        /// Optionally controls whether the text is made Linux compatible by removing carriage returns
        /// and expanding TABs into spaces.  This defaults to <c>true</c>.
        /// </param>
        public void AddFile(string path, string text, bool isExecutable = false, bool linuxCompatible = true)
        {
            Covenant.Requires <ArgumentNullException>(!string.IsNullOrEmpty(path), nameof(path));

            commandBundle.AddFile(path, text, isExecutable, linuxCompatible);
        }