Skip to content

Instantly share code, notes, and snippets.

View nomasprime's full-sized avatar

Rick Jones nomasprime

View GitHub Profile
require 'rails/generators/active_record'
module ActiveRecord
module Generators
class AdminBoundsGenerator < ActiveRecord::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def copy_migration
migration_template 'migration.rb', "db/migrate/admin_bounds_create_#{table_name}.rb"
binding.pry
class Application < Rails::Application
config.middleware.insert_after ActionDispatch::Session::CookieStore,
FayeRails::Middleware,
extensions: [Faye::Extensions::AuthenticationExtension.new],
engine: { type: Faye::Redis, host: 'localhost' },
mount: '/rt',
timeout: 25 do
map '/runbook/**' => RealtimeController
end
...
module Cucumber
module Ast
class TreeWalker
alias_method :visit_features_alias, :visit_features
def visit_features(features)
EM.synchrony do
visit_features_alias features
EM.stop
end
require 'rails/generators/active_record'
module ActiveRecord
module Generators
class AdminBoundsGenerator < ActiveRecord::Generators::Base
source_root File.expand_path('../templates', __FILE__)
puts 'here'
puts behavior
def copy_migration
migration_template 'migration.rb', "db/migrate/admin_bounds_create_#{table_name}.rb"
module AdminBounds
describe Osmosis do
context 'when pbf file does not exist' do
subject(:osmosis) { Osmosis.new('no.osm.pbf') }
before { osmosis.import_administrative_boundaries }
it { is_expected.to raise_error(RuntimeError) }
end
end
end
require 'spec_helper'
module AdminBounds
describe Osmosis do
context 'when pbf file does not exist' do
subject(:osmosis) { Osmosis.new('no.osm.pbf') }
it 'raises runtime error' do
expect { osmosis.import_administrative_boundaries }.to raise_error(RuntimeError)
end
class CreateAdminBoundsSchema < ActiveRecord::Migration
def change
reversible do |dir|
dir.up do
execute <<-SQL
CREATE SCHEMA IF NOT EXISTS admin_bounds;
CREATE EXTENSION IF NOT EXISTS postgis SCHEMA admin_bounds;
CREATE EXTENSION IF NOT EXISTS hstore SCHEMA admin_bounds;
SQL
end
class AdminBound < ActiveRecord::Base
scope :sites, -> {
where(arel_table[:iso].eq('BRA').and(Arel::Nodes::NamedFunction.new('st_contains', [arel_table[:geom], Site.arel_table[:lonlat]]))).project(Site.arel_table[Arel.star])
}
end
/o/b/homebrew git:master ❯❯❯ brew install php54 -v ✚ ◼
==> Downloading http://www.php.net/get/php-5.4.22.tar.bz2/from/this/mirror
Already downloaded: /opt/boxen/cache/homebrew/php54-5.4.22
tar xf /opt/boxen/cache/homebrew/php54-5.4.22
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file configure
Hunk #1 succeeded at 39208 (offset 931 lines).
Warning: Backing up all known pear.conf and .pearrc files
Warning: If you have a pre-existing pear install outside
Notice: /Stage[main]/Habitullence::Vim/File[/Users/rick/.vim/vundle/ctrlp.vim]/content: content changed '{md5}c6fc3a3a23ae4d832fcc697ecf8282cd' to '{md5}bcce34f6ad5be39b736c573ec94213d8'
Notice: /Stage[main]/Homebrew/File[/opt/boxen/cache/homebrew]/group: group changed 'staff' to 'admin'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `materialize': Could not find rake-10.0.3 in any of the sources (Bundler::GemNotFound)
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'
from