Skip to content

Instantly share code, notes, and snippets.

namespace :redmine_upyun do
task :count_size => :environment do
size = 0
Attachment.all.each { |a| size += a.filesize }
puts "Total Filesize: #{size} bytes"
end
task :fake_files => :environment do

备份数据库

mv redmine redmine-old

下载最新版 redmine
svn co http://svn.redmine.org/redmine/branches/2.3-stable redmine-2.3

复制配置文件
cp redmine-old/config/configuration.yml redmine-2.3/config/configuration.yml
cp redmine-old/config/database.yml redmine-2.3/config/database.yml

Redmine installation on MacOSX

  • A summarized instruction tested on MacOSX 10.7.4 installing Ruby 1.9.3p194 and Rails 3.2.3.

Install brew

  • Follow the instructions on https://github.com/mxcl/homebrew
  • $ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

brew hints

module Mongoid
module Finders
# add find_by_xxx to Mongoid
# from https://github.com/mitijain123/mongoid/commit/b28b360b787ba4cd32e5423afcfa3b83574f9df1
def method_missing(method_id, *args, &block)
conditions = {}
bang = false
case method_id.to_s
when /^find_(all|last||first)_?by_([_a-zA-Z]\w*)(!?)$/