source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/scoping/wa_with_no_possible_records_to_return_test.rb
Ruby
mit
246
master
2,163
# frozen_string_literal: true require_relative "../../test_helper" describe "wa" do let(:s0) { S0.create_default! } def check_association(association, &block) # With nothing at all assert !S0.where_assoc_count(1, :==, association).exists?, caller(0) assert !S0.where_assoc_count(1, :!=, association).e...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/scoping/wa_polymorphic_belongs_to_test.rb
Ruby
mit
246
master
11,451
# frozen_string_literal: true require_relative "../../test_helper" describe "wa" do let(:s0) { S0.create_default! } it "finds the right matching poly belongs_to" do s0_1 = s0 s0_1.create_assoc!(:bp1, :S0_bp1, target_model: S1) _s0_2 = S0.create_default! s0_3 = S0.create_default! s0_3.create...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/scoping/wa_belongs_to_test.rb
Ruby
mit
246
master
1,887
# frozen_string_literal: true require_relative "../../test_helper" describe "wa" do let(:s0) { S0.create_default! } it "finds the right matching belongs_tos" do s0_1 = s0 s0_1.create_assoc!(:b1, :S0_b1) _s0_2 = S0.create_default! s0_3 = S0.create_default! s0_3.create_assoc!(:b1, :S0_b1) ...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/scoping/wa_has_and_belongs_to_many_test.rb
Ruby
mit
246
master
2,026
# frozen_string_literal: true require_relative "../../test_helper" describe "wa" do let(:s0) { S0.create_default! } it "finds the right matching has_and_belongs_to_manys" do s0_1 = s0 s0_1.create_assoc!(:z1, :S0_z1) _s0_2 = S0.create_default! s0_3 = S0.create_default! s0_3.create_assoc!(:z1...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/scoping/wa_polymorphic_has_many_test.rb
Ruby
mit
246
master
3,625
# frozen_string_literal: true require_relative "../../test_helper" describe "wa" do let(:s0) { S0.create_default! } it "finds the right matching poly has_manys" do s0_1 = s0 s0_1.create_assoc!(:mp1, :S0_mp1) _s0_2 = S0.create_default! s0_3 = S0.create_default! s0_3.create_assoc!(:mp1, :S0_m...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/support/schema.rb
Ruby
mit
246
master
5,199
# frozen_string_literal: true ActiveRecord::Schema.verbose = false # Every table is a step. In tests, you always go toward the bigger step. # You can do it using a belongs_to, or has_one/has_many. # Try to make most columns unique so that any wrong column used is obvious in an error message. ActiveRecord::Schema.def...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/support/models.rb
Ruby
mit
246
master
16,030
# frozen_string_literal: true # Things to check: # * Poly or not # * With and without condition # * testable_has_one and testable_has_one # * different :source # * default_scopes require_relative "base_test_model" # Classes are names S0, S1, S2... for "Step" # Associations are names m1, o2, b3 for "Many", "One", "Be...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/support/load_test_env.rb
Ruby
mit
246
master
1,039
# frozen_string_literal: true require "bundler/setup" require "pry" require_relative "../../lib/active_record_where_assoc" if ENV["DB"] == "mysql" && [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR].join('.') < '5.1' puts "Exiting from tests with MySQL as success without doing them." puts "This is be...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/support/custom_asserts.rb
Ruby
mit
246
master
8,968
# frozen_string_literal: true # Adds some nice assertions for testing if a match is found or not, and # testing the behavior of the not_exists variant at the same time. module Minitest::Assertions # Just makes things more obvious in a test. # Otherwise there is just code doing something and no assertions. def a...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/support/base_test_model.rb
Ruby
mit
246
master
8,252
# frozen_string_literal: true require "prime" class BaseTestModel < ActiveRecord::Base self.abstract_class = true # We give a distinct prime number to ever conditions we use as part of associations # and default_scopes, and we record it, do that we can easily get a number that would match # each of them by ...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/support/database_setup.rb
Ruby
mit
246
master
3,296
# frozen_string_literal: true # Based on: # https://github.com/ReneB/activerecord-like/blob/72ca9d3c11f3d5a34f9bee530df5d43303259f51/test/helper.rb module Test module Postgres def self.connect_db ActiveRecord::Base.establish_connection(postgres_config) end def self.drop_and_create_database ...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
examples/examples.rb
Ruby
mit
246
master
6,721
# frozen_string_literal: true # To update the examples, run this from the project's root dir: # `ruby examples/examples.rb > EXAMPLES.md` # Avoid a message about default database used ENV["DB"] ||= "sqlite3" require "active_support/core_ext/string/strip" require_relative "../test/support/load_test_env" require_rela...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
examples/schema.rb
Ruby
mit
246
master
596
# frozen_string_literal: true ActiveRecord::Schema.verbose = false ActiveRecord::Schema.define do create_table :users do |t| t.string :username, null: false t.boolean :is_admin, default: false, null: false t.timestamps end create_table :posts do |t| t.references :author t.text :title t...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
examples/some_data.rb
Ruby
mit
246
master
227
# frozen_string_literal: true user1 = User.create!(username: "maxlap") my_post = user1.posts.create!(title: "First post", content: "This is new") my_post.comments.create!(author: user1, content: "Commenting on my own post!")
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
examples/models.rb
Ruby
mit
246
master
1,289
# frozen_string_literal: true # These models are available in bin/console # # And easy way to play with these (it will create an sqlite3 DB in memory): # # git clone git@github.com:MaxLap/activerecord_where_assoc.git # cd activerecord_where_assoc # bundle install # bin/console # class User < ActiveReco...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
Gemfile
Ruby
mit
246
master
819
source 'http://rubygems.org' source 'http://gems.github.com' gem 'rails', '3.2.12' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' # See https://github.com/sstephenson/execjs#readme for more su...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
Rakefile
Ruby
mit
246
master
281
#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) DddSampleAppRuby::Application.load_tasks
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
Guardfile
Ruby
mit
246
master
767
# Run 'guard' in the terminal guard :rspec do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$})...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/spec_helper.rb
Ruby
mit
246
master
976
# This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # Require this file using `require "spec_helper"` to ensure that it is only # loaded once. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration # Ad...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/domain/itinerary_spec.rb
Ruby
mit
246
master
3,494
require 'spec_helper' require 'models_require' # TODO Implement itinerary specs - probably need to be renamed to fit rspec idiom if false def handling_event_fake(location, handling_event_type) registration_date = Date.new(2013, 6, 21) completion_date = Date.new(2013, 6, 21) # TODO How is it possible to h...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/domain/cargo/delivery_spec.rb
Ruby
mit
246
master
9,395
require 'spec_helper' require 'models_require' def handling_event_fake(location, handling_event_type) registration_date = Date.new(2013, 6, 21) completion_date = Date.new(2013, 6, 21) # TODO Set it to fake tracking id for now HandlingEvent.new(handling_event_type, location, registration_date, completi...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/domain/cargo/cargo_spec.rb
Ruby
mit
246
master
4,095
require 'spec_helper' require 'cargo' require 'delivery' # # this doesn't work when running with all specs # class Delivery < Struct.new(:one, :two, :three); end # reopen Delivery to allow stubbing (otherwise it's frozen) # class Delivery # def initialize(route_specification='x', itinerary=nil, last_handled_event=n...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/domain/cargo/leg_spec.rb
Ruby
mit
246
master
1,350
require 'spec_helper' require 'leg' describe Leg do # Has to be a method def instead of the usual RSpec let() # because the latter acts more like a variable that persists # throught an example no matter how many times you call it def random_string (0...8).map { (65 + rand(26)).chr }.join end # This i...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/domain/cargo/route_specification_spec.rb
Ruby
mit
246
master
2,460
require 'spec_helper' require 'route_specification' describe RouteSpecification do context "initialize()" do {'origin is nil' => [nil, 'something', 'something'], 'destination is nil' => ['something', nil, 'something'], 'arrival_deadline is nil' => ['something', 'something', nil], }.each do |test, ...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/domain/voyage/voyage_spec.rb
Ruby
mit
246
master
484
require 'spec_helper' require 'voyage' describe Voyage do context "entity equality" do it "should equal a voyage with the same voyage number" do @voyage = Voyage.new('9999', 'fake schedule') @voyage.should == Voyage.new('9999', 'another fake schedule') end it "should not equal a voyage with...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/lib/value_object_spec.rb
Ruby
mit
246
master
3,533
require 'spec_helper' require 'value_object' describe ValueObject do # Use an anonymous class to test ValueObject let(:klass) do Class.new(ValueObject) do attr_reader :attr1 attr_reader :attr2 def initialize(attr1, attr2) @attr1 = attr1 @attr2 = attr2 end end end...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/integration/cargo_spec.rb
Ruby
mit
246
master
1,421
require 'spec_helper' require 'models_require' # TODO Move describe "Cargo" do xit "should have a transport status of Not Received" do hkg = Location.new(UnLocode.new('HKG'), 'Hong Kong') lgb = Location.new(UnLocode.new('LGB'), 'Long Beach') arrival_deadline = Date.new(2013, 2, 3) route_spec = Route...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/infrastructure/location_repository_spec.rb
Ruby
mit
246
master
1,637
require 'spec_helper' require 'models_require' require 'location_repository' describe "LocationRepository" do it "Location can be stored and then found again by UN/LOCODE" do location_repository = LocationRepository.new # TODO Replace this quick-and-dirty data teardown... location_repository.nuke_all_lo...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/infrastructure/sample_data_spec.rb
Ruby
mit
246
master
3,480
require 'spec_helper' require 'models_require' require 'cargo_repository' require 'handling_event_repository' require 'location_repository' # TODO Massive hack to get sample data into MongoDB # for manual testing purposes. Remove ASAP. describe "Sample Data" do it "Sample data can be set up" do DemoData.new.cre...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/infrastructure/cargo_repository_spec.rb
Ruby
mit
246
master
4,976
require 'spec_helper' require 'models_require' require 'cargo_repository' describe "CargoRepository" do specify "Cargo assigned to route but with no delivery history can be persisted" do cargo_repository = CargoRepository.new # TODO Replace this quick-and-dirty data teardown... cargo_repository.nuke_all...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/infrastructure/handling_event_repository_spec.rb
Ruby
mit
246
master
3,125
require 'spec_helper' require 'models_require' require 'handling_event_repository' describe "HandlingEventRepository" do it "Handling events can be persisted and retrieved by id" do handling_event_repository = HandlingEventRepository.new # TODO Replace this quick-and-dirty data teardown... handling_even...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
spec/support/models_require.rb
Ruby
mit
246
master
347
# helper file to require all models require 'routing_status' require 'transport_status' require 'cargo' require 'leg' require 'itinerary' require 'tracking_id' require 'route_specification' require 'location' require 'unlocode' require 'delivery' require 'handling_activity' require 'handling_event' require 'handling_e...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
lib/value_object.rb
Ruby
mit
246
master
693
class ValueObject # Class methods class << self # @equality_list is a class instance variable that is defined # inside the child class. It persists throughout the life of # that class. def attr_reader(*symbols) @equality_list ||= [] symbols.each do |symbol| super(symbol) ...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/voyage/transport_leg.rb
Ruby
mit
246
master
356
require 'ice_nine' require 'value_object' class TransportLeg < ValueObject attr_reader :departure_location attr_reader :arrival_location def initialize(departure_location, arrival_location) # TODO Check valid values @departure_location = departure_location @arrival_location = arrival_location ...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/voyage/schedule.rb
Ruby
mit
246
master
479
require 'ice_nine' require 'value_object' class Schedule < ValueObject attr_reader :carrier_movements attr_reader :departure_time attr_reader :arrival_time def initialize(carrier_movements, departure_time, arrival_time, price_per_cargo) # TODO Check valid values @carrier_movements = carrier_movements...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/voyage/carrier_movement.rb
Ruby
mit
246
master
524
require 'ice_nine' require 'value_object' # Based on .NET implementation class CarrierMovement < ValueObject attr_reader :transport_leg attr_reader :departure_time attr_reader :arrival_time attr_reader :price_per_cargo def initialize(transport_leg, departure_time, arrival_time, price_per_cargo) # TODO C...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/voyage/voyage.rb
Ruby
mit
246
master
423
class Voyage attr_reader :id # unique id of this voyage attr_accessor :number # voyage number (non-unique) associated with this voyage attr_accessor :schedule # schedule associated with this voyage def initialize (number, schedule) # TODO: add exception checking for invalid (null) values @nu...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/cargo/itinerary.rb
Ruby
mit
246
master
1,265
require 'ice_nine' require 'value_object' class Itinerary < ValueObject attr_reader :legs # TODO Handle empty values for attributes by returning UNKNOWN location # TODO Add is_empty method to supporting checking for this in is_empty def initialize(legs) # TODO Check valid values @legs = legs.dup ...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/cargo/leg.rb
Ruby
mit
246
master
947
require 'ice_nine' require 'value_object' class Leg < ValueObject attr_reader :voyage attr_reader :load_location attr_reader :unload_location attr_reader :load_date attr_reader :unload_date # TODO Handle empty values for attributes by returning UNKNOWN location # TODO Add is_empty method to supporting c...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/cargo/transport_status.rb
Ruby
mit
246
master
280
require 'ruby-enum' # Describes status of cargo transportation class TransportStatus include Ruby::Enum define :NotReceived, 'Not Received' define :OnboardCarrier, 'Onboard Carrier' define :InPort, 'In Port' define :Claimed, 'Claimed' define :Unknown, 'Unknown' end
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/cargo/delivery.rb
Ruby
mit
246
master
4,429
require 'date' require 'ice_nine' require 'value_object' class Delivery < ValueObject attr_reader :transport_status attr_reader :last_known_location attr_reader :is_misdirected attr_reader :eta attr_reader :is_unloaded_at_destination attr_reader :routing_status attr_reader :calculated_at attr_reader :l...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/cargo/cargo.rb
Ruby
mit
246
master
1,764
class Cargo attr_accessor :tracking_id attr_accessor :route_specification attr_accessor :itinerary attr_accessor :delivery class InitializationError < RuntimeError; end def initialize (tracking_id, route_specification) raise InitializationError unless tracking_id && route_specification @tracking_...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/cargo/handling_activity.rb
Ruby
mit
246
master
332
require 'ice_nine' require 'value_object' class HandlingActivity < ValueObject attr_reader :handling_event_type attr_reader :location def initialize(handling_event_type, location) # TODO Check valid values @handling_event_type = handling_event_type @location = location IceNine.deep_freeze(self...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/cargo/route_specification.rb
Ruby
mit
246
master
843
require 'ice_nine' require 'value_object' class RouteSpecification < ValueObject attr_reader :origin attr_reader :destination attr_reader :arrival_deadline class InitializationError < RuntimeError; end def initialize(origin, destination, arrival_deadline) raise InitializationError unless origin && dest...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/location/unlocode.rb
Ruby
mit
246
master
574
require 'ice_nine' require 'value_object' # United nations location code. # # http://www.unece.org/cefact/locode/service/location.html # http://www.unece.org/fileadmin/DAM/cefact/locode/Service/LocodeColumn.htm # # Returns a string representation of this UnLocode consisting of 5 characters (all upper): # 2 chars of I...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/location/location.rb
Ruby
mit
246
master
717
require 'ice_nine' require 'value_object' class Location < ValueObject attr_reader :unlocode attr_reader :name CODES = { 'USCHI' => 'Chicago', 'USDAL' => 'Dallas', 'DEHAM' => 'Hamburg', 'CNHGH' => 'Hangzhou', 'FIHEL' => 'Helsinki', 'HKHKG' => 'Hongkong', 'AUMEL' => 'Melbourne', '...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/handling/handling_event_type.rb
Ruby
mit
246
master
204
require 'ruby-enum' class HandlingEventType include Ruby::Enum define :Load, 'Load' define :Unload, 'Unload' define :Receive, 'Receive' define :Claim, 'Claim' define :Customs, 'Customs' end
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/handling/handling_history.rb
Ruby
mit
246
master
557
require 'ice_nine' require 'hamster' require 'value_object' class HandlingHistory < ValueObject attr_reader :handling_events # TODO Handle empty values for attributes by returning UNKNOWN location # TODO Add is_empty method to supporting checking for this in is_empty def initialize(handling_events) # TOD...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
domain/handling/handling_event.rb
Ruby
mit
246
master
561
require 'uuidtools' class HandlingEvent attr_accessor :event_type attr_accessor :location attr_accessor :registration_date attr_accessor :completion_date attr_accessor :tracking_id attr_accessor :id def initialize(event_type, location, registration_date, completion_date, tracking_id, id) @event_type...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
config/application.rb
Ruby
mit
246
master
3,228
require File.expand_path('../boot', __FILE__) require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" require "rails/test_unit/railtie" if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets ...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
config/initializers/session_store.rb
Ruby
mit
246
master
443
# Be sure to restart your server when you modify this file. DddSampleAppRuby::Application.config.session_store :cookie_store, key: '_ddd_sample_app_ruby_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the sessio...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
config/initializers/loader.rb
Ruby
mit
246
master
678
puts "Loading common objects..." Dir.glob("#{Rails.root.to_s}/lib/*.rb").each do |f| puts "Loading: " + f require f end puts "Loading domain objects..." Dir.glob("#{Rails.root.to_s}/domain/**/*.rb").each do |f| puts "Loading: " + f require f end puts "Loading ports and adaptors..." Dir.glob("#{Rails.root.to_s...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
config/initializers/secret_token.rb
Ruby
mit
246
master
507
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
config/environments/development.rb
Ruby
mit
246
master
1,385
DddSampleAppRuby::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart t...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
config/environments/production.rb
Ruby
mit
246
master
2,490
DddSampleAppRuby::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false conf...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
config/environments/test.rb
Ruby
mit
246
master
1,536
DddSampleAppRuby::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for th...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
app/controllers/tracking_cargos_controller.rb
Ruby
mit
246
master
1,331
class TrackingCargosController < ApplicationController def index handling_event_repository = HandlingEventRepository.new # TODO this doesn't belong here...obviously! tracking_id = TrackingId.new('cargo_1234') @handling_events_history = handling_event_repository.lookup_handling_history_of_cargo(trackin...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
app/controllers/cargo_inspection_service.rb
Ruby
mit
246
master
873
class CargoInspectionService include Wisper::Publisher def cargo_was_handled(tracking_id, last_handling_event) cargo_repository = CargoRepository.new cargo = cargo_repository.find_by_tracking_id(tracking_id) puts "Old delivery ", cargo.delivery.inspect cargo.derive_delivery_progress(last_handling_e...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
app/controllers/handling_event_registration.rb
Ruby
mit
246
master
953
class HandlingEventRegistration include Wisper::Publisher def handle(register_handling_event) location_repository = LocationRepository.new # TODO Make this a conversion to an enum when it is implemented event_type = register_handling_event[:event_type] completed = register_handling_event[:completi...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
app/controllers/bookings_controller.rb
Ruby
mit
246
master
696
class BookingsController < ApplicationController def index cargo_repository = CargoRepository.new @cargo_documents = cargo_repository.find_all end def show tracking_id = TrackingId.new(params[:id]) cargo_repository = CargoRepository.new @cargo = cargo_repository.find_by_tracking_id(tracking_i...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
app/controllers/handling_events_controller.rb
Ruby
mit
246
master
1,154
class HandlingEventsController < ApplicationController def index handling_event_repository = HandlingEventRepository.new # TODO this doesn't belong here...obviously! tracking_id = TrackingId.new('cargo_1234') @handling_events_history = handling_event_repository.lookup_handling_history_of_cargo(trackin...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
app/helpers/application_helper.rb
Ruby
mit
246
master
537
module ApplicationHelper def bootstrap_class_for flash_type { success: "alert-success", error: "alert-danger", alert: "alert-warning", notice: "alert-info" }[flash_type] || flash_type.to_s end def flash_messages(opts = {}) flash.each do |msg_type, message| concat(content_tag(:div, message, class: ...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
app/models/booking.rb
Ruby
mit
246
master
1,581
class Booking include ActiveModel::Validations attr_accessor :origin, :destination, :arrival_deadline def initialize(attributes = {}) attributes.each do |name, value| send("#{name}=", value) end end validates_presence_of :origin, :destination, :arrival_deadline validate :origin_must_not_...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
ports/persistence/mongodb_adaptor/cargo_repository.rb
Ruby
mit
246
master
5,897
require 'mongoid' require_relative 'handling_event_repository' class CargoRepository def initialize # TODO Move this somewhere (base class?) for all Mongoid-based repositories Mongoid.load!("#{File.dirname(__FILE__)}/../../../config/mongoid.yml", :development) end def store(cargo) # TODO Figure out...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
ports/persistence/mongodb_adaptor/handling_event_repository.rb
Ruby
mit
246
master
2,612
require 'mongoid' class HandlingEventRepository def initialize # TODO Move this somewhere (base class?) for all Mongoid-based repositories Mongoid.load!("#{File.dirname(__FILE__)}/../../../config/mongoid.yml", :development) end def store(handling_event) handling_event_document = HandlingEventDocume...
github
paulrayner/ddd_sample_app_ruby
https://github.com/paulrayner/ddd_sample_app_ruby
ports/persistence/mongodb_adaptor/location_repository.rb
Ruby
mit
246
master
1,453
require 'mongoid' class LocationRepository def initialize # TODO Move this somewhere (base class?) for all Mongoid-based repositories Mongoid.load!("#{File.dirname(__FILE__)}/../../../config/mongoid.yml", :development) end def store(location) location_document = LocationDocumentAdaptor.new.transfor...
github
vonahisec/leprechaun
https://github.com/vonahisec/leprechaun
leprechaun.rb
Ruby
mit
246
master
7,363
#!/usr/bin/env ruby # # This tool was intended to be used during post-exploitation. # Essentially, once you have elevated privileges, you can run a recursive netstat # using tools such as winexe, smbexec, psexec, whatever., and parse it here. # # See the GitHub or blog page for more information. # # Author; Alton Johns...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
Rakefile
Ruby
mit
245
main
250
# frozen_string_literal: true require File.expand_path("../vendor/bootstrap.rb", __FILE__) require "rake" require "rake/testtask" Rake::TestTask.new do |t| t.libs += %w(test) t.test_files = FileList["test/**/*_test.rb"] t.warning = false end
github
Shopify/git-chain
https://github.com/Shopify/git-chain
Gemfile
Ruby
mit
245
main
520
# frozen_string_literal: true source "https://rubygems.org" # None of these can actually be used in a development copy of dev # They are all for CI and tests # `dev` uses no gems group :development, :test do gem "rubocop", "~> 1.13.0" gem "rubocop-performance" gem "rubocop-minitest" gem "rubocop-rake" gem "...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/test_helper.rb
Ruby
mit
245
main
1,028
# frozen_string_literal: true require File.expand_path("../../vendor/bootstrap.rb", __FILE__) require "git_chain" require "minitest" require "mocha/minitest" require "minitest/autorun" require "minitest/reporters" MiniTest::Reporters.use! CLI::UI.enable_color = true require "tmpdir" require "fileutils" require "temp...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/git_test.rb
Ruby
mit
245
main
300
# frozen_string_literal: true require "test_helper" module GitChain class GitTest < MiniTest::Test include RepositoryTestHelper def test_chains with_test_repository("a-b-chain") do assert_equal({ "a" => "default", "b" => "default" }, Git.chains) end end end end
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/fixtures_test.rb
Ruby
mit
245
main
341
# frozen_string_literal: true require "test_helper" module GitChain class FixturesTest < MiniTest::Test include RepositoryTestHelper def test_with_test_repository with_test_repository do assert(File.exist?(".git")) assert_match(/master.2/, Git.exec("log", "--oneline", "@^..@")) e...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/model/chain_test.rb
Ruby
mit
245
main
844
# frozen_string_literal: true require "test_helper" module GitChain module Models class ChainTest < MiniTest::Test include RepositoryTestHelper def test_from_config with_test_repository("a-b-chain") do chain = Chain.from_config("default") assert_equal("default", chain.nam...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/model/branch_test.rb
Ruby
mit
245
main
463
# frozen_string_literal: true require "test_helper" module GitChain module Models class BranchTest < MiniTest::Test include RepositoryTestHelper def test_from_config with_test_repository("a-b-chain") do branch = Branch.from_config("a") assert_equal("a", branch.name) ...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/command/rebase_test.rb
Ruby
mit
245
main
3,085
# frozen_string_literal: true require "test_helper" module GitChain module Commands class RebaseTest < MiniTest::Test include RepositoryTestHelper def test_rebasing_a_clean_chain capture_io do with_test_repository("a-b-chain") do Rebase.new.call assert_equa...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/command/prune_test.rb
Ruby
mit
245
main
1,144
# frozen_string_literal: true require "test_helper" module GitChain module Commands class PruneTest < MiniTest::Test include RepositoryTestHelper def test_clean_chain capture_io do with_test_repository("a-b-chain") do assert_equal(%w(master a b), Models::Chain.from_conf...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/command/branch_test.rb
Ruby
mit
245
main
3,234
# frozen_string_literal: true require "test_helper" module GitChain module Commands class BranchTest < MiniTest::Test include RepositoryTestHelper def test_append capture_io do with_test_repository("a-b-chain") do chain = Models::Chain.from_config("default") ...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/command/setup_test.rb
Ruby
mit
245
main
1,902
# frozen_string_literal: true require "test_helper" module GitChain module Commands class SetupTest < MiniTest::Test include RepositoryTestHelper def test_chain_noop capture_io do with_test_repository("a-b-chain") do chain = Models::Chain.from_config("default") ...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/command/push_test.rb
Ruby
mit
245
main
2,061
# frozen_string_literal: true require "test_helper" module GitChain module Commands class PushTest < MiniTest::Test include RepositoryTestHelper def test_push_nothing capture_io do with_remote_test_repository("a-b-chain") do |remote_repo| assert_empty(Git.branches(dir: ...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/command/list_test.rb
Ruby
mit
245
main
642
# frozen_string_literal: true require "test_helper" module GitChain module Commands class ListTest < MiniTest::Test include RepositoryTestHelper def test_append with_test_repository("a-b-chain") do capture_io do Branch.new.call(%w(-c new a c)) end o...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/command/teardown_test.rb
Ruby
mit
245
main
867
# frozen_string_literal: true require "test_helper" module GitChain module Commands class TeardownTest < MiniTest::Test include RepositoryTestHelper def test_tearing_down_a_clean_chain capture_io do with_test_repository("a-b-chain") do assert_equal(%w(master a b), Model...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
test/git_chain/util/github_test.rb
Ruby
mit
245
main
625
# frozen_string_literal: true require "test_helper" module GitChain module Util class GithubTest < MiniTest::Test def test_parse_url %w( git@github.com:Shopify/git-chain.git ssh://git@github.com:Shopify/git-chain.git https://github.com/Shopify/git-chain.git h...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain.rb
Ruby
mit
245
main
853
# frozen_string_literal: true require "cli/ui" require "cli/kit" module GitChain extend CLI::Kit::Autocall TOOL_NAME = "git-chain" CONFIG_HOME = File.expand_path(ENV.fetch("XDG_CONFIG_HOME", "~/.config")) TOOL_CONFIG_PATH = File.join(CONFIG_HOME, TOOL_NAME) DEBUG_LOG_FILE = File.join(TOOL_CONF...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/entry_point.rb
Ruby
mit
245
main
1,126
# frozen_string_literal: true module GitChain module EntryPoint PRELUDE = "git chain" class << self include Util::Output def call(args) name = args.shift unless name GitChain::Logger.info(usage) return 0 end cmd = commands[name] unless...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/git.rb
Ruby
mit
245
main
3,969
# frozen_string_literal: true require "open3" module GitChain class Git class Failure < StandardError def initialize(args, err) super("git #{args.join(" ")} failed: \n#{err}") end end class << self def capture3(*args, dir: nil) cmd = %w(git) cmd += ["-C", dir] i...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/commands.rb
Ruby
mit
245
main
695
# frozen_string_literal: true module GitChain module Commands autoload :Branch, "git_chain/commands/branch" autoload :Command, "git_chain/commands/command" autoload :List, "git_chain/commands/list" autoload :Rebase, "git_chain/commands/rebase" autoload :Prune, "git_chain/commands/prune" autolo...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/models.rb
Ruby
mit
245
main
212
# frozen_string_literal: true module GitChain module Models autoload :Branch, "git_chain/models/branch" autoload :Chain, "git_chain/models/chain" autoload :Model, "git_chain/models/model" end end
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/util.rb
Ruby
mit
245
main
225
# frozen_string_literal: true module GitChain module Util autoload :EqualVariables, "git_chain/util/equal_variables" autoload :Github, "git_chain/util/github" autoload :Output, "git_chain/util/output" end end
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/models/chain.rb
Ruby
mit
245
main
1,758
# frozen_string_literal: true module GitChain module Models class Chain < Model attr_accessor :name, :branches def initialize(name:, branches: []) super() @name = name @branches = branches end def branch_names branches.map(&:name) end def empt...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/models/branch.rb
Ruby
mit
245
main
709
# frozen_string_literal: true module GitChain module Models class Branch < Model attr_accessor :name, :chain_name, :parent_branch, :branch_point def initialize(name:, chain_name: nil, parent_branch: nil, branch_point: nil) super() @name = name @chain_name = chain_name ...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/models/model.rb
Ruby
mit
245
main
264
# frozen_string_literal: true module GitChain module Models class Model include Util::EqualVariables include Util::Output def inspect "<#{self.class.name.split("::").last} #{state.select { |_, v| v }}>" end end end end
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/options/chain_name.rb
Ruby
mit
245
main
952
# frozen_string_literal: true module GitChain module Options module ChainName def post_process_options!(options) super unless options[:chain_name] branch_name = Git.current_branch if branch_name branch = Models::Branch.from_config(branch_name) opt...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/util/output.rb
Ruby
mit
245
main
871
# frozen_string_literal: true module GitChain module Util module Output def puts(text) GitChain::Logger.info(text) end def puts_warning(text) GitChain::Logger.warn(text) end def puts_error(text) GitChain::Logger.error("{{x}} " + text) end def pu...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/util/github.rb
Ruby
mit
245
main
915
# frozen_string_literal: true module GitChain module Util module Github class << self def parse_url(url) # matches git@github.com:organization/project.git, https://github.com/organization/project.git parsed_arg = url.match( %r{ ^(?:(?:ssh://)?git@|https?...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/util/equal_variables.rb
Ruby
mit
245
main
386
# frozen_string_literal: true module GitChain module Util module EqualVariables alias_method :eql?, :== def ==(other) other.class == self.class && other.state == state end def hash state.hash end protected def state instance_variables.map { |v|...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/commands/push.rb
Ruby
mit
245
main
2,052
# frozen_string_literal: true require "optparse" module GitChain module Commands class Push < Command include Options::ChainName def description "Push all branches of the chain to upstream" end def configure_option_parser(opts, options) super opts.on("-u", "--se...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/commands/command.rb
Ruby
mit
245
main
1,811
# frozen_string_literal: true require "optparse" module GitChain module Commands class Command include Util::Output def self.command_name @command_name ||= name.split("::") .last .gsub(/([A-Z]+)([A-Z][a-z])/, '\1-\2') .gsub(/([a-z\d])([A-Z])/, '\1-\2') ...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/commands/branch.rb
Ruby
mit
245
main
3,572
# frozen_string_literal: true require "optparse" module GitChain module Commands class Branch < Command def banner_options "<start_point> branch" end def description "Start a new branch, adding it to the chain" end def configure_option_parser(opts, options) ...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/commands/list.rb
Ruby
mit
245
main
2,261
# frozen_string_literal: true require "optparse" module GitChain module Commands class List < Command def banner_options "<chain name>" end def description "List existing chains" end def configure_option_parser(opts, options) super opts.on("-s", "-...
github
Shopify/git-chain
https://github.com/Shopify/git-chain
lib/git_chain/commands/prune.rb
Ruby
mit
245
main
1,584
# frozen_string_literal: true require "optparse" module GitChain module Commands class Prune < Command include Options::ChainName def description "Prune overlapping branches from the chain" end def configure_option_parser(opts, options) super opts.on("-d", "--de...