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 | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | Gemfile | Ruby | mit | 4,048 | main | 208 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in suspenders.gemspec
gemspec
gem "irb"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "standard", "~> 1.3" |
github | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | spec/suspenders_spec.rb | Ruby | mit | 4,048 | main | 2,246 | # frozen_string_literal: true
RSpec.describe Suspenders do
it "has a version number" do
expect(Suspenders::VERSION).not_to be nil
end
describe Suspenders::CLI do
let(:stub_success) {
allow_any_instance_of(Suspenders::CLI).to receive(:system).and_return(true)
}
before do
stub_success... |
github | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | spec/spec_helper.rb | Ruby | mit | 4,048 | main | 373 | # frozen_string_literal: true
require "suspenders"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect... |
github | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | lib/templates/web.rb | Ruby | mit | 4,048 | main | 19,256 | require "suspenders/version"
# Methods like `copy_file` will accept relative paths to the template's location.
def source_paths
Array(super) + [__dir__]
end
def install_gems
uncomment_lines "Gemfile", /gem\s"redis"/
gem "inline_svg"
gem "sidekiq"
gem "strong_migrations"
gem_group :test do
# TODO: Ho... |
github | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | lib/templates/config/initializers/sidekiq.rb | Ruby | mit | 4,048 | main | 496 | # https://github.com/sidekiq/sidekiq/wiki/Heroku
SIDEKIQ_REDIS_CONFIGURATION = {
url: ENV.fetch(ENV.fetch("REDIS_PROVIDER", "REDIS_URL"), nil), # use REDIS_PROVIDER for Redis environment variable name, defaulting to REDIS_URL
ssl_params: {verify_mode: OpenSSL::SSL::VERIFY_NONE} # we must trust Heroku and AWS here
... |
github | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | lib/templates/lib/tasks/development.rake | Ruby | mit | 4,048 | main | 437 | if Rails.env.development?
namespace :development do
namespace :db do
desc "Loads seed data into development."
task seed: ["environment", "db:seed"] do
Development::Seeder.load_seeds
end
namespace :seed do
desc "Truncate tables of each database for development and loads see... |
github | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | lib/templates/lib/development/seeder.rb | Ruby | mit | 4,048 | main | 633 | # This file should ensure the existence of records required to run the application in development.
# The code here should be idempotent so that it can be executed at any point in development.
# The data can then be loaded with the bin/rails development:db:seed command.
module Development
class Seeder
def self.lo... |
github | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | lib/templates/spec/support/action_mailer.rb | Ruby | mit | 4,048 | main | 457 | RSpec.configure do |config|
# https://guides.rubyonrails.org/testing.html#the-basic-test-case
#
# The ActionMailer::Base.deliveries array is only reset automatically in
# ActionMailer::TestCase and ActionDispatch::IntegrationTest tests. If
# you want to have a clean slate outside these test cases, you can res... |
github | thoughtbot/suspenders | https://github.com/thoughtbot/suspenders | lib/suspenders/cli.rb | Ruby | mit | 4,048 | main | 1,998 | # frozen_string_literal: true
module Suspenders
# Command-line interface for generating Rails applications with Suspenders.
# This class handles the creation of new Rails apps using a custom template
# and predefined configuration options.
class CLI
# Base options passed to the Rails generator for all new ... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails-i18n.gemspec | Ruby | mit | 4,025 | master | 1,271 | Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = "rails-i18n"
s.version = "8.1.0"
s.authors = ["Rails I18n Group"]
s.email = "rails-i18n@googlegroups.com"
s.homepage = "https://github.com/svenfuchs/rails-i18n"
s.summary = "Common locale data and... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | Rakefile | Ruby | mit | 4,025 | master | 772 | require 'rake'
require 'rake/testtask'
require 'rbconfig'
require 'yaml'
task :test => 'test:all'
namespace :test do
desc 'Check formality of all locale files.'
task :all do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
system(ruby, File.dirname(__FILE__) + '/rails/test/stru... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/spec_helper.rb | Ruby | mit | 4,025 | master | 463 | ENV["RAILS_ENV"] = "test"
require 'i18n-spec'
require 'active_support/core_ext/kernel/reporting'
require 'socket'
require 'unit/matchers/have_missing_particular_pluralization_keys_matcher'
require 'unit/matchers/have_keys_for_restrict_dependent_destroy_matcher'
I18n.enforce_available_locales = false
RSpec.configure ... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/transliteration_spec.rb | Ruby | mit | 4,025 | master | 2,536 | # encoding: utf-8
require 'spec_helper'
require 'support/transliteration_file'
require 'unit/transliteration/ordinary'
require 'unit/transliteration/ukrainian'
describe "Transliteration rule for" do
transliterations_dir = File.join('rails', 'transliteration')
let(:file) do |example|
filename = Dir[File.join... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/translation_spec.rb | Ruby | mit | 4,025 | master | 1,213 | # coding: utf-8
require 'spec_helper'
Dir.glob('rails/locale/*.yml') do |locale_file|
next if locale_file == 'rails/locale/es-419.yml'
describe "a rails-i18n #{locale_file} locale file" do
subject { locale_file }
it { should be_parseable }
# it { should have_valid_pluralization_keys }
it { should ... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/ordinals_spec.rb | Ruby | mit | 4,025 | master | 2,205 | require 'spec_helper'
require 'rails_i18n'
describe 'Ordinals for' do
# Mock Rails app in order to trigger the Railtie
let(:app) { double :app, config: config }
let(:config) { double :config, eager_load_namespaces: [], i18n: I18n, rails_i18n: RailsI18n }
let(:static_suffix_locales) {
{
%w[be bs cs da... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization_spec.rb | Ruby | mit | 4,025 | master | 12,841 | # Implementation of http://unicode.org/cldr/trac/browser/trunk/common/supplemental/plurals.xml
# with additional specs for I18n pluralization data format.
#
# Locales that behave like English are omitted, because I18n applies English plural rule
# to all locales without own plural rule.
require 'spec_helper'
require '... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/matchers/have_missing_particular_pluralization_keys_matcher.rb | Ruby | mit | 4,025 | master | 828 | RSpec::Matchers.define :have_missing_particular_pluralization_keys do
match do |actual|
@locale_file = I18nSpec::LocaleFile.new(actual)
keys =
if @locale_file.locale.language
@locale_file.missing_pluralization_keys.reject do |key, value|
key.match(/\.errors\.messages\.restrict_depende... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/matchers/have_keys_for_restrict_dependent_destroy_matcher.rb | Ruby | mit | 4,025 | master | 1,610 | RSpec::Matchers.define :have_keys_for_restrict_dependent_destroy do
def check_keys(scope, hash)
return unless hash['errors']
return unless hash['errors']['messages']
return unless hash['errors']['messages']['restrict_dependent_destroy']
return if hash['errors']['messages']['restrict_dependent_destroy'... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/one_few_other.rb | Ruby | mit | 4,025 | master | 939 | shared_examples 'one-few-other forms language' do
[1, 21, 31, 41, 51, 61, 71, 81, 101, 1001,
0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 10.1, 100.1, 1_000.1].each do |count|
it "detects that #{count.inspect} in category 'one'" do
rule.call(count).should == :one
end
end
[2, 3, 4, 22, 23, 24, 32, 33,... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/east_slavic.rb | Ruby | mit | 4,025 | master | 879 | shared_examples 'East Slavic' do
it 'has "one", "few", "many" and "other" plural keys' do
plural_keys.size.should == 4
plural_keys.should include(:one, :few, :many, :other)
end
[1, 21, 51, 71, 101, 1_031].each do |count|
it "detects that #{count.inspect} in category 'one'" do
rule.call(count).s... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/one_two_other.rb | Ruby | mit | 4,025 | master | 566 | shared_examples 'one-two-other forms language' do
it 'has "one", "two" and "other" plural keys' do
plural_keys.size.should == 3
plural_keys.should include(:one, :two, :other)
end
it "detects that 1 in category 'one'" do
rule.call(1).should == :one
end
it "detects that 2 in category 'two'" do
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/ordinary.rb | Ruby | mit | 4,025 | master | 468 | shared_examples 'an ordinary pluralization rule' do
it 'returns a hash' do |example|
file.content.should be_a Hash
end
it 'has one top level namespace' do |example|
file.content.keys.size.should == 1
end
it 'has its locale tag as a top level namespace' do |example|
file.content.keys.first.should... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/one_upto_two_other.rb | Ruby | mit | 4,025 | master | 525 | shared_examples 'one(upto 2)-other forms language' do
it 'has "one" and "other" plural keys' do
plural_keys.size.should == 2
plural_keys.should include(:one, :other)
end
[0, 0.5, 1, 1.2, 1.8].each do |count|
it "detects that #{count.inspect} in category 'one'" do
rule.call(count).should == :one... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/west_slavic.rb | Ruby | mit | 4,025 | master | 584 | shared_examples 'West Slavic' do
it 'has "one", "few" and "other" plural keys' do
plural_keys.size.should == 3
plural_keys.should include(:one, :few, :other)
end
it "detects that 1 in category 'one'" do
rule.call(1).should == :one
end
[2, 3, 4].each do |count|
it "detects that #{count.inspec... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/one_with_zero_other.rb | Ruby | mit | 4,025 | master | 518 | shared_examples 'one(with zero)-other forms language' do
it 'has "one" and "other" plural keys' do
plural_keys.size.should == 2
plural_keys.should include(:one, :other)
end
[0, 1].each do |count|
it "detects that #{count.inspect} in category 'one'" do
rule.call(count).should == :one
end
e... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/one_other.rb | Ruby | mit | 4,025 | master | 488 | shared_examples 'one-other forms language' do
it 'has "one" and "other" plural keys' do
plural_keys.size.should == 2
plural_keys.should include(:one, :other)
end
it "detects that 1 in category 'one'" do
rule.call(1).should == :one
end
[0, "0", 0.3, 1.2, 2, "2", 3, 5, 10, 11, 21, 23, 31, 50, 81, ... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/romanian.rb | Ruby | mit | 4,025 | master | 670 | shared_examples 'Romanian language' do
it 'has "one", "few", and "other" plural keys' do
plural_keys.size.should == 3
plural_keys.should include(:one, :few, :other)
end
it "detects that 1 in category 'one'" do
rule.call(1).should == :one
end
[0, 2, 3, 5, 8, 9, 10, 11, 15, 19, 101, 106, 112, 117,... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/pluralization/other.rb | Ruby | mit | 4,025 | master | 312 | shared_examples 'other form language' do
it 'has "other" plural keys' do
plural_keys.should == [:other]
end
[0, 1, 1.2, 2, 5, 11, 21, 22, 27, 99, 1_000, nil, "abc"].each do |count|
it "detects that #{count.inspect} in category 'other'" do
rule.call(count).should == :other
end
end
end |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/transliteration/ordinary.rb | Ruby | mit | 4,025 | master | 505 | shared_examples 'an ordinary transliteration rule' do
it 'returns a hash' do
file.content.should be_a Hash
end
it 'has one top level namespace' do
file.content.keys.size.should == 1
end
it 'has its locale tag as a top level namespace' do |example|
file.content.keys.first.should == example.metada... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/unit/transliteration/ukrainian.rb | Ruby | mit | 4,025 | master | 5,019 | # encoding: utf-8
# Below is an implementation of the official transliteration rules
# http://zakon2.rada.gov.ua/laws/show/55-2010-%D0%BF
shared_examples "Ukrainian transliteration" do
it "properly transliterates 'ь'" do
t("Ь").should == ''
t("ь").should == ''
end
it "properly transliterates 'Аa'" do
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/support/transliteration_file.rb | Ruby | mit | 4,025 | master | 1,225 | require 'support/traverse_path'
require 'support/ruby_content'
require 'yaml'
module RailsI18n
module Spec
class TransliterationFile
include TraversePath
def self.make(filepath)
raise "Transliteration file doesn't exist!" unless filepath
case File.extname(filepath)
when '.r... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/support/traverse_path.rb | Ruby | mit | 4,025 | master | 380 | module RailsI18n
module Spec
module TraversePath
# @return [Object, nil] Nil if path can't be traversed with the given key
# sequence, unless return Object at last key (it also can be nil)
def traverse_path(*keys)
keys.inject(content) do |memo, key|
return nil if memo[key].nil?... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/support/pluralization_file.rb | Ruby | mit | 4,025 | master | 264 | require 'support/traverse_path'
require 'support/ruby_content'
module RailsI18n
module Spec
class PluralizationFile
include TraversePath
include RubyContent
def initialize(filepath)
@filepath = filepath
end
end
end
end |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | spec/other/locale_files_spec.rb | Ruby | mit | 4,025 | master | 565 | # encoding: utf-8
require 'thor'
require 'spec_helper'
require_relative '../../rails/test/lib/check_locales.rb'
describe "Locale files" do
# there should not be any orphan pluralization files
it "a pluralization file should have a corresponding locale.yml file" do
expect(CheckLocales.orphan_pluralizations).to... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/transliteration.rb | Ruby | mit | 4,025 | master | 6,100 | # frozen_string_literal: true
module RailsI18n
module Transliteration
module Ukrainian
class << self
def rule
lambda do |string|
next '' unless string
string.gsub(/./) do |char|
# Regexp.last_match is local to the thread and method scope
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/pluralization.rb | Ruby | mit | 4,025 | master | 2,841 | module RailsI18n
module Pluralization
module Arabic
def self.rule
lambda do |n|
return :other unless n.is_a?(Numeric)
mod100 = n % 100
if n == 0
:zero
elsif n == 1
:one
elsif n == 2
:two
elsif (3..10).t... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/railtie.rb | Ruby | mit | 4,025 | master | 1,007 | require 'rails'
module RailsI18n
class Railtie < ::Rails::Railtie #:nodoc:
config.rails_i18n = RailsI18n
initializer 'rails-i18n' do |app|
RailsI18n::Railtie.instance_eval do
pattern = pattern_from app.config.i18n.available_locales
if app.config.rails_i18n.enabled_modules.empty?
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/one_other.rb | Ruby | mit | 4,025 | master | 390 | # Used as "default" pluralization rule
module RailsI18n
module Pluralization
module OneOther
def self.rule
lambda { |n| n == 1 ? :one : :other }
end
def self.with_locale(locale)
{ locale => {
:'i18n' => {
:plural => {
:keys => [:one, :o... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/west_slavic.rb | Ruby | mit | 4,025 | master | 486 | # Used for Czech, Slovak.
module RailsI18n
module Pluralization
module WestSlavic
def self.rule
lambda do |n|
case n
when 1 then :one
when 2, 3, 4 then :few
else :other
end
end
end
def self.with_locale(locale)
{ locale =... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/other.rb | Ruby | mit | 4,025 | master | 323 | module RailsI18n
module Pluralization
module Other
def self.rule
Proc.new { :other }
end
def self.with_locale(locale)
{ locale => {
:'i18n' => {
:plural => {
:keys => [:other],
:rule => rule }}}}
end
end
end
e... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/one_two_other.rb | Ruby | mit | 4,025 | master | 574 | # Used for Cornish, Inari Sami, Inuktitut, Lule Sami, Nama, Northern Sami,
# Sami Language, Skolt Sami, Southern Sami.
module RailsI18n
module Pluralization
module OneTwoOther
def self.rule
lambda do |n|
case n
when 1 then :one
when 2 then :two
else :other
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/east_slavic.rb | Ruby | mit | 4,025 | master | 1,083 | # Originally was implemented by Yaroslav Markin in "russian" gem
# (http://github.com/yaroslav/russian)
#
# Used for Belarusian, Russian, Ukrainian.
module RailsI18n
module Pluralization
module EastSlavic
FROM_2_TO_4 = (2..4).to_a.freeze
FROM_5_TO_9 = (5..9).to_a.freeze
FROM_11_TO_14 = (11.... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/one_with_zero_other.rb | Ruby | mit | 4,025 | master | 560 | # Used in Akan, Amharic, Bihari, Filipino, guw, Hindi, Lingala, Malagasy,
# Northen Sotho, Tachelhit, Tagalog, Tigrinya, Walloon.
module RailsI18n
module Pluralization
module OneWithZeroOther
def self.rule
lambda do |n|
case n
when 0, 1 then :one
else :other
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/one_few_other.rb | Ruby | mit | 4,025 | master | 863 | module RailsI18n
module Pluralization
module OneFewOther
FROM_2_TO_4 = (2..4).to_a.freeze
FROM_12_TO_14 = (12..14).to_a.freeze
def self.rule
lambda do |n|
return :other unless n.is_a?(Numeric)
frac = (n.to_d % 1)
if frac.nonzero?
n = frac.to... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/one_upto_two_other.rb | Ruby | mit | 4,025 | master | 442 | # Used for French, Fulah, Kabyle.
module RailsI18n
module Pluralization
module OneUptoTwoOther
def self.rule
lambda do |n|
n.is_a?(Numeric) && n >= 0 && n < 2 ? :one : :other
end
end
def self.with_locale(locale)
{ locale => {
:'i18n' => {
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | lib/rails_i18n/common_pluralizations/romanian.rb | Ruby | mit | 4,025 | master | 627 | # Used for Moldavian, Romanian.
module RailsI18n
module Pluralization
module Romanian
FROM_1_TO_19 = (1..19).to_a.freeze
def self.rule
lambda do |n|
return :other unless n.is_a?(Numeric)
if n == 1
:one
elsif n == 0 || FROM_1_TO_19.include?(n % 100)
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/pluralization/ar.rb | Ruby | mit | 4,025 | master | 204 | require 'rails_i18n/pluralization'
{ :ar => {
:'i18n' => {
:plural => {
:keys => [:zero, :one, :two, :few, :many, :other],
:rule => ::RailsI18n::Pluralization::Arabic.rule }}}} |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/ordinals/fr-FR.rb | Ruby | mit | 4,025 | master | 351 | {
"fr-FR": {
number: {
nth: {
ordinals: -> (_key, number:, **_options) {
if number.to_i.abs == 1
'er'
else
'e'
end
},
ordinalized: -> (_key, number:, **_options) {
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/ordinals/fr-CH.rb | Ruby | mit | 4,025 | master | 351 | {
"fr-CH": {
number: {
nth: {
ordinals: -> (_key, number:, **_options) {
if number.to_i.abs == 1
'er'
else
'e'
end
},
ordinalized: -> (_key, number:, **_options) {
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/ordinals/fr.rb | Ruby | mit | 4,025 | master | 346 | {
fr: {
number: {
nth: {
ordinals: -> (_key, number:, **_options) {
if number.to_i.abs == 1
'er'
else
'e'
end
},
ordinalized: -> (_key, number:, **_options) {
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/ordinals/fr-CA.rb | Ruby | mit | 4,025 | master | 351 | {
"fr-CA": {
number: {
nth: {
ordinals: -> (_key, number:, **_options) {
if number.to_i.abs == 1
'er'
else
'e'
end
},
ordinalized: -> (_key, number:, **_options) {
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/ordinals/gd.rb | Ruby | mit | 4,025 | master | 437 | {
gd: {
number: {
nth: {
ordinals: -> (_key, number:, **_options) {
case number.to_i.abs
when 1
'ᵈ'
when 2
'ⁿᵃ'
when 3
'ˢ'
else
'ᵐʰ'
end
},
ordinalized: -> (_key, number:, **... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/test/structure.rb | Ruby | mit | 4,025 | master | 936 | require File.dirname(__FILE__) + '/lib/key_structure.rb'
if ARGV.first
locales = [ARGV.first]
else
locales = []
Dir.glob(File.dirname(__FILE__) + '/../locale/*.{rb,yml}') do |filename|
if md = filename.match(/([\w\-]+)\.(rb|yml)$/)
locales << md[1]
end
end
end
locales.sort.each do |locale|
mis... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/test/lib/check_locales.rb | Ruby | mit | 4,025 | master | 1,866 | ##
# A utility class to check locale files with locales.thor
# and rspec
# Needs to inherit from Thor: https://github.com/rails/thor/wiki/Invocations
class CheckLocales < Thor
@path_to_locales = 'rails/locale'
@path_to_pluralizations = 'rails/pluralization'
@en_line_count = File.open(@path_to_locales+'/en.yml')... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/test/lib/normalize.rb | Ruby | mit | 4,025 | master | 1,719 | require 'active_support'
# Inspired from https://stackoverflow.com/questions/7275952/how-can-i-sort-yaml-files/13368706#13368706
#
# Used to standardize the locale yaml files
# Sorts all the keys alphabetically
# Ensures that the quoting is the simplest
# Ensures that the line break width is respected
module Normaliz... |
github | svenfuchs/rails-i18n | https://github.com/svenfuchs/rails-i18n | rails/test/lib/key_structure.rb | Ruby | mit | 4,025 | master | 3,310 | require 'rubygems'
require 'i18n'
require 'date'
I18n.enforce_available_locales = false
module I18n
module Backend
class Simple
public :translations, :init_translations
end
end
end
class KeyStructure
PLURALIZATION_KEYS = ['zero', 'one', 'two', 'few', 'many', 'other']
class << self
def chec... |
github | kneath/kss | https://github.com/kneath/kss | kss.gemspec | Ruby | mit | 4,022 | master | 992 | require File.dirname(__FILE__) + '/lib/kss/version'
Gem::Specification.new do |s|
s.name = "kss"
s.version = Kss::VERSION
s.date = Time.now.strftime('%Y-%m-%d')
s.summary = "A library for parsing KSS documented stylesheets and generating styleguides"
s.homepage ... |
github | kneath/kss | https://github.com/kneath/kss | Rakefile | Ruby | mit | 4,022 | master | 896 | require 'rake/testtask'
task :default => :test
def command?(command)
system("type #{command} > /dev/null 2>&1")
end
#
# Tests
#
if command? :turn
desc "Run tests"
task :test do
suffix = "-n #{ENV['TEST']}" if ENV['TEST']
sh "turn -Ilib:. test/*.rb #{suffix}"
end
else
Rake::TestTask.new do |t|
... |
github | kneath/kss | https://github.com/kneath/kss | example/app.rb | Ruby | mit | 4,022 | master | 1,803 | require 'sinatra'
require 'kss'
get '/' do
erb :index
end
get '/styleguide' do
@styleguide = Kss::Parser.new('public/stylesheets')
erb :styleguide
end
get '/inline' do
buttons =<<-'EOS'
/*
Your standard form button.
:hover - Highlights when hovering.
:disabled - Dims the button when disab... |
github | kneath/kss | https://github.com/kneath/kss | test/comment_parser_test.rb | Ruby | mit | 4,022 | master | 2,143 | require 'test/helper'
class CommentParser < Kss::Test
def setup
loc = 'test/fixtures/comments.txt'
@parsed_comments = Kss::CommentParser.new(loc).blocks
end
test "detects single-line comment syntax" do
assert Kss::CommentParser.single_line_comment?("// yuuuuup")
assert !Kss::CommentParser.singl... |
github | kneath/kss | https://github.com/kneath/kss | test/section_test.rb | Ruby | mit | 4,022 | master | 1,183 | require 'test/helper'
class SectionTest < Kss::Test
def setup
@comment_text = <<comment
# Form Button
Your standard form button.
:hover - Highlights when hovering.
:disabled - Dims the button when disabled.
.primary - Indicates button is the primary action.
.smaller - A smaller button
Styleguide 2.1.1.
... |
github | kneath/kss | https://github.com/kneath/kss | test/helper.rb | Ruby | mit | 4,022 | master | 347 | require 'minitest/autorun'
require 'kss'
module Kss
class Test < ::Minitest::Test
def self.test(name, &block)
define_method("test_#{name.gsub(/\W/,'_')}", &block) if block
end
def default_test
end
def fixture(name)
@fixtures ||= {}
@fixtures[name] ||= File.read("test/fixtures/... |
github | kneath/kss | https://github.com/kneath/kss | test/parser_test.rb | Ruby | mit | 4,022 | master | 3,572 | require 'test/helper'
class ParserTest < Kss::Test
def setup
@scss_parsed = Kss::Parser.new('test/fixtures/scss')
@sass_parsed = Kss::Parser.new('test/fixtures/sass')
@css_parsed = Kss::Parser.new('test/fixtures/css')
@less_parsed = Kss::Parser.new('test/fixtures/less')
@multiple_parsed = Kss::P... |
github | kneath/kss | https://github.com/kneath/kss | lib/kss/modifier.rb | Ruby | mit | 4,022 | master | 1,013 | module Kss
# Public: Represents a style modifier. Usually a class name or a
# pseudo-class such as :hover. See the spec on The Modifiers Section for
# more information.
class Modifier
# Public: Returns the modifier name String.
attr_accessor :name
# Public: Returns the description String for a Mod... |
github | kneath/kss | https://github.com/kneath/kss | lib/kss/section.rb | Ruby | mit | 4,022 | master | 2,570 | module Kss
# Public: Represents a styleguide section. Each section describes one UI
# element. A Section can be thought of as the collection of the description,
# modifiers, and styleguide reference.
class Section
# Returns the raw comment text for the section, not including comment
# syntax (such as /... |
github | kneath/kss | https://github.com/kneath/kss | lib/kss/comment_parser.rb | Ruby | mit | 4,022 | master | 5,482 | module Kss
# Public: Takes a file path of a text file and extracts comments from it.
# Currently accepts two formats:
#
# // Single line style.
# /* Multi-line style. */
class CommentParser
# Public: Is this a single-line comment? // This style
#
# line - A String of one line of text.
#
... |
github | kneath/kss | https://github.com/kneath/kss | lib/kss/parser.rb | Ruby | mit | 4,022 | master | 2,193 | module Kss
# Public: The main KSS parser. Takes a directory full of SASS / SCSS / CSS
# files and parses the KSS within them.
class Parser
# Public: Returns a hash of Sections.
attr_accessor :sections
# Public: Initializes a new parser based on a directory of files or kss strings.
# Scans within ... |
github | sds/overcommit | https://github.com/sds/overcommit | Gemfile | Ruby | mit | 3,997 | main | 349 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec
# Development dependencies are listed below
gem 'rspec', '~> 3.0'
gem 'simplecov', '~> 0.21.0'
gem 'simplecov-lcov', '~> 0.8.0'
# Pin RuboCop for CI builds
if RUBY_VERSION < '2.7.0'
gem 'rubocop', '1.50.0'
else
gem 'rubocop', '1.77.0'
end
ge... |
github | sds/overcommit | https://github.com/sds/overcommit | overcommit.gemspec | Ruby | mit | 3,997 | main | 1,290 | # frozen_string_literal: true
require_relative './lib/overcommit/constants'
require_relative './lib/overcommit/version'
Gem::Specification.new do |s|
s.name = 'overcommit'
s.version = Overcommit::VERSION
s.license = 'MIT'
s.summary = 'Git hook manager... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/spec_helper.rb | Ruby | mit | 3,997 | main | 1,892 | # frozen_string_literal: true
require 'bundler'
require 'simplecov'
SimpleCov.start do
add_filter 'bin/'
add_filter 'libexec/'
add_filter 'spec/'
add_filter 'template-dir/'
if ENV['CI']
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/utils_spec.rb | Ruby | mit | 3,997 | main | 7,173 | # frozen_string_literal: true
require 'spec_helper'
require 'securerandom'
describe Overcommit::Utils do
describe '.script_path' do
subject { described_class.script_path('some-script') }
it 'points to the libexec scripts directory' do
subject.should end_with File.join('libexec', 'some-script')
en... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_signer_spec.rb | Ruby | mit | 3,997 | main | 2,116 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::HookSigner do
describe '#signature_changed?' do
let(:config) { double('config') }
let(:context) { double('context') }
let(:signer) do
described_class.new('.git-hooks/pre_commit/some_path.rb', config, context)
end
le... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/logger_spec.rb | Ruby | mit | 3,997 | main | 4,004 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Logger do
let(:io) { StringIO.new }
let(:output) { io.string }
subject { described_class.new(io) }
describe '.silent' do
subject { described_class.silent }
it 'does not output anything' do
capture_stdout { subject.log('So... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/message_processor_spec.rb | Ruby | mit | 3,997 | main | 8,609 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::MessageProcessor do
# Shorthand to make writing these tests a little more sane
EMH = Overcommit::MessageProcessor::ERRORS_MODIFIED_HEADER + "\n"
WMH = Overcommit::MessageProcessor::WARNINGS_MODIFIED_HEADER + "\n"
EUH = Overcommit::Messag... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/installer_spec.rb | Ruby | mit | 3,997 | main | 8,236 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Installer do
let(:logger) { Overcommit::Logger.silent }
let(:installer) { described_class.new(logger) }
def hook_files_installed?(hooks_dir)
Overcommit::Utils.supported_hook_types.all? do |hook_type|
hook_file = File.join(hooks_... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/configuration_validator_spec.rb | Ruby | mit | 3,997 | main | 3,209 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::ConfigurationValidator do
let(:output) { StringIO.new }
let(:logger) { Overcommit::Logger.new(output) }
let(:options) { { logger: logger } }
let(:config) { Overcommit::Configuration.new(config_hash, validate: false) }
subject { descri... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/command_splitter_spec.rb | Ruby | mit | 3,997 | main | 4,655 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::CommandSplitter do
describe '.execute' do
let(:args_prefix) { %w[cmd] }
let(:max_command_length) { 10 }
let(:options) { { args: splittable_args } }
subject { described_class.execute(args_prefix, options) }
before do
... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/configuration_spec.rb | Ruby | mit | 3,997 | main | 8,630 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Configuration do
let(:hash) { {} }
let(:config) { described_class.new(hash) }
describe '#new' do
let(:internal_hash) { config.instance_variable_get(:@hash) }
subject { config }
context 'when no configuration exists for a hook... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/git_config_spec.rb | Ruby | mit | 3,997 | main | 2,379 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::GitConfig do
describe '.comment_character' do
subject { described_class.comment_character }
context 'with no configuration' do
it 'should be "#"' do
repo do
`git config --local core.commentchar ""`
ex... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/cli_spec.rb | Ruby | mit | 3,997 | main | 4,709 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/cli'
require 'overcommit/hook_context/diff'
require 'overcommit/hook_context/run_all'
describe Overcommit::CLI do
describe '#run' do
let(:logger) { Overcommit::Logger.silent }
let(:input) { double('input') }
let(:cli) { described_cl... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/configuration_loader_spec.rb | Ruby | mit | 3,997 | main | 3,463 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::ConfigurationLoader do
let(:output) { StringIO.new }
let(:logger) { Overcommit::Logger.new(output) }
describe '#load_repo_config' do
subject { described_class.new(logger).load_repo_config }
context 'when repo does not contain a c... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/git_repo_spec.rb | Ruby | mit | 3,997 | main | 10,669 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::GitRepo do
describe '.submodule_statuses' do
let(:options) { {} }
subject { described_class.submodule_statuses(options) }
context 'when repo contains no submodules' do
around do |example|
repo do
example.ru... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/default_configuration_spec.rb | Ruby | mit | 3,997 | main | 1,389 | # frozen_string_literal: true
require 'spec_helper'
describe 'default configuration' do
default_config =
begin
YAML.load_file(Overcommit::ConfigurationLoader::DEFAULT_CONFIG_PATH, aliases: true).to_hash
rescue ArgumentError
YAML.load_file(Overcommit::ConfigurationLoader::DEFAULT_CONFIG_PATH).to_... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/run_all_spec.rb | Ruby | mit | 3,997 | main | 2,251 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/run_all'
describe Overcommit::HookContext::RunAll do
let(:config) { double('config') }
let(:args) { [] }
let(:input) { double('input') }
let(:context) { described_class.new(config, args, input) }
describe '#modified_files'... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/post_rewrite_spec.rb | Ruby | mit | 3,997 | main | 6,555 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/post_rewrite'
describe Overcommit::HookContext::PostRewrite do
let(:config) { double('config') }
let(:input) { double('input') }
let(:context) { described_class.new(config, args, input) }
describe '#amend?' do
subject { ... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/pre_push_spec.rb | Ruby | mit | 3,997 | main | 14,549 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/pre_push'
describe Overcommit::HookContext::PrePush do
let(:config) { double('config') }
let(:args) { [remote_name, remote_url] }
let(:input) { double('input') }
let(:remote_name) { 'origin' }
let(:remote_url) { 'git@github... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/commit_msg_spec.rb | Ruby | mit | 3,997 | main | 21,688 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/commit_msg'
describe Overcommit::HookContext::CommitMsg do
let(:comment_char) { '#' }
let(:config) { double('config') }
let(:args) { [commit_message_file] }
let(:input) { double('input') }
let(:context) { described_class.ne... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/post_merge_spec.rb | Ruby | mit | 3,997 | main | 7,355 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/post_merge'
describe Overcommit::HookContext::PostMerge do
let(:config) { double('config') }
let(:args) { [] }
let(:input) { double('input') }
let(:context) { described_class.new(config, args, input) }
describe '#squash?' ... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/pre_rebase_spec.rb | Ruby | mit | 3,997 | main | 2,797 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/pre_rebase'
describe Overcommit::HookContext::PreRebase do
let(:config) { double('config') }
let(:args) { [upstream_branch, rebased_branch] }
let(:upstream_branch) { 'master' }
let(:rebased_branch) { 'topic' }
let(:input) {... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/pre_commit_spec.rb | Ruby | mit | 3,997 | main | 19,378 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/pre_commit'
describe Overcommit::HookContext::PreCommit do
let(:config) { double('config') }
let(:args) { [] }
let(:input) { double('input') }
let(:context) { described_class.new(config, args, input) }
describe '#amendment... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/base_spec.rb | Ruby | mit | 3,997 | main | 730 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::HookContext::Base do
let(:config) { double('config') }
let(:args) { [] }
let(:input) { double('input') }
let(:context) { described_class.new(config, args, input) }
describe '#hook_class_name' do
subject { context.hook_class_name }... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/post_checkout_spec.rb | Ruby | mit | 3,997 | main | 3,481 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/post_checkout'
describe Overcommit::HookContext::PostCheckout do
let(:config) { double('config') }
let(:args) { [previous_head, new_head, branch_flag] }
let(:input) { double('input') }
let(:previous_head) { random_hash }
le... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/prepare_commit_msg_spec.rb | Ruby | mit | 3,997 | main | 771 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/prepare_commit_msg'
describe Overcommit::HookContext::PrepareCommitMsg do
let(:config) { double('config') }
let(:args) { [commit_message_filename, commit_message_source] }
let(:commit_message_filename) { 'message-template.txt' ... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/diff_spec.rb | Ruby | mit | 3,997 | main | 3,798 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/diff'
describe Overcommit::HookContext::Diff do
let(:config) { double('config') }
let(:args) { [] }
let(:input) { double('input') }
let(:context) { described_class.new(config, args, input, diff: 'master') }
describe '#modi... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook_context/post_commit_spec.rb | Ruby | mit | 3,997 | main | 3,519 | # frozen_string_literal: true
require 'spec_helper'
require 'overcommit/hook_context/post_commit'
describe Overcommit::HookContext::PostCommit do
let(:config) { double('config') }
let(:args) { [] }
let(:input) { double('input') }
let(:context) { described_class.new(config, args, input) }
describe '#modifie... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook/base_spec.rb | Ruby | mit | 3,997 | main | 4,736 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::Base do
let(:config) { double('config') }
let(:context) { double('context') }
let(:hook) { described_class.new(config, context) }
describe '#run_and_transform' do
let(:var_name) { 'OVERCOMMIT_TEST_HOOK_VAR' }
let(:hook_con... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook/pre_commit/php_lint_spec.rb | Ruby | mit | 3,997 | main | 1,456 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PreCommit::PhpLint do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
before do
subject.stub(:applicable_files).and_r... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook/pre_commit/trailing_whitespace_spec.rb | Ruby | mit | 3,997 | main | 956 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PreCommit::TrailingWhitespace do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
let(:staged_file) { 'filename.txt' }
b... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook/pre_commit/mix_format_spec.rb | Ruby | mit | 3,997 | main | 1,211 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PreCommit::MixFormat do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
before do
subject.stub(:applicable_files).and... |
github | sds/overcommit | https://github.com/sds/overcommit | spec/overcommit/hook/pre_commit/puppet_lint_spec.rb | Ruby | mit | 3,997 | main | 1,733 | # frozen_string_literal: true
require 'spec_helper'
describe Overcommit::Hook::PreCommit::PuppetLint do
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
let(:context) { double('context') }
subject { described_class.new(config, context) }
before do
subject.stub(:applicable_files).an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.