我有一个非常简单的构建脚本
task hello{
println("hello World")
}
task bye {
println("bye")
}
Run Code Online (Sandbox Code Playgroud)
在我运行的命令行上
gradle hello,我得到以下输出:
hello World
bye
:hello UP-TO-DATE
Run Code Online (Sandbox Code Playgroud)
为什么它执行任务"再见"(我假设它被执行,因为"再见"被打印)?谢谢.
来自SQL背景,我想知道如何在firebase中进行数据库迁移?
假设我在firebase中有以下数据,{dateFrom: 2015-11-11, timeFrom: 09:00} ....现在前端客户端将存储和期望表单中的数据{dateTimeFrom: 2015-011-11T09:00:00-07:00}.如何更新火力,使得所有dateFrom: xxxx与timeFrom: yyyy被删除,取而代之的是dateTimeFrom: xxxxyyyy?谢谢.
在Cloud Functions for Firebase中,例如:
exports.makeUppercase = functions.database.ref('/messages/{pushId}/original')
.onWrite(event => {
//how to access data at another node, for example
//important/messages/{pushId}
})
Run Code Online (Sandbox Code Playgroud)
例如,如何在另一个节点读取数据/important/messages/{pushId}?谢谢
firebase firebase-realtime-database google-cloud-functions firebase-cloud-functions
我正在尝试使用grails gradle doc中提供的示例创建测试任务规则,但我不断收到"具有该名称的任务已存在"错误.
我的构建脚本如下:
import org.grails.gradle.plugin.tasks.* //Added import here else fails with "Could not find property GrailsTestTask"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.0.0"
}
}
version "0.1"
group "example"
apply plugin: "grails"
repositories {
grails.central() //creates a maven repo for the Grails Central repository (Core libraries and plugins)
}
grails {
grailsVersion = '2.3.5'
groovyVersion = '2.1.9'
springLoadedVersion '1.1.3'
}
dependencies {
bootstrap "org.grails.plugins:tomcat:7.0.50" // No container is deployed by default, so …Run Code Online (Sandbox Code Playgroud) 我可以只部署托管配置文件 firebase.json 而不是部署我的所有资产,即。html文件,图像等?如果是这样,如何?
我目前正在做,firebase deploy --only hosting但这将部署所有资产。
我问是因为我想测试我的重写规则等,并且不想再次重新上传所有资产,这很耗时。谢谢。
我的firebase数据如下所示:
{
"lambeosaurus": {
"vacationDates" : "2016-12-20 - 2016-12-25",
"length" : 12.5,
"weight": 5000
},
"stegosaurus": {
"vacationDates" : "2016-12-10 - 2016-12-20",
"length" : 9,
"weight" : 2500
}
}
Run Code Online (Sandbox Code Playgroud)
我如何查询将在2016-12-20度假的所有恐龙(即它应该返回lambeosaurus和剑龙)?或者我应该以不同方式存储数据?如果是这样,我应该如何存储数据以获得最佳性能?谢谢.
我从这里使用RDS命令行工具,将参数组复制到其他区域时遇到麻烦。运行rds-copy-db-parameter-group失败,并显示以下错误:
rds-copy-db-parameter-group: Could not find the resource you requested: DB ParameterGroup not found, not allowed to do cross region copy.
我正在使用的命令是:
rds-copy-db-parameter-group arn:aws:rds:ap-southeast-1:myAccntId:pg:myParamGroup-utf8mb4 -t copyOfMyParam -td testcopy
我很确定ARN正确并且参数确实存在。这是工具或aws的问题吗?还有其他人遇到类似的问题吗?
在index.js中,我有以下内容
exports.write = functions.https.onRequest((req, res) => {
admin.database()
.ref(`xxx/yyy`)
.push()
.set({timestamp: admin.database.ServerValue.TIMESTAMP});
res.status(200).end();
});
Run Code Online (Sandbox Code Playgroud)
在我的 test.js 中,我对 admin.database() 进行存根,如下所示:
const refStub = sinon.stub();
setStub = sinon.stub();
refStub.withArgs('xxx/yyy').returns({push: () => ({key: 'fakeKey', set: setStub})});
databaseStub = sinon.stub(admin, 'database').get(() => {
return () => {
return {ref: refStub};
};
});
Run Code Online (Sandbox Code Playgroud)
当我运行测试时,出现以下错误TypeError: Cannot read property 'TIMESTAMP' of undefined。如何修复此错误或将调用存根到admin.database.ServerValue.TIMESTAMP?谢谢。
javascript unit-testing sinon firebase firebase-realtime-database
假设我有登录的多个Geb/Spock测试.例如:
@Stepwise
Class AddNewPictureSpec extends GebSpec {
def "User at login page"() {
given: "User beings from login page"
to LoginPage
}
def "User gets redirected to Main page"() {
given: "User at Login page"
at LoginPage
when: "User signs in"
signIn "username", "pw"
to MainPage
then:
at MainPage
def "other test sequences follow...."() {
}
}
Run Code Online (Sandbox Code Playgroud)
另一个测试规范具有完全相同的启动顺序:
@Stepwise
Class EditPictureSpec extends GebSpec {
def "User at login page"() {
given: "User beings from login page"
to LoginPage
}
def …Run Code Online (Sandbox Code Playgroud) 我在firebase上托管了一个Polymer(单页面应用程序)应用程序.当我将新版本部署到firebase时,我希望firebase重新加载javascript源代码而不是使用缓存源代码.是否有可能通过firebase.json这样做?如果是这样,怎么样?或者我是否必须手动将缓存清除URL添加到我的构建输出中?谢谢
我在index.js中有以下函数代码:
var admin = require('firebase-admin');
admin.initializeApp();
admin.storage();
Run Code Online (Sandbox Code Playgroud)
以及以下测试代码:
var assert = require('assert');
var sinon = require('sinon');
describe('Event Sourcing', function() {
var myFunctions, adminInitStub, adminStorageStub,admin;
before(() => {
admin = require('firebase-admin');
adminStorageStub = sinon.stub(admin, 'storage');
adminInitStub = sinon.stub(admin, 'initializeApp');
myFunctions = require('../index');
});
after(() => {
// Restoring our stubs to the original methods.
adminInitStub.restore();
adminStorageStub.restore();
});
describe('CREATED', function() {
it('should return -1 when the value is not present', function() {
assert.equal(-1, [1,5,3].indexOf(4));
});
});
});
Run Code Online (Sandbox Code Playgroud)
由于某些奇怪的原因,我不断收到以下错误,Error: The default Firebase …
mocha.js sinon firebase google-cloud-functions firebase-storage
在 Cloud Functions for Firebase 中,例如:
exports.makeUppercase = functions.database.ref('/messages/{pushId}/original')
.onWrite(event => {
//how to write data at another node and return promise?
return admin.database().ref(`/abc/1234`).update({a:1}); //is this the correct way?
})
Run Code Online (Sandbox Code Playgroud)
在https://firebase.google.com/docs/functions/get-started 中,它说
// You must return a Promise when performing asynchronous tasks inside a Functions such as
// writing to the Firebase Realtime Database.
// Setting an "uppercase" sibling in the Realtime Database returns a Promise.
Run Code Online (Sandbox Code Playgroud)
但在https://firebase.google.com/docs/database/admin/save-data 中,api 正在使用回调。我可以知道如何正确设置/更新 firebase 函数中的数据吗?该代码将起作用,但我不确定我是否正确执行或者它是否是推荐的方式。谢谢。
javascript firebase firebase-realtime-database google-cloud-functions
firebase ×8
gradle ×2
javascript ×2
sinon ×2
aws-cli ×1
build.gradle ×1
geb ×1
grails ×1
mocha.js ×1
spock ×1
unit-testing ×1