Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan Vazquez jnillo

View GitHub Profile
@jnillo
jnillo / check_sidekiq_process
Last active Aug 29, 2015
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 Apr 11, 2012
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|
You can’t perform that action at this time.