Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Nov 21, 2020
2 parents 738cac0 + 088bdb4 commit 92cb346
Show file tree
Hide file tree
Showing 78 changed files with 912 additions and 146 deletions.
Binary file modified bin/engines/2710/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/2710/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/273/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/273/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/277/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/277/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/278/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/278/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/279/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/279/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/378/pyRevitLabs.PythonNet.dll
Binary file not shown.
Binary file modified bin/engines/385/pyRevitLabs.PythonNet.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Common.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonCLI.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonWPF.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.DeffrelDB.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Emojis.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Json.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Language.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.MahAppsMetro.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.NLog.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.PyRevit.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.AutoCAD.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.Navisworks.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.Revit.dll
Binary file not shown.
Binary file modified bin/pyrevit-autocomplete.exe
Binary file not shown.
Binary file added bin/pyrevit-doctor.exe
Binary file not shown.
12 changes: 12 additions & 0 deletions bin/pyrevit-products.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[
{
"product": "pyRevit",
"release": "4.8.4",
"version": "4.8.4",
"key": "{CA4CAB91-D337-4A68-BCF7-D56B77327D3A}"
},
{
"product": "pyRevit",
"release": "4.8.3",
Expand Down Expand Up @@ -209,6 +215,12 @@
"version": "4.6.1",
"key": "{EF91A585-DC0C-43B8-B88B-4C130F430E84}"
},
{
"product": "pyRevit CLI",
"release": "4.8.4",
"version": "4.8.4",
"key": "{EF5EC593-2F57-44D8-8456-CFB05247ADA0}"
},
{
"product": "pyRevit CLI",
"release": "4.8.3",
Expand Down
Binary file modified bin/pyrevit-stubsbuilder.exe
Binary file not shown.
Binary file modified bin/pyrevit-telemetryserver.exe
Binary file not shown.
Binary file modified bin/pyrevit-toast.exe
Binary file not shown.
Binary file modified bin/pyrevit.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions dev/pyRevit/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

[assembly: AssemblyVersion("4.8.3")]
[assembly: AssemblyFileVersion("4.8.3")]
[assembly: AssemblyVersion("4.8.4")]
[assembly: AssemblyFileVersion("4.8.4")]
17 changes: 16 additions & 1 deletion dev/pyRevitLabs/pyRevitCLI/PyRevitCLI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ internal enum PyRevitCLICommandType {
Caches,
Config,
Configs,
Doctor,
}

internal static class PyRevitCLI {
Expand Down Expand Up @@ -164,7 +165,7 @@ static void Main(string[] args) {
private static void ProcessArguments() {
if (IsHelpUsagePatternMode) Console.WriteLine(UsagePatterns.Replace("\t", " "));

else if (IsVersionMode) PyRevitCLIAppCmds.PrintVersion();
else if (IsVersionMode) PyRevitCLIAppCmds.PrintVersion(checkUpdates: true);

else if (all("wiki")) CommonUtils.OpenUrl(PyRevitLabsConsts.WikiUrl);

Expand Down Expand Up @@ -828,6 +829,20 @@ private static void ProcessArguments() {
}
}

else if (all("doctor")) {
if (IsHelpMode)
PyRevitCLIAppCmds.RunDoctor("--wrappedhelp");

else if (TryGetValue("<doctor_command>") is var doctorCommand && doctorCommand != null)
PyRevitCLIAppCmds.RunDoctor(doctorCommand, dryRun: arguments["--dryrun"].IsTrue);

else if (all("doctor", "--list"))
PyRevitCLIAppCmds.RunDoctor("--list");

else
PyRevitCLIAppCmds.RunDoctor("");
}

else if (IsHelpMode) PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Main);
}

Expand Down
54 changes: 38 additions & 16 deletions dev/pyRevitLabs/pyRevitCLI/PyRevitCLIAppCmds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,33 @@ internal static void

// cli specific commands
internal static void
PrintVersion() {
PrintVersion(bool checkUpdates = false) {
Console.WriteLine(string.Format(StringLib.ConsoleVersionFormat, PyRevitCLI.CLIVersion.ToString()));
if (CommonUtils.CheckInternetConnection()) {
var latestVersion = PyRevitReleases.GetLatestCLIReleaseVersion();
if (latestVersion != null) {
logger.Debug("Latest release: {0}", latestVersion);
if (PyRevitCLI.CLIVersion < latestVersion) {
Console.WriteLine(
string.Format(
"Newer v{0} is available.\nGo to {1} to download the installer.",
latestVersion,
PyRevitLabsConsts.ReleasesUrl)
);
if (checkUpdates) {
if (CommonUtils.CheckInternetConnection()) {
try {
var latestVersion = PyRevitReleases.GetLatestCLIReleaseVersion();

if (latestVersion != null) {
logger.Debug("Latest release: {0}", latestVersion);
if (PyRevitCLI.CLIVersion < latestVersion) {
Console.WriteLine(
string.Format(
"Newer v{0} is available.\nGo to {1} to download the installer.",
latestVersion,
PyRevitLabsConsts.ReleasesUrl)
);
}
else
Console.WriteLine("You have the latest version.");
}
else
logger.Debug("Failed getting latest release list OR no CLI releases.");
}
catch (Exception getRelEx) {
Console.WriteLine(getRelEx.Message);
}
else
Console.WriteLine("You have the latest version.");
}
else
logger.Debug("Failed getting latest release list OR no CLI releases.");
}
}

Expand All @@ -211,5 +219,19 @@ internal static void
RevitProductData.Update();
PyRevitProductData.Update();
}

internal static void
RunDoctor(string args, bool dryRun = false) {
if (dryRun) args += " --dryrun";

string doctorExe = Path.Combine(GetProcessPath(), "pyrevit-doctor.exe");
ProcessStartInfo cpyProcessInfo = new ProcessStartInfo(doctorExe) {
WorkingDirectory = GetProcessPath(),
Arguments = args,
UseShellExecute = false
};
var utilityProcess = Process.Start(cpyProcessInfo);
utilityProcess.WaitForExit();
}
}
}
1 change: 1 addition & 0 deletions dev/pyRevitLabs/pyRevitCLI/PyRevitCLIAppHelps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ internal static void
{ "detach", "Detach pyRevit clone from installed Revit" },
{ "config", "Configure pyRevit for current user" },
{ "run", "Run python script in Revit" },
{ "doctor", "Fix potential or real problems" },
},
helpCommands: new Dictionary<string, string>() {
{ "wiki", "Open pyRevit Wiki" },
Expand Down
41 changes: 22 additions & 19 deletions dev/pyRevitLabs/pyRevitCLI/Resources/UsagePatterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Usage:
pyrevit (-V | --version)
pyrevit --usage
pyrevit (wiki | blog | docs | source | youtube | support)
pyrevit env [--json] [--help] [--log=<log_file>]
pyrevit env [--json] [(-h | --help)] [--log=<log_file>]
pyrevit update [--help] [--log=<log_file>]
pyrevit clone --help
pyrevit clone (-h | --help)
pyrevit clone <clone_name> <deployment_name> [--dest=<dest_path>] [--branch=<branch_name>] [--log=<log_file>]
pyrevit clone <clone_name> --image=<image_url> [--dest=<dest_path>] [--log=<log_file>]
pyrevit clone <clone_name> [--dest=<dest_path>] [--source=<repo_url>] [--branch=<branch_name>] [--log=<log_file>] [--username=<username>] [--password=<password>]
pyrevit clones [--help]
pyrevit clones [(-h | --help)]
pyrevit clones (info | open) <clone_name>
pyrevit clones add <clone_name> <clone_path> [--force] [--log=<log_file>]
pyrevit clones forget (--all | <clone_name>) [--log=<log_file>]
Expand All @@ -23,54 +23,54 @@ Usage:
pyrevit clones update (--all | <clone_name>) [--log=<log_file>] [--username=<username>] [--password=<password>]
pyrevit clones deployments <clone_name>
pyrevit clones engines <clone_name>
pyrevit attach --help
pyrevit attach (-h | --help)
pyrevit attach <clone_name> (latest | dynamosafe | <engine_version>) (<revit_year> | --installed | --attached) [--allusers] [--log=<log_file>]
pyrevit attached [<revit_year>] [--help]
pyrevit switch --help
pyrevit attached [<revit_year>] [(-h | --help)]
pyrevit switch (-h | --help)
pyrevit switch <clone_name> [<revit_year>]
pyrevit detach --help
pyrevit detach (-h | --help)
pyrevit detach (--all | <revit_year>) [--log=<log_file>]
pyrevit extend --help
pyrevit extend (-h | --help)
pyrevit extend <extension_name> [--dest=<dest_path>] [--branch=<branch_name>] [--log=<log_file>]
pyrevit extend (ui | lib | run) <extension_name> <repo_url> [--dest=<dest_path>] [--branch=<branch_name>] [--log=<log_file>] [--username=<username>] [--password=<password>]
pyrevit extensions [--help]
pyrevit extensions [(-h | --help)]
pyrevit extensions search <search_pattern>
pyrevit extensions (info | help ) <extension_name>
pyrevit extensions open <extension_name>
pyrevit extensions open <clone_name> <extension_name>
pyrevit extensions delete <extension_name> [--log=<log_file>]
pyrevit extensions origin <extension_name> --reset [--log=<log_file>]
pyrevit extensions origin <extension_name> [<origin_url>] [--log=<log_file>]
pyrevit extensions paths [--help]
pyrevit extensions paths [(-h | --help)]
pyrevit extensions paths forget --all [--log=<log_file>]
pyrevit extensions paths (add | forget) <extensions_path> [--log=<log_file>]
pyrevit extensions (enable | disable) <extension_name> [--log=<log_file>]
pyrevit extensions (enable | disable) <clone_name> <extension_name> [--log=<log_file>]
pyrevit extensions sources [--help]
pyrevit extensions sources [(-h | --help)]
pyrevit extensions sources forget --all [--log=<log_file>]
pyrevit extensions sources (add | forget) <source_json_or_url> [--log=<log_file>]
pyrevit extensions update (--all | <extension_name>) [--log=<log_file>] [--username=<username>] [--password=<password>]
pyrevit releases --help
pyrevit releases (-h | --help)
pyrevit releases [--pre] [--notes]
pyrevit releases latest [--pre] [--notes]
pyrevit releases <search_pattern> [--pre] [--notes]
pyrevit releases open latest [--pre]
pyrevit releases open <search_pattern> [--pre]
pyrevit releases download (installer | archive) <search_pattern> [--dest=<dest_path>] [--pre]
pyrevit revits
pyrevit revits --help
pyrevit revits (-h | --help)
pyrevit revits [--installed] [--log=<log_file>]
pyrevit revits --supported [--csv=<output_file>]
pyrevit revits killall [<revit_year>] [--log=<log_file>]
pyrevit revits fileinfo <file_or_dir_path> [--csv=<output_file>] [--rvt] [--rte] [--rfa] [--rft]
pyrevit run --help
pyrevit run (-h | --help)
pyrevit run <script_or_command_name> [--revit=<revit_year>] [--purge] [--import=<import_path>]
pyrevit run <script_or_command_name> <model_file> [--revit=<revit_year>] [--purge] [--import=<import_path>]
pyrevit caches --help
pyrevit caches (-h | --help)
pyrevit caches [bim360] clear (--all | <revit_year>) [--log=<log_file>]
pyrevit config --help
pyrevit config (-h | --help)
pyrevit config --from=<template_config_path> [--log=<log_file>]
pyrevit configs --help
pyrevit configs (-h | --help)
pyrevit configs bincache [(enable | disable)] [--log=<log_file>]
pyrevit configs checkupdates [(enable | disable)] [--log=<log_file>]
pyrevit configs autoupdate [(enable | disable)] [--log=<log_file>]
Expand All @@ -85,11 +85,11 @@ Usage:
pyrevit configs usercanconfig [(yes | no)] [--log=<log_file>]
pyrevit configs colordocs [(enable | disable)] [--log=<log_file>]
pyrevit configs tooltipdebuginfo [(enable | disable)] [--log=<log_file>]
pyrevit configs routes [--help]
pyrevit configs routes [(-h | --help)]
pyrevit configs routes [(enable | disable)] [--log=<log_file>]
pyrevit configs routes port [<port_number>] [--log=<log_file>]
pyrevit configs routes coreapi [(enable | disable)] [--log=<log_file>]
pyrevit configs telemetry [--help]
pyrevit configs telemetry [(-h | --help)]
pyrevit configs telemetry [(enable | disable)] [--log=<log_file>]
pyrevit configs telemetry utc [(yes | no)] [--log=<log_file>]
pyrevit configs telemetry (file | server) [<dest_path>] [--log=<log_file>]
Expand All @@ -100,3 +100,6 @@ Usage:
pyrevit configs seed [--lock] [--log=<log_file>]
pyrevit configs <option_path> [(enable | disable)] [--log=<log_file>]
pyrevit configs <option_path> [<option_value>] [--log=<log_file>]
pyrevit doctor (-h | --help)
pyrevit doctor [--list]
pyrevit doctor <doctor_command> [--dryrun]
6 changes: 6 additions & 0 deletions dev/pyRevitLabs/pyRevitDoctor/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
112 changes: 112 additions & 0 deletions dev/pyRevitLabs/pyRevitDoctor/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

using pyRevitDoctor.Properties;

namespace pyRevitDoctor {
class Program {
const string helpMessage = @"Fix potential or real problems
Usage:
pyrevit-doctor (-V | --version)
pyrevit-doctor (-h | --help)
pyrevit-doctor [--list]
pyrevit-doctor <doctor_command> [--dryrun]
Arguments & Options:
<doctor_command> Doctor command to run
";

static DoctorCommand[] Commands = new DoctorCommand[] {
new DoctorCommand {
Name = "purge-installs",
HelpMsg = "Clean up records of old installations from registry",
Command = PurgeInstalls.PurgeOldInstalls
}
};

public static Version DoctorVersion => Assembly.GetExecutingAssembly().GetName().Version;

static void Main(string[] args) {
bool dryrun = args.Contains("--dryrun");

if (args.Contains("--version") || args.Contains("-V"))
Console.WriteLine(DoctorVersion);
else if (args.Contains("--help") || args.Contains("-h"))
Console.WriteLine(helpMessage);
else if (args.Contains("--wrappedhelp"))
Console.WriteLine(helpMessage.Replace("pyrevit-doctor (-V | --version)\n", "").Replace("pyrevit-doctor", "pyrevit doctor"));
else if (args.Contains("--list"))
PrintCommands();

else if (args.Length > 0) {
if (Commands.Where(x => x.Name == args[0]).FirstOrDefault() is DoctorCommand command)
command.Command(dryrun);
}
else {
if (AskForCommand() is DoctorCommand command) {
command.Command(dryrun);
Console.WriteLine("Press any key to close");
Console.ReadLine();
}
}
}

static DoctorCommand? AskForCommand() {
Console.WriteLine("Select a commands to run:");
uint commandId = 1;
foreach (var command in Commands)
Console.WriteLine($" {commandId}) {command.Name,-25} {command.HelpMsg}");
Console.Write("\nEnter Command Id: ");

if (int.TryParse(Console.ReadLine(), out int cmdId)) {
if (cmdId > 0 && cmdId <= Commands.Length)
return Commands[cmdId - 1];
}
return null;
}

static void PrintCommands() {
Console.WriteLine("Available Commands:");
foreach (var command in Commands)
Console.WriteLine($" {command.Name,-25} {command.HelpMsg}");
}

static Regex productFinder = new Regex(
@"\{$\s*""product"":\s+""(.+)"",$\s*""release"":\s+""(.+)"",$\s*""version"":\s+""(.+)"",$\s*""key"":\s+""(.+)""$\s*\}",
RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.Compiled
);


public static List<Product> LoadProducts() {
var products = new List<Product>();
foreach (Match match in productFinder.Matches(Resources.ProductInfo))
products.Add(new Product {
Name = match.Groups[1].Value,
Release = match.Groups[2].Value,
Version = new Version(match.Groups[3].Value),
Key = match.Groups[4].Value,
});
return products;
}
}

struct DoctorCommand {
public string Name;
public string HelpMsg;
public Action<bool> Command;
}

public struct Product {
public string Name;
public string Release;
public Version Version;
public string Key;
}
}
21 changes: 21 additions & 0 deletions dev/pyRevitLabs/pyRevitDoctor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("pyRevitDoctor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("pyRevitDoctor")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d4bad33b-faee-4d57-a3f6-e2bbdcde8ae6")]
Loading

0 comments on commit 92cb346

Please sign in to comment.