NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| class Foo | |
| alias_method :bar, | |
| def foo | |
| :hello | |
| end | |
| end | |
| Foo.new.bar # => :hello |
| module Barney | |
| refine String do | |
| def wait_for_it(ending) | |
| replace(self + ending) | |
| end | |
| end | |
| end | |
| using Barney | |
| "legen".wait_for_it "dary" # => "legendary" |
| echo "девуш\xD0:" | selecta | |
| /Users/max/Executables/selecta:124:in `=~': invalid byte sequence in UTF-8 (ArgumentError) | |
| from /Users/max/Executables/selecta:124:in `block in matches' | |
| from /Users/max/Executables/selecta:124:in `select' | |
| from /Users/max/Executables/selecta:124:in `matches' | |
| from /Users/max/Executables/selecta:144:in `render' | |
| from /Users/max/Executables/selecta:134:in `render!' | |
| from /Users/max/Executables/selecta:37:in `block in main' | |
| from /Users/max/Executables/selecta:169:in `block in with_screen' |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
+-----------------------+------------------+-----------------+
| | eager load paths | auto load paths |
+-----------------------+------------------+-----------------+
| Rails 3 (development) | auto loaded | auto loaded |
| Rails 4 (development) | auto loaded | auto loaded |
| Rails 3 (production) | eager loaded | auto loaded |
| Rails 4 (production) | eager loaded | eager loaded |
+-----------------------+------------------+-----------------+
| >> def wat; 'wat' end | |
| => nil | |
| >> wat = wat | |
| => nil | |
| >> wat | |
| => nil |
| To workaround this elasticsearch issue while it's not merged yet: | |
| https://github.com/elasticsearch/cookbook-elasticsearch/pull/103 | |
| 1. Paste everything in recipe.rb into your recipe, AFTER including elasticsearch recipe | |
| 2. Replace MY_COOKBOOK with your cookbook name | |
| 3. Put elasticsearch.init.erb to the templates/default/elasticsearch.init.erb of your cookbook | |
| When you run your runlist with this in place, it will fix things and restart elasticsearch. |
| require 'kitchen' | |
| require 'tmpdir' | |
| module Kitchen | |
| class GzippedChefDataUploader < ChefDataUploader | |
| def upload_path(scp, path, dir = File.basename(path)) | |
| if File.directory?(path) | |
| tmp_root = Dir.mktmpdir('gzipped_chef_uploader') | |
| gzip_path = "#{tmp_root}/#{dir}.tar.gz" | |
| system "cd #{path} && tar -zcf #{gzip_path} ." |
| # We need each node defined as a separate platform in order to give them different ip addresses on the private network | |
| --- | |
| driver_plugin: vagrant | |
| driver_config: | |
| require_chef_omnibus: true | |
| box: opscode-ubuntu-12.04 | |
| box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box |
| #!/usr/bin/env bash | |
| die() { | |
| echo >&2 "$@" | |
| exit 1 | |
| } | |
| [ "$#" -eq 1 ] || die "Single cookbook path argument required" | |
| src_path=$1 |