Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

113 #331

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft

113 #331

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 4 additions & 46 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,49 +56,7 @@ component.worker.ps1
module-with-component.worker.ps1
project.worker.ps1

# angular git ignore file
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
learnings/angular/slide-in-over-lay/dist
learnings/angular/slide-in-over-lay/tmp
learnings/angular/slide-in-over-lay/out-tsc
learnings/angular/slide-in-over-lay/bazel-out

# Node
learnings/angular/slide-in-over-lay/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
learnings/angular/slide-in-over-lay/.angular/cache
.sass-cache/
learnings/angular/slide-in-over-lay/connect.lock
learnings/angular/slide-in-over-lay/coverage
learnings/angular/slide-in-over-lay/libpeerconnection.log
testem.log
learnings/angular/slide-in-over-lay/typings

# System files
.DS_Store
Thumbs.db



# local development settings files
appsettings.Development.json
dotnet/notepad-plus-plus-file-management/settings/notepad-plus-plus-file-management/appsettings.json
dotnet/notepad-plus-plus-file-management/terminal/notepad-plus-plus-file-management/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using cross_application_feature_development_management.Combiners.Interfaces;
using cross_application_feature_development_management.Dirctories.Feature.EnvironmentVariablesTemplateFiles;
using cross_application_feature_development_management.Dirctories.Interfaces;
using cross_application_feature_development_management.Interfaces;
using cross_application_feature_development_management.Names.Classses;
Expand All @@ -18,7 +19,8 @@ public class CrossApplicationFeatureDevelopmentManagement(
IPowerShellScriptsDirectory powerShellScriptsDirectory,
IBatchScriptsDicrectory batchScriptsDicrectory,
ISomething something,
IAddToStartupScript addToStartupScript
IAddToStartupScript addToStartupScript,
INotePadPlusPlusOpenAll notePadPlusPlusOpenAll
)
: ICrossApplicationFeatureDevelopmentManagement
{
Expand All @@ -33,6 +35,7 @@ IAddToStartupScript addToStartupScript
private readonly IBatchScriptsDicrectory batchScriptsDicrectory = batchScriptsDicrectory;
private readonly ISomething something = something;
private readonly IAddToStartupScript addToStartupScript = addToStartupScript;
private readonly INotePadPlusPlusOpenAll notePadPlusPlusOpenAll = notePadPlusPlusOpenAll;

public void Run()
{
Expand Down Expand Up @@ -72,6 +75,11 @@ public void Run()
contentToWrite =
addToStartupScript.PairUpVariablesWithTheirValue(templateFile, environmentVariablesSourceDictionary);
}
else if (templateFile.Contains("notepadpp-open-all"))
{
contentToWrite =
notePadPlusPlusOpenAll.PairUpVariablesWithTheirValue(templateFile, environmentVariablesSourceDictionary);
}
else
{
contentToWrite =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@ public void CopyContentToFeatureNameDicrectory()
directories.CopyContentOfSourceDirectoryToDestinationDirectory(sourceDirectory, destinationDirectory);
}

public void CopyContentToTargetDicrectory()
{
string direcName = "powershell-scripts";
Directory.CreateDirectory(ConstructPathToSelfInTargetDirectory(direcName));
string sourceDirectory = ConstructPathToSelfInScriptsDirectory(direcName);
string destinationDirectory = ConstructPathToSelfInTargetDirectory(direcName);

directories.CopyContentOfSourceDirectoryToDestinationDirectory(sourceDirectory, destinationDirectory);
}

public string ConstructPathToSelfInScriptsDirectory(string direcName)
{
string scriptsDirectoryName = scriptsDirectory.GetName();
Expand All @@ -83,26 +73,5 @@ public string ConstructPathToSelfInFeatureNameDirectory(string direcName)
string environmentVariablesFilesDirectory = Path.Combine(destinationDirectory, direcName);
return environmentVariablesFilesDirectory;
}

public string ConstructPathToSelfInTargetDirectory(string direcName)
{
string destinationDirectory = targetDirectory.CreatePathToSelf();
string environmentVariablesFilesDirectory = Path.Combine(destinationDirectory, direcName);
return environmentVariablesFilesDirectory;
}

public string ConstructPathToSelfInScriptsDirectory()
{
string scriptsDirectoryName = scriptsDirectory.GetName();
string environmentVariablesFilesDirectory = Path.Combine(scriptsDirectoryName, "powershell-scripts");
return environmentVariablesFilesDirectory;
}

public string ConstructPathToSelfInTargetDirectory()
{
string destinationDirectory = targetDirectory.CreatePathToSelf();
string environmentVariablesFilesDirectory = Path.Combine(destinationDirectory, "powershell-scripts");
return environmentVariablesFilesDirectory;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using System.Text;
using cross_application_feature_development_management.Dirctories.Interfaces;
using cross_application_feature_development_management.Helpers.Interfaces;
using cross_application_feature_development_management.Names.Classses;
using cross_application_feature_development_management.Names.Interfaces;
using Microsoft.Extensions.Logging;

namespace cross_application_feature_development_management.Dirctories.Feature.EnvironmentVariablesTemplateFiles
{
public interface INotePadPlusPlusOpenAll
{
public Dictionary<string, string> PairUpVariablesWithTheirValue(
string fileNamePath,
Dictionary<string, string> environmentVariablesSourceDictionary
);
}

public class NotePadPlusPlusOpenAll(
IFeatureName featureName,
IGuestApplicationName guestApplicationName,
IHostApplicationName hostApplicationName,
IHostingDirectory hostingDirectory,
ILogger<NotePadPlusPlusOpenAll> logger,
IStringHelpers stringHelpers
) : INotePadPlusPlusOpenAll
{
private readonly IFeatureName featureName = featureName;
private readonly IGuestApplicationName guestApplicationName = guestApplicationName;
private readonly IHostApplicationName hostApplicationName = hostApplicationName;
private readonly IHostingDirectory hostingDirectory = hostingDirectory;
private readonly ILogger<NotePadPlusPlusOpenAll> logger = logger;
private readonly IStringHelpers stringHelpers = stringHelpers;

public Dictionary<string, string> PairUpVariablesWithTheirValue(
string fileNamePath,
Dictionary<string, string> environmentVariablesSourceDictionary
)
{
Dictionary<string, string> fileContentDictionaryToWriteToFile = [];

const int BufferSize = 128;
using var fileStream = File.OpenRead(fileNamePath);
using var streamReader = new StreamReader(fileStream, Encoding.UTF8, true, BufferSize);
string? line;

while ((line = streamReader.ReadLine()) != null)
{
string[] brokenLine = line.Split("=");
string key = brokenLine[0];
string value = brokenLine[1];

if (key == "FEATURE_NAME")
{
string val = featureName.GetName();
string wrappedVal = stringHelpers.WrappInQoutationMarks(val);
fileContentDictionaryToWriteToFile.Add(key, wrappedVal ?? "");
}
else if (key == "HOST_APPLICATION_NAME")
{
string val = hostApplicationName.GetName();
string wrappedVal = stringHelpers.WrappInQoutationMarks(val);
fileContentDictionaryToWriteToFile.Add(key, wrappedVal ?? "");
}
else if (key == "GUEST_APPLICATION_NAME")
{
string val = guestApplicationName.GetName();
string wrappedVal = stringHelpers.WrappInQoutationMarks(val);
fileContentDictionaryToWriteToFile.Add(key, wrappedVal ?? "");
}
else if (key == "HOSTING_DIRECTORY")
{
string val = hostingDirectory.GetName();
string wrappedVal = stringHelpers.WrappInQoutationMarks(val);
fileContentDictionaryToWriteToFile.Add(key, wrappedVal ?? "");
}
else if (key == "NOTEPAD_PLUS_PLUS_FILE_MANAGEMENT_EXECUTIVE_FILE_CONTAINING_DIRECTORY")
{
environmentVariablesSourceDictionary.TryGetValue(
"NOTEPAD_PLUS_PLUS_FILE_MANAGEMENT_EXECUTIVE_FILE_LOCATION",
out string? notepadPlusPlusFileManagementExecutiveFileLocation
);
var dirName = Path.GetDirectoryName(notepadPlusPlusFileManagementExecutiveFileLocation);
fileContentDictionaryToWriteToFile.Add(key, dirName ?? "");
}
else
{
environmentVariablesSourceDictionary.TryGetValue(key, out string? val);
fileContentDictionaryToWriteToFile.Add(key, val ?? "");
}
}

return fileContentDictionaryToWriteToFile;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ public interface IPowerShellScriptsDirectory
{
public void ReplaceFileNamesWithPaths();
public void CopyContentToFeatureNameDicrectory();
public void CopyContentToTargetDicrectory();
public string ConstructPathToSelfInScriptsDirectory(string direcName);
public string ConstructPathToSelfInFeatureNameDirectory(string direcName);
public string ConstructPathToSelfInTargetDirectory(string direcName);
public string ConstructPathToSelfInScriptsDirectory();
public string ConstructPathToSelfInTargetDirectory();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using cross_application_feature_development_management.Interfaces;

namespace cross_application_feature_development_management.Files.Execytables
{

public interface INotePadPlusPlusFileManagementExecutiveFile
{
}
public class NotePadPlusPlusFileManagementExecutiveFile() : INotePadPlusPlusFileManagementExecutiveFile
{


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using cross_application_feature_development_management.Interfaces;

namespace cross_application_feature_development_management.Names.Classses
{
public interface IFeatureName
{
public string GetName();
}

public class FeatureName(ICommandLineArgs commandLineArgs) : IFeatureName
{
private readonly ICommandLineArgs commandLineArgs = commandLineArgs;
public string GetName()
{
string guestApplicationNameKey = "--feature-name";
var name = commandLineArgs.GetByKey(guestApplicationNameKey);
return name;
}
}
}
3 changes: 3 additions & 0 deletions cross-application-feature-development-management/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using cross_application_feature_development_management.Combiners.Interfaces;
using cross_application_feature_development_management.Dirctories;
using cross_application_feature_development_management.Dirctories.Classes;
using cross_application_feature_development_management.Dirctories.Feature.EnvironmentVariablesTemplateFiles;
using cross_application_feature_development_management.Dirctories.Interfaces;
using cross_application_feature_development_management.Helpers.Classes;
using cross_application_feature_development_management.Helpers.Interfaces;
Expand Down Expand Up @@ -51,6 +52,8 @@ private static void Main(string[] args)
services.AddTransient<IAddToStartupScript, AddToStartupScript>();
services.AddTransient<IStringHelpers, StringHelpers>();
services.AddTransient<IDirectories, Directories>();
services.AddTransient<IFeatureName, FeatureName>();
services.AddTransient<INotePadPlusPlusOpenAll, NotePadPlusPlusOpenAll>();
})
.UseSerilog()
.Build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/bin/bash

hosting_directory=${PWD}
github_desktop_directory=
host_application_name=
guest_application_name=

dotnet run \
--templates-directory "environment-variables-template-files" \
--destination-directory "environment-variables-files" \
--environment-variables-source-directory "environment-variables-source" \
--feature-name "wonderful feature-v3" \
--executive-file-directory "/cross-application-feature-development-management/bin/Debug/net8.0/cross-application-feature-development-management" \
--scripts-directory "[ ... fill in here ...]/working-circulation/cross-application-feature-development-management/scripts" \
--repository-directory "[ ... fill in here ...]/working-circulation" \
--hosting-directory "${hosting_directory}" \
--host-application-name "[ ... fill in here ...]" \
--guest-application-name "[ ... fill in here ...]"
--scripts-directory "${github_desktop_directory}/working-circulation/cross-application-feature-development-management/scripts" \
--repository-directory "${github_desktop_directory}/working-circulation" \
--hosting-directory "${hosting_directory}/workers" \
--host-application-name "${host_application_name}" \
--guest-application-name "${guest_application_name}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

rem xcopy /s "source" "destination"
xcopy /s "" ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

rem xcopy /s "source" "destination"
xcopy /s "" ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rmdir /S /Q ""

dotnet run ^
--templates-directory "environment-variables-template-files" ^
--destination-directory "environment-variables-files" ^
--environment-variables-source-directory "environment-variables-source" ^
--feature-name "wonderful feature" ^
--executive-file-directory "/cross-application-feature-development-management/bin/Debug/net8.0/cross-application-feature-development-management" ^
--scripts-directory "[ ... fill in here ...]/working-circulation/cross-application-feature-development-management/scripts" ^
--repository-directory "[ ... fill in here ...]/working-circulation" ^
--hosting-directory "[ ... fill in here ...]" ^
--host-application-name "[ ... fill in here ...]" ^
--guest-application-name "[ ... fill in here ...]"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

rem xcopy /s "source" "destination"
xcopy /s /d "" ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rmdir /S /Q ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dotnet run ^
--templates-directory "environment-variables-template-files" ^
--destination-directory "environment-variables-files" ^
--environment-variables-source-directory "environment-variables-source" ^
--feature-name "wonderful feature" ^
--executive-file-directory "/cross-application-feature-development-management/bin/Debug/net8.0/cross-application-feature-development-management" ^
--scripts-directory "[ ... fill in here ...]/working-circulation/cross-application-feature-development-management/scripts" ^
--repository-directory "[ ... fill in here ...]/working-circulation" ^
--hosting-directory "[ ... fill in here ...]" ^
--host-application-name "[ ... fill in here ...]" ^
--guest-application-name "[ ... fill in here ...]"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rmdir /S /Q ""

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off

REM notepadpp-open-all
REM notepadpp-open-all.bat

Powershell.exe -ExecutionPolicy RemoteSigned -File "notepadpp-open-all.ps1"
Loading