[给读者注意]:我花了近5个小时试图解决这个问题并阅读了关于此事的每篇StackOverflow帖子,观看了每个视频等,所以请不要将其标记为重复没有具体的答案或解释。谢谢!
我正在尝试执行简单的“放置”操作。声明使用'随时随地' gem在开发环境中并将其输出到我的cron_log.log文件中。
1)当我安排任务每1分钟运行一次方法时,我在cron_log文件中收到此错误:
bundler: failed to load command: bin/rails (bin/rails)
Bundler::GemNotFound: Could not find activesupport-5.0.3 in any of the sources
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/spec_set.rb:87:in `block in materialize'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/spec_set.rb:81:in `map!'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/spec_set.rb:81:in `materialize'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/definition.rb:159:in `specs'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/definition.rb:218:in `specs_for'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/definition.rb:207:in `requested_specs'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/runtime.rb:109:in `block in definition_method'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/runtime.rb:21:in `setup'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler.rb:101:in `setup'
/Users/jessierichardson/.rvm/gems/ruby-2.2.1/gems/bundler-1.15.4/lib/bundler/setup.rb:19:in `<top (required)>'
/Users/jessierichardson/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/jessierichardson/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
我已经检查了我的Gemfile.lock并且activesupport-5.0.3在它的所有荣耀中都存在。
这是我在schedule.rb中的设置
set :environment, "development"
set :output, 'log/cron_log.log'
def say_hi
puts "hello"
end
every 1.minute do
runner 'say_hi'
end
(*请注意:我已经为每个计划任务尝试过rake,runner和command,结果会抛出相同的错误)
当我运行命令时,每当&#39;从终端,这是我的输出:
* * * * * /bin/bash -l -c 'cd /Users/jessierichardson/Desktop/projects/Ruby/blog_testing && bundle exec bin/rails runner -e development '\''say_hi'\'' >> log/cron_log.log 2>&1'
我正在使用Rails 5.0.3和Ruby 2.2.1
答案 0 :(得分:0)
您只需在library(shiny)
set.seed(42)
n_samp = 5 # this comes from the input
indx <- sample(1:20, n_samp)
let_small <- letters[indx]
let_caps <- sample(LETTERS[indx])
# user input
ui <- fluidPage(
selectInput(inputId = "n_samp_choice", label = NULL,
choices = 1:20, width = 500), # number of samples
uiOutput("mappings"),
)
server <- function(input, output, session) {
output$actionBut.out <- renderUI({
print(input$original1)
session$sendCustomMessage(type="jsCode",
list(code= "$('#text').prop('disabled',true)"))
actionButton("copyButton1","Copy Code")
})
output$mappings <- renderUI({
tagList(
lapply(
1:5,
function(idx){
fluidRow( # first row checkbox
column(width = 2, offset = 0,
checkboxInput(paste0("correct",idx), label = NULL, FALSE)
),
column(width = 2, offset = 0, # text input originial
textInput(inputId = paste0("original",idx), value = let_small[idx], label = NULL )
),
column(width = 5, # options for match
selectInput(inputId = paste0("options",idx), label = NULL,
choices = let_caps, width = 500)
)
)
}
)
)
})
lapply(
1:5,
function(idx){
observeEvent(input[[paste0("options",idx)]],
{
print(input[[paste0("options",idx)]])
},
ignoreInit = TRUE)
}
)
observeEvent(input$copyButton1, {
if(tolower(input$options1) == tolower(input$options1) &
tolower(input$options2) == tolower(input$options2) &
tolower(input$options3) == tolower(input$options3) &
tolower(input$options4) == tolower(input$options4) &
tolower(input$options5) == tolower(input$options5))
{
print("great job")
}else{
unmapp <- which(c(input$correct1, input$correct2,
input$correct3, input$correct4,
input$correct5))
print("The following are unmatched")
print(let_caps[unmapp])
}
})
}
shinyApp(ui = ui, server = server)
中设置env PATH
和GEM_PATH
,如:
schedule.rb