Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing "script/runner", undocumented dependency on rails? #819

Open
XanderStrike opened this issue Sep 25, 2021 · 2 comments
Open

Missing "script/runner", undocumented dependency on rails? #819

XanderStrike opened this issue Sep 25, 2021 · 2 comments

Comments

@XanderStrike
Copy link

When I try to use this gem in a plain old ruby project, runner tasks fail with:

bundler: command not found: script/runner
Install missing gem executables with `bundle install`

I know this is exists in rails projects, but the readme didn't make it seem like Rails was a hard requirement. I'm just trying to run a script on a schedule and this gem seemed perfect.

schedule.rb:

set :output, "./checker.log"
every 1.minutes do
  runner "Checker.run"
end

I installed whenever using the instructions, added to my Gemfile and ran bundle exec wheneverize ., then whenever --update-crontab

@ajahongir
Copy link

try to use bundler: bundle exec whenever --update-crontab

@s-s
Copy link

s-s commented Feb 11, 2022

try to use bundler: bundle exec whenever --update-crontab

Won't help. Experienced the very same issue in a plain ruby project. Whenever expects rails script to be present for runner tasks, otherwise it relies on the presence of script/runner:

set :runner_command, case
when Whenever.bin_rails?
"bin/rails runner"
when Whenever.script_rails?
"script/rails runner"
else
"script/runner"
end

Unfortunately, this script is missing and Whenever doesn't provide any option to create it. Having generator for such script or instructions in README or Wiki would be great.

I've solved this issue for myself by switching to rake tasks as my scenario allows them.

Another possible solution is to setup runner manually in config/schedule.rb, for example:

set :runner_command, 'ruby -r ./some/lib/dependency -e'
job_type :runner, 'cd :path && :bundle_command :runner_command ":task" :output'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants