(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
db.createUser( | |
{ | |
user: "<username>", | |
pwd: "<password>", | |
roles: [ { "role" : "readWrite", "db" : "<database_name>" } ] | |
} | |
) |
#!/usr/bin/ruby | |
require 'optparse' | |
require 'ostruct' | |
require 'fileutils' | |
require 'pathname' | |
require 'tmpdir' | |
$script_path = File.expand_path(File.dirname(__FILE__)) | |
$temp_path = Dir.mktmpdir |
Most of the time simple output statements using warn
, raise
, or a logger will help you find your issue. But sometimes you need the big guns, and that means ruby-debug
.
The ruby-debug
package has had some rocky times during the transition from Ruby 1.8.7 to 1.9.2 and beyond. But now, finally, the debugger is reliable and usable.
Bluepill.application("app", :base_dir => "#{RAILS_ROOT}/tmp/bluepill", :log_file => "#{RAILS_ROOT}/log/bluepill.log") do |app| | |
app.process("unicorn") do |process| | |
process.pid_file = File.join(RAILS_ROOT, 'tmp/pids/unicorn.pid') | |
process.working_dir = RAILS_ROOT | |
process.start_command = "unicorn -c config/unicorn.rb -E production config.ru" | |
process.stop_command = "kill -QUIT {{PID}}" | |
process.restart_command = "kill -USR2 {{PID}}" | |
process.uid = process.gid = 'www' |
# unicorn_rails -c config/unicorn.rb -E production -D | |
working_directory File.join(File.dirname(File.expand_path(__FILE__)), '..') | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 4 : 1) | |
stderr_path "log/unicorn.stderr.log" |
Failed to start bluepill: | |
TypeError `no marshal_dump is defined for class Mutex` | |
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:381:in `dump' | |
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:381:in `deep_copy' | |
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:367:in `block in refresh_children!' | |
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:366:in `each' | |
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:366:in `refresh_children!' | |
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:122:in `tick' | |
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/group.rb:19:in `block in tick' | |
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/group.rb:18:in `each' |