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/sh | |
# This BASH script for Rails project. | |
# It runs MySQL embedded server. | |
# It must by under $RAILS_ROOT/script directory. | |
# Author: Alexander Ulyanitsky <[email protected]>. | |
# License: Rails (BSD). | |
case $(uname -s) in | |
Linux) gnu_readlink_bin="readlink";; | |
FreeBSD) gnu_readlink_bin="greadlink";; |
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 ExeclyOneValidator < ActiveModel::Validator | |
def validate(record) | |
raise ArgumentError, ":fields option doesn't supplied" unless options.has_key?(:fields) | |
if options[:fields].select { |f| record.read_attribute(f.to_s).present? }.size != 1 | |
_fields = options[:fields].map(&:to_s).map(&:titleize).join(", ") | |
record.errors[:base] << "execly one of #{_fields} must be present" | |
end | |
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
set :ruby_rvm_string, "ree-1.8.7-2011.03" | |
set :ruby_rvm_gemset, application | |
set :default_environment, { | |
'PATH' => "/home/git/.rvm/gems/#{ruby_rvm_string}@#{ruby_rvm_gemset}/bin:/home/git/.rvm/gems/#{ruby_rvm_string}@global/bin:/home/git/.rvm/rubies/#{ruby_rvm_string}/bin:/home/git/.rvm/bin:$PATH", | |
'GEM_HOME' => "/home/git/.rvm/gems/#{ruby_rvm_string}@#{ruby_rvm_gemset}", | |
'GEM_PATH' => "/home/git/.rvm/gems/#{ruby_rvm_string}@#{ruby_rvm_gemset}:/home/git/.rvm/gems/#{ruby_rvm_string}@global", | |
'BUNDLE_PATH' => "/home/git/.rvm/gems/#{ruby_rvm_string}@#{ruby_rvm_gemset}:/home/git/.rvm/gems/#{ruby_rvm_string}@global" | |
} |
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
require 'bundler/vlad' | |
require 'vlad/rvm' | |
set :default_stage, 'production' | |
set :shared_paths, { | |
'log' => 'log', | |
'system' => 'public/system', | |
'pids' => 'tmp/pids', | |
'sockets' => 'tmp/sockets', |
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 | |
path="$(realpath $(dirname $0)/..)" | |
source /etc/profile.d/rvm.sh | |
cd /var/www/redmine | |
echo -n "Fetching changests for $(basename ${path}) repository in Redmine ... " | |
bundle exec rails runner -e production "Repository.find_by_url('${path}').fetch_changesets" && echo "OK" || echo "FAIL" |
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
set :shared_paths, { | |
'log' => 'log', | |
'pids' => 'tmp/pids', | |
'sockets' => 'tmp/sockets', | |
} | |
set :symlinks, { | |
'rvmrc' => '.rvmrc', | |
} | |
set :skip_scm, false | |
set :perm_owner, 'git' |
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
$.ajaxSetup({ | |
beforeSend: function(xhr) { | |
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); | |
} | |
}); |
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
#!/sbin/runscript | |
### BEGIN INIT INFO | |
# Provides: thin | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: S 0 1 6 | |
# Short-Description: thin initscript | |
# Description: thin | |
### END INIT INFO |
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
# Go back to the last commit that we want to form the initial commit (detach HEAD) | |
git checkout <sha1_for_B> | |
# reset the branch pointer to the initial commit, | |
# but leaving the index and working tree intact. | |
git reset --soft <sha1_for_A> | |
# amend the initial tree using the tree from 'B' | |
git commit --amend |
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 | |
# /usr/local/bin/open_subl | |
require 'cgi' | |
require 'uri' | |
begin | |
query = CGI.parse(URI.parse(ARGV.first).query) | |
url = query['url'].first | |
file = URI.parse(url).path | |
line = query['line'].first | |
column = query['column'].first |
OlderNewer