diff --git a/Makefile b/Makefile index 61633d3f..db5d0562 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ DNXLIBS=Microsoft.Dnx.Host.Mono.dll Microsoft.Dnx.Host.dll Microsoft.Dnx.Applica DNXLIBFP:=$(addprefix $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin/, $(DNXLIBS)) CONFIG=Debug +git_status := $(shell git status -s --porcelain |wc -l) + clean: rm -f src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll @@ -17,11 +19,21 @@ test: web: make -C src/Yavsc web -pushInProd: - make -C src/Yavsc pushInProd +pushInPre: yavscd + sudo service kestrel-pre stop + sudo cp yavscd /usr/local/bin/yavscd-pre + sudo sync + sudo service kestrel-pre start -pushInPre: - make -C src/Yavsc pushInPre +pushInProd: yavscd +ifeq ($(git_status),0) + sudo service kestrel stop + sudo cp yavscd /usr/local/bin/yavscd + sudo sync + sudo service kestrel start +else + $(error EPRODANDGITSTATUS! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.) +endif packages: make -C src/Yavsc.Abstract pack @@ -49,7 +61,7 @@ src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll: src/Yavsc.Abstract/bin/$ src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll: src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll make -C src/Yavsc CONFIGURATION=$(CONFIG) -bundle: src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll +yavscd: src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll mkbundle --static $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(LIBS) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o yavscd strip yavscd diff --git a/scripts/build/make/dnx.mk b/scripts/build/make/dnx.mk index eedce47b..2d55aa25 100644 --- a/scripts/build/make/dnx.mk +++ b/scripts/build/make/dnx.mk @@ -1,5 +1,4 @@ # Common defs -# assumes SOLUTIONDIR already defined # ifndef PRJNAME @@ -62,7 +61,7 @@ bin/output/wwwroot/version: bin/output pack: $(NUGETSOURCE)/$(PKGFILENAME) -$(NUGETSOURCE)/$(PKGFILENAME): $(BINTARGETPATH) $(SOLUTIONDIR)/version.txt +$(NUGETSOURCE)/$(PKGFILENAME): $(BINTARGETPATH) ../../version.txt ifeq ($(git_status),0) nuget pack $(PRJNAME).nuspec -Version $(VERSION) -Properties config=$(CONFIGURATION) -OutputDirectory bin else diff --git a/scripts/build/make/versioning.mk b/scripts/build/make/versioning.mk index eb1a52df..f721a1c3 100644 --- a/scripts/build/make/versioning.mk +++ b/scripts/build/make/versioning.mk @@ -2,7 +2,7 @@ ifndef PRJNAME PRJNAME := $(shell basename `pwd -P`) endif -SOLUTIONDIR=$(HOME)/workspace/yavsc +SOLUTIONDIR=../.. version := $(shell cat $(SOLUTIONDIR)/version.txt) MAKE=make NUGETSOURCE=$(HOME)/Nupkgs diff --git a/src/Yavsc.Abstract/Attributes/Validation/ValidRemoteUserDirAttribute.cs b/src/Yavsc.Abstract/Attributes/Validation/ValidRemoteUserDirAttribute.cs index 5b662870..2c59f689 100644 --- a/src/Yavsc.Abstract/Attributes/Validation/ValidRemoteUserDirAttribute.cs +++ b/src/Yavsc.Abstract/Attributes/Validation/ValidRemoteUserDirAttribute.cs @@ -29,4 +29,4 @@ namespace Yavsc.Attributes.Validation return str.IsValidYavscPath(); } } -} \ No newline at end of file +} diff --git a/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs b/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs index 1acfa340..b9de71f8 100644 --- a/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs +++ b/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs @@ -1,10 +1,9 @@ -using System.IO; +using System; +using System.IO; using System.Linq; using System.Text; using Yavsc.ViewModels.UserFiles; -using System; - namespace Yavsc.Helpers { public static class AbstractFileSystemHelpers @@ -50,7 +49,7 @@ namespace Yavsc.Helpers { if (ValidFileNameChars.Contains(c)) sb.Append(c); - else sb.Append('_'); + else sb.Append("#"+((int)c).ToString("D3")); } return sb.ToString(); } @@ -71,7 +70,7 @@ namespace Yavsc.Helpers public const char RemoteDirectorySeparator = '/'; // Only accept descent remote file names - public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. ".ToCharArray(); + public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. %#".ToCharArray(); // Estimate signature file name format public static Func diff --git a/src/Yavsc.Abstract/Makefile b/src/Yavsc.Abstract/Makefile index 9366a540..612c580b 100644 --- a/src/Yavsc.Abstract/Makefile +++ b/src/Yavsc.Abstract/Makefile @@ -1,5 +1,5 @@ -SOURCE_DIR=$(HOME)/workspace/yavsc -MAKEFILE_DIR=$(SOURCE_DIR)/scripts/build/make + +MAKEFILE_DIR=../../scripts/build/make BASERESX=Resources/Yavsc.Attributes.Validation.Resources.resx \ Resources/Yavsc.Models.Messaging.Resources.resx \ Resources/Yavsc.Models.IT.Fixing.Bug.resx\ diff --git a/src/Yavsc/Makefile b/src/Yavsc/Makefile index 3b14806a..4c9f4113 100644 --- a/src/Yavsc/Makefile +++ b/src/Yavsc/Makefile @@ -48,26 +48,6 @@ deploy-pkg: publish deploy: pushInPre pushInProd -pushInPre: cleanoutput bin/output/wwwroot/version - sudo service kestrel-pre stop - sudo rm -rf $(DESTDIR)/approot - sudo cp -a bin/output/* $(DESTDIR) - sudo cp ../../yavscd /usr/local/bin/yavscd-pre - sudo sync - sudo service kestrel-pre start - -pushInProd: cleanoutput bin/output/wwwroot/version -ifeq ($(git_status),0) - sudo service kestrel stop - sudo rm -rf $(PRODDESTDIR)/approot - sudo cp -a bin/output/* $(PRODDESTDIR) - sudo cp ../../yavscd /usr/local/bin/yavscd - sudo sync - sudo service kestrel start -else - $(error EPRODANDGITSTATUS! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.) -endif - cleanPublish: pushInPre pushInProd rm -rf bin/output/ diff --git a/src/test/Mandatory/AbstractTests.cs b/src/test/Mandatory/AbstractTests.cs new file mode 100644 index 00000000..aa236879 --- /dev/null +++ b/src/test/Mandatory/AbstractTests.cs @@ -0,0 +1,29 @@ +using System; +using Xunit; +using Xunit.Abstractions; +using Yavsc.Helpers; + +namespace test +{ + [Collection("Yavsc Abstract tests")] + [Trait("regres", "no")] + public class AbstractTests + { + ITestOutputHelper output; + public AbstractTests(ITestOutputHelper output) + { + this.output = output; + } + [Fact] + public void UniquePathesAfterFileNameCleaning() + { + var name1 = "content:///scanned_files/2020-06-02/00.11.02.JPG"; + var name2 = "content:///scanned_files/2020-06-02/00.11.03.JPG"; + var cleanName1 = AbstractFileSystemHelpers.FilterFileName(name1); + var cleanName2 = AbstractFileSystemHelpers.FilterFileName(name2); + output.WriteLine($"{name1} => {cleanName1}"); + output.WriteLine($"{name2} => {cleanName2}"); + Assert.True(cleanName1 != cleanName2); + } + } +} diff --git a/version.txt b/version.txt index 349ec495..f31b417e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.6-rc11 +1.0.6-rc13