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
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/refinery/models/user.rb
Ruby
mit
4,074
master
378
class User < ActiveRecord::Base has_and_belongs_to_many :roles if ActiveRecord::VERSION::MAJOR >= 4 has_many :plugins, lambda { order(:position => :asc) }, :class_name => "UserPlugin", :dependent => :destroy else has_many :plugins, :class_name => "UserPlugin", :order => "position ASC", :dependent => :dest...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/refinery/models/inquiry.rb
Ruby
mit
4,074
master
206
class Inquiry < ActiveRecord::Base validates :name, :presence => true validates :message, :presence => true validates :email, :format=> { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i } end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/refinery/models/page.rb
Ruby
mit
4,074
master
634
class Page < ActiveRecord::Base validates :title, :presence => true has_friendly_id :title, :use_slug => true, :reserved_words => %w(index new session login logout users refinery admin images wymiframe) if ActiveRecord::VERSION::MAJOR >= 4 has_many :parts, lambda { order(:positi...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/event_forms/schema.rb
Ruby
mit
4,074
master
2,611
ActiveRecord::Schema.define(:version => 20100905230322) do create_table "event_dates", :force => true do |t| t.string "date" t.text "description" t.string "location" t.date "expiry_date" t.datetime "created_at" t.datetime "updated_at" t.integer "event_id" end create_table...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/event_forms/models/group.rb
Ruby
mit
4,074
master
269
class Group < ActiveRecord::Base belongs_to :organization belongs_to :stylesheet belongs_to :form has_many :events has_many :event_dates, :through => :events, :source => :dates validates_presence_of :organization, :title, :url_slug, :form, :stylesheet end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/gemcutter/schema.rb
Ruby
mit
4,074
master
4,614
ActiveRecord::Schema.define(:version => 20100817182653) do create_table "dependencies", :force => true do |t| t.string "requirements" t.datetime "created_at" t.datetime "updated_at" t.integer "rubygem_id" t.integer "version_id" t.string "scope" end add_index "dependencies", ["rubyg...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/gemcutter/models/rubygem.rb
Ruby
mit
4,074
master
465
class Rubygem < ActiveRecord::Base has_many :owners, :through => :ownerships, :source => :user has_many :ownerships, :dependent => :destroy has_many :subscribers, :through => :subscriptions, :source => :user has_many :subscriptions, :dependent => :destroy has_many :versions, :dependent => :destroy has_many ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/gemcutter/models/user.rb
Ruby
mit
4,074
master
824
class User < ActiveRecord::Base if ActiveRecord::VERSION::MAJOR >= 4 has_many :rubygems, lambda { where(:ownerships => { :approved => true }).order(:name => :asc) }, :through => :ownerships has_many :subscribed_gems, lambda { order(:name => :asc) }, :through => :subscriptions, :s...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/typo/schema.rb
Ruby
mit
4,074
master
5,332
ActiveRecord::Schema.define(:version => 92) do create_table "articles_tags", :id => false, :force => true do |t| t.integer "article_id" t.integer "tag_id" end create_table "blogs", :force => true do |t| t.text "settings" t.string "base_url" end create_table "categories", :force => true do...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/typo/models/category.rb
Ruby
mit
4,074
master
437
class Category < ActiveRecord::Base has_many :categorizations if ActiveRecord::VERSION::MAJOR >= 4 has_many :articles, lambda { order(:published_at => :desc, :created_at => :desc) }, :through => :categorizations else has_many :articles, :through => :categorizations, :order => "publishe...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/typo/models/tag.rb
Ruby
mit
4,074
master
264
class Tag < ActiveRecord::Base if ActiveRecord::VERSION::MAJOR >= 4 has_and_belongs_to_many :articles, lambda { order(:created_at => :desc) } else has_and_belongs_to_many :articles, :order => 'created_at DESC' end validates_uniqueness_of :name end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/typo/models/user.rb
Ruby
mit
4,074
master
1,203
class User < ActiveRecord::Base belongs_to :profile belongs_to :text_filter has_many :notifications, :foreign_key => 'notify_user_id' if ActiveRecord::VERSION::MAJOR >= 4 has_many :notify_contents, :through => :notifications, :source => 'notify_content' has_many :articles, lambda { order(:created_...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/typo/models/article.rb
Ruby
mit
4,074
master
2,118
class Article < Content if ActiveRecord::VERSION::MAJOR >= 4 has_many :pings, lambda { order(:created_at => :asc) }, :dependent => :destroy has_many :comments, lambda { order(:created_at => :asc) }, :dependent => :destroy has_many :published_comments, lambda { order(:created_at => :asc) }, :class_n...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/typo/models/notification.rb
Ruby
mit
4,074
master
205
class Notification < ActiveRecord::Base belongs_to :notify_content, :class_name => 'Content', :foreign_key => 'content_id' belongs_to :notify_user, :class_name => 'User', :foreign_key => 'user_id' end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/typo/models/content.rb
Ruby
mit
4,074
master
438
class Content < ActiveRecord::Base belongs_to :text_filter has_many :notifications, :foreign_key => 'content_id' if ActiveRecord::VERSION::MAJOR >= 4 has_many :notify_users, :through => :notifications, :source => 'notify_user' else has_many :notify_users, :through => :notifications, :source ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/schema.rb
Ruby
mit
4,074
master
19,293
ActiveRecord::Schema.define(:version => 20100923162011) do create_table "addresses", :force => true do |t| t.string "firstname" t.string "lastname" t.string "address1" t.string "address2" t.string "city" t.integer "state_id" t.string "zipcode" t.integer "country_id" ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/lib/delegate_belongs_to.rb
Ruby
mit
4,074
master
2,257
module DelegateBelongsTo module ClassMethods @@default_rejected_delegate_columns = ['created_at','created_on','updated_at','updated_on','lock_version','type','id','position','parent_id','lft','rgt'] mattr_accessor :default_rejected_delegate_columns def delegate_belongs_to(association, *attrs) opts...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/checkout.rb
Ruby
mit
4,074
master
632
class Checkout < ActiveRecord::Base before_update :check_addresses_on_duplication, :if => "!ship_address.nil? && !bill_address.nil?" after_save :update_order_shipment before_validation :clone_billing_address, :if => "@use_billing" belongs_to :order belongs_to :bill_address, :foreign_key => "bill_address_id",...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/creditcard.rb
Ruby
mit
4,074
master
340
class Creditcard < ActiveRecord::Base has_many :payments, :as => :source validates :month, :year, :numericality => { :only_integer => true } validates :number, :presence => true, :unless => :has_payment_profile?, :on => :create validates :verification_value, :presence => true, :unless => :has_payment_profile?,...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/order.rb
Ruby
mit
4,074
master
632
class Order < ActiveRecord::Base belongs_to :user belongs_to :bill_address, :foreign_key => "bill_address_id", :class_name => "Address" belongs_to :ship_address, :foreign_key => "ship_address_id", :class_name => "Address" belongs_to :shipping_method has_many :state_events, :as => :stateful has_many :line_it...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/option_type.rb
Ruby
mit
4,074
master
395
class OptionType < ActiveRecord::Base if ActiveRecord::VERSION::MAJOR >= 4 has_many :option_values, lambda { order(:position) }, :dependent => :destroy else has_many :option_values, :order => :position, :dependent => :destroy end has_many :product_option_types, :dependent => :destroy has_and_belongs_t...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/property.rb
Ruby
mit
4,074
master
240
class Property < ActiveRecord::Base has_and_belongs_to_many :prototypes has_many :product_properties, :dependent => :destroy has_many :products, :through => :product_properties validates :name, :presentation, :presence => true end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/preference.rb
Ruby
mit
4,074
master
252
class Preference < ActiveRecord::Base belongs_to :owner, :polymorphic => true belongs_to :group, :polymorphic => true validates :name, :owner_id, :owner_type, :presence => true validates :group_type, :presence => true, :if => :group_id? end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/return_authorization.rb
Ruby
mit
4,074
master
217
class ReturnAuthorization < ActiveRecord::Base belongs_to :order has_many :inventory_units validates :order, :presence => true validates :amount, :numericality => true validate :must_have_shipped_units end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/variant.rb
Ruby
mit
4,074
master
739
class Variant < ActiveRecord::Base belongs_to :product delegate_belongs_to :product, :name, :description, :permalink, :available_on, :tax_category_id, :shipping_category_id, :meta_description, :meta_keywords has_many :inventory_units has_many :line_items has_and_belongs_to_many :option_values if ActiveReco...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/product.rb
Ruby
mit
4,074
master
1,714
class Product < ActiveRecord::Base has_many :product_option_types, :dependent => :destroy has_many :option_types, :through => :product_option_types has_many :product_properties, :dependent => :destroy has_many :properties, :through => :product_properties has_and_belongs_to_many :product_groups belongs_to :t...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/adjustment.rb
Ruby
mit
4,074
master
234
class Adjustment < ActiveRecord::Base belongs_to :order belongs_to :source, :polymorphic => true belongs_to :originator, :polymorphic => true validates :label, :presence => true validates :amount, :numericality => true end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/user.rb
Ruby
mit
4,074
master
231
class User < ActiveRecord::Base has_many :orders belongs_to :ship_address, :foreign_key => "ship_address_id", :class_name => "Address" belongs_to :bill_address, :foreign_key => "bill_address_id", :class_name => "Address" end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/line_item.rb
Ruby
mit
4,074
master
318
class LineItem < ActiveRecord::Base belongs_to :order belongs_to :variant has_one :product, :through => :variant validates :variant, :presence => true validates :quantity, :numericality => { :only_integer => true, :message => I18n.t("validation.must_be_int") } validates :price, :numericality => true end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/taxonomy.rb
Ruby
mit
4,074
master
294
class Taxonomy < ActiveRecord::Base has_many :taxons, :dependent => :destroy if ActiveRecord::VERSION::MAJOR >= 4 has_one :root, lambda { where("parent_id is null") }, :class_name => 'Taxon' else has_one :root, :class_name => 'Taxon', :conditions => "parent_id is null" end end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/address.rb
Ruby
mit
4,074
master
789
class Address < ActiveRecord::Base belongs_to :country belongs_to :state has_many :billing_checkouts, :foreign_key => "bill_address_id", :class_name => "Checkout" has_many :shipping_checkouts, :foreign_key => "ship_address_id", :class_name => "Checkout" has_many :shipments validates :firstname, :lastname,...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/payment.rb
Ruby
mit
4,074
master
581
class Payment < ActiveRecord::Base belongs_to :order belongs_to :source, :polymorphic => true belongs_to :payment_method has_many :transactions if ActiveRecord::VERSION::MAJOR >= 4 has_many :offsets, lambda { where("source_type = 'Payment' AND amount < 0") }, :class_name => 'Payment', :foreign_key => 'sou...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/product_group.rb
Ruby
mit
4,074
master
217
class ProductGroup < ActiveRecord::Base validates :name, :presence => true validates_associated :product_scopes has_and_belongs_to_many :cached_products, :class_name => "Product" has_many :product_scopes end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/shipment.rb
Ruby
mit
4,074
master
287
class Shipment < ActiveRecord::Base belongs_to :order belongs_to :shipping_method belongs_to :address has_many :state_events, :as => :stateful has_many :inventory_units validates :inventory_units, :presence => true, :if => :require_inventory validate :shipping_method end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/applications/spree/models/calculator/vat.rb
Ruby
mit
4,074
master
2,356
class Calculator::Vat < Calculator def self.description I18n.t("vat") end def self.register super TaxRate.register_calculator(self) end # list the vat rates for the default country def self.default_rates origin = Country.find(Spree::Config[:default_country_id]) calcs = Calculator::Vat...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/associations/one-to-one/schema.rb
Ruby
mit
4,074
master
353
ActiveRecord::Schema.define do create_table "countries", :force => true do |t| t.string :official_name, :null => false t.string :common_name t.integer :inhabitants_count end create_table "heads_of_state", :force => true do |t| t.references :country, :null => false t.string :name, :null => fal...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/associations/many-to-many/schema.rb
Ruby
mit
4,074
master
283
ActiveRecord::Schema.define do create_table "genres", :force => true do |t| t.string :name, :null => false t.string :description end create_table "films", :force => true do |t| t.string :title, :null => false t.date :release_date t.float :rating end end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/associations/one-to-one-recursive/schema.rb
Ruby
mit
4,074
master
230
ActiveRecord::Schema.define do create_table "emperors", :force => true do |t| t.string :name, :null => false t.boolean :murdered t.references :predecessor t.date :reigned_from t.date :reigned_until end end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/associations/one-to-many/schema.rb
Ruby
mit
4,074
master
341
ActiveRecord::Schema.define do create_table "galleons", :force => true do |t| t.string :name, :null => false t.integer :mast_count, :null => false t.date :completed_on end create_table "cannons", :force => true do |t| t.references :galleon, :null => false t.integer :calibre t.integer :bar...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/associations/many-to-many-indirect/schema.rb
Ruby
mit
4,074
master
432
ActiveRecord::Schema.define do create_table "wizards", :force => true do |t| t.string :name, :null => false t.date :graduated_on end create_table "spells", :force => true do |t| t.string :formula, :null => false t.string :nickname end create_table "spell_masteries", :force => true do |t| ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/polymorphism/polymorphic-belongs-to/schema.rb
Ruby
mit
4,074
master
504
ActiveRecord::Schema.define do create_table "barricades", :force => true do |t| t.string :name, :null => false t.string :location t.boolean :upheld, :null => false end create_table "strongholds", :force => true do |t| t.string :name, :null => false t.string :location t.date :completed_on ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
examples/entities/attributes/schema.rb
Ruby
mit
4,074
master
379
ActiveRecord::Schema.define do create_table "photographs" do |t| t.decimal :aperture t.binary :data, :null => false t.text :description, :limit => 512 t.string :filename, :null => false, :limit => 64 t.boolean :flash t.integer :iso t.float :shutter_s...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/test_helper.rb
Ruby
mit
4,074
master
6,640
require "rubygems" require "bundler/setup" require 'pry' require 'pry-nav' require "active_record" require "minitest/autorun" require 'mocha/minitest' require "rails_erd/domain" ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ":memory:" if ActiveSupport::TestCase.respond_to?(:test_order...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/config_test.rb
Ruby
mit
4,074
master
4,866
# encoding: utf-8 require File.expand_path("../test_helper", File.dirname(__FILE__)) class ConfigTest < ActiveSupport::TestCase test "load_config_gile should return blank hash when neither CURRENT_CONFIG_FILE nor USER_WIDE_CONFIG_FILE exist." do expected_hash = {} assert_equal expected_hash, RailsERD::Confi...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/graphviz_test.rb
Ruby
mit
4,074
master
17,329
require File.expand_path("../test_helper", File.dirname(__FILE__)) require "rails_erd/diagram/graphviz" class GraphvizTest < ActiveSupport::TestCase def setup RailsERD.options.filetype = :png RailsERD.options.warn = false end def teardown FileUtils.rm Dir["erd*.*"] rescue nil end def diagra...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/relationship_test.rb
Ruby
mit
4,074
master
17,918
require File.expand_path("../test_helper", File.dirname(__FILE__)) class RelationshipTest < ActiveSupport::TestCase N = Domain::Relationship::N def domain_cardinalities Domain.generate.relationships.map(&:cardinality) end # Relationship ============================================================= test...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/specialization_test.rb
Ruby
mit
4,074
master
2,732
require File.expand_path("../test_helper", File.dirname(__FILE__)) class SpecializationTest < ActiveSupport::TestCase # Specialization =========================================================== test "inspect should show source and destination" do create_specialization domain = Domain.generate assert_m...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/diagram_test.rb
Ruby
mit
4,074
master
11,716
require File.expand_path("../test_helper", File.dirname(__FILE__)) require "rails_erd/diagram" class DiagramTest < ActiveSupport::TestCase def retrieve_entities(options = {}) klass = Class.new(Diagram) [].tap do |entities| klass.class_eval do each_entity do |entity, attributes| entiti...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/attribute_test.rb
Ruby
mit
4,074
master
11,283
# encoding: utf-8 require File.expand_path("../test_helper", File.dirname(__FILE__)) class AttributeTest < ActiveSupport::TestCase def with_native_limit(type, new_limit) ActiveRecord::Base.connection.singleton_class.class_eval do undef :native_database_types define_method(:native_database_types) do ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/rake_task_test.rb
Ruby
mit
4,074
master
6,408
require File.expand_path("../test_helper", File.dirname(__FILE__)) require "rails_erd/diagram/graphviz" require "rails_erd/diagram/mermaid" class RakeTaskTest < ActiveSupport::TestCase include ActiveSupport::Testing::Isolation def setup require "rake" load "rails_erd/tasks.rake" RailsERD.options.file...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/entity_test.rb
Ruby
mit
4,074
master
9,870
require File.expand_path("../test_helper", File.dirname(__FILE__)) class EntityTest < ActiveSupport::TestCase def create_entity(model) Domain::Entity.new(Domain.new, model.name, model) end def create_generalized_entity(name) Domain::Entity.new(Domain.new, name) end def create_abstract_entity(name) ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/mermaid_test.rb
Ruby
mit
4,074
master
6,831
require File.expand_path("../test_helper", File.dirname(__FILE__)) require "rails_erd/diagram/mermaid" class MermaidTest < ActiveSupport::TestCase def setup RailsERD.options.filetype = :png RailsERD.options.warn = false end def teardown FileUtils.rm Dir["erd*.*"] rescue nil end def diagram(...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/domain_test.rb
Ruby
mit
4,074
master
10,334
require File.expand_path("../test_helper", File.dirname(__FILE__)) class DomainTest < ActiveSupport::TestCase # Domain =================================================================== test "generate should return domain" do assert_kind_of Domain, Domain.generate end test "name should return rails appli...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
test/unit/cardinality_test.rb
Ruby
mit
4,074
master
6,008
require File.expand_path("../test_helper", File.dirname(__FILE__)) class CardinalityTest < ActiveSupport::TestCase def setup @n = Domain::Relationship::Cardinality::N end # Cardinality ============================================================== test "inspect should show source and destination ranges" d...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd.rb
Ruby
mit
4,074
master
2,656
require "active_support/ordered_options" require "rails_erd/railtie" if defined? Rails require "rails_erd/config" # Welcome to the API documentation of Rails ERD. If you wish to extend or # customise the output that is generated by Rails ERD, you have come to the # right place. # # == Creating custom output # # If you...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/tasks/auto_generate_diagram.rake
Ruby
mit
4,074
master
352
namespace :db do task :migrate do ERDGraph::Migration.update_model end namespace :migrate do [:change, :up, :down, :reset, :redo].each do |t| task t do ERDGraph::Migration.update_model end end end end module ERDGraph class Migration def self.update_model Rake::Task[...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/generators/erd/install_generator.rb
Ruby
mit
4,074
master
377
module Erd module Generators class InstallGenerator < Rails::Generators::Base desc "Copy rails-erd rakefiles for automatic graphic generation" source_root File.expand_path('../templates', __FILE__) # copy rake tasks def copy_tasks template "auto_generate_diagram.rake", "lib/tasks/...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/generators/erd/templates/auto_generate_diagram.rake
Ruby
mit
4,074
master
270
# NOTE: only doing this in development as some production environments (Heroku) # NOTE: are sensitive to local FS writes, and besides -- it's just not proper # NOTE: to have a dev-mode tool do its thing in production. if Rails.env.development? RailsERD.load_tasks end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/railtie.rb
Ruby
mit
4,074
master
300
module RailsERD # Rails ERD integrates with Rails 3. If you add it to your +Gemfile+, you # will gain a Rake task called +erd+, which you can use to generate diagrams # of your domain model. class Railtie < Rails::Railtie rake_tasks do load "rails_erd/tasks.rake" end end end
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/cli.rb
Ruby
mit
4,074
master
5,970
require "rails_erd" require "choice" Choice.options do separator "" separator "Diagram options:" option :generator do long "--generator=Generator" desc "Generator to use (graphviz or mermaid). Defaults to graphviz." end option :title do long "--title=TITLE" desc "Replace default diagram tit...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/domain.rb
Ruby
mit
4,074
master
6,422
require "rails_erd" require "rails_erd/domain/attribute" require "rails_erd/domain/entity" require "rails_erd/domain/relationship" require "rails_erd/domain/specialization" module RailsERD # The domain describes your Rails domain model. This class is the starting # point to get information about your models. # ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/diagram.rb
Ruby
mit
4,074
master
7,143
require "rails_erd/domain" module RailsERD # This class is an abstract class that will process a domain model and # allows easy creation of diagrams. To implement a new diagram type, derive # from this class and override +process_entity+, +process_relationship+, # and (optionally) +save+. # # As an example...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/tasks.rake
Ruby
mit
4,074
master
2,530
require 'graphviz/utils' module ErdRakeHelper def say(message) puts message unless Rake.application.options.silent end end namespace :erd do task :check_dependencies do if RailsERD.options.generator == :graphviz include GraphViz::Utils unless find_executable("dot", nil) raise "#{Rail...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/config.rb
Ruby
mit
4,074
master
2,585
require "yaml" module RailsERD class Config USER_WIDE_CONFIG_FILE = File.expand_path(".erdconfig", ENV["HOME"]) CURRENT_CONFIG_FILE = File.expand_path(".erdconfig", Dir.pwd) attr_reader :options def self.load(extra_config_file=nil) new.load extra_config_file end def initialize ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/diagram/mermaid.rb
Ruby
mit
4,074
master
2,093
# encoding: utf-8 require "rails_erd/diagram" require "erb" module RailsERD class Diagram class Mermaid < Diagram attr_accessor :graph setup do self.graph = ["classDiagram"] # hard code to RL to make it easier to view diagrams from GitHub self.graph << "\tdirection RL" ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/diagram/graphviz.rb
Ruby
mit
4,074
master
10,920
# encoding: utf-8 require "rails_erd/diagram" require "graphviz" require "erb" # Fix bad RegEx test in Ruby-Graphviz. GraphViz::Types::LblString.class_eval do def output # @private :nodoc: if /^<.*>$/m =~ @data @data else @data.to_s.inspect.gsub("\\\\", "\\") end end alias_method :to_gv, ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/domain/relationship.rb
Ruby
mit
4,074
master
8,189
require "set" require "active_support/core_ext/module/delegation" require "rails_erd/domain/relationship/cardinality" module RailsERD class Domain # Describes a relationship between two entities. A relationship is detected # based on Active Record associations. One relationship may represent more # than ...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/domain/specialization.rb
Ruby
mit
4,074
master
3,102
module RailsERD class Domain # Describes the specialization of an entity. Specialized entities correspond # to inheritance or polymorphism. In Rails, specialization is referred to # as single table inheritance, while generalization is referred to as # polymorphism or abstract classes. class Specia...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/domain/attribute.rb
Ruby
mit
4,074
master
5,608
# encoding: utf-8 #-- module RailsERD class Domain # Describes an entity's attribute. Attributes correspond directly to # database columns. class Attribute TIMESTAMP_NAMES = %w{created_at created_on updated_at updated_on} # @private :nodoc: class << self def from_model(domain, model)...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/domain/entity.rb
Ruby
mit
4,074
master
3,613
module RailsERD class Domain # Entities represent your Active Record models. Entities may be connected # to other entities. class Entity class << self def from_models(domain, models) # @private :nodoc: (concrete_from_models(domain, models) + abstract_from_models(domain, models)).so...
github
voormedia/rails-erd
https://github.com/voormedia/rails-erd
lib/rails_erd/domain/relationship/cardinality.rb
Ruby
mit
4,074
master
4,097
module RailsERD class Domain class Relationship class Cardinality extend Inspectable inspection_attributes :source_range, :destination_range N = Infinity = 1.0/0 # And beyond. CLASSES = { [1, 1] => :one_to_one, [1, N] => :one_to_many, [N, 1] =>...
github
bblimke/webmock
https://github.com/bblimke/webmock
webmock.gemspec
Ruby
mit
4,051
master
2,304
$:.push File.expand_path('../lib', __FILE__) require 'webmock/version' Gem::Specification.new do |s| s.name = 'webmock' s.version = WebMock::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Bartosz Blimke'] s.email = ['bartosz.blimke@gmail.com'] s.homepage = 'https://github...
github
bblimke/webmock
https://github.com/bblimke/webmock
Rakefile
Ruby
mit
4,051
master
977
require 'bundler' Bundler::GemHelper.install_tasks require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) do |t| t.rspec_opts = %w[ --force-color --format progress --require ./spec/spec_helper.rb ] t.pattern = 'spec/**/*_spec.rb' end RSpec::Core::RakeTask.new(:spec_http_without_webmock) do ...
github
bblimke/webmock
https://github.com/bblimke/webmock
Gemfile
Ruby
mit
4,051
master
545
source 'https://rubygems.org/' gemspec # FIXME: This is a workaround to resolve the following error in Ruby 3.5: # # /home/runner/work/webmock/webmock/vendor/bundle/ruby/3.5.0+0/gems/ethon-0.16.0/lib/ethon.rb:2: # warning: logger was loaded from the standard library, but is not part of the default gems starting from ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/spec_helper.rb
Ruby
mit
4,051
master
1,381
require 'rubygems' require 'httpclient' unless RUBY_PLATFORM =~ /java/ require 'curb' require 'em-http' require 'patron' require 'typhoeus' end if RUBY_PLATFORM =~ /java/ require 'manticore' end $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) requ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/quality_spec.rb
Ruby
mit
4,051
master
2,802
require "spec_helper" # Borrowed from Bundler # https://github.com/carlhuda/bundler/blob/1-0-stable/spec/quality_spec.rb # Portions copyright (c) 2010 Andre Arko # Portions copyright (c) 2009 Engine Yard # MIT License # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software a...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/stub_registry_spec.rb
Ruby
mit
4,051
master
4,424
require 'spec_helper' describe WebMock::StubRegistry do before(:each) do WebMock::StubRegistry.instance.reset! @request_pattern = WebMock::RequestPattern.new(:get, "www.example.com") @request_signature = WebMock::RequestSignature.new(:get, "www.example.com") @request_stub = WebMock::RequestStub.new(...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/errors_spec.rb
Ruby
mit
4,051
master
6,482
require 'spec_helper' describe "errors" do describe WebMock::NetConnectNotAllowedError do describe "message" do it "should have message with request signature and snippet" do allow(WebMock::RequestStub).to receive(:from_request_signature).and_return(request_stub) allow(WebMock::StubRequestS...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/request_registry_spec.rb
Ruby
mit
4,051
master
4,161
require 'spec_helper' describe WebMock::RequestRegistry do before(:each) do WebMock::RequestRegistry.instance.reset! @request_pattern = WebMock::RequestPattern.new(:get, "www.example.com") @request_signature = WebMock::RequestSignature.new(:get, "www.example.com") end describe "reset!" do befor...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/request_execution_verifier_spec.rb
Ruby
mit
4,051
master
8,714
require 'spec_helper' describe WebMock::RequestExecutionVerifier do before(:each) do @verifier = WebMock::RequestExecutionVerifier.new @request_pattern = double(WebMock::RequestPattern, to_s: "www.example.com") @verifier.request_pattern = @request_pattern allow(WebMock::RequestRegistry.instance).to r...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/stub_request_snippet_spec.rb
Ruby
mit
4,051
master
5,551
require 'spec_helper' describe WebMock::StubRequestSnippet do describe "to_s" do describe "GET" do before(:each) do @request_signature = WebMock::RequestSignature.new(:get, "www.example.com/?a=b&c=d", headers: {}) end it "should print stub request snippet with url with params and metho...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/request_body_diff_spec.rb
Ruby
mit
4,051
master
2,424
require 'spec_helper' RSpec.describe WebMock::RequestBodyDiff do subject { WebMock::RequestBodyDiff.new(request_signature, request_stub) } let(:uri) { "http://example.com" } let(:method) { "GET" } let(:request_stub) { WebMock::RequestStub.new(method, uri) } let(:request_signature) { WebMock::RequestSignatu...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/request_pattern_spec.rb
Ruby
mit
4,051
master
42,458
require 'spec_helper' describe WebMock::RequestPattern do describe "describing itself" do it "should report string describing itself" do expect(WebMock::RequestPattern.new(:get, "www.example.com", body: "abc", headers: {'A' => 'a', 'B' => 'b'}).to_s).to eq( "GET http://www.example.com/ with ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/rack_response_spec.rb
Ruby
mit
4,051
master
4,333
require 'spec_helper' describe WebMock::RackResponse do before :each do @rack_response = WebMock::RackResponse.new(MyRackApp) end it "should hook up to a rack appliance" do request = WebMock::RequestSignature.new(:get, 'www.example.com') response = @rack_response.evaluate(request) expect(respon...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/request_signature_spec.rb
Ruby
mit
4,051
master
6,906
require 'spec_helper' describe WebMock::RequestSignature do describe "initialization" do it "assign the uri to be the normalized uri" do expect(WebMock::Util::URI).to receive(:normalize_uri).and_return("www.example.kom") signature = WebMock::RequestSignature.new(:get, "www.example.com") expec...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/response_spec.rb
Ruby
mit
4,051
master
11,076
require 'spec_helper' describe WebMock::ResponseFactory do describe "response_for" do it "should create response with options passed as arguments" do options = {body: "abc", headers: {a: :b}} expect(WebMock::Response).to receive(:new).with(options).and_return(@response = double(WebMock::Response)) ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/webmock_spec.rb
Ruby
mit
4,051
master
3,813
require 'spec_helper' describe "WebMock" do describe ".version" do it "should report version" do expect(WebMock.version).to eq(WebMock::VERSION) end it "should not require safe_yaml" do expect(defined?SafeYAML).to eq(nil) end it "should alias enable_net_connect! to allow_net_connec...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/request_signature_snippet_spec.rb
Ruby
mit
4,051
master
2,500
require "spec_helper" RSpec.describe WebMock::RequestSignatureSnippet do it("is real"){expect{subject}.not_to(raise_error)} subject { WebMock::RequestSignatureSnippet.new(request_signature) } let(:uri) { "http://example.com" } let(:method) { "GET" } let(:request_signature) { WebMock::RequestSignature.new(...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/request_stub_spec.rb
Ruby
mit
4,051
master
10,284
require 'spec_helper' describe WebMock::RequestStub do before(:each) do @request_stub = WebMock::RequestStub.new(:get, "www.example.com") end it "should have request pattern with method and uri" do expect(@request_stub.request_pattern.to_s).to eq("GET http://www.example.com/") end it "should have ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/api_spec.rb
Ruby
mit
4,051
master
5,541
require 'spec_helper' describe WebMock::API do describe '#hash_including' do subject { klass.new.hash_including(args) } let(:args) { { data: :one } } context 'when mixed into a class that does not define `hash_including`' do let(:klass) do Class.new do include WebMock::API ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/util/hash_keys_stringifier_spec.rb
Ruby
mit
4,051
master
482
require 'spec_helper' describe WebMock::Util::HashKeysStringifier do it "should recursively stringify all symbol keys" do hash = { a: { b: [ { c: [{d: "1"}] } ] } } stringified = { 'a' => { 'b' => [ { 'c' => ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/util/uri_spec.rb
Ruby
mit
4,051
master
13,265
require 'spec_helper' URIS_WITHOUT_PATH_OR_PARAMS = [ "www.example.com", "www.example.com/", "www.example.com:80", "www.example.com:80/", "http://www.example.com", "http://www.example.com/", "http://www.example.com:80", "http://www.example.com:80/" ].sort URIS_WITHOUT_PATH_BUT_WITH_PARAMS = [ "www.e...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/util/query_mapper_spec.rb
Ruby
mit
4,051
master
5,563
require 'spec_helper' describe WebMock::Util::QueryMapper do subject { described_class } context '#query_to_values' do it 'should raise on invalid notation' do query = 'a=&b=c' expect { subject.query_to_values(query, {notation: 'foo'}) }.to raise_error( ArgumentError, 'Invalid nota...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/util/version_checker_spec.rb
Ruby
mit
4,051
master
6,089
require 'spec_helper' module WebMock describe VersionChecker do it 'prints a warning if the major version is too low' do checker = VersionChecker.new('foo', '0.7.3', '1.0.0', '1.1') expect(Kernel).to receive(:warn).with("\e[31mYou are using foo 0.7.3. WebMock supports version >= 1.0.0, < 1.2.\e[0m") ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/util/hash_counter_spec.rb
Ruby
mit
4,051
master
1,065
require 'spec_helper' describe WebMock::Util::HashCounter do it "should return 0 for non existing key" do expect(WebMock::Util::HashCounter.new.get(:abc)).to eq(0) end it "should increase the returned value on every put with the same key" do counter = WebMock::Util::HashCounter.new counter.put(:abc...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/util/headers_spec.rb
Ruby
mit
4,051
master
941
require 'spec_helper' describe WebMock::Util::Headers do it "should decode_userinfo_from_header handles basic auth" do authorization_header = "Basic dXNlcm5hbWU6c2VjcmV0" userinfo = WebMock::Util::Headers.decode_userinfo_from_header(authorization_header) expect(userinfo).to eq("username:secret") end ...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/util/parsers/json_spec.rb
Ruby
mit
4,051
master
1,243
require 'spec_helper' describe WebMock::Util::Parsers::JSON do describe ".parse" do it "should parse json without parsing dates" do expect(described_class.parse("\"a\":\"2011-01-01\"")).to eq( {"a" => "2011-01-01"} ) end it "can parse json with multibyte characters" do expect(d...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb
Ruby
mit
4,051
master
559
require 'spec_helper' describe WebMock::HttpLibAdapterRegistry do describe "each_adapter" do it "should yield block over each adapter" do class MyAdapter < WebMock::HttpLibAdapter; end WebMock::HttpLibAdapterRegistry.instance.register(:my_lib, MyAdapter) adapters = [] WebMock::HttpLibAdap...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/http_lib_adapters/http_lib_adapter_spec.rb
Ruby
mit
4,051
master
356
require 'spec_helper' describe WebMock::HttpLibAdapter do describe "adapter_for" do it "should add adapter to adapter registry" do class MyAdapter < WebMock::HttpLibAdapter; end expect(WebMock::HttpLibAdapterRegistry.instance). to receive(:register).with(:my_lib, MyAdapter) MyAdapter.ad...
github
bblimke/webmock
https://github.com/bblimke/webmock
spec/unit/matchers/hash_excluding_matcher_spec.rb
Ruby
mit
4,051
master
1,952
require 'spec_helper' module WebMock module Matchers describe HashExcludingMatcher do it 'stringifies the given hash keys' do expect(HashExcludingMatcher.new(a: 1, b: 2)).not_to eq('a' => 1, 'b' => 2) end it 'sorts elements in the hash' do expect(HashExcludingMatcher.new(b: 2, ...