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 |
|---|---|---|---|---|---|---|---|---|
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/app/controllers/application_controller.rb | test-app/app/controllers/application_controller.rb | # frozen_string_literal: true
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
wrap_parameters format: [:json]
respond_to :json
rescue_from 'ActionController... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/app/models/blog.rb | test-app/app/models/blog.rb | # frozen_string_literal: true
class Blog < ActiveRecord::Base
validates :content, presence: true
alias_attribute :headline, :title
alias_attribute :text, :content
# Rails 7.0 introduced new syntax to define enums.
# See https://github.com/rails/rails/pull/50987
if Gem::Version.new(Rails.version) >= Gem::... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/db/schema.rb | test-app/db/schema.rb | # frozen_string_literal: true
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define yo... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/db/migrate/20160218212104_create_blogs.rb | test-app/db/migrate/20160218212104_create_blogs.rb | # frozen_string_literal: true
migration_class = if Gem::Version.new(Rails.version) >= Gem::Version.new('5.0')
ActiveRecord::Migration[4.2]
else
ActiveRecord::Migration
end
class CreateBlogs < migration_class
def change
create_table :blo... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/spec/openapi_helper.rb | test-app/spec/openapi_helper.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.configure do |config|
# Specify a root folder where OpenAPI JSON files are generated
# NOTE: If you're using the rswag-api to serve API descriptions, you'll need
# to ensure that it's configured to serve OpenAPI from the same folder
config.openapi_roo... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/spec/rails_helper.rb | test-app/spec/rails_helper.rb | # frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
abort('The Rails environment is running in production mode!') if... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/spec/spec_helper.rb | test-app/spec/spec_helper.rb | # frozen_string_literal: true
require 'simplecov'
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to alw... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/spec/integration/blogs_spec.rb | test-app/spec/integration/blogs_spec.rb | # frozen_string_literal: true
require 'openapi_helper'
RSpec.describe 'Blogs API', openapi_spec: 'v1/openapi.json', type: :request do
let(:blog) { Blog.create(title: 'foo', content: 'bar', thumbnail: 'thumbnail.png') }
path '/blogs' do
post 'Creates a blog' do
tags 'Blogs'
description 'Creates a ... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/spec/integration/auth_tests_spec.rb | test-app/spec/integration/auth_tests_spec.rb | # frozen_string_literal: true
require 'openapi_helper'
RSpec.describe 'Auth Tests API', openapi_spec: 'v1/openapi.json', type: :request do
path '/auth-tests/basic' do
post 'Authenticates with basic auth' do
tags 'Auth Tests'
operationId 'testBasicAuth'
security [basic_auth: []]
response... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/spec/features/openapi_ui_spec.rb | test-app/spec/features/openapi_ui_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'swagger-ui', :js do
scenario 'browsing api-docs' do
skip "Needs work to run on others' machines"
visit '/api-docs'
expect(page).to have_content('GET /blogs Searches blogs', normalize_ws: true)
expect(page).to have_content('POST /bl... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/spec/rake/rswag_specs_swaggerize_spec.rb | test-app/spec/rake/rswag_specs_swaggerize_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rake'
RSpec.describe 'rswag:specs:swaggerize' do
let(:openapi_root) { Rails.root.join('openapi').to_s }
before do
TestApp::Application.load_tasks
FileUtils.rm_r(openapi_root) if File.exist?(openapi_root)
end
it 'generates OpenAPI JSON file... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/application.rb | test-app/config/application.rb | # frozen_string_literal: true
require File.expand_path('boot', __dir__)
# Pick the frameworks you want:
require 'active_record/railtie'
require 'action_controller/railtie'
require 'action_mailer/railtie'
# require "sprockets/railtie"
# require "rails/test_unit/railtie"
Bundler.require(*Rails.groups)
module TestApp
... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/environment.rb | test-app/config/environment.rb | # frozen_string_literal: true
# Load the rails application
require File.expand_path('application', __dir__)
# Initialize the rails application
TestApp::Application.initialize!
| ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/routes.rb | test-app/config/routes.rb | # frozen_string_literal: true
TestApp::Application.routes.draw do
post '/blogs/flexible', to: 'blogs#flexible_create'
post '/blogs/alternate', to: 'blogs#alternate_create'
resources :blogs
put '/blogs/:id/upload', to: 'blogs#upload'
post 'auth-tests/basic', to: 'auth_tests#basic'
post 'auth-tests/api-key'... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/boot.rb | test-app/config/boot.rb | # frozen_string_literal: true
require 'rubygems'
gemfile = File.expand_path('../../Gemfile', __dir__)
if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
end
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
| ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/initializers/session_store.rb | test-app/config/initializers/session_store.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
TestApp::Application.config.session_store :cookie_store, key: '_dummy_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create th... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/initializers/rswag-ui.rb | test-app/config/initializers/rswag-ui.rb | # frozen_string_literal: true
Rswag::Ui.configure do |c|
# List the OpenAPI endpoints that you want to be documented through the swagger-ui
# The first parameter is the path (absolute or relative to the UI host) to the corresponding
# JSON endpoint and the second is a title that will be displayed in the document... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/initializers/rswag-api.rb | test-app/config/initializers/rswag-api.rb | # frozen_string_literal: true
Rswag::Api.configure do |c|
# Specify a root folder where OpenAPI JSON files are located
# This is used by the OpenAPI middleware to serve requests for API descriptions
# NOTE: If you're using rswag-specs to generate OpenAPI, you'll need to ensure
# that it's configured to generat... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/initializers/wrap_parameters.rb | test-app/config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_co... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/initializers/inflections.rb | test-app/config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
#... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/initializers/backtrace_silencers.rb | test-app/config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/initializers/mime_types.rb | test-app/config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/initializers/secret_token.rb | test-app/config/initializers/secret_token.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
if Rails.version.first.to_i < 5
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and al... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/environments/test.rb | test-app/config/environments/test.rb | # frozen_string_literal: true
TestApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is ... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
rswag/rswag | https://github.com/rswag/rswag/blob/0a5a04983b5fe16f1698f2acf7ec787bf08ebf08/test-app/config/environments/development.rb | test-app/config/environments/development.rb | # frozen_string_literal: true
TestApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you d... | ruby | MIT | 0a5a04983b5fe16f1698f2acf7ec787bf08ebf08 | 2026-01-04T15:57:26.551519Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-dart-sass/spec/manifest_spec.rb | nanoc-dart-sass/spec/manifest_spec.rb | # frozen_string_literal: true
describe 'manifest', chdir: false do
example do
expect('nanoc-dart-sass').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-dart-sass/spec/gem_spec.rb | nanoc-dart-sass/spec/gem_spec.rb | # frozen_string_literal: true
describe 'nanoc-dart-sass.gem', :stdio, chdir: false do
subject(:build_gem) do
TTY::Command.new.run('gem build nanoc-dart-sass.gemspec')
end
around do |ex|
Dir['*.gem'].each { |f| FileUtils.rm(f) }
ex.run
Dir['*.gem'].each { |f| FileUtils.rm(f) }
end
it 'builds... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-dart-sass/spec/spec_helper.rb | nanoc-dart-sass/spec/spec_helper.rb | # frozen_string_literal: true
require_relative '../../common/spec/spec_helper_head'
require 'nanoc/dart_sass'
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-dart-sass/spec/nanoc/dart_sass/filter_spec.rb | nanoc-dart-sass/spec/nanoc/dart_sass/filter_spec.rb | # frozen_string_literal: true
describe Nanoc::DartSass::Filter, :helper do
it 'supports simple .scss' do
# Create item
ctx.create_item('stuff', {}, '/foo.scss')
ctx.create_rep(ctx.items['/foo.scss'], '/assets/foo.css')
ctx.item = ctx.items['/foo.scss']
filter = described_class.new(ctx.assigns)
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-dart-sass/spec/nanoc/dart_sass/filter/nanoc_importer_spec.rb | nanoc-dart-sass/spec/nanoc/dart_sass/filter/nanoc_importer_spec.rb | # frozen_string_literal: true
describe Nanoc::DartSass::Filter::NanocImporter do
let(:importer) { described_class.new(items_view) }
let(:items_view) { Nanoc::Core::ItemCollectionWithoutRepsView.new(items, view_context) }
let(:config) { Nanoc::Core::Configuration.new(dir: Dir.getwd).with_defaults }
let(:base_i... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-dart-sass/lib/nanoc-dart-sass.rb | nanoc-dart-sass/lib/nanoc-dart-sass.rb | # frozen_string_literal: true
require 'nanoc/dart_sass'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-dart-sass/lib/nanoc/dart-sass.rb | nanoc-dart-sass/lib/nanoc/dart-sass.rb | # frozen_string_literal: true
require_relative 'dart_sass'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-dart-sass/lib/nanoc/dart_sass.rb | nanoc-dart-sass/lib/nanoc/dart_sass.rb | # frozen_string_literal: true
module Nanoc
module DartSass
end
end
require 'sass-embedded'
require 'nanoc/dart_sass/version'
require 'nanoc/dart_sass/filter'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-dart-sass/lib/nanoc/dart_sass/version.rb | nanoc-dart-sass/lib/nanoc/dart_sass/version.rb | # frozen_string_literal: true
module Nanoc
module DartSass
VERSION = '2.0.0'
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-dart-sass/lib/nanoc/dart_sass/filter.rb | nanoc-dart-sass/lib/nanoc/dart_sass/filter.rb | # frozen_string_literal: true
module Nanoc
module DartSass
class Filter < Nanoc::Filter
identifier :dart_sass
# Runs the content through [Dart Sass](https://sass-lang.com/dart-sass).
# Parameters passed as `:args` will be passed on to Dart Sass.
#
# @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-tilt/spec/manifest_spec.rb | nanoc-tilt/spec/manifest_spec.rb | # frozen_string_literal: true
describe 'manifest', chdir: false do
example do
expect('nanoc-tilt').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-tilt/spec/gem_spec.rb | nanoc-tilt/spec/gem_spec.rb | # frozen_string_literal: true
describe 'nanoc-tilt.gem', :stdio, chdir: false do
subject(:build_gem) do
TTY::Command.new.run('gem build nanoc-tilt.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-tilt/spec/spec_helper.rb | nanoc-tilt/spec/spec_helper.rb | # frozen_string_literal: true
require_relative '../../common/spec/spec_helper_head'
require 'nanoc/tilt'
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-tilt/spec/nanoc/tilt/filter_spec.rb | nanoc-tilt/spec/nanoc/tilt/filter_spec.rb | # frozen_string_literal: true
describe Nanoc::Tilt::Filter do
it 'supports .erb' do
item = Nanoc::Core::Item.new('stuff', {}, '/foo.erb')
item_rep = Nanoc::Core::ItemRep.new(item, :default)
filter = described_class.new({ item:, item_rep: })
res = filter.run('<%= "a" * 3 %>')
expect(res.strip).t... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-tilt/lib/nanoc-tilt.rb | nanoc-tilt/lib/nanoc-tilt.rb | # frozen_string_literal: true
require 'nanoc/tilt'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-tilt/lib/nanoc/tilt.rb | nanoc-tilt/lib/nanoc/tilt.rb | # frozen_string_literal: true
module Nanoc
module Tilt
end
end
require 'tilt'
require 'nanoc/tilt/version'
require 'nanoc/tilt/filter'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-tilt/lib/nanoc/tilt/version.rb | nanoc-tilt/lib/nanoc/tilt/version.rb | # frozen_string_literal: true
module Nanoc
module Tilt
VERSION = '1.0.0'
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-tilt/lib/nanoc/tilt/filter.rb | nanoc-tilt/lib/nanoc/tilt/filter.rb | # frozen_string_literal: true
module Nanoc
module Tilt
class Filter < Nanoc::Filter
identifier :tilt
# Runs the content through [Tilt](https://github.com/rtomayko/tilt).
# Parameters passed as `:args` will be passed on to Tilt.
#
# @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-checking/test/helper.rb | nanoc-checking/test/helper.rb | # frozen_string_literal: true
$VERBOSE = false
require 'simplecov'
SimpleCov.start
require 'minitest/mock'
require 'minitest/autorun'
require 'mocha/minitest'
require 'vcr'
require 'debug'
require 'tmpdir'
require 'stringio'
require 'yard'
VCR.configure do |c|
c.cassette_library_dir = 'test/fixtures/vcr_cassette... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/test/nanoc/checking/test_link_collector.rb | nanoc-checking/test/nanoc/checking/test_link_collector.rb | # frozen_string_literal: true
require 'helper'
module Nanoc
module Checking
class LinkCollectorTest < Nanoc::TestCase
def test_all
# Create dummy data
FileUtils.mkdir_p('test dir')
file_a = File.join(Dir.pwd, 'file-a.html')
file_b = File.join(Dir.pwd, 'test dir', 'file-b.ht... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/manifest_spec.rb | nanoc-checking/spec/manifest_spec.rb | # frozen_string_literal: true
describe 'manifest', chdir: false do
example do
expect('nanoc-checking').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-checking/spec/gem_spec.rb | nanoc-checking/spec/gem_spec.rb | # frozen_string_literal: true
describe 'nanoc-checking.gem', :stdio, chdir: false do
subject do
TTY::Command.new.run('gem build nanoc-checking.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
e... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/spec_helper.rb | nanoc-checking/spec/spec_helper.rb | # frozen_string_literal: true
require_relative '../../common/spec/spec_helper_head'
require 'nanoc/checking'
require 'vcr'
VCR.configure do |c|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
c.hook_into :webmock
end
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-checking/spec/nanoc/checking/check_spec.rb | nanoc-checking/spec/nanoc/checking/check_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::Check do
let(:config) do
Nanoc::Core::Configuration.new(
dir: Dir.getwd,
hash: config_hash,
).with_defaults
end
let(:config_hash) { {} }
let(:reps) { Nanoc::Core::ItemRepRepo.new }
let(:site) do
Nanoc::Core::Site.new(
co... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/dsl_spec.rb | nanoc-checking/spec/nanoc/checking/dsl_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::DSL do
it 'can read from file' do
File.write('Checks', "check :foo do\n\nend\ndeploy_check :bar\n")
enabled_checks = []
described_class.from_file('Checks', enabled_checks:)
expect(Nanoc::Checking::Check.named(:foo)).not_to be_nil
expect(ena... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/runner_spec.rb | nanoc-checking/spec/nanoc/checking/runner_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::Runner, :site do
subject(:runner) { described_class.new(site) }
let(:site) { Nanoc::Core::SiteLoader.new.new_from_cwd }
describe '#run_specific' do
it 'can run a predefined check' do
File.write('output/blah', 'I am stale! Haha!')
expect { ... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/command_runners/check_spec.rb | nanoc-checking/spec/nanoc/checking/command_runners/check_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::CommandRunners::Check, :site, :stdio do
describe '#run' do
before do
File.write('Checks', "deploy_check :stale\n")
end
context 'without options and arguments' do
subject { Nanoc::CLI.run(['check']) }
context 'no issues for any ch... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/checks/html_spec.rb | nanoc-checking/spec/nanoc/checking/checks/html_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::Checks::HTML do
let(:check) { described_class.create(site) }
let(:site) do
Nanoc::Core::Site.new(
config:,
code_snippets:,
data_source: Nanoc::Core::InMemoryDataSource.new(items, layouts),
)
end
let(:config) { Nanoc::Cor... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/checks/css_spec.rb | nanoc-checking/spec/nanoc/checking/checks/css_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::Checks::CSS do
let(:check) { described_class.create(site) }
let(:site) do
Nanoc::Core::Site.new(
config:,
code_snippets:,
data_source: Nanoc::Core::InMemoryDataSource.new(items, layouts),
)
end
let(:config) { Nanoc::Core... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/checks/mixed_content_spec.rb | nanoc-checking/spec/nanoc/checking/checks/mixed_content_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::Checks::MixedContent do
let(:check) { described_class.create(site) }
let(:site) do
Nanoc::Core::Site.new(
config:,
code_snippets:,
data_source: Nanoc::Core::InMemoryDataSource.new(items, layouts),
)
end
let(:config) { Na... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/checks/internal_links_spec.rb | nanoc-checking/spec/nanoc/checking/checks/internal_links_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::Checks::InternalLinks do
let(:check) { described_class.create(site) }
let(:site) do
Nanoc::Core::Site.new(
config:,
code_snippets:,
data_source: Nanoc::Core::InMemoryDataSource.new(items, layouts),
)
end
let(:config) { N... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/checks/stale_spec.rb | nanoc-checking/spec/nanoc/checking/checks/stale_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::Checks::Stale do
let(:check) { described_class.create(site) }
let(:site) do
Nanoc::Core::Site.new(
config:,
code_snippets:,
data_source: Nanoc::Core::InMemoryDataSource.new(items, layouts),
)
end
let(:config) { Nanoc::Co... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/spec/nanoc/checking/checks/external_links_spec.rb | nanoc-checking/spec/nanoc/checking/checks/external_links_spec.rb | # frozen_string_literal: true
describe Nanoc::Checking::Checks::ExternalLinks do
let(:check) do
described_class.create(site).tap do |c|
def c.request_url_once(_url)
Net::HTTPResponse.new('1.1', '200', 'okay')
end
end
end
let(:site) do
Nanoc::Core::Site.new(
config:,
c... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc-checking.rb | nanoc-checking/lib/nanoc-checking.rb | # frozen_string_literal: true
require 'nanoc/checking'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking.rb | nanoc-checking/lib/nanoc/checking.rb | # frozen_string_literal: true
require 'nanoc-core'
require 'nanoc-cli'
module Nanoc
module Checking
end
end
require_relative 'checking/version'
require_relative 'checking/check'
require_relative 'checking/checks'
require_relative 'checking/command_runners'
require_relative 'checking/dsl'
require_relative 'checki... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/link_collector.rb | nanoc-checking/lib/nanoc/checking/link_collector.rb | # frozen_string_literal: true
module ::Nanoc
module Checking
class LinkCollector
# HTML5 element attributes
URI_ATTRS = {
'a' => %i[href ping],
'area' => %i[href ping],
'audio' => %i[src],
'base' => %i[href],
'blockquote' => %i[cite],
'form' => %i[actio... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/version.rb | nanoc-checking/lib/nanoc/checking/version.rb | # frozen_string_literal: true
module Nanoc
module Checking
VERSION = '1.0.6'
end
end
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/issue.rb | nanoc-checking/lib/nanoc/checking/issue.rb | # frozen_string_literal: true
module Nanoc
module Checking
# @api private
class Issue
attr_reader :description
attr_reader :subject
attr_reader :check_class
def initialize(desc, subject, check_class)
@description = desc
@subject = subject
@check_class ... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/command_runners.rb | nanoc-checking/lib/nanoc/checking/command_runners.rb | # frozen_string_literal: true
# @api private
module Nanoc
module Checking
module CommandRunners
end
end
end
require_relative 'command_runners/check'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/loader.rb | nanoc-checking/lib/nanoc/checking/loader.rb | # frozen_string_literal: true
module Nanoc
module Checking
# @api private
class Loader
CHECKS_FILENAMES = ['Checks', 'Checks.rb', 'checks', 'checks.rb'].freeze
def initialize(config:)
@config = config
end
def run
dsl
end
def enabled_checks
(enabl... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/dsl.rb | nanoc-checking/lib/nanoc/checking/dsl.rb | # frozen_string_literal: true
module Nanoc
module Checking
# @api private
class DSL
def self.from_file(filename, enabled_checks:)
dsl = new(enabled_checks:)
absolute_filename = File.expand_path(filename)
dsl.instance_eval(File.read(filename), absolute_filename)
dsl
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/runner.rb | nanoc-checking/lib/nanoc/checking/runner.rb | # frozen_string_literal: true
module Nanoc
module Checking
# Runner is reponsible for running issue checks.
#
# @api private
class Runner
# Number of threads to use for running checks.
NUM_THREADS = 5
# @param [Nanoc::Core::Site] site The Nanoc site this runner is for
def ini... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/check.rb | nanoc-checking/lib/nanoc/checking/check.rb | # frozen_string_literal: true
module Nanoc
module Checking
# @api private
class OutputDirNotFoundError < ::Nanoc::Core::Error
def initialize(directory_path)
super("Unable to run check against output directory at “#{directory_path}”: directory does not exist.")
end
end
# @api priv... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/checks.rb | nanoc-checking/lib/nanoc/checking/checks.rb | # frozen_string_literal: true
# @api private
module Nanoc
module Checking
module Checks
end
end
end
require_relative 'checks/w3c_validator'
require_relative 'checks/css'
require_relative 'checks/external_links'
require_relative 'checks/html'
require_relative 'checks/internal_links'
require_relative 'chec... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/commands/check.rb | nanoc-checking/lib/nanoc/checking/commands/check.rb | # frozen_string_literal: true
usage 'check [options] [names]'
summary 'run issue checks'
description "
Run issue checks on the current site. If the `--all` option is passed, all available issue checks will be run. By default, the issue checks marked for deployment will be run.
"
flag :a, :all, 'run all checks'
fla... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/command_runners/check.rb | nanoc-checking/lib/nanoc/checking/command_runners/check.rb | # frozen_string_literal: true
module Nanoc
module Checking
module CommandRunners
class Check < ::Nanoc::CLI::CommandRunner
def run
site = load_site
runner = Nanoc::Checking::Runner.new(site)
if options[:list]
runner.list_checks
return
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/checks/css.rb | nanoc-checking/lib/nanoc/checking/checks/css.rb | # frozen_string_literal: true
module Nanoc
module Checking
module Checks
# @api private
class CSS < ::Nanoc::Checking::Checks::W3CValidator
identifier :css
def extension
'css'
end
def validator_class
::W3CValidators::CSSValidator
end
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/checks/internal_links.rb | nanoc-checking/lib/nanoc/checking/checks/internal_links.rb | # frozen_string_literal: true
module Nanoc
module Checking
module Checks
# A check that verifies that all internal links point to a location that exists.
#
# @api private
class InternalLinks < ::Nanoc::Checking::Check
identifiers :internal_links, :ilinks
# Starts the vali... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/checks/stale.rb | nanoc-checking/lib/nanoc/checking/checks/stale.rb | # frozen_string_literal: true
module Nanoc
module Checking
module Checks
# @api private
class Stale < ::Nanoc::Checking::Check
identifier :stale
def run
output_filenames.each do |f|
next if pruner.filename_excluded?(f)
next if item_rep_paths.include?... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/checks/mixed_content.rb | nanoc-checking/lib/nanoc/checking/checks/mixed_content.rb | # frozen_string_literal: true
module Nanoc
module Checking
module Checks
# A check that verifies HTML files do not reference external resources with
# URLs that would trigger "mixed content" warnings.
#
# @api private
class MixedContent < ::Nanoc::Checking::Check
identifier ... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/checks/external_links.rb | nanoc-checking/lib/nanoc/checking/checks/external_links.rb | # frozen_string_literal: true
module Nanoc
module Checking
module Checks
# A validator that verifies that all external links point to a location that exists.
#
# @api private
class ExternalLinks < ::Nanoc::Checking::Check
identifiers :external_links, :elinks
def run
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/checks/w3c_validator.rb | nanoc-checking/lib/nanoc/checking/checks/w3c_validator.rb | # frozen_string_literal: true
module Nanoc
module Checking
module Checks
# @api private
class W3CValidator < ::Nanoc::Checking::Check
def run
require 'w3c_validators'
Dir[@config.output_dir + '/**/*.' + extension].each do |filename|
results = validator_class.n... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-checking/lib/nanoc/checking/checks/html.rb | nanoc-checking/lib/nanoc/checking/checks/html.rb | # frozen_string_literal: true
module Nanoc
module Checking
module Checks
# @api private
class HTML < ::Nanoc::Checking::Checks::W3CValidator
identifier :html
def extension
'{htm,html}'
end
def validator_class
::W3CValidators::NuValidator
e... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/manifest_spec.rb | nanoc-core/spec/manifest_spec.rb | # frozen_string_literal: true
describe 'manifest', chdir: false do
example do
expect('nanoc-core').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-core/spec/meta_spec.rb | nanoc-core/spec/meta_spec.rb | # frozen_string_literal: true
describe 'meta', chdir: false do
# rubocop:disable RSpec/ExampleLength
it 'is covered by specs' do
regular_files = Dir['lib/nanoc/core/**/*.rb']
regular_file_base_names = regular_files.map { |fn| fn.gsub(%r{^lib/nanoc/core/|\.rb$}, '') }
spec_files = Dir['spec/nanoc/core/... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/spec_helper.rb | nanoc-core/spec/spec_helper.rb | # frozen_string_literal: true
require_relative '../../common/spec/spec_helper_head_core'
require 'nanoc/core'
require_relative '../../common/spec/spec_helper_foot_core'
| ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/checksummer_spec.rb | nanoc-core/spec/nanoc/core/checksummer_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::Checksummer::VerboseDigest do
let(:digest) { described_class.new }
it 'concatenates' do
digest.update('foo')
digest.update('bar')
expect(digest.to_s).to eql('foobar')
end
end
describe Nanoc::Core::Checksummer::CompactDigest do
let(:digest) { des... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/notification_center_spec.rb | nanoc-core/spec/nanoc/core/notification_center_spec.rb | # frozen_string_literal: true
shared_examples 'a notification center' do
it 'receives notification after subscribing' do
res = false
subject.on :ping_received, :test do
res = true
end
subject.post(:ping_received)
expect(res).to be(true)
end
it 'does not receive notification after unsu... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/temp_filename_factory_spec.rb | nanoc-core/spec/nanoc/core/temp_filename_factory_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::TempFilenameFactory do
subject(:factory) { described_class.new }
let(:prefix) { 'foo' }
describe '#create' do
it 'creates unique paths' do
path_a = subject.create(prefix)
path_b = subject.create(prefix)
expect(path_a).not_to eq(path_b)
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/outdatedness_store_spec.rb | nanoc-core/spec/nanoc/core/outdatedness_store_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::OutdatednessStore do
subject(:store) { described_class.new(config:) }
let(:item) { Nanoc::Core::Item.new('foo', {}, '/foo.md') }
let(:rep) { Nanoc::Core::ItemRep.new(item, :foo) }
let(:config) { Nanoc::Core::Configuration.new(dir: Dir.getwd).with_defaults }... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/outdatedness_status_spec.rb | nanoc-core/spec/nanoc/core/outdatedness_status_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::OutdatednessStatus do
let(:status) { described_class.new }
describe '#reasons' do
subject { status.reasons }
context 'default' do
it { is_expected.to eql([]) }
end
context 'one passed in' do
let(:reasons) do
[
Nano... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/string_pattern_spec.rb | nanoc-core/spec/nanoc/core/string_pattern_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::StringPattern do
describe '#match?' do
it 'matches simple strings' do
pattern = described_class.new('d*key')
expect(pattern.match?('donkey')).to be(true)
expect(pattern.match?('giraffe')).to be(false)
end
it 'matches with pathname op... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/site_spec.rb | nanoc-core/spec/nanoc/core/site_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::Site do
describe '#freeze' do
let(:site) do
described_class.new(
config:,
code_snippets:,
data_source: Nanoc::Core::InMemoryDataSource.new(items, layouts),
)
end
let(:config) do
Nanoc::Core::Configuration.new(d... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/checksum_store_spec.rb | nanoc-core/spec/nanoc/core/checksum_store_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::ChecksumStore do
let(:store) { described_class.new(config:, objects:) }
let(:config) { Nanoc::Core::Configuration.new(dir: Dir.getwd).with_defaults }
let(:objects) { [item, code_snippet] }
let(:item) { Nanoc::Core::Item.new('asdf', item_attributes, '/foo.m... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/changes_stream_spec.rb | nanoc-core/spec/nanoc/core/changes_stream_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::ChangesStream do
let(:simple_stream) do
described_class.new do |cl|
cl.unknown
sleep
end
end
it 'returns a stream of events generated by the listener' do
buffered_stream = SlowEnumeratorTools.buffer(simple_stream, 1)
expect(buffered... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/regexp_pattern_spec.rb | nanoc-core/spec/nanoc/core/regexp_pattern_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::RegexpPattern do
let(:pattern) { described_class.new(/the answer is (\d+)/) }
describe '#match?' do
it 'matches' do
expect(pattern.match?('the answer is 42')).to be(true)
expect(pattern.match?('the answer is donkey')).to be(false)
end
end
... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/binary_compiled_content_cache_spec.rb | nanoc-core/spec/nanoc/core/binary_compiled_content_cache_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::BinaryCompiledContentCache do
let(:cache) { described_class.new(config:) }
let(:items) { [item] }
let(:item) { Nanoc::Core::Item.new('asdf', {}, '/foo.md') }
let(:item_rep) { Nanoc::Core::ItemRep.new(item, :default) }
let(:other_item) { Nanoc::Core::Item... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/dependency_tracker_spec.rb | nanoc-core/spec/nanoc/core/dependency_tracker_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::DependencyTracker do
let(:tracker) { described_class.new(store, root: item_root) }
let(:store) { Nanoc::Core::DependencyStore.new(empty_items, empty_layouts, config) }
let(:item_a) { Nanoc::Core::Item.new('a', {}, '/a.md') }
let(:item_b) { Nanoc::Core::Item... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/data_source_spec.rb | nanoc-core/spec/nanoc/core/data_source_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::DataSource, :stdio do
subject(:data_source) do
described_class.new({}, nil, nil, {})
end
it 'has an empty #up implementation' do # rubocop:disable RSpec/NoExpectationExample
data_source.up
end
it 'has an empty #down implementation' do # rubocop:di... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/item_rep_writer_spec.rb | nanoc-core/spec/nanoc/core/item_rep_writer_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::ItemRepWriter do
describe '#write' do
subject { described_class.new.write(item_rep, compiled_content_repo, snapshot_name, written_paths) }
let(:raw_path) { Dir.getwd + '/output/blah.dat' }
let(:item) { Nanoc::Core::Item.new(orig_content, {}, '/foo') }... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/context_spec.rb | nanoc-core/spec/nanoc/core/context_spec.rb | # frozen_string_literal: true
module Nanoc
module Core
module Helper37F4A8EAF27F4DB0B4AB61117975D519
def my_sample
'sample succeeded!'
end
end
end
end
describe Nanoc::Core::Context do
let(:context) do
described_class.new(foo: 'bar', baz: 'quux')
end
it 'provides instance var... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/site_loader_spec.rb | nanoc-core/spec/nanoc/core/site_loader_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::SiteLoader do
let(:loader) { described_class.new }
Class.new(Nanoc::Core::DataSource) do
identifier :iyf5eeqefhzyu6vdda7cibfbhou1mnm7
def items
[Nanoc::Core::Item.new('I am Denis!', {}, '/about.md')]
end
def layouts
[Nanoc::Core::La... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/action_sequence_store_spec.rb | nanoc-core/spec/nanoc/core/action_sequence_store_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::ActionSequenceStore do
let(:store) { described_class.new(config:) }
let(:config) { Nanoc::Core::Configuration.new(dir: Dir.getwd).with_defaults }
describe '#[]' do
subject { store[obj] }
let(:known_obj) { Nanoc::Core::Item.new('asdf', {}, '/asdf.md')... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/in_memory_data_source_spec.rb | nanoc-core/spec/nanoc/core/in_memory_data_source_spec.rb | # frozen_string_literal: true
describe Nanoc::Core::InMemoryDataSource, :stdio do
subject(:data_source) do
described_class.new(items, layouts, original_data_source)
end
let(:items) { Nanoc::Core::ItemCollection.new(config, []) }
let(:layouts) { Nanoc::Core::LayoutCollection.new(config, []) }
let(:confi... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
nanoc/nanoc | https://github.com/nanoc/nanoc/blob/59f767805018b4fc69e0bba896309c0028d3f53e/nanoc-core/spec/nanoc/core/document_spec.rb | nanoc-core/spec/nanoc/core/document_spec.rb | # frozen_string_literal: true
shared_examples 'a document' do
describe '#initialize' do
subject do
described_class.new(
content_arg,
attributes_arg,
identifier_arg,
checksum_data: checksum_data_arg,
content_checksum_data: content_checksum_data_arg,
attributes... | ruby | MIT | 59f767805018b4fc69e0bba896309c0028d3f53e | 2026-01-04T15:57:49.460670Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.