This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in app/workers/testing_worker.rb | |
class TestingWorker < Workling::Base | |
def this_is_a_test(options) | |
File.open(options[:id], "w") { |f| 1.upto(30) { f.write "."; f.flush; sleep(1) } } | |
end | |
end | |
# in any controller... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :workling do | |
namespace :client do | |
desc "Starts workling client" | |
task :start, :roles => :app, :only => { :primary => true } do | |
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client stop'" | |
run "sudo -u #{app_user} bash -c 'cd #{current_path} && rm -f log/workling.output'" | |
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client start'" | |
end | |
desc "Stops workling client" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in app/workers/testing_worker.rb | |
class TestingWorker < Workling::Base | |
def this_is_a_test(options) | |
File.open(options[:id], "w") { |f| 1.upto(30) { f.write "."; f.flush; sleep(1) } } | |
end | |
end | |
# in any controller... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :workling do | |
namespace :client do | |
desc "Starts workling client" | |
task :start, :roles => :app, :only => { :primary => true } do | |
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client stop'" | |
run "sudo -u #{app_user} bash -c 'cd #{current_path} && rm -f log/workling.output'" | |
run "sudo -u #{app_user} bash -c 'cd #{current_path} && export RAILS_ENV=#{rails_env} && ./script/workling_client start'" | |
end | |
desc "Stops workling client" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'octopi' | |
require 'choice' | |
include Octopi | |
Choice.options do | |
header '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MigrateProductsToPaperclip < ActiveRecord::Migration | |
def self.up | |
# Rename the old "image" column to "old_file_name", since Product.image will now try to do Paperclip stuff | |
rename_column :products, :image, :old_file_name | |
# Rename asset directories to pluralize | |
File.rename("public/system/product","public/system/products") | |
File.rename("public/system/products/image","public/system/products/images") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install | |
# | |
# Move this file into config/preinitializer.rb | |
# | |
# Usage | |
# | |
# This line: | |
# config.github_gem "mislav-will_paginate" | |
# is equivalent to this line: | |
# config.gem "mislav-will_paginate", :lib => "will_paginate", :source => "http://gem.github.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warden::Strategies.add(:bcrypt) do | |
def valid? | |
params[:username] || params[:password] | |
end | |
def authenticate! | |
return fail! unless user = User.first(:username => params[:username]) | |
if user.encrypted_password == params[:password] | |
success!(user) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warden::Strategies.add(:bcrypt) do | |
def valid? | |
params[:username] || params[:password] | |
end | |
def authenticate! | |
return fail! unless user = User.first(:username => params[:username]) | |
if user.encrypted_password == params[:password] | |
success!(user) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get rid of the pg if you have it already; you might want to do this for ruby-pg as well | |
gem uninstall pg | |
# change to some convenient working directory | |
cd ~/src | |
svn checkout http://ruby-pg.rubyforge.org/svn | |
cd svn/ruby-pg/trunk/ext | |
# download and install the patch | |
curl -O http://gist.github.com/raw/215956/54166b63f9cce030232b09397934315f004fb649/pg-patch.txt |
OlderNewer