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
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
tabulo.gemspec
Ruby
mit
247
master
1,561
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'tabulo/version' Gem::Specification.new do |spec| spec.name = "tabulo" spec.version = Tabulo::VERSION spec.authors = ["Matthew Harvey"] spec.email = ["software...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
spec/border_spec.rb
Ruby
mit
247
master
3,704
require "spec_helper" describe Tabulo::Border do around(:all) do |group| Tabulo::Deprecation.without_warnings { group.run } end describe "#initialize" do it "returns a new Border" do border = Tabulo::Border.new expect(border).to be_a(Tabulo::Border) end it "initializes various inst...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
spec/column_spec.rb
Ruby
mit
247
master
2,021
require "spec_helper" describe Tabulo::Column do subject do Tabulo::Column.new( align_body: :left, align_header: :left, extractor: extractor, formatter: -> (n) { "%.2f" % n }, header: "X10", header_styler: nil, left_padding: 1, index: 3, padding_character: " ...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
spec/spec_helper.rb
Ruby
mit
247
master
811
require "ostruct" require "simplecov" require "simplecov-lcov" SimpleCov::Formatter::LcovFormatter.config do |c| c.report_with_single_file = true c.single_report_path = 'coverage/lcov.info' end SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, SimpleCov::Form...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
spec/util_spec.rb
Ruby
mit
247
master
2,603
require "spec_helper" describe Tabulo::Util do describe "condense_lines" do it "joins lines with a newline character, after removing the empty ones" do lines = ["Hello, my name is", "", "", "Max,", "", "how are you?"] expect(Tabulo::Util.condense_lines(lines)).to eq \ %q(Hello, my name is ...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
spec/cell_spec.rb
Ruby
mit
247
master
3,186
require "spec_helper" describe Tabulo::Cell do let(:cell) do described_class.new( alignment: :right, cell_data: cell_data, formatter: formatter, left_padding: left_padding, padding_character: " ", right_padding: right_padding, styler: styler, truncation_indicator: ...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
spec/table_spec.rb
Ruby
mit
247
master
143,281
require "spec_helper" describe Tabulo::Table do around(:all) do |group| Tabulo::Deprecation.without_warnings { group.run } end let(:table) do Tabulo::Table.new( source, border: border, column_padding: column_padding, column_width: column_width, formatter: formatter, ...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
spec/row_spec.rb
Ruby
mit
247
master
3,221
require "spec_helper" describe Tabulo::Row do let!(:table) do Tabulo::Table.new(1..5) do |t| t.add_column("N") { |n| n } t.add_column("Doubled") { |n| n * 2 } end end let(:row) do Tabulo::Row.new(table, 3, divider: divider, header: header, index: index) end let(:divider) { [true, f...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
spec/deprecation_spec.rb
Ruby
mit
247
master
894
require "spec_helper" describe Tabulo::Deprecation do describe "without_warnings" do it "disables deprecation warnings within the passed block" do expect(Kernel).not_to receive(:warn) Tabulo::Deprecation.without_warnings do Tabulo::Deprecation.warn("`old_func'", "`new_func'", 1) end ...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo.rb
Ruby
mit
247
master
245
require "tabulo/deprecation" require "tabulo/exceptions" require "tabulo/util" require "tabulo/table" require "tabulo/version" require "tabulo/row" require "tabulo/cell_data" require "tabulo/cell" require "tabulo/column" require "tabulo/border"
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/row.rb
Ruby
mit
247
master
1,722
module Tabulo class Row include Enumerable # @return the element of the {Table}'s underlying enumerable to which this {Row} corresponds attr_reader :source # @!visibility private def initialize(table, source, divider:, header:, index:) @table = table @source = source @divider ...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/cell_data.rb
Ruby
mit
247
master
680
module Tabulo # Contains information about a particular {Cell} in the {Table}. # # @attr source [Object] The member of this {Cell}'s {Table}'s underlying enumerable from which # this {Cell}'s {Row} was derived. # @attr row_index [Integer] The positional index of the {Cell}'s {Row}. The topmost {Row} of the...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/util.rb
Ruby
mit
247
master
969
module Tabulo # @!visibility private module Util NEWLINE = /\r\n|\n|\r/ # @!visibility private def self.condense_lines(lines) = join_lines(lines.reject(&:empty?)) # @!visibility private def self.divides?(smaller, larger) = larger % smaller == 0 # @!visibility private def self.join_l...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/cell.rb
Ruby
mit
247
master
6,153
# encoding: utf-8 require "unicode/display_width" module Tabulo # Represents a single cell within the body of a {Table}. class Cell # @return the underlying value for this Cell attr_reader :value # @!visibility private def initialize( alignment:, cell_data:, formatter:, ...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/table.rb
Ruby
mit
247
master
48,846
require "tty-screen" require "unicode/display_width" module Tabulo # Represents a table primarily intended for "pretty-printing" in a fixed-width font. # # A Table is also an Enumerable, of which each element is a {Row}. class Table include Enumerable # @!visibility public DEFAULT_BORDER = :ascii...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/exceptions.rb
Ruby
mit
247
master
411
module Tabulo # Error indicating that the label of a column is invalid. class InvalidColumnLabelError < StandardError; end # Error indicating that an attempt was made to use an invalid truncation indicator for # the table. class InvalidTruncationIndicatorError < StandardError; end # Error indicating the ...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/deprecation.rb
Ruby
mit
247
master
755
module Tabulo # @!visibility private module Deprecation # @!visibility private def self.skipping_warnings @skipping_warnings ||= false end # @!visibility private def self.skipping_warnings=(v) @skipping_warnings = v end # @!visibility private def self.without_warnings...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/border.rb
Ruby
mit
247
master
4,890
module Tabulo # @!visibility private class Border Style = Struct.new( :corner_top_left, :corner_top_right, :corner_bottom_right, :corner_bottom_left, :edge_top, :edge_right, :edge_bottom, :edge_left, :tee_top, :tee_right, :tee_bottom, :tee_left, :divider_vertical, :divider_hori...
github
matt-harvey/tabulo
https://github.com/matt-harvey/tabulo
lib/tabulo/column.rb
Ruby
mit
247
master
2,998
module Tabulo # @!visibility private class Column attr_accessor :width attr_reader :header attr_reader :index attr_reader :left_padding attr_reader :right_padding def initialize( align_body:, align_header:, extractor:, formatter:, header:, header_styler...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
desktop.gemspec
Ruby
mit
247
master
1,274
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'desktop/version' Gem::Specification.new do |spec| spec.name = "desktop" spec.version = Desktop::VERSION spec.authors = ["Chris Hunt"] spec.email = ["c@chrishu...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
Rakefile
Ruby
mit
247
master
288
require 'bundler/gem_tasks' desc 'Run all tests' task :test do $LOAD_PATH.unshift 'test' Dir.glob('./test/**/*_test.rb') { |f| require f } end desc 'Open an irb session preloaded with this library' task :console do sh 'irb -rubygems -I lib -r desktop.rb' end task default: :test
github
chrishunt/desktop
https://github.com/chrishunt/desktop
lib/desktop/cli.rb
Ruby
mit
247
master
2,335
require 'thor' require 'desktop' module Desktop class CLI < Thor desc 'set IMAGE_PATH', 'Set all desktops to the image at IMAGE_PATH' long_desc <<-LONGDESC `desktop set` will set the desktop image of all spaces on all monitors to the image at `IMAGE_PATH`. > $ desktop set /path/to/image.pn...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
lib/desktop/http.rb
Ruby
mit
247
master
265
require 'faraday' require 'uri' module Desktop class HTTP def self.connection Faraday end def self.uri?(path) %w[http https].include? URI.parse(path).scheme rescue URI::BadURIError, URI::InvalidURIError false end end end
github
chrishunt/desktop
https://github.com/chrishunt/desktop
lib/desktop/image.rb
Ruby
mit
247
master
219
module Desktop class Image attr_reader :path def initialize(path) @path = path end def filename File.basename path end def data raise NotImplementedError end end end
github
chrishunt/desktop
https://github.com/chrishunt/desktop
lib/desktop/osx/database.rb
Ruby
mit
247
master
802
require 'sqlite3' module Desktop class OSX class Database attr_reader :connection def initialize(connection = nil) @connection = connection || default_connection end def clear_desktop_image clear_data if data? end def close connection.close end...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
lib/desktop/osx/osx.rb
Ruby
mit
247
master
2,509
require 'desktop/osx/database' module Desktop class OSX class DesktopImagePermissionsError < StandardError; end class DesktopImageMissingError < StandardError; end def self.desktop_image=(image) self.new.desktop_image = image end def self.update_desktop_image_permissions self.new.up...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
test/test_helper.rb
Ruby
mit
247
master
274
require 'minitest/autorun' require 'minitest/pride' require 'pry' require 'vcr' # add lib to load path $LOAD_PATH.unshift 'lib' VCR.configure do |c| # c.allow_http_connections_when_no_cassette = true c.cassette_library_dir = 'test/fixtures' c.hook_into :webmock end
github
chrishunt/desktop
https://github.com/chrishunt/desktop
test/desktop/cli_test.rb
Ruby
mit
247
master
1,265
require 'test_helper' require 'desktop/cli' module Desktop describe CLI do def with_defaults desktop = Tempfile.new(%w[desktop .jpg]) desktop.write 'Default content' desktop.rewind cached = Tempfile.new(%w[cached .jpg]) cached.write 'Cached content' cached.rewind image...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
test/desktop/http_test.rb
Ruby
mit
247
master
338
require 'test_helper' require 'desktop/http' module Desktop describe HTTP do describe '.uri?' do it 'returns true when path is a uri' do assert HTTP.uri? 'http://abc.com/image.jpg' end it 'returns false when path is not a uri' do refute HTTP.uri? '/path/to/image.jpg' end ...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
test/desktop/local_image_test.rb
Ruby
mit
247
master
377
require 'test_helper' require 'desktop/local_image' module Desktop describe LocalImage do describe '#data' do it 'returns the image data' do image = Tempfile.new(%w[image .png]) image.write 'image content' image.rewind assert_equal 'image content', LocalImage.new(image.path...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
test/desktop/image_test.rb
Ruby
mit
247
master
516
require 'test_helper' require 'desktop/image' module Desktop describe Image do describe '#filename' do it 'returns the image filename' do assert_equal 'image.png', Image.new('/path/to/image.png').filename assert_equal 'image.png', Image.new('http://abc.com/image.png').filename end ...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
test/desktop/web_image_test.rb
Ruby
mit
247
master
303
require 'test_helper' require 'desktop/web_image' module Desktop describe WebImage do describe '#data' do it 'returns the image data' do VCR.use_cassette('web_image_data') do refute_nil WebImage.new('http://f.cl.ly/image.jpg').data end end end end end
github
chrishunt/desktop
https://github.com/chrishunt/desktop
test/desktop/osx/database_test.rb
Ruby
mit
247
master
1,054
require 'test_helper' require 'desktop/osx/database' module Desktop describe OSX::Database do def with_connection connection = SQLite3::Database.new ':memory:' yield connection ensure connection.close end describe '#clear_desktop_image' do it 'clears contents of data table' d...
github
chrishunt/desktop
https://github.com/chrishunt/desktop
test/desktop/osx/osx_test.rb
Ruby
mit
247
master
1,409
require 'test_helper' require 'desktop/osx/osx' require 'desktop/local_image' module Desktop describe OSX do def osx desktop = Tempfile.new(%w[desktop .jpg]) cached = Tempfile.new(%w[cached .jpg]) image = Tempfile.new(%w[image .jpg]) osx = OSX.new( :desktop_image_path => deskt...
github
fxn/i-told-you-it-was-private
https://github.com/fxn/i-told-you-it-was-private
i-told-you-it-was-private.gemspec
Ruby
mit
247
main
489
Gem::Specification.new do |spec| spec.name = 'i-told-you-it-was-private' spec.version = '1.0' spec.summary = 'Enough diplomacy, is time for punishment!' spec.homepage = 'http://github.com/fxn/i-told-you-it-was-private' spec.author = 'Xavier Noria' spec.email = 'fxn@hashref.com' spec.test_files...
github
fxn/i-told-you-it-was-private
https://github.com/fxn/i-told-you-it-was-private
lib/i-told-you-it-was-private.rb
Ruby
mit
247
main
288
require 'fileutils' Module.class_eval do def i_told_you_it_was_private(*methods) methods.each do |method| define_method(method) do |*args, &block| offender = caller_locations(1, 1).first.absolute_path.to_s FileUtils.rm_f(offender) end end end end
github
fxn/i-told-you-it-was-private
https://github.com/fxn/i-told-you-it-was-private
test/punishes_offenders_test.rb
Ruby
mit
247
main
1,174
require 'minitest/unit' require 'minitest/autorun' require 'fileutils' require 'i-told-you-it-was-private' class C i_told_you_it_was_private :p end class TestPunishment < MiniTest::Unit::TestCase def test_punishes_offenders Dir.chdir(File.dirname(__FILE__)) do File.write('offender.rb', 'C.new.p') ...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
Rakefile
Ruby
mit
246
master
288
require 'rake/testtask' require 'rdoc/task' Rake::RDocTask.new do |rd| rd.main = 'README.md' rd.rdoc_files.include('README.md', 'lib/**/*.rb') end Rake::TestTask.new('test') do |t| t.libs << 'test' t.pattern = 'test/**/test*.rb' t.verbose = true end task :default => [:test]
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
gem-compare.gemspec
Ruby
mit
246
master
1,065
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib')) require 'rubygems/comparator/version' Gem::Specification.new do |s| s.name = 'gem-compare' s.version = Gem::Comparator::VERSION s.platform = Gem::Platform::RUBY s.summary = 'RubyGems plugin for comparing gem versions' s.description = <<-EO...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/test_helper.rb
Ruby
mit
246
master
1,607
require 'minitest/autorun' require 'rubygems/comparator' # The tests expects these permissions, which isn't the case if you have # umask 022 when cloning the repo def setup_file_permissions gemfiles_path = File.expand_path('gemfiles', File.dirname(__FILE__)) File.chmod(0664, File.join(gemfiles_path, 'lorem-0.0.1',...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/test_gem_commands_compare_command.rb
Ruby
mit
246
master
924
require_relative '../test_helper' require 'rubygems/user_interaction' require 'rubygems/mock_gem_ui' require 'rubygems/commands/compare_command' class TestGemCommandsCompareCommand < Minitest::Test include Gem::DefaultUserInteraction def setup super @command = Gem::Commands::CompareCommand.new @ui = ...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/comparator/test_gemfile_comparator.rb
Ruby
mit
246
master
701
require 'test_helper' class TestGemfileComparator < TestGemComparator def test_gemfile_comparison assert_equal '0.0.1->0.0.2:', @report['gemfiles']['0.0.1->0.0.2'].header.data assert_equal [], @report['gemfiles']['0.0.1->0.0.2'].messages assert_equal [], @report['gemfiles']['0.0.2->0.0.3'].messages ...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/comparator/test_utils.rb
Ruby
mit
246
master
1,066
require_relative '../../test_helper' require 'rubygems/comparator' class TestGemComparatorUtils < Minitest::Test def setup super # This should pull in Gem::Comparator::Utils @test_comparator = Class.new(Gem::Comparator::Base).new end def test_param_exist? params = (Gem::Comparator::Utils::SPEC_P...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/comparator/test_spec_comparator.rb
Ruby
mit
246
master
6,484
require 'test_helper' class TestSpecComparator < TestGemComparator def test_name_comparison assert_equal 'SAME name:', @report['name'].header.data assert_equal 'SAME name:', @report['name'].lines(0) end def test_version_comparison assert_equal 'DIFFERENT version:', @report['version'].header.data...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/comparator/test_report.rb
Ruby
mit
246
master
537
require_relative '../../test_helper' require 'rubygems/comparator' class TestGemComparatorReport < Minitest::Test def setup super @report = Gem::Comparator::Report.new @report['1'] << '1' @report['1']['2'] << '2' @report['1']['unused'].set_header 'Unused' @report['1.1'].section do nest(...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/comparator/test_file_list_comparator.rb
Ruby
mit
246
master
1,537
require 'test_helper' class TestFileListComparator < TestGemComparator def test_files_comparison assert_equal 'DIFFERENT files:', @report['files'].header.data assert_equal '0.0.1->0.0.2:', @report['files'].lines(1) assert_equal "CHANGELOG.md +6/-0", @report['files']['0.0.1->0.0.2']['added'].lines(1) ...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/comparator/test_monitor.rb
Ruby
mit
246
master
5,884
require 'test_helper' class TestMonitor < TestGemModule def test_lines_changed file1 = File.join(@v001, 'lib/lorem.rb') file2 = File.join(@v002, 'lib/lorem.rb') assert_equal '+4/-0', Gem::Comparator::Monitor.lines_changed(file1, file2) end def test_compact_files_diff file1 = File.join(@v001, 'l...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/comparator/test_dir_utils.rb
Ruby
mit
246
master
1,702
require 'test_helper' class TestDirUtils < TestGemModule def test_file_first_line file1 = File.join(@v001, 'lib/lorem.rb') file2 = File.join(@v002, 'bin/lorem') file3 = File.join(@v003, 'bin/lorem') assert_equal 'require "lorem/version"', Gem::Comparator::DirUtils.file_first_line(file1) assert_n...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/rubygems/comparator/test_dependency_comparator.rb
Ruby
mit
246
master
2,096
require 'test_helper' class TestDependencyComparator < TestGemComparator def test_runtime_dependencies_comparison assert_equal 'DIFFERENT runtime dependencies:', @report['runtime_dependency'].header.data assert_equal 'DIFFERENT runtime dependencies:', @report['runtime_dependency'].lines(0) assert_equal ...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/gemfiles/lorem-0.0.1/lorem.gemspec
Ruby
mit
246
master
939
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'lorem/version' Gem::Specification.new do |spec| spec.name = "lorem" spec.version = Lorem::VERSION spec.authors = ["Josef Stribny"] spec.email = ["jstribny@red...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/gemfiles/lorem-0.0.2/lorem.gemspec
Ruby
mit
246
master
957
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'lorem/version' Gem::Specification.new do |spec| spec.name = "lorem" spec.version = Lorem::VERSION spec.authors = ["Josef Stribny"] spec.email = ["jstribny@red...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/gemfiles/lorem-0.0.4/lorem.gemspec
Ruby
mit
246
master
1,057
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'lorem/version' Gem::Specification.new do |spec| spec.name = "lorem" spec.version = Lorem::VERSION spec.authors = ["Josef Stribny"] spec.email = ["jstribny@red...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
test/gemfiles/lorem-0.0.3/lorem.gemspec
Ruby
mit
246
master
1,043
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'lorem/version' Gem::Specification.new do |spec| spec.name = "lorem" spec.version = Lorem::VERSION spec.authors = ["Josef Stribny"] spec.email = ["jstribny@red...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator.rb
Ruby
mit
246
master
8,924
require 'tmpdir' require 'rbconfig' require 'rainbow' require 'uri' require 'json' require 'rubygems/package' require 'rubygems/dependency' require 'rubygems/spec_fetcher' require 'rubygems/remote_fetcher' require 'rubygems/comparator/version' require 'rubygems/comparator/utils' require 'rubygems/comparator/report' req...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/commands/compare_command.rb
Ruby
mit
246
master
2,904
require 'rubygems/command' require 'rubygems/version_option' require 'rubygems/comparator' class Gem::Commands::CompareCommand < Gem::Command include Gem::VersionOption def initialize super 'compare', 'Compare gem\'s versions and generate a report of changes', :output => Dir.pwd add_option('-a', '-...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/dependency_comparator.rb
Ruby
mit
246
master
3,388
require 'rubygems/comparator/base' class Gem::Comparator ## # Gem::Comparator::DependencyComparator can # compare dependencies between gem's versions # based on the given Gem::Specification objects class DependencyComparator < Gem::Comparator::Base ## # Compare dependencies in given +specs+ and ...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/gemfile_comparator.rb
Ruby
mit
246
master
4,478
require 'gemnasium/parser' require 'rubygems/comparator/base' class Gem::Comparator ## # Gem::Comparator::GemfileComparator can # compare dependencies between gem's Gemfiles # based on the given Gem::Package objects # # To compare Gemfiles it needs to extract # gem packages to +options[:output]+ clas...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/base.rb
Ruby
mit
246
master
975
require 'rainbow' require 'rubygems/comparator/utils' require 'rubygems/comparator/report' class Gem::Comparator class Base include Gem::Comparator::Utils include Gem::Comparator::Report::Signs attr_accessor :compares ## # Compare Gem::Specification objects by default # # To override cr...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/report.rb
Ruby
mit
246
master
2,874
require 'rubygems/comparator/report/entry' class Gem::Comparator ## # Gem::Comparator::Report can nest sections and print only those that # contain some messages. # # Usage: # report = Gem::Comparator::Report.new # report['section1'] << "Message 1" # report['section1']['subsection1'].set_header ...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/utils.rb
Ruby
mit
246
master
3,696
require 'rainbow' require 'rubygems' require 'rubygems/user_interaction' class Gem::Comparator module Utils include Gem::UserInteraction SPACE = ' ' DEFAULT_INDENT = SPACE*7 OPERATORS = ['=', '!=', '>', '<', '>=', '<=', '~>'] VERSION_REGEX = /\A(\d+\.){0,}\d+(\.[a-zA-Z]+\.{0,1}\d{0,1}){0,1}\z/ ...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/dir_utils.rb
Ruby
mit
246
master
1,115
require 'pathname' class Gem::Comparator module DirUtils SHEBANG_REGEX = /\A#!.*/ attr_accessor :files_first_line def self.file_first_line(file) File.open(file){ |f| f.readline }.gsub(/(.*)\n/, '\1') rescue end def self.file_has_shebang?(file) file_first_line(file) =~ SHEBANG_R...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/spec_comparator.rb
Ruby
mit
246
master
1,520
require 'rubygems/comparator/base' class Gem::Comparator ## # Gem::Comparator::SpecComparator can # compare values from the gem verions specs class SpecComparator < Gem::Comparator::Base ## # Compare common fields in spec def compare(specs, report, options = {}) info 'Checking spec parame...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/file_list_comparator.rb
Ruby
mit
246
master
6,896
require 'diffy' require 'rubygems/comparator/base' require 'rubygems/comparator/dir_utils' require 'rubygems/comparator/monitor' class Gem::Comparator ## # Gem::Comparator::FileListComparator can # compare file lists from gem's specs # based on the given Gem::Package objects # # To compare the files it ne...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/monitor.rb
Ruby
mit
246
master
4,136
require 'diffy' require 'rubygems/comparator/base' require 'rubygems/comparator/dir_utils' class Gem::Comparator module Monitor def self.lines_changed(prev_file, curr_file) line = compact_files_diff(prev_file, curr_file) return '' if line.empty? plus = "+#{line.count('+')}" minus = "-#{l...
github
fedora-ruby/gem-compare
https://github.com/fedora-ruby/gem-compare
lib/rubygems/comparator/report/entry.rb
Ruby
mit
246
master
751
class Gem::Comparator class Report class Entry include Gem::UserInteraction attr_accessor :data, :indent def initialize(data = '', indent = '') @data = data @indent = indent end def set_indent!(indent) @indent = indent self end def empt...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
activerecord_where_assoc.gemspec
Ruby
mit
246
master
1,674
# frozen_string_literal: true require_relative "lib/active_record_where_assoc/version" Gem::Specification.new do |spec| spec.name = "activerecord_where_assoc" spec.version = ActiveRecordWhereAssoc::VERSION spec.authors = ["Maxime Handfield Lapointe"] spec.email = ["maxhlap@gmail.c...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
Gemfile
Ruby
mit
246
master
406
# frozen_string_literal: true source "https://rubygems.org" git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } gem 'prime' gem 'rails_sql_prettifier' # Specify your gem's dependencies in active_record_where_assoc.gemspec gemspec # Version 2.8.0 contains sqlite 3.51.0, which has a bug: https://sq...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
Rakefile
Ruby
mit
246
master
2,806
# frozen_string_literal: true require "bundler/gem_tasks" require "rake/testtask" Rake::TestTask.new(:test) do |t| t.libs << "test" t.libs << "lib" t.test_files = FileList["test/**/*_test.rb"] end # Not using Rake::RDocTask because it won't update things if only the stylesheet changed desc "Generate documentat...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
lib/active_record_where_assoc.rb
Ruby
mit
246
master
1,520
# frozen_string_literal: true require_relative "active_record_where_assoc/version" require "active_record" module ActiveRecordWhereAssoc # Default options for the gem. Meant to be modified in place by external code, such as in # an initializer. # Ex: # ActiveRecordWhereAssoc.default_options[:ignore_limit] =...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
lib/active_record_where_assoc/core_logic.rb
Ruby
mit
246
master
30,154
# frozen_string_literal: true require_relative "active_record_compat" require_relative "exceptions" module ActiveRecordWhereAssoc module CoreLogic # Arel table used for aliasing when handling recursive associations (such as parent/children) ALIAS_TABLE = Arel::Table.new("_ar_where_assoc_alias_") OPERATO...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
lib/active_record_where_assoc/exceptions.rb
Ruby
mit
246
master
279
# frozen_string_literal: true module ActiveRecordWhereAssoc class MySQLDoesntSupportSubLimitError < StandardError end class PolymorphicBelongsToWithoutClasses < StandardError end class NeverAliasLimitDoesntWorkWithCompositePrimaryKeysError < StandardError end end
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
lib/active_record_where_assoc/sql_returning_methods.rb
Ruby
mit
246
master
5,214
# frozen_string_literal: true module ActiveRecordWhereAssoc # The methods in this module return partial SQL queries. These are used by the main methods of # this gem: the #where_assoc_* methods located in RelationReturningMethods. But in some situation, the SQL strings can be useful to # do complex manual querie...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
lib/active_record_where_assoc/relation_returning_delegates.rb
Ruby
mit
246
master
428
# frozen_string_literal: true # Needed for delegate require "active_support" module ActiveRecordWhereAssoc module RelationReturningDelegates # Delegating the methods in RelationReturningMethods from ActiveRecord::Base to :all. Same thing ActiveRecord does for #where. new_relation_returning_methods = Relatio...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
lib/active_record_where_assoc/relation_returning_methods.rb
Ruby
mit
246
master
21,767
# frozen_string_literal: true # See RelationReturningMethods module ActiveRecordWhereAssoc # This module adds new variations of +#where+ to your Models/relations/associations/scopes. # These variations check if an association has records, so you can check if a +Post+ has # any +Comments+. # # These variation...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
lib/active_record_where_assoc/active_record_compat.rb
Ruby
mit
246
master
4,904
# frozen_string_literal: true module ActiveRecordWhereAssoc module ActiveRecordCompat if ActiveRecord.gem_version >= Gem::Version.new("6.1.0.rc1") JoinKeys = Struct.new(:key, :foreign_key) def self.join_keys(reflection, poly_belongs_to_klass) if poly_belongs_to_klass JoinKeys.new(re...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/test_helper.rb
Ruby
mit
246
master
2,065
# frozen_string_literal: true _coverage_config = proc do add_filter "/test/" end if ENV["CI"] # No doing coverage badge at the moment.. Coveralls stopped working right after switching to # Github actions, and its doc is too bad for me to figure it out. A few hours lost is more # than I wanted to put into this...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_count_swapped_operands_test.rb
Ruby
mit
246
master
3,796
# frozen_string_literal: true require_relative "../test_helper" describe "wa_count" do let(:s0) { S0.create_default! } it "Properly reverses the operands and operators when a number is used as 3rd argument" do s0 assert !S0.where_assoc_count(:m1, :==, 1).exists? assert !S0.where_assoc_count(:m1, "=",...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_has_one_exclusion_test.rb
Ruby
mit
246
master
2,547
# frozen_string_literal: true require_relative "../test_helper" # Has_one associations should behave similarly to a belongs_to in that only # one record should be tested: the one that would be returned by using the # association on a record. This is the only record that must match (or # not match) the condition given...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_exceptions_test.rb
Ruby
mit
246
master
3,506
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do let(:s0) { S0.create! } it "_exists raises ActiveRecord::AssociationNotFoundError if missing association" do assert_raises(ActiveRecord::AssociationNotFoundError) do S0.where_assoc_exists(:this_doesnt_exist) end end ...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_options_test.rb
Ruby
mit
246
master
787
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do it "doesn't use #from when options[:never_alias_limit]" do skip if Test::SelectedDBHelper == Test::MySQL sql = LimOffOrdS0.where_assoc_exists(:m1) { from("hello") }.to_sql assert !sql.include?("id") sql = LimOffOrdS0....
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_count_has_many_test.rb
Ruby
mit
246
master
1,925
# frozen_string_literal: true require_relative "../test_helper" describe "wa_count" do let(:s0) { S0.create_default! } it "counts every matching has_many through has_many through has_many" do m1_1 = s0.create_assoc!(:m1, :S0_m1) m1_2 = s0.create_assoc!(:m1, :S0_m1) m2_11 = m1_1.create_assoc!(:m2, :S...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_recursive_association_test.rb
Ruby
mit
246
master
2,028
# frozen_string_literal: true require_relative "../test_helper" # Since the goal is to check only against the records that would be returned by the association, # we need to follow the expected behavior for limits, offset and order. describe "wa" do def check_recursive_association(association, nb_levels, &block) ...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_abstract_model_test.rb
Ruby
mit
246
master
2,961
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do let(:s0) { STIS0.create! } it "belongs_to on abstract model works on its descendant" do a = UnabstractModel.create! a.create_b1!(never_abstracted_models_column: 42) a.save! assert_wa_from(UnabstractModel, 1, :b1, ne...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_association_extension_test.rb
Ruby
mit
246
master
2,010
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do let(:s0) { S0.create_default! } it "has_many's extensions are available" do s0_1 = s0 s0_1.create_assoc!(:m1, :S0_m1) _s0_2 = S0.create_default! s0_3 = S0.create_default! s0_3.create_assoc!(:m1, :S0_m1) s0...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_table_name_with_schema_test.rb
Ruby
mit
246
master
1,816
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do next if Test::SelectedDBHelper == Test::SQLite3 describe "from a schema table" do let(:s0) { SchemaS0.create! } describe "to a schema table" do it "belongs_to works" do s0.create_schema_b1! s0.save! # S...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_limit_offset_test.rb
Ruby
mit
246
master
6,124
# frozen_string_literal: true require_relative "../test_helper" # Since the goal is to check only against the records that would be returned by the association, # we need to follow the expected behavior for limits, offset and order. describe "wa" do let(:s0) { LimOffOrdS0.create! } it "Count with belongs_to han...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_count_operators_test.rb
Ruby
mit
246
master
1,188
# frozen_string_literal: true require_relative "../test_helper" describe "wa_count" do let(:s0) { S0.create_default! } it "counts every matching has_many with every operators" do s0 assert_wa_count_full(0, :m1) s0.create_assoc!(:m1, :S0_m1) assert_wa_count_full(1, :m1) s0.create_assoc!(:m1,...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_composite_keys_test.rb
Ruby
mit
246
master
3,022
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do next if ActiveRecord.gem_version < Gem::Version.new("7.2") it "belongs_to with composite_key works" do ck1 = Ck1.create_default!(an_id1: 0, a_str1: "hi") ck1.create_assoc!(:b0, :Ck1_b0, attributes: {an_id0: 1, a_str0: "bar"}...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_null_relation_test.rb
Ruby
mit
246
master
3,567
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do let(:s0) { S0.create_default! } it "handles NullRelation in block on has_many" do s0 assert_wa(0, :m1) assert_wa(0, :m1) { |scope| scope.none } s0.create_assoc!(:m1, :S0_m1) assert_wa(1, :m1) assert_wa(0, :...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/raw_sql_test.rb
Ruby
mit
246
master
1,917
# frozen_string_literal: true require_relative "../test_helper" # rubocop:disable Metrics/LineLength describe "SQL methods" do it "#assoc_exists_sql generates expected sql" do sql = S0.assoc_exists_sql(:m1) expected_sql = %(EXISTS (SELECT 1 FROM "s1s" WHERE ("s1s"."s1s_column" % __NUMBER__ = 0) AND ("s1s"."...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_has_one_optimization_test.rb
Ruby
mit
246
master
10,164
# frozen_string_literal: true require_relative "../test_helper" # has_one requires doing sub-queries with SELECT IN / applying limits to # handle conditions / counts properly. However, when there is no conditions and no counts, # the deepest layer can avoid those sub-queries, which is faster. # # Another optimization...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_through_inter_macro_test.rb
Ruby
mit
246
master
1,210
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do # MySQL doesn't support has_one next if Test::SelectedDBHelper == Test::MySQL let(:s0) { S0.create_default! } it "has_one through: belongs_to, source: belongs_to doesn't use LIMIT" do scope = S0.where_assoc_exists(:ob2b1) ...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_last_equality_wins_test.rb
Ruby
mit
246
master
3,121
# frozen_string_literal: true require_relative "../test_helper" # Last Equality Wins is a special behavior in rails since 4.0 # https://github.com/rails/rails/issues/7365 # # Basically, when using #merge, if the receiving relation has a hash # condition on an attribute and the passed relation also has one on # the sa...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_count_has_one_test.rb
Ruby
mit
246
master
2,016
# frozen_string_literal: true require_relative "../test_helper" describe "wa_count" do # MySQL doesn't support has_one next if Test::SelectedDBHelper == Test::MySQL let(:s0) { S0.create_default! } it "counts matching has_one through has_one through has_one as at most 1" do o1_1 = s0.create_assoc!(:o1, :...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_sti_test.rb
Ruby
mit
246
master
6,231
# frozen_string_literal: true require_relative "../test_helper" describe "wa" do let(:s0) { STIS0.create! } it "belongs_to finds with STI type of same class" do s0.create_b1! s0.create_b1! s0.save! # Save the changed id assert_wa_from(STIS0, 1, :b1) end it "belongs_to finds with STI type of ...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/wa_count_left_side_test.rb
Ruby
mit
246
master
6,211
# frozen_string_literal: true require_relative "../test_helper" describe "wa_count" do let(:s0) { S0.create_default! } it "compare to a column using a string on left_side with has_many" do s0.update(s0s_adhoc_column: 2) assert !S0.where_assoc_count("s0s.s0s_adhoc_column", :<, :m1).exists? s0.create_...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/conditions/wa_has_one_test.rb
Ruby
mit
246
master
1,885
# frozen_string_literal: true require_relative "../../test_helper" describe "wa has_one" do # MySQL doesn't support has_one next if Test::SelectedDBHelper == Test::MySQL let(:s0) { S0.create_default! } it "matches with Arel condition" do s0.create_assoc!(:o1, :S0_o1, adhoc_value: 1) assert_wa(1, :o1...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/scoping/wa_polymorphic_has_one_test.rb
Ruby
mit
246
master
3,674
# frozen_string_literal: true require_relative "../../test_helper" describe "wa" do # MySQL doesn't support has_one next if Test::SelectedDBHelper == Test::MySQL let(:s0) { S0.create_default! } it "finds the right matching poly has_ones" do s0_1 = s0 s0_1.create_assoc!(:op1, :S0_op1) _s0_2 = S0...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/scoping/wa_has_one_test.rb
Ruby
mit
246
master
3,344
# frozen_string_literal: true require_relative "../../test_helper" describe "wa" do # MySQL doesn't support has_one next if Test::SelectedDBHelper == Test::MySQL let(:s0) { S0.create_default! } it "finds the right matching has_ones" do s0_1 = s0 s0_1.create_assoc!(:o1, :S0_o1) _s0_2 = S0.create...
github
MaxLap/activerecord_where_assoc
https://github.com/MaxLap/activerecord_where_assoc
test/tests/scoping/wa_has_many_test.rb
Ruby
mit
246
master
3,295
# frozen_string_literal: true require_relative "../../test_helper" describe "wa" do let(:s0) { S0.create_default! } it "finds the right matching has_manys" do s0_1 = s0 s0_1.create_assoc!(:m1, :S0_m1) _s0_2 = S0.create_default! s0_3 = S0.create_default! s0_3.create_assoc!(:m1, :S0_m1) ...