Farmbot-Web-App/lib/tasks/api.rake

46 lines
1.2 KiB
Ruby
Raw Normal View History

2017-11-27 21:00:08 -07:00
# Going to make an `update` AND `upgrade` task that do the same thing
def same_thing
sh "git pull https://github.com/FarmBot/Farmbot-Web-App.git master"
sh "bundle install"
sh "yarn install"
sh "rails db:migrate"
end
2017-12-14 07:52:01 -07:00
2017-10-10 16:27:28 -06:00
namespace :api do
desc "Just testing things out"
task log_digest: :environment do
puts "=== Looking for digests..."
Log
.where(sent_at: nil, created_at: 1.day.ago...Time.now)
.where(Log::IS_EMAIL_ISH)
.where
.not(Log::IS_FATAL_EMAIL)
.pluck(:device_id)
.uniq
.tap {|ids| puts "=== Found #{ids.count} digests..."}
.map do |id|
device = Device.find(id)
puts "=== Sending email digest to #{device.name}: #{device.id}"
LogDeliveryMailer.log_digest(device).deliver
end
puts "=== Done."
end
2017-10-10 16:33:47 -06:00
desc "Run Webpack and Rails"
2017-10-10 16:27:28 -06:00
task start: :environment do
sh "PORT=3000 bundle exec foreman start --procfile=Procfile.dev"
end
2018-07-24 14:17:47 -06:00
desc "Run Rails _ONLY_. No Webpack."
task only: :environment do
sh "PORT=3000 bundle exec foreman start --procfile=Procfile.api_only"
end
2017-11-27 21:00:08 -07:00
desc "Pull the latest Farmbot API version"
task(update: :environment) { same_thing }
desc "Pull the latest Farmbot API version"
task(upgrade: :environment) { same_thing }
2018-07-24 14:01:57 -06:00
2017-10-10 16:27:28 -06:00
end