我正在尝试在OpenShift上部署Grails应用程序,并且我试图避免在每次更改时在网络上推送50MB文件.
我创建了一个项目~/dev/apps/grails/test来测试它
grails.war.exploded=true
Run Code Online (Sandbox Code Playgroud)
to grails-app/conf/BuildConfig.groovy,导致创建此文件夹:
/home/sas/.grails/2.1.1/projects/test/stage
Run Code Online (Sandbox Code Playgroud)
我怎么能告诉它创造爆炸战~/dev/apps/grails/test/target/test-0.1?
像这样复制文件夹:
cp -r /home/sas/.grails/2.1.1/projects/test/stage ~/dev/tomcat/webapps/test-0.1
Run Code Online (Sandbox Code Playgroud)
工作正常,但我正在尝试自动化整个过程,为OpenShift提供一个快速入门脚本.
我不是正则表达式专家,所以我正在寻求帮助以使正则表达式像这样工作:
var regExp = ???
regExp.exec('\/Date(1330848000000-0800)\/') = [..., '1330848000000', '0800']
// optional gmt
regExp.exec('\/Date(1330848000000)\/') = [..., '1330848000000', null]
regExp.exec('\/Date(1)\/') = [..., '1', null]
// gmt required if - is present
regExp.exec('\/Date(1330848000000-)\/') = null
// escaping backslash is required
regExp.exec('/Date(1330848000000-0800)\/') = null
regExp.exec('\/Date(1330848000000-0800)/') = null
// case sensitive
regExp.exec('\/date(1330848000000-0800)\/') = null
// only numbers allowed
regExp.exec('\/Date(1aaa848000000-0800)\/') = null
regExp.exec('\/Date(1330848000000-0a00)\/') = null
Run Code Online (Sandbox Code Playgroud)
我很早就被这样愚蠢的东西卡住了:
/\\bla(.*)bla/.exec('\bla123bla') = null // instead of [ ..., '123']
new RegExp('\\\\bla(.*)bla').exec('\bla123bla') = null // instead of [ ..., '123']
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用依赖项注入来注入自己的类,如下所示:
// Startup.cs
public class Startup
{
private readonly ILogger _log;
private readonly IMainController _controller;
public Startup(ILoggerFactory loggerFactory, IMainController controller)
{
_log = loggerFactory.CreateLogger("Logger");
_controller = controller;
}
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IMainController, MainController>();
// services.AddTransient<MainController, MainController>();
}
Run Code Online (Sandbox Code Playgroud)
然后是MainController,要注入的对象
// MainController.cs
public interface IMainController
{
Task Run(HttpContext context);
}
public …Run Code Online (Sandbox Code Playgroud) c# dependency-injection .net-core asp.net-core .net-core-2.0
我有以下代码可以正常工作:
// api.js
export default {
async readAsync (resource) {
await new Promise(r => setTimeout(r, 400));
return data[resource];
},
}
// ProductList.vue
import api from '@/services/api'
[...]
methods: {
fetch () {
this.loading = true;
api.readAsync('products').then(data => {
this.products = data;
this.loading = false;
});
}
}
[...]
Run Code Online (Sandbox Code Playgroud)
我想使用await 来摆脱承诺,如下所示:
methods: {
fetch () {
this.loading = true;
this.products = await api.readAsync('products');;
this.loading = false;
}
}
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: D:\devel\apps\vue-tests\cli-test\src\components\ProductList.vue: await is a reserved word …Run Code Online (Sandbox Code Playgroud) 我正在使用以下方法创建控制台记录器:
_log = new LoggerFactory().AddConsole().CreateLogger(this.GetType().Name);
Run Code Online (Sandbox Code Playgroud)
现在我收到以下警告:
controllers\DummyController.cs(31,20): warning CS0618:
'ConsoleLoggerExtensions.AddConsole(ILoggerFactory)' is obsolete:
'This method is obsolete and will be removed in a future version. The
recommended alternative is AddConsole(this ILoggingBuilder builder).'
Run Code Online (Sandbox Code Playgroud)
我不在依赖注入容器的上下文中。
更新:我也试过像这样使用 DI:
var serviceProvider = new ServiceCollection()
.AddLogging()
.BuildServiceProvider();
var log = serviceProvider.GetService<ILogger>();
log.LogInformation("testing _log");
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
Error Message:
System.ArgumentNullException : Value cannot be null.
Parameter name: logger
Stack Trace:
at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args)
at Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(ILogger logger, String message, Object[] …Run Code Online (Sandbox Code Playgroud) 我想知道是否可以将gitlab存储库移至gitlab中的另一个组。
例如,如果我有https://gitlab.com/my-user/my-repo,我想将其移至 https://gitlab.com/my-group/another-group/my-repo
理想情况下,保留所有与之相关的问题
I'm having a hard time trying to get a winstom custom logger compiled using typescript.
I'm taking this js code as starting point and taking into account this comment from github:
import * as Transport from 'winston-transport'
//
// Inherit from `winston-transport` so you can take advantage
// of the base functionality and `.exceptions.handle()`.
//
module.exports = class YourCustomTransport extends Transport {
constructor(opts) {
super(opts);
//
// Consume any custom options here. e.g.:
// - Connection information for databases
// …Run Code Online (Sandbox Code Playgroud) 我正在按照此示例为打字稿项目设置一些基本单元测试:https : //dev.to/muhajirdev/unit-testing-with-typescript-and-jest-2gln
我有一个main.ts导出isInternalLink功能
和一个main.spec.ts试图测试它的
但我收到以下错误:
C:\data\devel\apps\tmp\jest-typescript\src\main.spec.ts:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { isInternalLink } from './main.js';
SyntaxError: Unexpected token {
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
Run Code Online (Sandbox Code Playgroud)
这是带有完整示例的公共存储库:https : //gitlab.com/opensas/jest-typescript
任何人都可以指出我正确的方向,或提供一个有效的例子吗?
我在源代码管理(使用 Ctrl-Shift-U 打开的那个)工具栏中找不到“Stashes”(也找不到“REMOTES”、“BRANCHES”、“FILE HISTORY”)菜单。
我的 Visual Studio 代码如下所示:
这是我在网上找到的一张图片,其中包含我想要恢复的菜单选项:
我找不到恢复这些菜单选项的选项。
似乎 GitLens 没有替换源代码控制面板,而是添加了他自己的:
我正在开发一个 SvelteKit 项目,并且有一堆 vite.config 文件:
ll vite.config.*
Run Code Online (Sandbox Code Playgroud)
输出:
.rw-rw-r-- 1.3k sas 30 May 19:49 vite.config.ts
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977000-d9424581b6c6.mjs
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977001-6954a6ac5ac19.mjs
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977001-9201cfcc774c9.mjs
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977001-ad78163483ceb.mjs
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977007-4c080a380ebd9.mjs
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977007-4cf3e5ed6cf92.mjs
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977007-a642b2ba2f4cd.mjs
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977007-bcfada510dd4.mjs
.rw-rw-r-- 5.3k sas 19 Jun 18:09 vite.config.ts.timestamp-1687208977007-d88f9fb0e8e01.mjs
.rw-rw-r-- 5.3k …Run Code Online (Sandbox Code Playgroud) .net-core ×2
javascript ×2
typescript ×2
asp.net-core ×1
async-await ×1
c# ×1
date ×1
deployment ×1
git ×1
git-stash ×1
gitlab ×1
gitlab-ce ×1
grails ×1
jestjs ×1
json ×1
logging ×1
openshift ×1
regex ×1
sveltekit ×1
tomcat ×1
ts-jest ×1
vite ×1
war ×1
winston ×1