Skip to content

Instantly share code, notes, and snippets.

@jnillo
jnillo / check_sidekiq_process
Last active August 29, 2015 14:12
Task to check status of your Sidekiq process
View check_sidekiq_process
namespace :check_services do
task :sidekiq => :environment do
path = "path/to/file.pid"
pid=File.open(path,'r').read.gsub("\n",'')
result = IO.popen("ps aux | grep sidekiq").gets.include?(pid)
unless result
system "command_to_run_your_sidekiq" # For Example: bundle exec sidekiq -C config/sidekiq.yml
end
end
end
@jnillo
jnillo / Extract Entities List RoR proyects
Created April 11, 2012 08:00
Extract a list of available data model's entities on RoR projects
View Extract Entities List RoR proyects
# This method reads all models that the project hash.
# @return [Array] The proyect models list.
def self.load_models
models = [] #All models will be in this list.
models_valids = [] #This list is only to models with database table associated.
mod = nil
#Get all models in Model's folder
Dir["#{RAILS_ROOT}/app/models/**/*.rb"].each do |file|