我有一个使用React,Webpack和Yarn的Rails应用程序用于客户端.我在/ client目录中拥有与客户端相关的所有内容.这包括我的yarn.lock和package.json文件.我有一个proc文件,cds到/ client并正确运行yarn run build.这在本地工作,没有错误.但是,当我部署/推送到Heroku时,我的推送被拒绝,我收到以下错误:
remote: cd client && yarn run build:production
remote: sh: 1: yarn: not found
remote: rake aborted!
remote: Command failed with status (127): [cd client && yarn run build:production...]
Run Code Online (Sandbox Code Playgroud)
这对我说的是Heroku无法在根级别找到yarn.lock文件.如何让Heroku使用yarn.lock我/ client目录下的文件?
或者这个错误的原因是完全不同的?
因此,我试图通过外部应用程序的API访问自己的数据。我只需要访问自己的数据。不尝试从我的任何用户帐户中接收数据,因此他们无需授权任何内容。因此,显然我需要避免任何重定向(我研究OAuth越多,这似乎是标准过程……)
该过程到达/authorize端点,该端点返回一个代码。然后在向accesstoken端点的请求中提供该代码。然后,我可以通过API访问我的帐户。我95%确信此过程对于所有OAuth都是标准的,但我想我会提供详细信息,以防万一。
如何在后端提供凭据以获取用于输入令牌请求的代码,以使所有用户交互都无效?我使用的API迫使我使用OAuth。
我想对不同的媒体查询使用相同的变量。像这样:
$avatar_size: 200px;
@media (#{$tablet_size}) {
$avatar_size: 150px;
}
@media (#{$mobile_size}) {
$avatar_size: 100px;
}
Run Code Online (Sandbox Code Playgroud)
目的是能够在多个位置使用此变量,因此我可以引用该变量,而不必每次都进行媒体查询。像这样:
.font-awesome-icon {
font-size: $avatar_size;
}
img {
width: $avatar_size;
height: $avatar_size;
}
.img-wrapper {
height: $avatar_size;
}
Run Code Online (Sandbox Code Playgroud)
有什么办法吗?
我正在尝试使用我一直在使用的通用方法使用Gibbon 2.2.4订阅用户Mailchimp subscribe,然后不久我想添加一些额外的字段来跟踪他们采取的测验结果.
我想将这些数据存储在Mailchimp上,因为我想管理我直接从Mailchimp的仪表板发送的电子邮件.
我创建的服务来处理我的订阅:
class MailchimpService
def subscribe(list_id,email,first_name)
GIBBON.lists(list_id).members.create({
body: {
email_address: email,
status: 'subscribed',
merge_fields: {
FNAME: first_name,
},
double_optin: false,
update_existing: true
}
})
end
def subscribe_to_quiz(first_name, email, user_id, quiz_id)
list_id = ENV['QUIZ_MAILCHIMP_LIST_ID']
if subscribe(list_id,email,first_name)
attempt = QuizAttempt.where("user_id = ? AND quiz_id = ?", user_id, quiz_id).last
correct = attempt.correct_answer_count
total = attempt.questions_answered
successful = attempt.successful?
send_quiz_results(list_id, email, correct, total, successful)
end
end
def send_quiz_results(list_id, email, correct, total, successful)
GIBBON.lists(list_id).members(email).upsert(
body: {
email_address: email,
status: …Run Code Online (Sandbox Code Playgroud) 所以我最初命名了我的 github repo my_repo,但my-repo在创建后不久就重命名了,就像在第一天一样。这是大约一年前的事情。
从那以后,我一直在使用免费的 .org 版本使用 Travis CI 构建项目。现在,在将我的所有存储库设为私有并使用 travis-ci.com 升级到专业版之后,我不得不在我的 .travis.yml 中提供新的 API 凭据。所以我必须这样做
travis encrypt $(heroku auth:token) --add deploy.api_key --pro
Run Code Online (Sandbox Code Playgroud)
这适用于其他存储库,但不是这个特定的存储库。相反,我得到
repository not known to https://api.travis-ci.com/: dben89x/my_repo
Run Code Online (Sandbox Code Playgroud)
但是,在我的 Travis CI 仪表板上,它试图将其构建为dben89x/my-repo. 我不确定如何告诉 travis 将其构建为dben89x/my-repo.
我所有的 git 遥控器都设置为my-repo. 我尝试在 CLI 中注销并重新登录。
continuous-integration heroku command-line-interface travis-ci
我有一个嵌套在其他几个方法中的方法,我希望这个方法break来自所有带有返回错误的递归方法.例如,如果我pay_order在这里被叫:
class API::StripeController < ApiController
def my_api_action
# ...
order = create_order
pay_order(order, token)
# do things if payment is successful
end
end
Run Code Online (Sandbox Code Playgroud)
并pay_order定义为:
def pay_order(order, token)
begin
order.pay(source: token)
rescue Stripe::CardError => e
break e
end
end
Run Code Online (Sandbox Code Playgroud)
如何突破所有父方法并返回来自付款失败的卡错误?我需要这样的东西break and return e或return e and break.但是我知道这些break和return语句都会立即返回,所以我不能将它们链接起来(我不认为).
我可以只添加return语句来调用各项功能,但我打算在很多地方使用这种方法,而不要永远需要它的行为方式不同计划,所以我在寻找写它的最可重用的方式.