repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/filters/mustache.rb | nanoc/lib/nanoc/filters/mustache.rb | # frozen_string_literal: true
module Nanoc::Filters
# @api private
class Mustache < Nanoc::Filter
identifier :mustache
requires 'mustache'
# Runs the content through
# [Mustache](https://github.com/defunkt/mustache). This method takes no
# options.
#
# @param [String] content The cont... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/filters/markaby.rb | nanoc/lib/nanoc/filters/markaby.rb | # frozen_string_literal: true
module Nanoc::Filters
# @api private
class Markaby < Nanoc::Filter
identifier :markaby
requires 'markaby'
# Runs the content through [Markaby](http://markaby.github.io/).
# This method takes no options.
#
# @param [String] content The content to filter
#
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/filters/slim.rb | nanoc/lib/nanoc/filters/slim.rb | # frozen_string_literal: true
module Nanoc::Filters
# @api private
class Slim < Nanoc::Filter
identifier :slim
requires 'slim'
# Runs the content through [Slim](http://slim-lang.com/).
# This method takes no options.
#
# @param [String] content The content to filter
#
# @return [S... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/filters/colorize_syntax.rb | nanoc/lib/nanoc/filters/colorize_syntax.rb | # frozen_string_literal: true
module Nanoc::Filters
# @api private
class ColorizeSyntax < Nanoc::Filter
identifier :colorize_syntax
requires 'nokogiri'
DEFAULT_COLORIZER = :coderay
ExtractedLanguage = Struct.new(:language, :from_class)
def run(content, params = {})
@colorizers = color... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/filters/colorize_syntax/colorizers.rb | nanoc/lib/nanoc/filters/colorize_syntax/colorizers.rb | # frozen_string_literal: true
module Nanoc::Filters::ColorizeSyntax::Colorizers
class Abstract
extend DDPlugin::Plugin
def process(_code, _language, params = {})
raise NotImplementedError
end
def postprocess(_language, _element); end
private
def check_availability(*cmd)
TTY::C... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/filters/sass/importer.rb | nanoc/lib/nanoc/filters/sass/importer.rb | # frozen_string_literal: true
module Nanoc::Filters::SassCommon
# @api private
class Importer < ::Sass::Importers::Filesystem
attr_reader :filter
def initialize(filter)
@filter = filter
super('.')
end
def find_relative(name, base_identifier, options)
base_raw_filename = filter.i... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/filters/sass/functions.rb | nanoc/lib/nanoc/filters/sass/functions.rb | # frozen_string_literal: true
module ::Sass::Script::Functions
def nanoc(string, params = {})
assert_type string, :String
assert_type params, :Hash
result = options[:importer].filter.instance_eval(string.value)
case result
when TrueClass, FalseClass
bool(result)
when Array
list(re... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/action_sequence_calculator.rb | nanoc/lib/nanoc/rule_dsl/action_sequence_calculator.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class ActionSequenceCalculator
class UnsupportedObjectTypeException < ::Nanoc::Error
def initialize(obj)
super("Do not know how to calculate the action sequence for #{obj.inspect}")
end
end
class NoActionSequenceForLayoutException <... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/errors.rb | nanoc/lib/nanoc/rule_dsl/errors.rb | # frozen_string_literal: true
module Nanoc
module RuleDSL
module Errors
# Error that is raised when no rules file can be found in the current
# working directory.
class NoRulesFileFound < ::Nanoc::Core::Error
def initialize
super('This site does not have a rules file, which is... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/rules_collection.rb | nanoc/lib/nanoc/rule_dsl/rules_collection.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
# Keeps track of the rules in a site.
#
# @api private
class RulesCollection
# @return [String] the contents of the Rules file
attr_accessor :data
# The hash containing layout-to-filter mapping rules. This hash is
# ordered: iterating over th... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/routing_rule.rb | nanoc/lib/nanoc/rule_dsl/routing_rule.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class RoutingRule < Rule
include Nanoc::Core::ContractsSupport
contract C::None => C::Maybe[Symbol]
attr_reader :snapshot_name
contract Nanoc::Core::Pattern, Symbol, Proc, C::KeywordArgs[snapshot_name: C::Optional[Symbol]] => C::Any
def initia... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/compilation_rule_context.rb | nanoc/lib/nanoc/rule_dsl/compilation_rule_context.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class CompilationRuleContext < RuleContext
include Nanoc::Core::ContractsSupport
contract C::KeywordArgs[
rep: Nanoc::Core::ItemRep,
site: Nanoc::Core::Site,
recorder: Nanoc::RuleDSL::ActionRecorder,
view_context: Nanoc::Core::ViewC... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/compiler_dsl.rb | nanoc/lib/nanoc/rule_dsl/compiler_dsl.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class CompilerDSL < Nanoc::Core::Context
# The current rules filename.
#
# @return [String] The current rules filename.
#
# @api private
attr_accessor :rules_filename
# Creates a new compiler DSL for the given collection of rules.
#... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/routing_rule_context.rb | nanoc/lib/nanoc/rule_dsl/routing_rule_context.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class RoutingRuleContext < RuleContext
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/action_provider.rb | nanoc/lib/nanoc/rule_dsl/action_provider.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class ActionProvider < Nanoc::Core::ActionProvider
identifier :rule_dsl
# @api private
attr_reader :rules_collection
def self.for(site)
rules_collection = Nanoc::RuleDSL::RulesCollection.new
action_sequence_calculator =
Nanoc:... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/rule_context.rb | nanoc/lib/nanoc/rule_dsl/rule_context.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class RuleContext < Nanoc::Core::Context
include Nanoc::Core::ContractsSupport
contract C::KeywordArgs[
rep: Nanoc::Core::ItemRep,
site: Nanoc::Core::Site,
view_context: Nanoc::Core::ViewContextForPreCompilation,
] => C::Any
def i... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/rule.rb | nanoc/lib/nanoc/rule_dsl/rule.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class Rule
include Nanoc::Core::ContractsSupport
contract C::None => Symbol
attr_reader :rep_name
contract C::None => Nanoc::Core::Pattern
attr_reader :pattern
contract Nanoc::Core::Pattern, Symbol, Proc => C::Any
def initialize(patte... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/rules_loader.rb | nanoc/lib/nanoc/rule_dsl/rules_loader.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class RulesLoader
def initialize(config, rules_collection)
@dsl = Nanoc::RuleDSL::CompilerDSL.new(rules_collection, config)
end
def load
# Find rules file
rules_filenames = ['Rules', 'rules', 'Rules.rb', 'rules.rb']
rules_filena... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/action_recorder.rb | nanoc/lib/nanoc/rule_dsl/action_recorder.rb | # frozen_string_literal: true
module Nanoc
module RuleDSL
class ActionRecorder
include Nanoc::Core::ContractsSupport
contract Nanoc::Core::ItemRep => C::Any
def initialize(item_rep)
@item_rep = item_rep
@action_sequence_builder = Nanoc::Core::ActionSequenceBuilder.new
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/rule_dsl/compilation_rule.rb | nanoc/lib/nanoc/rule_dsl/compilation_rule.rb | # frozen_string_literal: true
module Nanoc::RuleDSL
class CompilationRule < Rule
include Nanoc::Core::ContractsSupport
contract Nanoc::Core::ItemRep, C::KeywordArgs[
site: Nanoc::Core::Site,
recorder: Nanoc::RuleDSL::ActionRecorder,
view_context: Nanoc::Core::ViewContextForPreCompilation,
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/data_sources/filesystem.rb | nanoc/lib/nanoc/data_sources/filesystem.rb | # frozen_string_literal: true
module Nanoc::DataSources
# The filesystem data source stores its items and layouts in nested
# directories. Items and layouts are represented by one or two files; if it
# is represented using one file, the metadata can be contained in this file.
#
# The default root directory f... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/data_sources/filesystem/tools.rb | nanoc/lib/nanoc/data_sources/filesystem/tools.rb | # frozen_string_literal: true
class Nanoc::DataSources::Filesystem < Nanoc::DataSource
# Contains useful functions for managing the filesystem.
#
# @api private
module Tools
# Error that is raised when too many symlink indirections are encountered.
class MaxSymlinkDepthExceededError < ::Nanoc::Core::Tr... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/data_sources/filesystem/errors.rb | nanoc/lib/nanoc/data_sources/filesystem/errors.rb | # frozen_string_literal: true
class Nanoc::DataSources::Filesystem < Nanoc::DataSource
# @api private
module Errors
class Generic < ::Nanoc::Error
end
class BinaryLayout < Generic
def initialize(content_filename)
super("The layout file '#{content_filename}' is a binary file, but layouts ... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc/lib/nanoc/data_sources/filesystem/parser.rb | nanoc/lib/nanoc/data_sources/filesystem/parser.rb | # frozen_string_literal: true
# @api private
class Nanoc::DataSources::Filesystem
class Parser
SEPARATOR = /(-{5}|-{3}|\+{3})/.source
class ParseResult
attr_reader :content
attr_reader :attributes
attr_reader :attributes_data
def initialize(content:, attributes:, attributes_data:)
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/guard-nanoc/spec/gem_spec.rb | guard-nanoc/spec/gem_spec.rb | # frozen_string_literal: true
describe 'guard-nanoc.gem', :stdio, chdir: false do
subject do
TTY::Command.new.run('gem build guard-nanoc.gemspec')
end
around do |ex|
Dir['*.gem'].each { |f| FileUtils.rm(f) }
ex.run
Dir['*.gem'].each { |f| FileUtils.rm(f) }
end
it 'builds gem' do
expect ... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/guard-nanoc/spec/spec_helper.rb | guard-nanoc/spec/spec_helper.rb | # frozen_string_literal: true
require_relative '../../common/spec/spec_helper_head'
module Guard
# `guard-compat` defines `Notifier` as a module rather than a class. We define
# `Notifier` as a class here, before requiring guard-compat and guard, so that
# `guard` does not break.
class Notifier
end
end
req... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/guard-nanoc/spec/lib/guard/nanoc_spec.rb | guard-nanoc/spec/lib/guard/nanoc_spec.rb | # frozen_string_literal: true
RSpec.describe Guard::Nanoc do
around do |example|
Dir.mktmpdir('nanoc-test') do |dir|
__nanoc_core_chdir(dir) do
Nanoc::CLI.run(%w[create-site foo])
__nanoc_core_chdir('foo') do
example.run
end
end
end
end
before do
allow(P... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/guard-nanoc/spec/lib/guard/nanoc/live_command_spec.rb | guard-nanoc/spec/lib/guard/nanoc/live_command_spec.rb | # frozen_string_literal: true
RSpec.describe Guard::Nanoc do
around do |example|
Dir.mktmpdir('nanoc-test') do |dir|
__nanoc_core_chdir(dir) do
Nanoc::CLI.run(%w[create-site foo])
__nanoc_core_chdir('foo') do
example.run
end
end
end
end
it 'loads the command... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/guard-nanoc/lib/guard-nanoc.rb | guard-nanoc/lib/guard-nanoc.rb | # frozen_string_literal: true
require 'guard/nanoc'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/guard-nanoc/lib/guard/nanoc.rb | guard-nanoc/lib/guard/nanoc.rb | # frozen_string_literal: true
require 'guard/compat/plugin'
require 'nanoc'
require 'nanoc/orig_cli'
module Guard
class Nanoc < Plugin
def self.live_cmd
@_live_cmd ||= begin
path = File.join(File.dirname(__FILE__), 'nanoc', 'live_command.rb')
Cri::Command.load_file(path, infer_name: true)... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/guard-nanoc/lib/guard/nanoc/version.rb | guard-nanoc/lib/guard/nanoc/version.rb | # frozen_string_literal: true
module Guard
GUARD_NANOC_VERSION = '2.1.10'
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/guard-nanoc/lib/guard/nanoc/live_command.rb | guard-nanoc/lib/guard/nanoc/live_command.rb | # frozen_string_literal: true
usage 'live [options]'
summary 'start the web server, and recompile the site when changed'
description <<~EOS
Start the static web server (like `nanoc view` would), and watch for changes
in the background (like `guard start` would). See the documentation of those
two commands for de... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/spec/manifest_spec.rb | nanoc-live/spec/manifest_spec.rb | # frozen_string_literal: true
describe 'manifest', chdir: false do
example do
expect('nanoc-live').to have_a_valid_manifest
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/spec/gem_spec.rb | nanoc-live/spec/gem_spec.rb | # frozen_string_literal: true
describe 'nanoc-live.gem', :stdio, chdir: false do
subject do
TTY::Command.new.run('gem build nanoc-live.gemspec')
end
around do |ex|
Dir['*.gem'].each { |f| FileUtils.rm(f) }
ex.run
Dir['*.gem'].each { |f| FileUtils.rm(f) }
end
it 'builds gem' do
expect { ... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/spec/spec_helper.rb | nanoc-live/spec/spec_helper.rb | # frozen_string_literal: true
require_relative '../../common/spec/spec_helper_head'
require 'nanoc'
if Nanoc::Core.on_windows?
warn 'nanoc-live is not currently supported on Windows'
exit 0
end
require 'nanoc/live'
require_relative '../../common/spec/spec_helper_foot'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/spec/nanoc/live_spec.rb | nanoc-live/spec/nanoc/live_spec.rb | # frozen_string_literal: true
describe Nanoc::Live::VERSION do
it { is_expected.to be_a(String) }
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/spec/nanoc/live/live_recompiler_spec.rb | nanoc-live/spec/nanoc/live/live_recompiler_spec.rb | # frozen_string_literal: true
describe Nanoc::Live::LiveRecompiler, :fork, :site, :stdio do
before do
Nanoc::CLI::ErrorHandler.enable
end
# TODO: vary
let(:focus) { nil }
it 'detects content changes' do
command = nil
command_runner = Nanoc::CLI::CommandRunner.new({}, [], command)
live_recom... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/spec/nanoc/live/command_runners/live_spec.rb | nanoc-live/spec/nanoc/live/command_runners/live_spec.rb | # frozen_string_literal: true
describe Nanoc::Live::CommandRunners::Live, :fork, :site, :stdio do
def run_cmd
pipe_stdout_read, pipe_stdout_write = IO.pipe
pid = fork do
trap(:INT) { exit(0) }
pipe_stdout_read.close
$stdout = pipe_stdout_write
Nanoc::CLI.run(['live'])
end
pipe... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/lib/nanoc/live.rb | nanoc-live/lib/nanoc/live.rb | # frozen_string_literal: true
require 'adsf/live'
require 'listen'
require 'nanoc'
require 'nanoc/orig_cli'
module Nanoc
module Live
end
end
require_relative 'live/version'
require_relative 'live/live_recompiler'
require_relative 'live/command_runners/live'
root = File.dirname(__FILE__)
live_command_path = File... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/lib/nanoc/live/version.rb | nanoc-live/lib/nanoc/live/version.rb | # frozen_string_literal: true
module Nanoc
module Live
VERSION = '1.1.0'
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/lib/nanoc/live/live_recompiler.rb | nanoc-live/lib/nanoc/live/live_recompiler.rb | # frozen_string_literal: true
module Nanoc
module Live
class LiveRecompiler
def initialize(command_runner:, focus:)
@command_runner = command_runner
@focus = focus
end
def run
run_parent do |site|
handle_changes(site, @command_runner, focus: @focus)
en... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/lib/nanoc/live/commands/live.rb | nanoc-live/lib/nanoc/live/commands/live.rb | # frozen_string_literal: true
usage 'live'
summary 'auto-recompile and serve'
description <<~EOS
Starts the live recompiler along with the static web server. Unless specified,
the web server will run on port 3000 and listen on 127.0.0.1. Running this
static web server requires `adsf` (not `asdf`!).
EOS
option :... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-live/lib/nanoc/live/command_runners/live.rb | nanoc-live/lib/nanoc/live/command_runners/live.rb | # frozen_string_literal: true
module Nanoc
module Live
module CommandRunners
class Live < ::Nanoc::CLI::CommandRunner
def run
if defined?(Guard::Nanoc)
$stderr.puts '-' * 40
$stderr.puts 'NOTE:'
$stderr.puts 'You are using the `nanoc live` command provi... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/spec/manifest_spec.rb | nanoc-deploying/spec/manifest_spec.rb | # frozen_string_literal: true
describe 'manifest', chdir: false do
example do
expect('nanoc-deploying').to have_a_valid_manifest
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/spec/gem_spec.rb | nanoc-deploying/spec/gem_spec.rb | # frozen_string_literal: true
describe 'nanoc-deploying.gem', :stdio, chdir: false do
subject do
TTY::Command.new.run('gem build nanoc-deploying.gemspec')
end
around do |ex|
Dir['*.gem'].each { |f| FileUtils.rm(f) }
ex.run
Dir['*.gem'].each { |f| FileUtils.rm(f) }
end
it 'builds gem' do
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/spec/spec_helper.rb | nanoc-deploying/spec/spec_helper.rb | # frozen_string_literal: true
require_relative '../../common/spec/spec_helper_head'
require 'nanoc/deploying'
require_relative '../../common/spec/spec_helper_foot'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/spec/nanoc/deploying/command_runners/deploy_spec.rb | nanoc-deploying/spec/nanoc/deploying/command_runners/deploy_spec.rb | # frozen_string_literal: true
describe Nanoc::Deploying::CommandRunners::Deploy, :site, :stdio do
before do
skip_unless_have_command 'rsync'
end
describe '#run' do
let(:config) { {} }
before do
# Prevent double-loading
expect(Nanoc::CLI).to receive(:setup)
File.write('nanoc.yaml'... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/spec/nanoc/deploying/deployers/git_spec.rb | nanoc-deploying/spec/nanoc/deploying/deployers/git_spec.rb | # frozen_string_literal: true
describe Nanoc::Deploying::Deployers::Git, :stdio do
subject { deployer.run }
let(:deployer) { described_class.new(output_dir, options, dry_run:) }
let(:output_dir) { 'output/' }
let(:options) { remote_options.merge(branch_options).merge(forced_options) }
let(:dry_run) { false... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/spec/nanoc/deploying/deployers/fog_spec.rb | nanoc-deploying/spec/nanoc/deploying/deployers/fog_spec.rb | # frozen_string_literal: true
describe Nanoc::Deploying::Deployers::Fog, :stdio do
subject { deployer.run }
let(:deployer) do
described_class.new(
'output/',
config,
dry_run: is_dry_run,
)
end
let(:is_dry_run) { false }
let(:config) do
{
bucket: 'bucky',
provider:... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/spec/nanoc/deploying/deployers/rsync_spec.rb | nanoc-deploying/spec/nanoc/deploying/deployers/rsync_spec.rb | # frozen_string_literal: true
describe Nanoc::Deploying::Deployers::Rsync, :stdio do
subject { deployer.run }
let(:deployer) do
described_class.new(
'output',
config,
**extra_opts,
)
end
let(:config) { {} }
let(:extra_opts) { {} }
before do
skip_unless_have_command 'rsync'
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc-deploying.rb | nanoc-deploying/lib/nanoc-deploying.rb | # frozen_string_literal: true
require 'nanoc/deploying'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying.rb | nanoc-deploying/lib/nanoc/deploying.rb | # frozen_string_literal: true
require 'nanoc-core'
require 'nanoc-cli'
module Nanoc
module Deploying
end
end
require 'nanoc/deploying/version'
require 'nanoc/deploying/deployer'
require 'nanoc/deploying/deployers'
require 'nanoc/deploying/command_runners'
root = File.dirname(__FILE__)
deploying_command_path = ... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/version.rb | nanoc-deploying/lib/nanoc/deploying/version.rb | # frozen_string_literal: true
module Nanoc
module Deploying
VERSION = '1.0.3'
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/command_runners.rb | nanoc-deploying/lib/nanoc/deploying/command_runners.rb | # frozen_string_literal: true
# @api private
module Nanoc
module Deploying
module CommandRunners
end
end
end
require_relative 'command_runners/deploy'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/deployer.rb | nanoc-deploying/lib/nanoc/deploying/deployer.rb | # frozen_string_literal: true
module Nanoc
module Deploying
# Represents a deployer, an object that allows uploading the compiled site
# to a specific (remote) location.
#
# @abstract Subclass and override {#run} to implement a custom filter.
#
# @api private
class Deployer
extend D... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/deployers.rb | nanoc-deploying/lib/nanoc/deploying/deployers.rb | # frozen_string_literal: true
require 'tty-command'
# @api private
module Nanoc
module Deploying
module Deployers
end
end
end
require_relative 'deployers/fog'
require_relative 'deployers/git'
require_relative 'deployers/rsync'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/commands/deploy.rb | nanoc-deploying/lib/nanoc/deploying/commands/deploy.rb | # frozen_string_literal: true
usage 'deploy [target] [options]'
summary 'deploy the compiled site'
description "
Deploys the compiled site. The compiled site contents in the output directory will be uploaded to the destination, which is specified using the `--target` option.
"
option :t, :target, 'specify the... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/command_runners/deploy.rb | nanoc-deploying/lib/nanoc/deploying/command_runners/deploy.rb | # frozen_string_literal: true
module Nanoc
module Deploying
module CommandRunners
class Deploy < ::Nanoc::CLI::CommandRunner
def run
@site = load_site
Nanoc::Core::Compiler.new_for(@site).run_until_preprocessed
if options[:'list-deployers']
list_deployers
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/deployers/rsync.rb | nanoc-deploying/lib/nanoc/deploying/deployers/rsync.rb | # frozen_string_literal: true
module Nanoc
module Deploying
module Deployers
# A deployer that deploys a site using rsync.
#
# The configuration has should include a `:dst` value, a string containing
# the destination to where rsync should upload its data. It will likely be
# in `ho... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/deployers/fog.rb | nanoc-deploying/lib/nanoc/deploying/deployers/fog.rb | # frozen_string_literal: true
module Nanoc
module Deploying
module Deployers
# A deployer that deploys a site using [fog](https://github.com/fog/fog).
#
# @example A deployment configuration with public and staging configurations
#
# deploy:
# public:
# kind:... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-deploying/lib/nanoc/deploying/deployers/git.rb | nanoc-deploying/lib/nanoc/deploying/deployers/git.rb | # frozen_string_literal: true
module Nanoc
module Deploying
module Deployers
# A deployer that deploys a site using [Git](https://git-scm.com).
#
# @example A deployment configuration for GitHub Pages:
#
# deploy:
# default:
# kind: git
# re... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-spec/spec/manifest_spec.rb | nanoc-spec/spec/manifest_spec.rb | # frozen_string_literal: true
describe 'manifest', chdir: false do
example do
expect('nanoc-spec').to have_a_valid_manifest
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-spec/spec/gem_spec.rb | nanoc-spec/spec/gem_spec.rb | # frozen_string_literal: true
describe 'nanoc-spec.gem', :stdio, chdir: false do
subject do
TTY::Command.new.run('gem build nanoc-spec.gemspec')
end
around do |ex|
Dir['*.gem'].each { |f| FileUtils.rm(f) }
ex.run
Dir['*.gem'].each { |f| FileUtils.rm(f) }
end
it 'builds gem' do
expect { ... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-spec/spec/spec_helper.rb | nanoc-spec/spec/spec_helper.rb | # frozen_string_literal: true
require_relative '../../common/spec/spec_helper_head'
require 'nanoc/spec'
require_relative '../../common/spec/spec_helper_foot'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-spec/spec/nanoc/spec/helper_context_spec.rb | nanoc-spec/spec/nanoc/spec/helper_context_spec.rb | # frozen_string_literal: true
describe Nanoc::Spec::HelperContext do
subject(:ctx) { described_class.new(helper) }
let(:helper) do
Module.new {}
end
it 'has no items by default' do
# TODO: Add #empty? to item collection view
expect(subject.items.size).to eq(0)
end
it 'has no layouts by defau... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-spec/lib/nanoc-spec.rb | nanoc-spec/lib/nanoc-spec.rb | # frozen_string_literal: true
require 'nanoc/spec'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-spec/lib/nanoc/spec.rb | nanoc-spec/lib/nanoc/spec.rb | # frozen_string_literal: true
module Nanoc
module Spec
end
end
require 'nanoc/spec/version'
module Nanoc
module Spec
module Helper
def chdir(dir)
here = Dir.getwd
Dir.chdir(dir)
yield
ensure
Dir.chdir(here)
end
def command?(cmd)
TTY::Which.ex... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-spec/lib/nanoc/spec/version.rb | nanoc-spec/lib/nanoc/spec/version.rb | # frozen_string_literal: true
module Nanoc
module Spec
VERSION = '0.0.2'
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/file_system_data_spec.rb | spec/file_system_data_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "File system i18n" do
describe "#available_locales" do
before do
TestCodebase.setup(
"config/locales/en.yml" => {en: {}},
"config/locales/es.yml" => {es: {}},
"config/locales/other.fr.yml" => {fr: {}}
)
en... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/used_keys_erb_prism_spec.rb | spec/used_keys_erb_prism_spec.rb | # frozen_string_literal: true
require "spec_helper"
# This spec is a duplicate of `spec/used_keys_erb_spec.rb` but what we expect for the Prism-based ERB-parser.
RSpec.describe "UsedKeysErbPrism" do
let!(:task) { I18n::Tasks::BaseTask.new }
let(:paths) do
%w[app/views/application/show.html.erb]
end
let!(:p... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/interpolations_spec.rb | spec/interpolations_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Interpolations" do
let!(:task) { I18n::Tasks::BaseTask.new }
let(:base_keys) do
{"a" => "hello %{world}", "b" => "foo", "c" => {"d" => "hello %{name}"}, "e" => "ok", "f" => "%%{escaped}",
"g" => "okay"}
end
let(:test_keys) do
{"... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/dotenv_integration_spec.rb | spec/dotenv_integration_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Dotenv integration" do
describe "CLI dotenv loading" do
let(:cli) { I18n::Tasks::CLI.new }
context "when dotenv is available" do
it "attempts to load dotenv" do
# Mock dotenv to be available - using class_double for verificat... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/locale_pathname_spec.rb | spec/locale_pathname_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "LocalePathname" do
describe "#replace_locale" do
def replace_locale(path, from, to)
I18n::Tasks::LocalePathname.replace_locale(path, from, to)
end
it "es.yml" do
expect(replace_locale("es.yml", "es", "fr")).to eq "fr.yml"
... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/split_key_spec.rb | spec/split_key_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "SplitKey" do
include I18n::Tasks::SplitKey
[
# rubocop:disable Lint/InterpolationCheck
["", %w[]],
["a", %w[a]],
["a.b", %w[a b]],
["a.b.", %w[a b]],
["a.b.c", %w[a b c]],
['a.#{b.c}', %w[a #{b.c}]],
['a.#{b.c}.',... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/used_keys_custom_scanner_spec.rb | spec/used_keys_custom_scanner_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "UsedKeysCustomScanner" do
let!(:task) { I18n::Tasks::BaseTask.new }
let(:paths) do
%w[custom_scanner.what_rb]
end
around do |ex|
I18n::Tasks.add_scanner(
"::I18n::Tasks::Scanners::RubyScanner",
receiver_messages: [nil, AS... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/isolating_router_spec.rb | spec/isolating_router_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Isolating router" do
around do |spec|
TestCodebase.setup(
"app/components/movies_component.en.yml" => {en: {title: "Movies"}}.to_yaml,
"app/components/games_component.en.yml" => {en: {title: "Games"}}.to_yaml
)
TestCodebase.... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/used_keys_ruby_prism_spec.rb | spec/used_keys_ruby_prism_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "UsedKeysRubyPrism" do
let!(:task) { I18n::Tasks::BaseTask.new }
let(:extra_search_config) { {} }
let(:paths) { %w[a.rb] }
let(:strict) { true }
around do |ex|
task.config[:search] = {paths: paths, strict: strict, prism: "rails"}.merge(... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/missing_keys_spec.rb | spec/missing_keys_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "MissingKeys" do
describe "#required_plural_keys_for_locale(locale)" do
let(:task) { I18n::Tasks::BaseTask.new }
def configuration_from(locale)
{
"#{locale}": {
i18n: {
plural: {
keys: %i[on... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/used_keys_erb_spec.rb | spec/used_keys_erb_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "UsedKeysErb" do
let!(:task) { I18n::Tasks::BaseTask.new }
let(:paths) do
%w[app/views/application/show.html.erb]
end
let(:ast_matchers) do
%w[I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher]
end
around do |ex|
I18n::Tas... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/used_keys_haml_spec.rb | spec/used_keys_haml_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "UsedKeysHaml" do
let!(:task) { I18n::Tasks::BaseTask.new }
let(:file_name) { "a.html.haml" }
let(:file_content) do
<<~HAML
#first{ title: t('a') }
.second{ title: t('a') }
- # t('a') in a comment is ignored
HAML
end
... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/used_keys_ruby_spec.rb | spec/used_keys_ruby_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "UsedKeysRuby" do
let!(:task) { I18n::Tasks::BaseTask.new }
let(:extra_search_config) { {} }
let(:paths) { %w[a.rb] }
let(:strict) { true }
let(:ast_matchers) do
%w[
I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher
I18n:... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/pattern_scanner_spec.rb | spec/pattern_scanner_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "PatternScanner" do
describe "#keys" do
let(:expected_key) do
"events.show.success"
end
let(:expected_occurrence) do
{path: "spec/fixtures/app/controllers/events_controller.rb",
pos: 836,
line_num: 32,
l... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/i18n_spec.rb | spec/i18n_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe I18n do
let(:i18n) { I18n::Tasks::BaseTask.new }
let(:missing_keys) { i18n.missing_keys }
let(:unused_keys) { i18n.unused_keys }
let(:inconsistent_interpolations) { i18n.inconsistent_interpolations }
it "does not have missing keys" do
e... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/references_spec.rb | spec/references_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Reference keys" do
let(:task) { I18n::Tasks::BaseTask.new }
describe "#process_references" do
it "resolves plain references" do
result = task.process_references(
build_tree(
"reference" => nil,
"not-a-refere... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/key_pattern_matching_spec.rb | spec/key_pattern_matching_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Key pattern" do
include I18n::Tasks::KeyPatternMatching
describe "matching" do
describe "*" do
it "as suffix" do
expect("devise.*").to match_key "devise.some.key"
end
it "as prefix" do
expect("*.some.key").... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/openai_translator_spec.rb | spec/openai_translator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "i18n/tasks/commands"
require "i18n/tasks/translators/openai_translator"
require "openai"
RSpec.describe "OpenAI Translation" do
nil_value_test = ["nil-value-key", nil, nil]
empty_value_test = ["empty-value-key", "", ""]
text_test = ["hello", "Hello, %... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/readme_spec.rb | spec/readme_spec.rb | # frozen_string_literal: true
RSpec.describe "README.md" do
let(:readme) { File.read("README.md", encoding: "UTF-8") }
it "has valid YAML in ```yaml blocks" do
readme.scan(/```yaml\n(.*)(?=^)\n```/) do |m|
expect { YAML.load(m[0]) }.not_to raise_errors
end
end
end
| ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/prism_scanner_spec.rb | spec/prism_scanner_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "PrismScanner" do
describe "controllers" do
it "detects controller" do
source = <<~RUBY
class EventsController < ApplicationController
before_action(:method_in_before_action1, only: :create)
before_action('metho... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/bin_simplecov_helper.rb | spec/bin_simplecov_helper.rb | # frozen_string_literal: true
if ENV["COVERAGE"] && !%w[rbx jruby].include?(RUBY_ENGINE)
ENV["SIMPLECOV_NO_DEFAULTS"] = "1"
require "simplecov"
SimpleCov.command_name "#{$PROGRAM_NAME.sub(%r{^([.]{2}/)+}, "")} #{ARGV.join " "}".strip
SimpleCov.root File.expand_path(File.join(File.dirname(__FILE__), ".."))
re... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/relative_keys_spec.rb | spec/relative_keys_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "i18n/tasks/scanners/relative_keys"
class RelativeKeysUser
include ::I18n::Tasks::Scanners::RelativeKeys
def config
{}
end
end
RSpec.describe "Relative keys" do
let(:relative_keys) { RelativeKeysUser.new }
describe "absolute_key" do
cont... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/plural_keys_spec.rb | spec/plural_keys_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Plural keys" do
let(:task) { I18n::Tasks::BaseTask.new }
let(:base_keys) do
{
regular_key: "a",
plural_key: {
one: "one",
other: "%{count}"
},
not_really_plural: {
one: "a",
green: "b... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/conservative_router_spec.rb | spec/conservative_router_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Conservative router" do
describe "#available_locales" do
before do
TestCodebase.setup(
"config/locales/en.yml" => {en: {a: 1}}.to_yaml,
"config/locales/other.en.yml" => {en: {b: 1}}.to_yaml,
"config/locales/es.yml"... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/yaml_spec.rb | spec/yaml_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "YAML spec" do
describe "emoji retention" do
let(:yaml) do
{
"a" => "hello %{world}😀",
"b" => "foo",
"c" => {
"d" => "hello %{name}"
},
"e" => "ok"
}
end
it "does not strip ... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/pattern_with_scope_scanner_spec.rb | spec/pattern_with_scope_scanner_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "PatternWithScopeScanner" do
def stub_source(scanner, source)
allow(scanner).to receive(:traverse_files) { |&block| [block.call("test")] }
allow(scanner).to receive(:read_file) { source }
end
describe "match_to_key" do
let(:scanner)... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/i18n_tasks_spec.rb | spec/i18n_tasks_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "fileutils"
require "open3"
# Integration tests
RSpec.describe "i18n-tasks" do
delegate :run_cmd, :run_cmd_capture_stdout_and_result, :run_cmd_capture_stderr, :i18n_task, :in_test_app_dir,
to: :TestCodebase
# --- setup ---
bench_keys_count = ENV["... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/used_keys_slim_spec.rb | spec/used_keys_slim_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "UsedKeysSlim" do
let!(:task) { I18n::Tasks::BaseTask.new }
let(:file_name) { "a.html.slim" }
let(:file_content) do
<<~SLIM
div = t 'a'
p = t 'a'
h1 = t 'b'
h2 = t 'c.layer'
h3 = t 'c.layer.underneath_c'
... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
if ENV["COVERAGE"] && !%w[rbx jruby].include?(RUBY_ENGINE)
require "simplecov"
SimpleCov.command_name "RSpec"
end
$LOAD_PATH << File.expand_path("lib", __dir__)
require "i18n/tasks"
require "rake"
require "rainbow"
Rainbow.enabled = false
Dir["spec/support/**/*.rb"].each { |f| req... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/support/fixtures.rb | spec/support/fixtures.rb | # frozen_string_literal: true
# quick'n'dirty fixture loader
module FixturesSupport
def fixtures_contents
@fixtures_contents ||= begin
fixtures_path = "spec/fixtures"
Dir.glob("#{fixtures_path}/**/*").inject({}) do |h, path|
next h if File.directory?(path)
h.update(path[(fixtures_pat... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/support/test_codebase.rb | spec/support/test_codebase.rb | # frozen_string_literal: true
require "fileutils"
require "yaml"
require_relative "capture_std"
require "i18n/tasks/commands"
require "i18n/tasks/cli"
module TestCodebase
AT = "tmp/test_codebase"
class << self
include CaptureStd
def i18n_task(*args)
in_test_app_dir do
::I18n::Tasks::BaseTa... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
glebm/i18n-tasks | https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/support/keys_and_occurrences.rb | spec/support/keys_and_occurrences.rb | # frozen_string_literal: true
module KeysAndOccurrences
# rubocop:disable Metrics/ParameterLists
def make_occurrence(
path: "",
line: "",
pos: 1,
line_pos: 1,
line_num: 1,
raw_key: nil,
candidate_keys: nil
)
::I18n::Tasks::Scanners::Results::Occurrence.new(
path: path,
... | ruby | MIT | b7db1cb2fe1484d93ee1cf14b5100c321d16392a | 2026-01-04T15:57:47.349094Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.