Skip to content

Commit f4104dc

Browse files
committed
Normalizing line endings
1 parent 3c0ac6c commit f4104dc

12 files changed

+573
-568
lines changed

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
3+
# Enforce Windows newlines for C# files to avoid false positives with IDE0055 warning.
4+
# See https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/issues/106
5+
*.cs text eol=crlf

AddPathToPSModulePath.ps1

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
<#
2-
.Synopsis
3-
Adds a path to the PSModulePath environment variable.
4-
5-
.DESCRIPTION
6-
Only adds the path if hasn't been added yet. The path will also be added to the $PSModulePath variable so the modules will be available in the current console too.
7-
8-
.EXAMPLE
9-
.\AddPathToPSModulePath.ps1
10-
.\AddPathToPSModulePath.ps1 -Path "C:\MyPowerShellScripts"
11-
#>
12-
13-
Param
14-
(
15-
# The path to a folder that should be added to the list of paths containing PS modules. If not specified, the current path of this script will be added.
16-
[string]
17-
$Path = "$PSScriptRoot\"
18-
)
19-
20-
$paths = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine").Split(";", [System.StringSplitOptions]::RemoveEmptyEntries)
21-
22-
if(!$paths.Contains($Path))
23-
{
24-
[System.Environment]::SetEnvironmentVariable("PSModulePath", [string]::Join(";", $paths + $Path), "Machine")
25-
Write-Information "The path `"$Path`" was successfully added to the PSModulePath environment variable."
26-
}
27-
else
28-
{
29-
Write-Warning "The PSModulePath environment variable already contains the path `"$Path`"."
1+
<#
2+
.Synopsis
3+
Adds a path to the PSModulePath environment variable.
4+
5+
.DESCRIPTION
6+
Only adds the path if hasn't been added yet. The path will also be added to the $PSModulePath variable so the modules will be available in the current console too.
7+
8+
.EXAMPLE
9+
.\AddPathToPSModulePath.ps1
10+
.\AddPathToPSModulePath.ps1 -Path "C:\MyPowerShellScripts"
11+
#>
12+
13+
Param
14+
(
15+
# The path to a folder that should be added to the list of paths containing PS modules. If not specified, the current path of this script will be added.
16+
[string]
17+
$Path = "$PSScriptRoot\"
18+
)
19+
20+
$paths = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine").Split(";", [System.StringSplitOptions]::RemoveEmptyEntries)
21+
22+
if(!$paths.Contains($Path))
23+
{
24+
[System.Environment]::SetEnvironmentVariable("PSModulePath", [string]::Join(";", $paths + $Path), "Machine")
25+
Write-Information "The path `"$Path`" was successfully added to the PSModulePath environment variable."
26+
}
27+
else
28+
{
29+
Write-Warning "The PSModulePath environment variable already contains the path `"$Path`"."
3030
}

Readme.md

+89-89
Large diffs are not rendered by default.

ReloadEveryModuleInPSModulePaths.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
foreach ($path in [Environment]::GetEnvironmentVariable("PSModulePath", "Machine").Split(";", [System.StringSplitOptions]::RemoveEmptyEntries))
2-
{
3-
Reload-Module $path
1+
foreach ($path in [Environment]::GetEnvironmentVariable("PSModulePath", "Machine").Split(";", [System.StringSplitOptions]::RemoveEmptyEntries))
2+
{
3+
Reload-Module $path
44
}
+17-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
@echo off
2-
3-
rem Script for copying the files changed in the last commit of a hg repo to another folder (like a git repo's folder so
4-
rem you can commit the changes to git too).
5-
rem You can use this to publish changesets (like when an issue branch is merged) from a hg repo to a git (or another hg) repo.
6-
7-
rem Usage: ArchiveLastCommitToFolder.bat HgRepoPath ToDirectoryPath
8-
9-
rem Note that with this only changed (and added) files will be copied over, but if a file was removed this change won't
10-
rem be reflected in the target directory.
11-
12-
rem Taking two command line arguments.
13-
set hgRepoPath=%1
14-
set toDirectoryPath=%2
15-
16-
@echo on
17-
1+
@echo off
2+
3+
rem Script for copying the files changed in the last commit of a hg repo to another folder (like a git repo's folder so
4+
rem you can commit the changes to git too).
5+
rem You can use this to publish changesets (like when an issue branch is merged) from a hg repo to a git (or another hg) repo.
6+
7+
rem Usage: ArchiveLastCommitToFolder.bat HgRepoPath ToDirectoryPath
8+
9+
rem Note that with this only changed (and added) files will be copied over, but if a file was removed this change won't
10+
rem be reflected in the target directory.
11+
12+
rem Taking two command line arguments.
13+
set hgRepoPath=%1
14+
set toDirectoryPath=%2
15+
16+
@echo on
17+
1818
hg archive -I "set:added() or modified()" -S -r tip -t files %toDirectoryPath% -R %hgRepoPath%
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
@echo off
2-
3-
rem Script for exporting the files changed in the last commit of a hg repo to another hg repo as a patch so you can
4-
rem commit the changes to the other repo too.
5-
rem You can use this to publish changesets (like when an issue branch is merged) from a hg repo to another hg repo.
6-
7-
rem Usage: ExportLastCommitToAnotherHgRepo.bat HgRepo1Path HgRepo2Path
8-
9-
rem Note that on contrary to doing a hg archive exporting a patch like this will also remove files in the other repo
10-
rem when they're removed in the original repo.
11-
12-
rem Taking two command line arguments. Below we cd to the git repo path because with relative paths --git-dir and
13-
rem --work-tree wouldn't work.
14-
set hgRepo1Path=%1
15-
set hgRepo2Path=%2
16-
17-
rem Replacing double quotes with empty string (i.e. removing double quotes) so if the path needs the quotes (due to
18-
rem containing spaces) it won't mess up the path concatenation in hg export.
19-
set hgRepo2Path=%hgRepo2Path:"=%
20-
21-
@echo on
22-
23-
hg export --output "%hgRepo2Path%\export.patch" --verbose --git -R %hgRepo1Path%
24-
cd /D "%hgRepo2Path%"
25-
hg import "export.patch" --verbose --similarity 80 --no-commit -R %hgRepo2Path%
26-
del "export.patch"
27-
1+
@echo off
2+
3+
rem Script for exporting the files changed in the last commit of a hg repo to another hg repo as a patch so you can
4+
rem commit the changes to the other repo too.
5+
rem You can use this to publish changesets (like when an issue branch is merged) from a hg repo to another hg repo.
6+
7+
rem Usage: ExportLastCommitToAnotherHgRepo.bat HgRepo1Path HgRepo2Path
8+
9+
rem Note that on contrary to doing a hg archive exporting a patch like this will also remove files in the other repo
10+
rem when they're removed in the original repo.
11+
12+
rem Taking two command line arguments. Below we cd to the git repo path because with relative paths --git-dir and
13+
rem --work-tree wouldn't work.
14+
set hgRepo1Path=%1
15+
set hgRepo2Path=%2
16+
17+
rem Replacing double quotes with empty string (i.e. removing double quotes) so if the path needs the quotes (due to
18+
rem containing spaces) it won't mess up the path concatenation in hg export.
19+
set hgRepo2Path=%hgRepo2Path:"=%
20+
21+
@echo on
22+
23+
hg export --output "%hgRepo2Path%\export.patch" --verbose --git -R %hgRepo1Path%
24+
cd /D "%hgRepo2Path%"
25+
hg import "export.patch" --verbose --similarity 80 --no-commit -R %hgRepo2Path%
26+
del "export.patch"
27+
2828
cd "%~dp0%"
+27-27
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
@echo off
2-
3-
rem Script for exporting the files changed in the last commit of a hg repo to a git repo as a patch so you can commit
4-
rem the changes to git too.
5-
rem You can use this to publish changesets (like when an issue branch is merged) from a hg repo to a git repo.
6-
7-
rem Usage: ExportLastCommitToGit.bat HgRepoPath GitRepoPath
8-
9-
rem Note that on contrary to doing a hg archive exporting a patch like this will also remove files in the git repo
10-
rem when they're removed in the hg repo.
11-
12-
rem Taking two command line arguments. Below we cd to the git repo path because with relative paths --git-dir and
13-
rem --work-tree wouldn't work.
14-
set hgRepoPath=%1
15-
set gitRepoPath=%2
16-
17-
rem Replacing double quotes with empty string (i.e. removing double quotes) so if the path needs the quotes (due to
18-
rem containing spaces) it won't mess up the path concatenation in hg export.
19-
set gitRepoPath=%gitRepoPath:"=%
20-
21-
@echo on
22-
23-
hg export --output "%gitRepoPath%\export.patch" --verbose --git -R %hgRepoPath%
24-
cd /D "%gitRepoPath%"
25-
git apply "export.patch" --3way --whitespace=fix
26-
del "export.patch"
27-
1+
@echo off
2+
3+
rem Script for exporting the files changed in the last commit of a hg repo to a git repo as a patch so you can commit
4+
rem the changes to git too.
5+
rem You can use this to publish changesets (like when an issue branch is merged) from a hg repo to a git repo.
6+
7+
rem Usage: ExportLastCommitToGit.bat HgRepoPath GitRepoPath
8+
9+
rem Note that on contrary to doing a hg archive exporting a patch like this will also remove files in the git repo
10+
rem when they're removed in the hg repo.
11+
12+
rem Taking two command line arguments. Below we cd to the git repo path because with relative paths --git-dir and
13+
rem --work-tree wouldn't work.
14+
set hgRepoPath=%1
15+
set gitRepoPath=%2
16+
17+
rem Replacing double quotes with empty string (i.e. removing double quotes) so if the path needs the quotes (due to
18+
rem containing spaces) it won't mess up the path concatenation in hg export.
19+
set gitRepoPath=%gitRepoPath:"=%
20+
21+
@echo on
22+
23+
hg export --output "%gitRepoPath%\export.patch" --verbose --git -R %hgRepoPath%
24+
cd /D "%gitRepoPath%"
25+
git apply "export.patch" --3way --whitespace=fix
26+
del "export.patch"
27+
2828
cd "%~dp0%"
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
<#
2-
.Synopsis
3-
Gets the name of the default local SQL Server instance.
4-
#>
5-
6-
7-
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
8-
9-
function Get-DefaultSqlServerName
10-
{
11-
[CmdletBinding()]
12-
[Alias("gdssm")]
13-
[OutputType([string])]
14-
Param()
15-
16-
Process
17-
{
18-
$serverServices = (Get-WmiObject win32_Service -Computer $env:COMPUTERNAME | Where-Object { $PSItem.Name -match "MSSQL" -and $PSItem.PathName -match "sqlservr.exe" })
19-
$servicePath = ""
20-
21-
# No SQL Servers installed.
22-
if ($serverServices -eq $null)
23-
{
24-
throw ("Could not find any SQL Server services!")
25-
}
26-
# Only one SQL Server installed.
27-
elseif ($serverServices.Count -eq $null)
28-
{
29-
$servicePath = $serverServices.PathName
30-
}
31-
# More than one SQL Servers installed and one of them is named "MSSQLSERVER" (default name), so let's choose that.
32-
elseif (($serverServices | Where-Object { $PSItem.Name -eq "MSSQLSERVER" }) -ne $null)
33-
{
34-
$servicePath = ($serverServices | Where-Object { $PSItem.Name -eq "MSSQLSERVER" }).PathName
35-
}
36-
# More than one SQL Servers installed, choosing the first one.
37-
else
38-
{
39-
$servicePath = $serverServices[0].PathName
40-
}
41-
42-
return $servicePath.Substring($servicePath.LastIndexOf(" -s") + 3)
43-
}
1+
<#
2+
.Synopsis
3+
Gets the name of the default local SQL Server instance.
4+
#>
5+
6+
7+
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
8+
9+
function Get-DefaultSqlServerName
10+
{
11+
[CmdletBinding()]
12+
[Alias("gdssm")]
13+
[OutputType([string])]
14+
Param()
15+
16+
Process
17+
{
18+
$serverServices = (Get-WmiObject win32_Service -Computer $env:COMPUTERNAME | Where-Object { $PSItem.Name -match "MSSQL" -and $PSItem.PathName -match "sqlservr.exe" })
19+
$servicePath = ""
20+
21+
# No SQL Servers installed.
22+
if ($serverServices -eq $null)
23+
{
24+
throw ("Could not find any SQL Server services!")
25+
}
26+
# Only one SQL Server installed.
27+
elseif ($serverServices.Count -eq $null)
28+
{
29+
$servicePath = $serverServices.PathName
30+
}
31+
# More than one SQL Servers installed and one of them is named "MSSQLSERVER" (default name), so let's choose that.
32+
elseif (($serverServices | Where-Object { $PSItem.Name -eq "MSSQLSERVER" }) -ne $null)
33+
{
34+
$servicePath = ($serverServices | Where-Object { $PSItem.Name -eq "MSSQLSERVER" }).PathName
35+
}
36+
# More than one SQL Servers installed, choosing the first one.
37+
else
38+
{
39+
$servicePath = $serverServices[0].PathName
40+
}
41+
42+
return $servicePath.Substring($servicePath.LastIndexOf(" -s") + 3)
43+
}
4444
}

0 commit comments

Comments
 (0)