Skip to content

Instantly share code, notes, and snippets.

@ono
ono / travis-pro.markdown
Created November 1, 2012 14:38
Travis CI pro beta note

1st November, 2012

Summary

Luckily we have got a beta access to Travis CI pro which allows you to build your private repos on github. I did some research for my work and we have decided to replace our Jenkins to Travis CI pro. I leave some notes here.

Background

We have bunch of private repositories, mainly Ruby (rails and gems), on github that we want to continuously test. We currently maintain two CI servers: Buildbot for legacy project and Jenkins for recent projects. On this research, I simply ignored the legacy one and evaluated Travis CI pro as an alternative for Jenkins.

% ack ":app" bin/capify
49: "config/deploy.rb" => 'set :application, "set your application name here"
56:role :app, "your app-server here" # This may be the same as your `Web` server
70:# task :restart, :roles => :app, :except => { :no_release => true } do
lib/capistrano/configuration/actions/inspect.rb
19: # task :tail_fcgi, :roles => :app do
lib/capistrano/configuration/actions/invocation.rb
39: # session.when "in?(:app)", "/path/to/restart/mongrel"
class User
# e.g. stephen.issue_membership ono
def issue_membership(to_user)
# do stuff
end
end
describe User do
describe "issue_membership" do
it "issues a membership to a given user"

Workflow

Edit cookbooks, role

Edit cookbook or role on your chef repo. Don't forget update its version.

Upload them to a Chef server

% knife cookbook upload [cookbook]

% knife role from file [file e.g. roles/ssh_known_hosts.rb]

@ono
ono / resque.sh
Created March 1, 2012 10:23
resque.sh
#!/bin/sh
usage()
{
echo "usage: ${0} {start|stop|graceful_stop|stop_child|restart} <any_process_keyword>"
exit 1
}
start_app() {
${app_cmd} 2>&1 | logger -t resque_worker &
}
@ono
ono / resque.rake
Created March 1, 2012 10:15
resque:work_fast_pid
namespace :resque do
task :work_fast_pid do
File.open(ENV['PIDFILE'], 'w') { |f| f << Process.pid.to_s } if ENV['PIDFILE']
Rake::Task['resque:work'].invoke
end
end
describe "#section_tabs", js: true do
include_context "logged in and selected a course"
it "switches learning path and all lessons" do
visit dv_lessons_path
# Shows learning path on default
find('#section_learning_path').should be_visible
find('#section_all').should_not be_visible
@ono
ono / gist:1646623
Created January 20, 2012 10:33
RubyConfig
ruby -e "require 'rbconfig'; require 'pp'; pp RbConfig::CONFIG"
@ono
ono / gist:1140249
Created August 11, 2011 17:31
Core Dump (where)
(gdb) where
#0 0x0000000800c6dfcc in kill () from /lib/libc.so.7
#1 0x0000000800c6cdcb in abort () from /lib/libc.so.7
#2 0x0000000800672410 in rb_bug () from /usr/local/lib/libruby18.so.18
#3 0x00000008006da23f in sigsegv () from /usr/local/lib/libruby18.so.18
#4 <signal handler called>
#5 0x000000081b7675dc in pthread_mutex_lock () from /lib/libthr.so.3
#6 0x00000008072f3795 in xmlRMutexLock () from /usr/local/lib/libxml2.so.5
#7 0x0000000807342561 in xmlDictReference () from /usr/local/lib/libxml2.so.5
#8 0x0000000807345925 in xmlSAX2StartDocument () from /usr/local/lib/libxml2.so.5
@ono
ono / gist:1139622
Created August 11, 2011 13:17
Core Dump
$ gdb ruby18 --core=ruby18.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)...
Core was generated by `ruby18'.
Program terminated with signal 6, Aborted.