yavsccli target

vnext
Paul Schneider 4 years ago
parent 66616e7314
commit 80d1f8be1a
16 changed files with 85 additions and 107 deletions

@ -7,6 +7,7 @@ CONFIG=Debug
git_status := $(shell git status -s --porcelain |wc -l) git_status := $(shell git status -s --porcelain |wc -l)
yavscd=binaries/$(CONFIG)/yavscd yavscd=binaries/$(CONFIG)/yavscd
yavsccli=binaries/$(CONFIG)/yavsccli
all: $(yavscd) all: $(yavscd)
@ -71,8 +72,12 @@ $(yavscd): src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$(CONFI
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) 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) strip $(yavscd)
yavsccli: src/cli/bin/$(CONFIG)/dnx451/cli.dll src/cli/bin/$(CONFIG)/dnx451/fr/cli.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.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
mkdir -p binaries/$(CONFIG)
mkbundle --static $(DNXLIBS) src/cli/bin/$(CONFIG)/dnx451/cli.dll src/cli/bin/$(CONFIG)/dnx451/fr/cli.resources.dll 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 $(yavsccli)
strip $(yavsccli)
version-increment-patch: version-increment-patch:
scripts/version.sh $$(cat version.txt) patch > version.txt scripts/version.sh $$(cat version.txt) patch > version.txt
.PHONY: packages .PHONY: packages

Binary file not shown.

@ -143,11 +143,13 @@ namespace Yavsc.Helpers
using (Process p = new Process()) using (Process p = new Process())
{ {
p.StartInfo.WorkingDirectory = tempdir; p.StartInfo.WorkingDirectory = tempdir;
p.StartInfo = new ProcessStartInfo(); p.StartInfo = new ProcessStartInfo
p.StartInfo.UseShellExecute = false; {
p.StartInfo.WorkingDirectory = tempdir; UseShellExecute = false,
p.StartInfo.FileName = "/usr/bin/texi2pdf"; WorkingDirectory = tempdir,
p.StartInfo.Arguments = $"--batch --build-dir=. -o {fo.FullName} {fi.FullName}"; FileName = "/usr/bin/texi2pdf",
Arguments = $"--batch --build-dir=. -o {fo.FullName} {fi.FullName}"
};
p.Start(); p.Start();
p.WaitForExit(); p.WaitForExit();
if (p.ExitCode != 0) if (p.ExitCode != 0)

@ -37,10 +37,10 @@ namespace Yavsc
using Yavsc.Services; using Yavsc.Services;
public partial class ChatHub : Hub, IDisposable public partial class ChatHub : Hub, IDisposable
{ {
ApplicationDbContext _dbContext; private readonly ApplicationDbContext _dbContext;
private IConnexionManager _cxManager; private readonly IConnexionManager _cxManager;
private IStringLocalizer _localizer; private readonly IStringLocalizer _localizer;
ILogger _logger; private readonly ILogger _logger;
public HubInputValidator InputValidator { get; } public HubInputValidator InputValidator { get; }

@ -20,9 +20,9 @@ namespace Yavsc.Services
/// </summary> /// </summary>
public class HubConnectionManager : IConnexionManager public class HubConnectionManager : IConnexionManager
{ {
ILogger _logger; private readonly ILogger _logger;
Action<string, string> _errorHandler; private Action<string, string> _errorHandler;
/// <summary> /// <summary>
/// by cx id /// by cx id

@ -28,23 +28,21 @@ namespace Yavsc.Services
return false; return false;
} }
} }
UserMatch Out = new OutOfCircle();
UserMatch In = new BelongsToCircle();
readonly ApplicationDbContext _dbContext; private readonly UserMatch Out = new OutOfCircle();
readonly ILogger _logger; private readonly UserMatch In = new BelongsToCircle();
readonly SiteSettings SiteSettings; private readonly ApplicationDbContext _dbContext;
readonly string aclfileName; private readonly SiteSettings SiteSettings;
private readonly string aclfileName;
readonly RuleSetParser ruleSetParser; readonly RuleSetParser ruleSetParser;
public FileSystemAuthManager(ApplicationDbContext dbContext, ILoggerFactory loggerFactory, public FileSystemAuthManager(ApplicationDbContext dbContext, IOptions<SiteSettings> sitesOptions)
IOptions<SiteSettings> sitesOptions)
{ {
_dbContext = dbContext; _dbContext = dbContext;
_logger = loggerFactory.CreateLogger<FileSystemAuthManager>();
SiteSettings = sitesOptions.Value; SiteSettings = sitesOptions.Value;
aclfileName = SiteSettings.AccessListFileName; aclfileName = SiteSettings.AccessListFileName;
ruleSetParser = new RuleSetParser(false); ruleSetParser = new RuleSetParser(false);

@ -23,17 +23,12 @@ namespace Yavsc.Services
public class LiveProcessor : ILiveProcessor public class LiveProcessor : ILiveProcessor
{ {
readonly IHubContext _hubContext;
private readonly ILogger _logger; private readonly ILogger _logger;
readonly ApplicationDbContext _dbContext;
public ConcurrentDictionary<string, LiveCastHandler> Casters { get; } = new ConcurrentDictionary<string, LiveCastHandler>(); public ConcurrentDictionary<string, LiveCastHandler> Casters { get; } = new ConcurrentDictionary<string, LiveCastHandler>();
public LiveProcessor(ApplicationDbContext dbContext, ILoggerFactory loggerFactory) public LiveProcessor(ILoggerFactory loggerFactory)
{ {
_dbContext = dbContext;
_hubContext = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
_logger = loggerFactory.CreateLogger<LiveProcessor>(); _logger = loggerFactory.CreateLogger<LiveProcessor>();
} }

@ -7,60 +7,58 @@ using Microsoft.Extensions.Logging;
namespace Yavsc namespace Yavsc
{ {
class YaSendFileWrapper : IHttpSendFileFeature
{
private readonly Stream _output;
private readonly ILogger _logger; class YaSendFileWrapper : IHttpSendFileFeature
{
private readonly Stream _output;
private readonly ILogger _logger;
internal YaSendFileWrapper(Stream output, ILogger logger)
{
_output = output;
_logger = logger;
}
internal YaSendFileWrapper(Stream output, ILogger logger) public async Task SendFileAsync(string fileName, long offset, long? length, CancellationToken cancel)
{
cancel.ThrowIfCancellationRequested();
if (string.IsNullOrWhiteSpace(fileName))
{ {
_output = output; throw new ArgumentNullException("fileName");
_logger = logger;
} }
if (!File.Exists(fileName))
public async Task SendFileAsync(string fileName, long offset, long? length, CancellationToken cancel) {
throw new FileNotFoundException(string.Empty, fileName);
}
FileInfo fileInfo = new FileInfo(fileName);
if (offset < 0 || offset > fileInfo.Length)
{ {
cancel.ThrowIfCancellationRequested(); throw new ArgumentOutOfRangeException("offset", offset, string.Empty);
if (string.IsNullOrWhiteSpace(fileName))
{
throw new ArgumentNullException("fileName");
}
if (!File.Exists(fileName))
{
throw new FileNotFoundException(string.Empty, fileName);
}
FileInfo fileInfo = new FileInfo(fileName);
if (offset < 0 || offset > fileInfo.Length)
{
throw new ArgumentOutOfRangeException("offset", offset, string.Empty);
}
if (length.HasValue && (length.Value < 0 || length.Value > fileInfo.Length - offset))
{
throw new ArgumentOutOfRangeException("length", length, string.Empty);
}
FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, maxbufferlen, FileOptions.Asynchronous | FileOptions.SequentialScan);
try
{
fileStream.Seek(offset, SeekOrigin.Begin);
_logger.LogInformation(string.Format("Copying bytes range:{0},{1} filename:{2} ", offset, (!length.HasValue) ? null : (offset + length), fileName));
// await CopyToAsync(fileStream, _output, length, cancel);
await CopyToAsync(fileStream, _output);
}
finally
{
fileStream.Dispose();
}
} }
if (length.HasValue && (length.Value < 0 || length.Value > fileInfo.Length - offset))
{
throw new ArgumentOutOfRangeException("length", length, string.Empty);
}
FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, maxbufferlen, FileOptions.Asynchronous | FileOptions.SequentialScan);
try
{
fileStream.Seek(offset, SeekOrigin.Begin);
_logger.LogInformation(string.Format("Copying bytes range:{0},{1} filename:{2} ", offset, (!length.HasValue) ? null : (offset + length), fileName));
// await CopyToAsync(fileStream, _output, length, cancel);
await CopyToAsync(fileStream, _output);
}
finally
{
fileStream.Dispose();
}
}
private const int maxbufferlen = 65536; private const int maxbufferlen = 65536;
private byte[] buffer = new byte[maxbufferlen];
private async Task CopyToAsync(FileStream fileStream, Stream output) private async Task CopyToAsync(FileStream fileStream, Stream output)
{ {
await Task.Run(()=> fileStream.CopyTo(output, maxbufferlen)); await Task.Run(() => fileStream.CopyTo(output, maxbufferlen));
} }
} }
} }

@ -24,18 +24,5 @@ namespace Yavsc
app.UseSignalR(PathString.FromUriComponent(Constants.SignalRPath)); app.UseSignalR(PathString.FromUriComponent(Constants.SignalRPath));
} }
private async Task Echo(WebSocket webSocket)
{
var buffer = new byte[1024 * 4];
WebSocketReceiveResult result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
while (!result.CloseStatus.HasValue)
{
await webSocket.SendAsync(new ArraySegment<byte>(buffer, 0, result.Count), result.MessageType, result.EndOfMessage, CancellationToken.None);
result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
}
await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
}
} }
} }

@ -8,15 +8,12 @@ namespace Yavsc.ViewComponents
{ {
public class CalendarViewComponent : ViewComponent public class CalendarViewComponent : ViewComponent
{ {
readonly ApplicationDbContext _dbContext;
readonly ICalendarManager _manager; readonly ICalendarManager _manager;
public CalendarViewComponent ( public CalendarViewComponent (
ApplicationDbContext dbContext,
ICalendarManager manager) ICalendarManager manager)
{ {
_manager = manager; _manager = manager;
_dbContext = dbContext;
} }
public async Task<IViewComponentResult> InvokeAsync ( public async Task<IViewComponentResult> InvokeAsync (

@ -11,7 +11,7 @@ namespace Yavsc.ViewComponents
public class CirclesControlViewComponent : ViewComponent public class CirclesControlViewComponent : ViewComponent
{ {
ApplicationDbContext dbContext; private readonly ApplicationDbContext dbContext;
public CirclesControlViewComponent(ApplicationDbContext dbContext) public CirclesControlViewComponent(ApplicationDbContext dbContext)
{ {
this.dbContext = dbContext; this.dbContext = dbContext;

@ -6,11 +6,10 @@ namespace Yavsc.ViewComponents
{ {
public partial class CommentViewComponent : ViewComponent public partial class CommentViewComponent : ViewComponent
{ {
IStringLocalizer<CommentViewComponent> localizer; private readonly IStringLocalizer<CommentViewComponent> localizer;
public CommentViewComponent(IStringLocalizer<CommentViewComponent> localizer) public CommentViewComponent(IStringLocalizer<CommentViewComponent> localizer)
{ {
this.localizer = localizer; this.localizer = localizer;
} }
public IViewComponentResult Invoke(IIdentified<long> longCommentable) public IViewComponentResult Invoke(IIdentified<long> longCommentable)
{ {
@ -19,4 +18,4 @@ namespace Yavsc.ViewComponents
return View(longCommentable.GetType().Name, new Comment{ PostId = longCommentable.Id }); return View(longCommentable.GetType().Name, new Comment{ PostId = longCommentable.Id });
} }
} }
} }

@ -7,15 +7,11 @@ using Yavsc.Models;
namespace Yavsc.ViewComponents namespace Yavsc.ViewComponents
{ {
public class TaggerViewComponent : ViewComponent public class TaggerViewComponent : ViewComponent
{
{
readonly ApplicationDbContext dbContext;
readonly IStringLocalizer<TaggerViewComponent> localizer; readonly IStringLocalizer<TaggerViewComponent> localizer;
public TaggerViewComponent( public TaggerViewComponent(
ApplicationDbContext pdbContext,
IStringLocalizer<TaggerViewComponent> pLocalizer) IStringLocalizer<TaggerViewComponent> pLocalizer)
{ {
dbContext = pdbContext;
this.localizer = pLocalizer; this.localizer = pLocalizer;
} }
public IViewComponentResult Invoke(ITaggable<long> longTaggable) public IViewComponentResult Invoke(ITaggable<long> longTaggable)

@ -22,7 +22,7 @@ namespace test
[Trait("regression", "oui")] [Trait("regression", "oui")]
public class Remoting : BaseTestContext, IClassFixture<ServerSideFixture> public class Remoting : BaseTestContext, IClassFixture<ServerSideFixture>
{ {
RegiserAPI r; readonly RegiserAPI r;
public Remoting(ServerSideFixture serverFixture, ITestOutputHelper output) public Remoting(ServerSideFixture serverFixture, ITestOutputHelper output)
: base(output, serverFixture) : base(output, serverFixture)
{ {

@ -22,8 +22,8 @@ namespace test
SiteSettings _siteSetup; SiteSettings _siteSetup;
ILogger _logger; ILogger _logger;
IApplication _app; IApplication _app;
EMailer _mailer; readonly EMailer _mailer;
ILoggerFactory _loggerFactory; readonly ILoggerFactory _loggerFactory;
IEmailSender _mailSender; IEmailSender _mailSender;
public static string ApiKey => "53f4d5da-93a9-4584-82f9-b8fdf243b002"; public static string ApiKey => "53f4d5da-93a9-4584-82f9-b8fdf243b002";
@ -95,8 +95,8 @@ namespace test
} }
} }
bool dbCreated; bool dbCreated;
private WebHostBuilder host; private readonly WebHostBuilder host;
private IHostingEngine hostengnine; private readonly IHostingEngine hostengnine;
@ -145,7 +145,7 @@ namespace test
} }
private ModelBuilder modelBuilder; private readonly ModelBuilder modelBuilder;
public string TestingDatabase { get; private set; } public string TestingDatabase { get; private set; }

@ -19,11 +19,12 @@ namespace test
{ {
readonly SourceInformationProvider _sourceInfoProvider; readonly SourceInformationProvider _sourceInfoProvider;
readonly IOptions<LocalizationOptions> _localizationOptions; readonly IOptions<LocalizationOptions> _localizationOptions;
public NotWorking( IHostingEnvironment env , IOptions<SiteSettings> siteSettings, public NotWorking(
SourceInformationProvider sourceInfoProvider, SourceInformationProvider sourceInfoProvider,
IOptions<LocalizationOptions> localizationOptions, IOptions<LocalizationOptions> localizationOptions,
ServerSideFixture serverFixture, ITestOutputHelper output ServerSideFixture serverFixture, ITestOutputHelper output
) : base (output, serverFixture) { ) : base(output, serverFixture)
{
_sourceInfoProvider = sourceInfoProvider; _sourceInfoProvider = sourceInfoProvider;
_localizationOptions = localizationOptions; _localizationOptions = localizationOptions;
} }
@ -38,8 +39,8 @@ namespace test
public void NoDnxEnv() public void NoDnxEnv()
{ {
IOptions<LocalizationOptions> localOptions = Activator.CreateInstance<IOptions<LocalizationOptions>>(); IOptions<LocalizationOptions> localOptions = Activator.CreateInstance<IOptions<LocalizationOptions>>();
ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory(applicationEnvironment, localOptions); ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory(applicationEnvironment, localOptions);
IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking)); IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking));
} }

Loading…