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 | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20230330215830_create_subscriptions.rb | Ruby | mit | 4,115 | main | 682 | # frozen_string_literal: true
class CreateSubscriptions < ActiveRecord::Migration[7.0]
def change
create_table :subscriptions do |t|
t.references :user,
foreign_key: true,
null: false,
index: { unique: true }
t.text :stripe_customer_id, null: f... |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20130418221144_add_user_model.rb | Ruby | mit | 4,115 | main | 229 | # frozen_string_literal: true
class AddUserModel < ActiveRecord::Migration[4.2]
def change
create_table :users do |t|
t.string :email
t.string :password_digest
t.timestamps null: false
end
end
end |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20230313034938_add_admin_to_users.rb | Ruby | mit | 4,115 | main | 491 | # frozen_string_literal: true
class AddAdminToUsers < ActiveRecord::Migration[7.0]
def change
add_column :users, :admin, :boolean, default: false
set_first_user_as_admin
change_column_null :users, :admin, false
end
private
def set_first_user_as_admin
first_user_id = connection.select_value(... |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20230721160939_create_settings.rb | Ruby | mit | 4,115 | main | 273 | # frozen_string_literal: true
class CreateSettings < ActiveRecord::Migration[7.0]
def change
create_table :settings do |t|
t.string :type, null: false, index: { unique: true }
t.jsonb :data, null: false, default: {}
t.timestamps
end
end
end |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20230801025231_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb | Ruby | mit | 4,115 | main | 800 | # frozen_string_literal: true
class CreateIndexGoodJobsJobsOnPriorityCreatedAtWhenUnfinished < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
... |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20230223231930_add_username_to_users.rb | Ruby | mit | 4,115 | main | 532 | # frozen_string_literal: true
class AddUsernameToUsers < ActiveRecord::Migration[7.0]
def change
add_column :users, :username, :string
add_index :users, :username, unique: true
set_default_username
change_column_null :users, :username, false
end
private
def set_default_username
first_us... |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20140421224454_fix_invalid_unicode.rb | Ruby | mit | 4,115 | main | 285 | # frozen_string_literal: true
class FixInvalidUnicode < ActiveRecord::Migration[4.2]
def up
Story.find_each do |story|
valid_body = story.body.delete("\u2028").delete("\u2029")
story.update_attribute(:body, valid_body)
end
end
def down
# skip
end
end |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20130905204142_use_text_datatype_for_title_and_entry_id.rb | Ruby | mit | 4,115 | main | 317 | # frozen_string_literal: true
class UseTextDatatypeForTitleAndEntryId < ActiveRecord::Migration[4.2]
def up
change_column :stories, :title, :text
change_column :stories, :entry_id, :text
end
def down
change_column :stories, :title, :string
change_column :stories, :entry_id, :string
end
end |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20240314031221_create_good_job_labels_index.rb | Ruby | mit | 4,115 | main | 645 | # frozen_string_literal: true
class CreateGoodJobLabelsIndex < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_labels)
add_index :good_jobs, :labels, using: :gin, where: ... |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20230801025230_create_good_job_settings.rb | Ruby | mit | 4,115 | main | 498 | # frozen_string_literal: true
class CreateGoodJobSettings < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.table_exists?(:good_job_settings)
... |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20130409010818_create_feeds.rb | Ruby | mit | 4,115 | main | 247 | # frozen_string_literal: true
class CreateFeeds < ActiveRecord::Migration[4.2]
def change
create_table :feeds do |t|
t.string :name
t.string :url
t.timestamp :last_fetched
t.timestamps null: false
end
end
end |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20130504022615_change_story_permalink_column.rb | Ruby | mit | 4,115 | main | 226 | # frozen_string_literal: true
class ChangeStoryPermalinkColumn < ActiveRecord::Migration[4.2]
def up
change_column :stories, :permalink, :text
end
def down
change_column :stories, :permalink, :string
end
end |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | db/migrate/20230224042638_update_unique_indexes.rb | Ruby | mit | 4,115 | main | 249 | # frozen_string_literal: true
class UpdateUniqueIndexes < ActiveRecord::Migration[7.0]
def change
remove_index :feeds, :url
add_index :feeds, [:url, :user_id], unique: true
add_index :groups, [:name, :user_id], unique: true
end
end |
github | stringer-rss/stringer | https://github.com/stringer-rss/stringer | linters/rubocop/cop/rspec/no_before_hook.rb | Ruby | mit | 4,115 | main | 725 | # frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Disallows the use of `before` hooks in specs.
#
# @example
# # bad
# before { do_something }
# before(:each) { do_something }
#
# # good
# # Inline setup directly in the example.... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | Gemfile | Ruby | mit | 4,103 | gh-pages | 562 | # frozen_string_literal: true
source 'https://rubygems.org'
require 'json'
require 'net/http'
versions = JSON.parse(Net::HTTP.get(URI('https://pages.github.com/versions.json')))
gem 'github-pages', versions['github-pages']
# https://github.com/jekyll/jekyll/issues/8523
gem 'webrick', '~> 1.7'
group :development do... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | Rakefile | Ruby | mit | 4,103 | gh-pages | 1,336 | # frozen_string_literal: true
require 'html-proofer'
require 'rspec/core/rake_task'
desc 'Run specs'
RSpec::Core::RakeTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
t.rspec_opts = ['--order', 'rand', '--color']
end
task :test do
sh 'bundle exec jekyll build'
Rake::Task['spec'].invoke
HTMLProofer.check_dir... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/license_spec.rb | Ruby | mit | 4,103 | gh-pages | 1,620 | # frozen_string_literal: true
require 'spec_helper'
describe 'licenses' do
it 'matches the number of files in the _licenses folder' do
expect(licenses.count).to eql(Dir["#{licenses_path}/*.txt"].count)
end
licenses.each do |license|
context "The #{license['title']} license" do
let(:spdx_lcase) { ... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/license_bom_spec.rb | Ruby | mit | 4,103 | gh-pages | 482 | # frozen_string_literal: true
require 'spec_helper'
describe 'byte order marks' do
Dir["#{licenses_path}/*.txt"].each do |file|
context "the #{File.basename(file, '.txt')} license" do
it 'does not begin with a byte order mark' do
bom = File.read(file).start_with?("\u0000EF\u0000BB\u0000BF")
... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/license_fields_spec.rb | Ruby | mit | 4,103 | gh-pages | 440 | # frozen_string_literal: true
require 'spec_helper'
describe 'license fillable fields' do
licenses.each do |license|
context "The #{license['title']} license" do
it 'should only contain supported fillable fields' do
matches = license['content'][1, 1000].scan(/\s+\[([a-z_]+)\]/)
extra_field... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/self_license_spec.rb | Ruby | mit | 4,103 | gh-pages | 222 | # frozen_string_literal: true
require 'spec_helper'
context 'licensee detects this project' do
let(:detected) { Licensee.project('.').license }
it 'license as MIT' do
expect(detected.key).to eq('mit')
end
end |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/license_rules_spec.rb | Ruby | mit | 4,103 | gh-pages | 594 | # frozen_string_literal: true
require 'spec_helper'
describe 'license rules' do
licenses.each do |license|
groups = rules.keys
context "The #{license['title']} license" do
groups.each do |group|
valid_tags = rules[group].map { |r| r['tag'] }
context "the #{group} group" do
... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/spec_helper.rb | Ruby | mit | 4,103 | gh-pages | 3,207 | # frozen_string_literal: true
require 'jekyll'
require 'json'
require 'licensee'
require 'open-uri'
module SpecHelper
class << self
attr_accessor :config, :licenses, :site, :spdx,
:osi_approved_licenses, :fsf_approved_licenses, :od_approved_licenses
end
end
def config_file
File.expand_pat... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/license_shown_spec.rb | Ruby | mit | 4,103 | gh-pages | 756 | # frozen_string_literal: true
require 'spec_helper'
# Popular licenses that are shown (non-hidden)
# Note: most new licenses that are added should be hidden by default
SHOWN_LICENSES = %w[
agpl-3.0
apache-2.0
bsd-2-clause
bsd-3-clause
bsl-1.0
cc0-1.0
epl-2.0
gpl-2.0
gpl-3.0
lgpl-2.1
mit
mpl-2.... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/ci_ruby_version_spec.rb | Ruby | mit | 4,103 | gh-pages | 1,251 | # frozen_string_literal: true
require 'json'
require 'open-uri'
require 'spec_helper'
require 'yaml'
describe 'ruby version' do
pages_versions = JSON.parse(URI.open('https://pages.github.com/versions.json').read)
pages_ruby_version = pages_versions['ruby']
ci_config_file = '.github/workflows/test.yml'
ci_con... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/license_meta_spec.rb | Ruby | mit | 4,103 | gh-pages | 2,417 | # frozen_string_literal: true
require 'spec_helper'
describe 'license meta' do
licenses.each do |license|
# Manually load the raw license so we don't get the defaults
raw_fields = SafeYAML.load_file("_licenses/#{license['spdx-lcase']}.txt")
context "The #{license['title']} license" do
it 'should ... |
github | github/choosealicense.com | https://github.com/github/choosealicense.com | spec/license_wrap_spec.rb | Ruby | mit | 4,103 | gh-pages | 430 | # frozen_string_literal: true
require 'spec_helper'
describe 'word wrapping' do
licenses.each do |license|
context "the #{license['slug']} license" do
it 'wraps at line length 78' do
max_line = license['content'].lines.max_by { |line| line.chomp!.length }
msg = "Longest line is #{max_line.... |
github | noraj/OSCP-Exam-Report-Template-Markdown | https://github.com/noraj/OSCP-Exam-Report-Template-Markdown | osert.rb | Ruby | mit | 4,092 | master | 9,423 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
require 'fileutils'
require 'date'
require 'shellwords'
colors = {
red: "\e[31m",
nocolor: "\e[0m"
}
certifications = [
{
exam: 'OSCP',
template: [
{
name: 'Whoisflynn Improved Template v3.2',
path: 'src/OSCP-exa... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | awesome_print.gemspec | Ruby | mit | 4,084 | master | 1,453 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
$:.push File.expand_path('../lib'... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | Appraisals | Ruby | mit | 4,084 | master | 1,284 | # appraise 'rails-4.2' do
# gem 'rails', '~> 4.2.0'
#
# # The last version that doesn't need Ruby 2.0 and works with version 4.2 of
# # Rails. This addresses a build problem with Travis for version 1.9.3 of Ruby
# gem 'mime-types', '2.6.2', :platforms => :ruby_19
# end
appraise 'rails-5.0' do
gem 'rails', '>... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | Rakefile | Ruby | mit | 4,084 | master | 454 | require 'rubygems'
require 'bundler/setup'
require 'bundler'
Bundler::GemHelper.install_tasks
task :default do
if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
Rake::Task['spec'].invoke
else
Rake::Task['appraise'].invoke
end
end
task :appraise do
exec 'appraisal install && appraisal rake'
end
desc 'Run all aw... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | rails/init.rb | Ruby | mit | 4,084 | master | 435 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
#
# Load awesome_print when instal... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/formats_spec.rb | Ruby | mit | 4,084 | master | 19,090 | require 'spec_helper'
require 'bigdecimal'
require 'rational'
require 'set'
RSpec.describe 'AwesomePrint' do
describe 'Array' do
before do
@arr = [1, :two, 'three', [nil, [true, false]]]
end
it 'empty array' do
expect([].ai).to eq('[]')
end
it 'plain multiline' do
expect(@arr.... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/objects_spec.rb | Ruby | mit | 4,084 | master | 4,866 | require 'spec_helper'
RSpec.describe 'Objects' do
after do
Object.instance_eval { remove_const :Hello } if defined?(Hello)
end
describe 'Formatting an object' do
it 'attributes' do
class Hello
attr_reader :abra
attr_writer :ca
attr_accessor :dabra
def initializ... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/spec_helper.rb | Ruby | mit | 4,084 | master | 2,959 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
#
# Running specs from the command... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/colors_spec.rb | Ruby | mit | 4,084 | master | 2,692 | require 'spec_helper'
RSpec.describe 'AwesomePrint' do
def stub_tty!(output = true, stream = STDOUT)
if output
stream.instance_eval { def tty?; true; end }
else
stream.instance_eval { def tty?; false; end }
end
end
describe 'colorization' do
PLAIN = '[ 1, :two, "three", [ nil, [ tru... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/methods_spec.rb | Ruby | mit | 4,084 | master | 14,620 | require 'spec_helper'
RSpec.describe 'Single method' do
after do
Object.instance_eval { remove_const :Hello } if defined?(Hello)
end
it 'plain: should handle a method with no arguments' do
method = ''.method(:upcase)
if RUBY_VERSION >= '2.4.0'
expect(method.ai(plain: true)).to eq('String#upcas... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/active_record_helper.rb | Ruby | mit | 4,084 | master | 746 | if ExtVerifier.has_rails?
# Required to use the column support
module Rails
def self.env
{}
end
end
# Establish connection to in-memory SQLite DB
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
# Create the users table
ActiveRecord::Migration.verbose = fals... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/misc_spec.rb | Ruby | mit | 4,084 | master | 8,623 | require 'net/http'
require 'spec_helper'
RSpec.describe 'AwesomePrint' do
describe 'Misc' do
it 'handle weird objects that return nil on inspect' do
weird = Class.new do
def inspect
nil
end
end
expect(weird.new.ai(plain: true)).to eq('')
end
it 'handle frozen... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/core_ext/string_spec.rb | Ruby | mit | 4,084 | master | 725 | require 'spec_helper'
RSpec.describe 'String extensions' do
[:gray, :red, :green, :yellow, :blue, :purple, :cyan, :white].each_with_index do |color, i|
it "should have #{color} color" do
expect(color.to_s.send(color)).to eq("\e[1;#{30 + i}m#{color}\e[0m")
end
it "should have #{color}ish color" do
... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/core_ext/logger_spec.rb | Ruby | mit | 4,084 | master | 972 | require 'spec_helper'
require 'logger'
require 'awesome_print/core_ext/logger'
RSpec.describe 'AwesomePrint logging extensions' do
before(:all) do
@logger = Logger.new('/dev/null') rescue Logger.new('nul')
end
describe 'ap method' do
it 'should awesome_inspect the given object' do
object = doubl... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/action_view_spec.rb | Ruby | mit | 4,084 | master | 734 | require 'spec_helper'
RSpec.describe 'AwesomePrint ActionView extensions', skip: -> { !ExtVerifier.has_rails? }.call do
before do
@view = if rails_6_1?
ActionView::Base.new(ActionView::LookupContext.new([]), {}, {})
else
ActionView::Base.new
end
end
it "us... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/mongo_mapper_spec.rb | Ruby | mit | 4,084 | master | 7,567 | require 'spec_helper'
RSpec.describe 'AwesomePrint/MongoMapper', skip: -> { !ExtVerifier.has_mongo_mapper? }.call do
if ExtVerifier.has_mongo_mapper?
before :all do
class MongoUser
include MongoMapper::Document
key :first_name, String
key :last_name, String
end
end
a... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/mongoid_spec.rb | Ruby | mit | 4,084 | master | 1,572 | require 'spec_helper'
RSpec.describe 'AwesomePrint/Mongoid', skip: -> { !ExtVerifier.has_mongoid? }.call do
if ExtVerifier.has_mongoid?
before :all do
class MongoUser
include Mongoid::Document
field :first_name, type: String
field :last_name, type: String
end
end
a... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/ostruct_spec.rb | Ruby | mit | 4,084 | master | 497 | require 'spec_helper'
RSpec.describe 'AwesomePrint Ostruct extension' do
before do
@ap = AwesomePrint::Inspector.new(plain: true, sort_keys: true)
end
it 'empty hash' do
struct = OpenStruct.new
expect(@ap.send(:awesome, struct)).to eq('OpenStruct {}')
end
it 'plain multiline' do
struct = Op... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/nobrainer_spec.rb | Ruby | mit | 4,084 | master | 1,302 | require 'spec_helper'
RSpec.describe 'AwesomePrint/NoBrainer', skip: -> { !ExtVerifier.has_nobrainer? }.call do
if ExtVerifier.has_nobrainer?
before :all do
NoBrainer.configure do |config|
config.app_name = 'ap_test'
config.environment = :test
end
end
before :all do
cl... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/nokogiri_spec.rb | Ruby | mit | 4,084 | master | 1,430 | require 'spec_helper'
RSpec.describe 'AwesomePrint/Nokogiri' do
it 'should colorize tags' do
xml = Nokogiri::XML('<html><body><h1></h1></body></html>')
expect(xml.ai).to eq <<-EOS
<?xml version=\"1.0\"?>\e[1;32m
\e[0m<\e[1;36mhtml\e[0m>\e[1;32m
\e[0m<\e[1;36mbody\e[0m>\e[1;32m
\e[0m<\e[1;36mh1\e[0m/>\e... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/active_record_spec.rb | Ruby | mit | 4,084 | master | 7,661 | require 'spec_helper'
require 'active_record_helper'
RSpec.describe 'AwesomePrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? }.call do
describe 'ActiveRecord instance, attributes only (default)' do
before do
ActiveRecord::Base.default_timezone = :utc
@diana = User.new(name: 'Diana', rank: 1, a... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/active_support_spec.rb | Ruby | mit | 4,084 | master | 1,180 | require 'spec_helper'
RSpec.describe 'AwesomePrint::ActiveSupport', skip: -> { !ExtVerifier.has_rails? }.call do
before do
@ap = AwesomePrint::Inspector.new
end
it 'should format ActiveSupport::TimeWithZone as regular Time' do
Time.zone = 'Eastern Time (US & Canada)'
time = Time.utc(2007, 2, 10, 20,... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/ext/ripple_spec.rb | Ruby | mit | 4,084 | master | 1,083 | require 'spec_helper'
RSpec.describe 'AwesomePrint/Ripple', skip: -> { !ExtVerifier.has_ripple? }.call do
if ExtVerifier.has_ripple?
before :all do
class RippleUser
include Ripple::Document
key_on :_id
property :_id, String
property :first_name, String
property :la... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/support/ext_verifier.rb | Ruby | mit | 4,084 | master | 734 | module ExtVerifier
def require_dependencies!(dependencies)
dependencies.each do |dependency|
begin
require dependency
rescue LoadError
end
end
end
module_function :require_dependencies!
def has_rails?
defined?(Rails)
end
module_function :has_rails?
def has_mongoid?... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/support/rails_versions.rb | Ruby | mit | 4,084 | master | 1,434 | module RailsVersions
def rails_version
Gem::Version.new(Rails::VERSION::STRING)
end
def rails_6_1?
Gem::Requirement.new('~> 6.1.0').satisfied_by?(rails_version)
end
alias_method :activerecord_6_1?, :rails_6_1?
def rails_6_0?
Gem::Requirement.new('~> 6.0.0').satisfied_by?(rails_version)
end
... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/support/active_record_data.rb | Ruby | mit | 4,084 | master | 576 | require 'pathname'
class ActiveRecordData
class << self
data_file_selector = Pathname(File.dirname(__FILE__)).join('active_record_data', '*.txt')
# Example generated method
# data_filename = '/path/to/ap/spec/support/active_record_data/4_2_diana.txt'
#
# def self.raw_4_2_dana
# File.read(d... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | spec/support/mongoid_versions.rb | Ruby | mit | 4,084 | master | 570 | module MongoidVersions
def mongoid_version
Gem::Version.new(Mongoid::VERSION)
end
def mongoid_5_0?
Gem::Requirement.new('~> 5.0.0').satisfied_by?(mongoid_version)
end
def mongoid_6_0?
Gem::Requirement.new('~> 6.0.0').satisfied_by?(mongoid_version)
end
def mongoid_7_0?
Gem::Requirement.n... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print.rb | Ruby | mit | 4,084 | master | 1,771 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
#
# AwesomePrint might be loaded i... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/ap.rb | Ruby | mit | 4,084 | master | 407 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
#
# Keeping this for backwards com... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/custom_defaults.rb | Ruby | mit | 4,084 | master | 1,372 | module AwesomePrint
class << self
attr_accessor :defaults, :force_colors
# Class accessor to force colorized output (ex. forked subprocess where TERM
# might be dumb).
#---------------------------------------------------------------------------
def force_colors!(value = true)
@force_colors ... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatter.rb | Ruby | mit | 4,084 | master | 4,146 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
require 'awesome_print/formatters'... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/colorize.rb | Ruby | mit | 4,084 | master | 865 | autoload :CGI, 'cgi'
module AwesomePrint
module Colorize
# Pick the color and apply it to the given string as necessary.
#------------------------------------------------------------------------------
def colorize(str, type)
str = CGI.escapeHTML(str) if options[:html]
if options[:plain] || !... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/inspector.rb | Ruby | mit | 4,084 | master | 5,690 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
require_relative 'indentator'
mod... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters.rb | Ruby | mit | 4,084 | master | 583 | module AwesomePrint
module Formatters
require 'awesome_print/formatters/object_formatter'
require 'awesome_print/formatters/struct_formatter'
require 'awesome_print/formatters/hash_formatter'
require 'awesome_print/formatters/array_formatter'
require 'awesome_print/formatters/simple_formatter'
... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/indentator.rb | Ruby | mit | 4,084 | master | 322 | module AwesomePrint
class Indentator
attr_reader :shift_width, :indentation
def initialize(indentation)
@indentation = indentation
@shift_width = indentation.freeze
end
def indent
@indentation += shift_width
yield
ensure
@indentation -= shift_width
end
end
en... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/version.rb | Ruby | mit | 4,084 | master | 347 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
def self.ver... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/core_ext/logger.rb | Ruby | mit | 4,084 | master | 768 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Logge... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/core_ext/string.rb | Ruby | mit | 4,084 | master | 1,065 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class String
#
# ANSI color co... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/core_ext/object.rb | Ruby | mit | 4,084 | master | 898 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Object #:nodoc:
#
# Inte... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/core_ext/method.rb | Ruby | mit | 4,084 | master | 575 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
#
# Method#name was intorduced in ... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/core_ext/class.rb | Ruby | mit | 4,084 | master | 927 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Class #:nodoc:
#
# Inter... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/core_ext/kernel.rb | Ruby | mit | 4,084 | master | 737 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module Kernel
def ai(options = ... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/core_ext/awesome_method_array.rb | Ruby | mit | 4,084 | master | 2,757 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
#
# The following makes it possibl... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/base_formatter.rb | Ruby | mit | 4,084 | master | 4,123 | require_relative '../colorize'
module AwesomePrint
module Formatters
class BaseFormatter
include Colorize
DEFAULT_LIMIT_SIZE = 7
# To support limited output, for example:
#
# ap ('a'..'z').to_a, :limit => 3
# [
# [ 0] "a",
# [ 1] .. [24],
# [25]... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/class_formatter.rb | Ruby | mit | 4,084 | master | 541 | require_relative 'base_formatter'
module AwesomePrint
module Formatters
class ClassFormatter < BaseFormatter
attr_reader :klass, :inspector, :options
def initialize(klass, inspector)
@klass = klass
@inspector = inspector
@options = inspector.options
end
def form... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/dir_formatter.rb | Ruby | mit | 4,084 | master | 488 | require_relative 'base_formatter'
require 'shellwords'
module AwesomePrint
module Formatters
class DirFormatter < BaseFormatter
attr_reader :dir, :inspector, :options
def initialize(dir, inspector)
@dir = dir
@inspector = inspector
@options = inspector.options
end
... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/simple_formatter.rb | Ruby | mit | 4,084 | master | 421 | require_relative 'base_formatter'
module AwesomePrint
module Formatters
class SimpleFormatter < BaseFormatter
attr_reader :string, :type, :inspector, :options
def initialize(string, type, inspector)
@string = string
@type = type
@inspector = inspector
@options = insp... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/array_formatter.rb | Ruby | mit | 4,084 | master | 3,269 | require_relative 'base_formatter'
module AwesomePrint
module Formatters
class ArrayFormatter < BaseFormatter
attr_reader :array, :inspector, :options
def initialize(array, inspector)
@array = array
@inspector = inspector
@options = inspector.options
end
def forma... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/object_formatter.rb | Ruby | mit | 4,084 | master | 2,164 | require_relative 'base_formatter'
module AwesomePrint
module Formatters
class ObjectFormatter < BaseFormatter
attr_reader :object, :variables, :inspector, :options
def initialize(object, inspector)
@object = object
@variables = object.instance_variables
@inspector = inspecto... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/method_formatter.rb | Ruby | mit | 4,084 | master | 494 | require_relative 'base_formatter'
module AwesomePrint
module Formatters
class MethodFormatter < BaseFormatter
attr_reader :method, :inspector, :options
def initialize(method, inspector)
@method = method
@inspector = inspector
@options = inspector.options
end
def... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/file_formatter.rb | Ruby | mit | 4,084 | master | 559 | require_relative 'base_formatter'
require 'shellwords'
module AwesomePrint
module Formatters
class FileFormatter < BaseFormatter
attr_reader :file, :inspector, :options
def initialize(file, inspector)
@file = file
@inspector = inspector
@options = inspector.options
end... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/struct_formatter.rb | Ruby | mit | 4,084 | master | 1,914 | require_relative 'base_formatter'
module AwesomePrint
module Formatters
class StructFormatter < BaseFormatter
attr_reader :struct, :variables, :inspector, :options
def initialize(struct, inspector)
@struct = struct
@variables = struct.members
@inspector = inspector
@... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/formatters/hash_formatter.rb | Ruby | mit | 4,084 | master | 2,377 | require_relative 'base_formatter'
module AwesomePrint
module Formatters
class HashFormatter < BaseFormatter
attr_reader :hash, :inspector, :options
def initialize(hash, inspector)
@hash = hash
@inspector = inspector
@options = inspector.options
end
def format
... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/action_view.rb | Ruby | mit | 4,084 | master | 678 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Actio... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/ostruct.rb | Ruby | mit | 4,084 | master | 891 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module OpenS... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/nobrainer.rb | Ruby | mit | 4,084 | master | 1,998 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module NoBra... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/sequel.rb | Ruby | mit | 4,084 | master | 2,294 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Seque... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/ripple.rb | Ruby | mit | 4,084 | master | 2,737 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Rippl... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/active_support.rb | Ruby | mit | 4,084 | master | 1,674 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Activ... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/mongoid.rb | Ruby | mit | 4,084 | master | 2,623 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Mongo... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/active_record.rb | Ruby | mit | 4,084 | master | 4,203 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Activ... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/nokogiri.rb | Ruby | mit | 4,084 | master | 1,688 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Nokog... |
github | awesome-print/awesome_print | https://github.com/awesome-print/awesome_print | lib/awesome_print/ext/mongo_mapper.rb | Ruby | mit | 4,084 | master | 4,687 | # Copyright (c) 2010-2016 Michael Dvorkin and contributors
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module AwesomePrint
module Mongo... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | Rakefile | Ruby | mit | 4,074 | master | 443 | require "bundler"
require "rake/testtask"
require "yard"
Bundler::GemHelper.install_tasks
Rake::TestTask.new do |test|
test.test_files = FileList["test/**/*_test.rb"]
end
YARD::Rake::YardocTask.new do |yard|
yard.files = ["lib/**/*.rb", "-", "LICENSE", "CHANGES.md"]
end
desc "Generate diagrams for bundled examp... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | rails-erd.gemspec | Ruby | mit | 4,074 | master | 1,160 | $:.push File.expand_path("../lib", __FILE__)
require "rails_erd/version"
Gem::Specification.new do |s|
s.name = "rails-erd"
s.version = RailsERD::VERSION
s.authors = ["Rolf Timmermans", "Kerri Miller"]
s.email = ["r.timmermans@voormedia.com", "kerrizor@kerrizor.com"]
s.homepage = "htt... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | Gemfile | Ruby | mit | 4,074 | master | 617 | source "https://rubygems.org"
gemspec
if ENV["edge"]
gem "activerecord", :github => "rails/rails"
end
group :development, :test do
gem 'minitest', '~> 5.14.0'
end
group :development do
gem 'mocha'
gem "rake"
gem "yard"
platforms :ruby do
gem "activerecord", "< 7.0"
gem "activesupport", "< 7.0"... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | examples/generate.rb | Ruby | mit | 4,074 | master | 2,716 | require "rubygems"
require "bundler/setup"
require "active_record"
require "rails_erd/diagram/graphviz"
require "rails_erd/diagram/mermaid"
require "active_support/dependencies"
output_dir = File.expand_path("output", ".")
FileUtils.mkdir_p output_dir
Dir["#{File.dirname(__FILE__)}/*/*"].each do |path|
name = File.... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | examples/identity.rb | Ruby | mit | 4,074 | master | 1,451 | # This is an experiment at using Rails ERD reflection to reconstruct the
# domain model in Active Record itself. It does not support specializations or
# indirect relationships.
require "rails_erd/diagram"
class Identity < RailsERD::Diagram
setup do
@class_defintions = {}
end
each_entity do |entity, attribu... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | examples/meta/rails-erd/schema.rb | Ruby | mit | 4,074 | master | 1,164 | ActiveRecord::Schema.define do
create_table "domains", :force => true do |t|
t.string :name
end
create_table "entities", :force => true do |t|
t.references :domain, :null => false
t.string :name, :null => false
t.boolean :specialized
end
create_table "relationships", :force => true do |t|
... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | examples/meta/rails-erd/models/entity.rb | Ruby | mit | 4,074 | master | 325 | class Entity < ActiveRecord::Base
belongs_to :domain
has_many :properties
has_many :outgoing_relationships, :class_name => "Relationship", :foreign_key => :source_entity_id
has_many :incoming_relationships, :class_name => "Relationship", :foreign_key => :destination_entity_id
validates_presence_of :properties... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | examples/domains/orchard/schema.rb | Ruby | mit | 4,074 | master | 1,122 | ActiveRecord::Schema.define do
create_table "companies", :force => true do |t|
t.string :name, :null => false
t.date :founded_on
end
create_table "orchards", :force => true do |t|
t.references :company
t.float :acres
t.string :name, :null => false
t.string :location
t.date :planted_on... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | examples/domains/orchard/models/orchard.rb | Ruby | mit | 4,074 | master | 391 | class Orchard < ActiveRecord::Base
belongs_to :company
has_many :trees
if ActiveRecord::VERSION::MAJOR >= 4
has_many :recent_trees, lambda { order(:planted_on => :desc) }, :class_name => "Tree"
else
has_many :recent_trees, :class_name => "Tree", :order => "planted_on DESC"
end
has_and_belongs_to_man... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | examples/applications/refinery/schema.rb | Ruby | mit | 4,074 | master | 4,711 | ActiveRecord::Schema.define(:version => 20100929035252) do
create_table "images", :force => true do |t|
t.string "image_mime_type"
t.string "image_name"
t.integer "image_size"
t.integer "image_width"
t.integer "image_height"
t.datetime "created_at"
t.datetime "updated_at"
t.str... |
github | voormedia/rails-erd | https://github.com/voormedia/rails-erd | examples/applications/refinery/lib/has_friendly_id.rb | Ruby | mit | 4,074 | master | 441 | # Extracted from https://github.com/eric/friendly_id
class ActiveRecord::Base
def self.has_friendly_id(column, options = {})
if options[:use_slug]
if ActiveRecord::VERSION::MAJOR >= 4
has_many :slugs, lambda { order(:id => :desc) }, :as => :sluggable, :dependent => :destroy
else
has_ma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.