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 Alert < ActiveRecord::Base | |
def self.delete_stale | |
execute <<-EOS | |
DELETE FROM alerts | |
WHERE alerts.alertable_type = 'Post' | |
AND alerts.alertable_id IN ( | |
SELECT id FROM posts WHERE deleted = 1 | |
) | |
EOS | |
end |
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
#!/bin/bash | |
# Grab the del.icio.us bookmarks into an xml file... ick know but it works! | |
curl --user theadmin:PASSWORD -o /home/edavis/doc/D/delicious/Delicious`date +%d`.xml -O 'https://api.del.icio.us/v1/posts/all' |
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 :uploads do | |
desc "Symlink uploads to shared path" | |
task :symlink do | |
run "rm -Rv #{release_path}/public/wp-content/uploads/" | |
run "ln -nfs #{shared_path}/uploads #{release_path}/public/wp-content/uploads" | |
end | |
end | |
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
# | |
# Core Redmine sync | |
# | |
[core] | |
repositoryformatversion = 0 | |
filemode = true | |
bare = false | |
logallrefupdates = true | |
[instaweb] | |
local = true |
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
cerberus_project('redmine_sqlite', | |
:git_url => "git://github.com/edavis10/redmine.git", | |
:database_yml_source => "/home/#{configuration[:user]}/.cerberus/database.yml.sqlite3", | |
:rake_task => 'log:clear ci') |
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
##### | |
# Customize the default logger (http://ruby-doc.org/core/classes/Logger.html) | |
# | |
# Use a different logger for distributed setups | |
# config.logger = SyslogLogger.new | |
# | |
# Rotate logs bigger than 1MB, keeps no more than 7 rotated logs around. | |
# When setting a new Logger, make sure to set the log level too. | |
# | |
# config.logger = Logger.new(config.log_path, 7, 1048576) |
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
# script/console | |
include IssuesHelper | |
include CustomFieldsHelper | |
# Pick one: | |
# All issues and projects | |
File.open('output-file.csv','w') do |f| | |
f.puts issues_to_csv(Issue.all) | |
end |
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
# Returns the mail adresses of users that should be notified | |
def recipients | |
notified = project.notified_users | |
# Author and assignee are always notified unless they have been locked | |
notified << author if author && author.active? && author.notify_about?(self) | |
notified << entered_by if entered_by && entered_by.active? && entered_by.notify_about?(self) | |
notified << assigned_to if assigned_to && assigned_to.active? && assigned_to.notify_about?(self) | |
notified.uniq! | |
# Remove users that can not view the issue | |
notified.reject! {|user| !visible?(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
def default_assignee_id | |
if some_setting | |
"Hardcoded value" | |
else | |
read_attribute(:default_assignee_id) | |
end | |
end | |
def default_assignee_id=(v) | |
if some_setting |
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
should "select the exact matching user first" do | |
case_sensitive_user = User.generate_with_protected!(:login => 'changed', :password => 'admin', :password_confirmation => 'admin') | |
# bypass validations to make it appear like existing data | |
case_sensitive_user.update_attribute(:login, 'ADMIN') | |
user = User.try_to_login("ADMIN", "admin") | |
assert_kind_of User, user | |
assert_equal "ADMIN", user.login | |
end |