Use the -d flag with run command.
EG:
eval $(docker-machine env feature)
docker-compose -f delivery.docker-compose.yml run -d rails rake db:seed
defmodule Gifnoc.Config do | |
@spec get(atom, atom, term | nil) :: term | |
def get(app, key, default \\ nil) when is_atom(app) and is_atom(key) do | |
case read_config(Application.get_env(app, key)) do | |
nil -> default | |
val -> val | |
end | |
end | |
def read_config({:system, var_name}), do: System.get_env(var_name) |
module Analysis.GobanState exposing (GobanState, Intersection(..), Stone(..), blank, addStone) | |
import Matrix exposing (Matrix, repeat, set) | |
type alias GobanState = Matrix Intersection | |
type Intersection = Free | Stone | |
type Stone = Black | White | |
blank : Int -> GobanState |
pidfile ENV.fetch('PUMA_PID_PATH','/tmp/pid') | |
# Should not be a solution | |
worker_timeout Integer(ENV.fetch('PUMA_WORKER_TIMEOUT', 60)) | |
# Default worker ( OS processes ) is set to 4 ( most machines has 4 cores ) | |
# But adjust depending on context ( how much CPU are given to my container ? ) | |
current_cpu_count = begin | |
Integer(`nproc`) - 1 | |
rescue | |
4 | |
end |
# this wont work for immediate values as Fixnum Symbols but there may be workaround | |
# | |
module Doublable | |
def self.extended(base) | |
case base | |
when ::Array | |
base.extend Doublable::Array | |
when ::String | |
base.extend Doublable::String |
module PgArrayHstoreFix | |
def self.included(base) | |
base.class_eval do | |
before_save :serialize_array_hash | |
end | |
def serialize_array_hash | |
self.class.attribute_names.each do |attribute| | |
column_definition = self.column_for_attribute(attribute) | |
if column_definition.array && column_definition.type == :hstore |
require 'spec_helper' | |
describe PersonPolicy do | |
subject { PersonPolicy } | |
let(:person) { create(:person) } | |
let(:user) { create(:valid_user) } | |
context 'given user\'s role activities' do |
class ApplicationController < ActionController::Base | |
# Includes Authorization mechanism | |
include Pundit | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :exception | |
# Globally rescue Authorization Errors in controller. |
class CreateRoles < ActiveRecord::Migration | |
def change | |
create_table :roles do |t| | |
t.string :activities, array: true, length: 30, using: 'gin', default: '{}' | |
t.timestamps | |
end | |
end | |
end | |
## |
module ApiController | |
def index | |
# ... | |
# How | |
if request.head? | |
@count = self.class.resource_model.count(user_context, format_filters(@filters)).content | |
head :ok, "Content-Range" => "#{self.class.resource_model.name} #{@offset}-#{@limit}/#{@count}" | |
else |