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 |
|---|---|---|---|---|---|---|---|---|
piotrmurach/tty-pie | https://github.com/piotrmurach/tty-pie/blob/98b8b1d1779cce8242fb35646aaf06df24291a73/spec/unit/add_spec.rb | spec/unit/add_spec.rb | # frozen_string_literal: true
RSpec.describe TTY::Pie, "#add" do
it "adds additional item" do
data = [{name: "BTC", value: 5977, fill: "*"}]
pie = TTY::Pie.new(data: data, radius: 2)
pie << {name: "BCH", value: 3045, fill: "+"}
pie << {name: "LTC", value: 2030, fill: "x"}
output = pie.render
... | ruby | MIT | 98b8b1d1779cce8242fb35646aaf06df24291a73 | 2026-01-04T17:37:26.546188Z | false |
piotrmurach/tty-pie | https://github.com/piotrmurach/tty-pie/blob/98b8b1d1779cce8242fb35646aaf06df24291a73/examples/format.rb | examples/format.rb | # frozen_string_literal: true
require_relative "../lib/tty-pie"
data = [
{name: "BTC", value: 5977, color: :yellow},
{name: "BCH", value: 3045, color: :green},
{name: "LTC", value: 2030, color: :magenta}
]
pie = TTY::Pie.new(
data: data,
legend: {
format: "%<label>s %<name>s $%<currency>s (%<percent>.0... | ruby | MIT | 98b8b1d1779cce8242fb35646aaf06df24291a73 | 2026-01-04T17:37:26.546188Z | false |
piotrmurach/tty-pie | https://github.com/piotrmurach/tty-pie/blob/98b8b1d1779cce8242fb35646aaf06df24291a73/examples/fill.rb | examples/fill.rb | # frozen_string_literal: true
require_relative "../lib/tty-pie"
data = [
{name: "BTC", value: 5977, color: :bright_yellow, fill: "*"},
{name: "BCH", value: 3045, color: :bright_green, fill: "x"},
{name: "LTC", value: 2030, color: :bright_magenta, fill: "@"},
{name: "ETH", value: 2350, color: :bright_cyan, fil... | ruby | MIT | 98b8b1d1779cce8242fb35646aaf06df24291a73 | 2026-01-04T17:37:26.546188Z | false |
piotrmurach/tty-pie | https://github.com/piotrmurach/tty-pie/blob/98b8b1d1779cce8242fb35646aaf06df24291a73/examples/basic.rb | examples/basic.rb | # frozen_string_literal: true
require_relative "../lib/tty-pie"
data = [
{name: "BTC", value: 5977, color: :bright_yellow},
{name: "BCH", value: 3045, color: :bright_green},
{name: "LTC", value: 2030, color: :bright_magenta},
{name: "ETH", value: 2350, color: :bright_cyan}
]
pie = TTY::Pie.new(data: data, ra... | ruby | MIT | 98b8b1d1779cce8242fb35646aaf06df24291a73 | 2026-01-04T17:37:26.546188Z | false |
piotrmurach/tty-pie | https://github.com/piotrmurach/tty-pie/blob/98b8b1d1779cce8242fb35646aaf06df24291a73/lib/tty-pie.rb | lib/tty-pie.rb | # frozen_string_literal: true
require_relative "tty/pie"
| ruby | MIT | 98b8b1d1779cce8242fb35646aaf06df24291a73 | 2026-01-04T17:37:26.546188Z | false |
piotrmurach/tty-pie | https://github.com/piotrmurach/tty-pie/blob/98b8b1d1779cce8242fb35646aaf06df24291a73/lib/tty/pie.rb | lib/tty/pie.rb | # frozen_string_literal: true
require "pastel"
require "tty-cursor"
require_relative "pie/data_item"
require_relative "pie/version"
module TTY
# Responsible for drawing pie chart in a terminal
#
# @api public
class Pie
# The full circle degrees
#
# @return [Integer]
#
# @api private
F... | ruby | MIT | 98b8b1d1779cce8242fb35646aaf06df24291a73 | 2026-01-04T17:37:26.546188Z | false |
piotrmurach/tty-pie | https://github.com/piotrmurach/tty-pie/blob/98b8b1d1779cce8242fb35646aaf06df24291a73/lib/tty/pie/data_item.rb | lib/tty/pie/data_item.rb | # frozen_string_literal: true
require "pastel"
module TTY
class Pie
# Encapsulates a single data item
#
# @api private
class DataItem
# Default legend label format
#
# @return [String]
#
# @api private
LABEL_FORMAT = "%<label>s %<name>s %<percent>.2f%%"
# T... | ruby | MIT | 98b8b1d1779cce8242fb35646aaf06df24291a73 | 2026-01-04T17:37:26.546188Z | false |
piotrmurach/tty-pie | https://github.com/piotrmurach/tty-pie/blob/98b8b1d1779cce8242fb35646aaf06df24291a73/lib/tty/pie/version.rb | lib/tty/pie/version.rb | # frozen_string_literal: true
module TTY
class Pie
VERSION = "0.4.0"
end # Pie
end # TTY
| ruby | MIT | 98b8b1d1779cce8242fb35646aaf06df24291a73 | 2026-01-04T17:37:26.546188Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/spec_helper.rb | spec/spec_helper.rb | require 'simplecov'
SimpleCov.start
$LOAD_PATH.unshift File.expand_path('lib', __FILE__)
require 'vcr'
require 'yaml'
require 'contentful_middleman'
require 'middleman-core'
RSpec.configure do |config|
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
VCR.configure do |config|... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/version_hash_spec.rb | spec/contentful_middleman/version_hash_spec.rb | require 'spec_helper'
describe ContentfulMiddleman::VersionHash do
let(:path) { File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures', 'space_hash_fixtures')) }
describe 'class methods' do
it '::source_root=' do
described_class.source_root = 'foobar'
expect(described_class.instance_va... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/core_spec.rb | spec/contentful_middleman/core_spec.rb | require 'spec_helper'
class MapperDouble
end
describe ContentfulMiddleman::Core do
subject { described_class.new Middleman::Application.new }
let(:options) { subject.options }
before(:each) do
ContentfulMiddleman.instance_variable_set(:@contentful_middleman_instances, [])
end
describe 'options' do
... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/import_task_spec.rb | spec/contentful_middleman/import_task_spec.rb | require 'spec_helper'
class ClientDouble
def entries
[]
end
def options
OptionsDouble.new
end
end
describe ContentfulMiddleman::ImportTask do
let(:path) { File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures', 'space_hash_fixtures')) }
let(:client) { ClientDouble.new }
subject { d... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/instance_spec.rb | spec/contentful_middleman/instance_spec.rb | require 'spec_helper'
class ExtensionDouble
attr_reader :options
def initialize(options = OptionsDouble.new)
@options = options
end
end
class MapperDouble
end
describe ContentfulMiddleman::Instance do
let(:options) { OptionsDouble.new }
let(:extension) { ExtensionDouble.new(options) }
subject { descr... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/helpers_spec.rb | spec/contentful_middleman/helpers_spec.rb | require 'spec_helper'
class CustomEntryRenderer < RichTextRenderer::BaseNodeRenderer
def render(node)
"<div>Custom Content</div>"
end
end
class OtherCustomEntryRenderer < RichTextRenderer::BaseNodeRenderer
def render(node)
"<h1>#{node['data'].body}</h1>"
end
end
class InstanceMock
def initialize(ma... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/webhook_handler_spec.rb | spec/contentful_middleman/webhook_handler_spec.rb | require 'spec_helper'
class ContentfulMiddleman::WebhookHandler
def sleep(*)
nil
end
def system(*)
nil
end
end
describe ContentfulMiddleman::WebhookHandler do
subject { described_class.new ServerDouble.new, Logger.new(STDOUT), 10 }
describe 'class methods' do
it '::start' do
expect(Con... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/mappers/base_spec.rb | spec/contentful_middleman/mappers/base_spec.rb | require 'spec_helper'
describe ContentfulMiddleman::Mapper::Base do
let(:entries) do
vcr('mappers/entries') {
client = Contentful::Client.new(
access_token: 'b4c0n73n7fu1',
space: 'cfexampleapi',
dynamic_entries: :auto
)
client.entries
}
end
let(:entries_locali... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/tools/preview_proxy_spec.rb | spec/contentful_middleman/tools/preview_proxy_spec.rb | require 'spec_helper'
describe ContentfulMiddleman::Tools::PreviewProxy do
subject do
preview_proxy = nil
vcr('tools/preview_helper') {
preview_proxy = described_class.instance(space: 'cfexampleapi', access_token: 'b4c0n73n7fu1', api_url: 'cdn.contentful.com')
}
preview_proxy
end
before(:e... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/tools/backup_spec.rb | spec/contentful_middleman/tools/backup_spec.rb | require 'spec_helper'
class DoBackupDouble
include ContentfulMiddleman::Tools::Backup::InstanceMethods
end
describe ContentfulMiddleman::Tools::NullBackup do
describe 'instance methods' do
describe 'do nothing' do
it '#restore' do
expect(subject.restore).to eq nil
end
it '#destroy' ... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/commands/context_spec.rb | spec/contentful_middleman/commands/context_spec.rb | require 'spec_helper'
describe ContentfulMiddleman::Context do
describe 'instance methods' do
it '#set' do
subject.set('foo', 'bar')
expect(subject.foo).to eq 'bar'
end
it '#get' do
subject.set('foo', 'bar')
expect(subject.get('foo')).to eq 'bar'
end
describe '#method_mi... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/local_data/file_spec.rb | spec/contentful_middleman/local_data/file_spec.rb | require 'spec_helper'
class ThorDouble
def create_file(path, *args, &block)
end
end
describe ContentfulMiddleman::LocalData::File do
describe 'class methods' do
it '::thor= / ::thor' do
expect(described_class.thor).to eq nil
described_class.thor = 'foo'
expect(described_class.thor).to eq... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/spec/contentful_middleman/local_data/store_spec.rb | spec/contentful_middleman/local_data/store_spec.rb | require 'spec_helper'
class FileDouble
def write
end
end
describe ContentfulMiddleman::LocalData::Store do
let(:path) { File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'backup_fixtures')) }
before do
described_class.base_path = nil
end
describe 'class methods' do
it ':... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/examples/mappers/backref.rb | examples/mappers/backref.rb | # A function that returns a Mapper class for adding back-references to
# contentful data files. If a Product content type had a "company" entry field
# that referenced a Company content type, using the following BackrefMapper on
# the Company content type would add a "products" field to the company data
# files with a... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/middleman_extension.rb | lib/middleman_extension.rb | require 'contentful_middleman'
| ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman.rb | lib/contentful_middleman.rb | require "middleman-core"
require 'contentful_middleman/version'
require 'contentful_middleman/core'
require "contentful_middleman/commands/contentful"
::Middleman::Extensions.register(:contentful, ContentfulMiddleman::Core)
| ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/core.rb | lib/contentful_middleman/core.rb | require 'logger'
require 'middleman-core'
require 'contentful'
require 'contentful/webhook/listener'
require_relative 'mappers/base'
require_relative 'helpers'
require_relative 'instance'
require_relative 'webhook_handler'
# The Contentful Middleman extensions allows to load managed content into Middleman projects thr... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/version_hash.rb | lib/contentful_middleman/version_hash.rb | module ContentfulMiddleman
class VersionHash
class << self
def source_root=(source_root)
@source_root = source_root
end
def read_for_space(space_name)
hashfilename_for_space = hashfilename(space_name)
::File.read(hashfilename_for_space) if File.exist? hashfilename_for_sp... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/version.rb | lib/contentful_middleman/version.rb | module ContentfulMiddleman
VERSION = "4.2.0"
end
| ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/helpers.rb | lib/contentful_middleman/helpers.rb | require 'thor/core_ext/hash_with_indifferent_access'
require 'contentful_middleman/tools/preview_proxy'
require 'rich_text_renderer'
module ContentfulMiddleman
module Helpers
def contentful_instances
ContentfulMiddleman.instances
end
def localize_entry(entry, locale, fallback_locale='en-US')
... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/import_task.rb | lib/contentful_middleman/import_task.rb | module ContentfulMiddleman
class ImportTask
def initialize(space_name, content_type_names, content_type_mappers, contentful)
@space_name = space_name
@content_type_names = content_type_names
@content_type_mappers = content_type_mappers
@changed_local_data = false
@conte... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/webhook_handler.rb | lib/contentful_middleman/webhook_handler.rb | require 'contentful/webhook/listener'
module ContentfulMiddleman
class WebhookHandler < Contentful::Webhook::Listener::Controllers::Wait
def perform(*)
logger.info 'Webhook Received - Waiting for rebuild'
super
logger.info 'Rebuilding'
system('bundle exec middleman contentful --rebuild')
... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/instance.rb | lib/contentful_middleman/instance.rb | module ContentfulMiddleman
class Instance
API_PREVIEW_URL = 'preview.contentful.com'
def initialize(extension)
@extension = extension
end
def entries
if options.all_entries
all_entries(options.cda_query)
else
client.entries(options.cda_query)
end
end
... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/mappers/base.rb | lib/contentful_middleman/mappers/base.rb | require_relative '../commands/context'
module ContentfulMiddleman
module Mapper
class Base
attr_reader :entries
def initialize(entries, options)
@entries = entries
@options = options
@children = {}
@created_at_key = using_camel_case? ? :createdAt : :created_at
... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/tools/preview_proxy.rb | lib/contentful_middleman/tools/preview_proxy.rb | require 'contentful'
module ContentfulMiddleman
module Tools
class PreviewProxy < ::Contentful::Client
@@instances = []
def self.instance(space: '', access_token: '', api_url: 'preview.contentful.com', tries: 3, expires_in: hours(2))
possible_instance = @@instances.detect { |i| i[:space] == s... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/tools/backup.rb | lib/contentful_middleman/tools/backup.rb | require 'fileutils'
module ContentfulMiddleman
module Tools
class NullBackup
def restore; end
def destroy; end
end
class Backup
class << self
def basepath
::File.join ENV["MM_ROOT"], ".tmp", "backups"
end
def ensure_backup_path!
return if :... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/commands/contentful.rb | lib/contentful_middleman/commands/contentful.rb | require 'middleman-cli'
require 'date'
require 'digest'
require 'contentful_middleman/commands/context'
require 'contentful_middleman/tools/backup'
require 'contentful_middleman/version_hash'
require 'contentful_middleman/import_task'
require 'contentful_middleman/local_data/store'
require 'contentful_middleman/local_d... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/commands/context.rb | lib/contentful_middleman/commands/context.rb | module ContentfulMiddleman
class Context < BasicObject
def initialize
@variables = {}
end
def method_missing(symbol, *args, &block)
if symbol =~ /\A.+=\z/
variable_name = symbol.to_s.gsub('=','')
variable_value = args.first
set variable_name, variable_value
els... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/local_data/file.rb | lib/contentful_middleman/local_data/file.rb | module ContentfulMiddleman
module LocalData
class File
class << self
def thor=(thor)
@thor = thor
end
def thor
@thor
end
end
def initialize(data, path)
@data = data
@path = path
end
def write
self.class.th... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
contentful/contentful_middleman | https://github.com/contentful/contentful_middleman/blob/cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79/lib/contentful_middleman/local_data/store.rb | lib/contentful_middleman/local_data/store.rb | module ContentfulMiddleman
module LocalData
class Store
include ContentfulMiddleman::Tools::Backup::InstanceMethods
class << self
def base_path=(path)
@base_path = path
end
def base_path
@base_path
end
end
def initialize(files, folder)... | ruby | MIT | cf49e7d7bd96b5d6ac346ad2ddf5f7aef5f3be79 | 2026-01-04T17:37:30.156780Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require_relative "../lib/jekyll-relative-links"
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end... | ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/spec/jekyll-relative-links/generator_excerpt_frontmatter_spec.rb | spec/jekyll-relative-links/generator_excerpt_frontmatter_spec.rb | # frozen_string_literal: true
RSpec.describe JekyllRelativeLinks::Generator do
let(:generator) { described_class.new(site.config) }
let(:site) { fixture_site("excerpt-in-frontmatter") }
let(:page) { page_by_path(site, "page-with-excerpt.md") }
before do
site.reset
site.read
generator.generate(site... | ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/spec/jekyll_relative_links/context_spec.rb | spec/jekyll_relative_links/context_spec.rb | # frozen_string_literal: true
RSpec.describe JekyllRelativeLinks::Context do
subject(:context) { described_class.new(site) }
let(:site) { fixture_site("site") }
it "stores the site" do
expect(context.site).to eql(site)
end
it "returns the registers" do
expect(context.registers).to have_key(:site)
... | ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/spec/jekyll_relative_links/filter_spec.rb | spec/jekyll_relative_links/filter_spec.rb | # frozen_string_literal: true
RSpec.describe JekyllRelativeLinks::Filter do
let(:site) { fixture_site("site") }
let(:page) { page_by_path(site, "page.md") }
let(:subdir_page) { page_by_path(site, "subdir/page.md") }
let(:filter) { make_filter }
before do
site.reset
site.read
site.liquid_renderer... | ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/spec/jekyll_relative_links/generator_spec.rb | spec/jekyll_relative_links/generator_spec.rb | # frozen_string_literal: true
RSpec.describe JekyllRelativeLinks::Generator do
subject(:generator) { described_class.new(site.config) }
let(:site_config) do
overrides["relative_links"] = plugin_config if plugin_config
overrides
end
let(:overrides) { {} }
let(:plugin_config) { nil }
let(:site) { fi... | ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/lib/jekyll-relative-links.rb | lib/jekyll-relative-links.rb | # frozen_string_literal: true
require "jekyll"
require_relative "jekyll-relative-links/generator"
require_relative "jekyll-relative-links/context"
require_relative "jekyll-relative-links/filter"
module JekyllRelativeLinks
end
| ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/lib/jekyll-relative-links/version.rb | lib/jekyll-relative-links/version.rb | # frozen_string_literal: true
module JekyllRelativeLinks
VERSION = "0.7.0"
end
| ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/lib/jekyll-relative-links/filter.rb | lib/jekyll-relative-links/filter.rb | # frozen_string_literal: true
module JekyllRelativeLinks
module Filter
# This filter processes HTML content that's already been converted by the markdownify
# filter and updates any relative links to markdown files to point to their HTML equivalents.
# Usage: {{ content | markdownify | rellinks }}
de... | ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/lib/jekyll-relative-links/generator.rb | lib/jekyll-relative-links/generator.rb | # frozen_string_literal: true
module JekyllRelativeLinks
class Generator < Jekyll::Generator
attr_accessor :site, :config
# Use Jekyll's native relative_url filter
include Jekyll::Filters::URLFilters
LINK_TEXT_REGEX = %r!(.*?)!.freeze
FRAGMENT_REGEX = %r!(#.+?|)?!.freeze
TITLE_REGEX = %r{(\... | ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
benbalter/jekyll-relative-links | https://github.com/benbalter/jekyll-relative-links/blob/6cf68fcef569620dcd511c2d01fea9d56d482163/lib/jekyll-relative-links/context.rb | lib/jekyll-relative-links/context.rb | # frozen_string_literal: true
module JekyllRelativeLinks
class Context
attr_reader :site
def initialize(site)
@site = site
end
def registers
{ :site => site }
end
end
end
| ruby | MIT | 6cf68fcef569620dcd511c2d01fea9d56d482163 | 2026-01-04T17:37:30.662128Z | false |
shuber/sortable | https://github.com/shuber/sortable/blob/f1d01727218816d3e1f569c3d6f4d6bf6a14bb86/init.rb | init.rb | require 'sortable' | ruby | MIT | f1d01727218816d3e1f569c3d6f4d6bf6a14bb86 | 2026-01-04T17:37:33.483994Z | false |
shuber/sortable | https://github.com/shuber/sortable/blob/f1d01727218816d3e1f569c3d6f4d6bf6a14bb86/test/sortable_test.rb | test/sortable_test.rb | require 'test/unit'
require 'rubygems'
args = ['activerecord']
args << ENV['ACTIVE_RECORD_VERSION'] if ENV['ACTIVE_RECORD_VERSION']
send(:gem, *args)
require 'active_record'
require File.dirname(__FILE__) + '/../lib/sortable'
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
def... | ruby | MIT | f1d01727218816d3e1f569c3d6f4d6bf6a14bb86 | 2026-01-04T17:37:33.483994Z | false |
shuber/sortable | https://github.com/shuber/sortable/blob/f1d01727218816d3e1f569c3d6f4d6bf6a14bb86/lib/sortable.rb | lib/sortable.rb | module Huberry
module Sortable
class InvalidSortableList < StandardError; end
# Raises InvalidSortableList if <tt>list_name</tt> is not a valid sortable list
def assert_sortable_list_exists!(list_name)
raise ::Huberry::Sortable::InvalidSortableList.new("sortable list '#{list_name}' does not exi... | ruby | MIT | f1d01727218816d3e1f569c3d6f4d6bf6a14bb86 | 2026-01-04T17:37:33.483994Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/uninstall.rb | uninstall.rb | # Uninstall hook code here
| ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/install.rb | install.rb | # When the BlogKit plugin is installed run the blog_assets generator
begin
if defined?(Rails)
rails_root = Rails.root
elsif defined?(RAILS_ROOT)
rails_root = RAILS_ROOT
else
rails_root = File.join(File.dirname(__FILE__), '..', '..', '..')
end
if (File.exists?(rails_root) && File.exists?(File.join(rails_root... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/init.rb | init.rb | require File.dirname(__FILE__) + "/lib/blog_kit"
# Setup blog kit
BlogKit.instance | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/app/helpers/blog_helper.rb | app/helpers/blog_helper.rb | module BlogHelper
def blog_tags_list(limit=nil)
html = []
limits = {}
limits[:limit] = limit if limit
BlogTag.all({:select => 'tag,count(id) as count', :group => 'tag', :order => 'count DESC'}.merge(limits)).sort_by {|bt| bt.tag }.each do |tag|
html << "<li><a href=\"/blog_posts/tag/#{tag.tag}\">#{... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/app/controllers/blog_posts_controller.rb | app/controllers/blog_posts_controller.rb | class BlogPostsController < ApplicationController
unloadable
helper :blog
layout :choose_layout
before_filter :require_user, :except => [:index, :show, :tag]
before_filter :require_admin, :except => [:index, :show, :tag]
before_filter :setup_image_template, :only => [:new, :edit, :create, :update]
def ... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/app/controllers/blog_comments_controller.rb | app/controllers/blog_comments_controller.rb | class BlogCommentsController < ApplicationController
unloadable
helper :blog
layout(BlogKit.instance.settings['layout'] || 'application')
before_filter :require_user, :only => [:destroy]
before_filter :require_admin, :only => [:destroy]
before_filter :require_blog_post
def create
@blog_comment = @blo... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/app/models/blog_tag.rb | app/models/blog_tag.rb | class BlogTag < ActiveRecord::Base
unloadable
belongs_to :blog_post
end | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/app/models/blog_comment.rb | app/models/blog_comment.rb | class BlogComment < ActiveRecord::Base
include BlogKitModelHelper
unloadable
belongs_to :user
belongs_to :blog_article
validates_presence_of :body
before_save :check_for_spam
def validate
if !self.user
self.errors.add(:name, 'is required') if self.name.blank?
end
end
def formatted_created_at
... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/app/models/blog_image.rb | app/models/blog_image.rb | class BlogImage < ActiveRecord::Base
unloadable
belongs_to :blog_post
attr_accessor :random_id
# Check for paperclip
if self.respond_to?(:has_attached_file)
has_attached_file(:image, {
:styles => {
:original => '1000x1000>',
:large => '600x600>',
:medium => '300x300>',
:small =>... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/app/models/blog_post.rb | app/models/blog_post.rb |
class BlogPost < ActiveRecord::Base
include BlogKitModelHelper
unloadable
belongs_to :user
has_many :blog_comments, :dependent => :destroy
has_many :blog_tags, :dependent => :destroy
has_many :blog_images, :dependent => :destroy
accepts_nested_attributes_for :blog_images, :allow_destroy => true
val... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/test/test_helper.rb | test/test_helper.rb | ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
require 'test/unit'
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
# Remove any existing user class
Object.send(:remove_const, :User)
# Stub User
class User < ActiveRecord::Base
end
# Stub auth... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/test/schema.rb | test/schema.rb | # Test Schema
ActiveRecord::Schema.define(:version => 0) do
create_table "blog_comments", :force => true do |t|
t.integer "blog_post_id"
t.integer "user_id"
t.string "user_ip"
t.string "user_agent"
t.string "referrer"
t.string "name"
t.string "site_url"
t.string "email"
... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/test/functional/blog_assets_generator_test.rb | test/functional/blog_assets_generator_test.rb | # require File.dirname(__FILE__) + '/../test_helper.rb'
# require 'rails_generator'
# require 'rails_generator/scripts/generate'
#
# class BlogAssetsGeneratorTest < Test::Unit::TestCase
# def setup
# FileUtils.mkdir_p(fake_rails_root)
# FileUtils.mkdir_p(fake_rails_root + '/config')
# FileUtils.mkdir_p(f... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/test/functional/blog_comments_controller_test.rb | test/functional/blog_comments_controller_test.rb | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false | |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/test/functional/blog_posts_controller_test.rb | test/functional/blog_posts_controller_test.rb | require File.dirname(__FILE__) + '/../test_helper.rb'
class BlogPostsControllerTest < ActionController::TestCase
def setup
load_schema
setup_user
end
def post_attrs
{
:title => 'Blog Title',
:body => 'Test Body',
:user_id => 1
}
end
test "should get index" do
get :index
assert_res... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/lib/akismetor.rb | lib/akismetor.rb | # Included from http://github.com/levycarneiro/akismetor.git
#
# Copyright (c) 2008 Michael Hale
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without li... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/lib/blog_kit_model_helper.rb | lib/blog_kit_model_helper.rb | require 'rubygems'
begin
require 'bluecloth'
rescue Exception => e
require 'erb'
puts "Could not load bluecloth #{e.inspect}"
end
begin
require 'uv'
rescue Exception => e
require 'erb'
puts "Could not load UltraViolet"
end
module BlogKitModelHelper
def code_highlight_and_markdown(text, markdown_options = {})
... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/lib/blog_kit.rb | lib/blog_kit.rb | # BlogKit Setup - handles settings
# require 'tm_syntax_highlighting'
# require 'rubygems'
# require 'uv'
#
# # takes about a second to this, if we don't do it now, then the first call to highlight will take a little longer
# Uv.init_syntaxes
#
# ActionView::Base.send(:include, TmSyntaxHighlighting::Helper)
# Actio... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/lib/generators/blog_assets/blog_assets_generator.rb | lib/generators/blog_assets/blog_assets_generator.rb | class BlogAssetsGenerator < Rails::Generator::Base
def self.source_root
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
end
def manifest
record do |m|
m.migration_template 'blog_comments_migration.rb', "db/migrate", {:migration_file_name => "create_blog_comments"}
m.sleep 1 # not ... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/lib/generators/blog_assets/templates/blog_comments_migration.rb | lib/generators/blog_assets/templates/blog_comments_migration.rb | class CreateBlogComments < ActiveRecord::Migration
def self.up
create_table :blog_comments do |t|
t.column :blog_post_id, :integer
t.column :user_id, :integer
t.column :user_ip, :string
t.column :user_agent, :string
t.column :referrer, :string
t.column :name, :string
t.column :site_url, :stri... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/lib/generators/blog_assets/templates/blog_posts_migration.rb | lib/generators/blog_assets/templates/blog_posts_migration.rb | class CreateBlogPosts < ActiveRecord::Migration
def self.up
create_table :blog_posts do |t|
t.column :title, :string, :null => false
t.column :body, :text
t.column :created_at, :datetime
t.column :updated_at, :datetime
t.column :published, :boolean, :null => false, :default => false
t.column :us... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/lib/generators/blog_assets/templates/blog_tags_migration.rb | lib/generators/blog_assets/templates/blog_tags_migration.rb | class CreateBlogTags < ActiveRecord::Migration
def self.up
create_table :blog_tags do |t|
t.column :blog_post_id, :integer
t.column :tag, :string, :null => false
end
add_index :blog_tags, :blog_post_id
add_index :blog_tags, :tag
end
def self.down
drop_table :blog_tags
end
end | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/lib/generators/blog_assets/templates/blog_images_migration.rb | lib/generators/blog_assets/templates/blog_images_migration.rb | class CreateBlogImages < ActiveRecord::Migration
def self.up
create_table :blog_images, :force => true do |t|
t.string :image_file_name
t.string :image_content_type
t.integer :image_file_size
t.datetime :image_updated_at
t.integer :blog_post_id
t.timestamps
end
add_ind... | ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
ryanstout/blog_kit | https://github.com/ryanstout/blog_kit/blob/76a028b3369d5329c40b7f01bf56d821b82afe41/config/routes.rb | config/routes.rb | ActionController::Routing::Routes.draw do |map|
map.resources :blog_posts, :collection => {:drafts => :any}, :member => {:tag => :any}, :has_many => :blog_comments
end
| ruby | MIT | 76a028b3369d5329c40b7f01bf56d821b82afe41 | 2026-01-04T17:37:26.878838Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/app/controllers/pwa/apps_controller.rb | app/controllers/pwa/apps_controller.rb | # frozen_string_literal: true
module Pwa
class AppsController < ApplicationController
before_action :set_app
def manifest; end
def offline; end
private
def set_app
@app = Pwa::App.find_by_url(request.original_url).first
end
end
end
| ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
# This file was generated by the `rspec --init` 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 always be loaded, without a need to expl... | ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/pwa.rb | lib/pwa.rb | # frozen_string_literal: true
require 'pwa/version'
module Pwa
require 'pwa/configuration'
require 'pwa/app'
require 'pwa/engine'
require 'pwa/railtie'
end
| ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/pwa/version.rb | lib/pwa/version.rb | # frozen_string_literal: true
module Pwa
VERSION = '4.0.6'
end
| ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/pwa/railtie.rb | lib/pwa/railtie.rb | # frozen_string_literal: true
require 'rails/railtie'
require 'mozaic'
module Pwa
class Railtie < Rails::Railtie
initializer 'pwa.mozaic' do
Mozaic.configure do |config|
config.define_component 'pwa/manifest', url: 'http://localhost:3000'
config.define_component 'pwa/theme', default: '#FFF... | ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/pwa/app.rb | lib/pwa/app.rb | # frozen_string_literal: true
module Pwa
class App
attr_accessor :name
attr_accessor :scopes
def initialize(name, scopes = nil)
@name = name
@scopes = scopes
end
def safe_name
name.parameterize.underscore
end
def self.find_by_name(name)
Pwa.configuration.apps.se... | ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/pwa/configuration.rb | lib/pwa/configuration.rb | # frozen_string_literal: true
module Pwa
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Configuration.new
yield configuration
end
class Configuration
attr_accessor :apps
def initialize
@apps = []
end
def define_app(name, scope = ... | ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/pwa/engine.rb | lib/pwa/engine.rb | # frozen_string_literal: true
require 'rails/railtie'
module Pwa
class Engine < ::Rails::Engine
end
end
| ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/generators/pwa/app_generator.rb | lib/generators/pwa/app_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/migration'
module Pwa
class AppGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.join File.dirname(__FILE__), '../templates/app'
desc 'Generate a Progressive Web Apps for Rails app... | ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/generators/pwa/install_generator.rb | lib/generators/pwa/install_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/migration'
module Pwa
class InstallGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.join File.dirname(__FILE__), '../templates/install'
desc 'Install Progressive Web Apps for Rail... | ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/lib/generators/templates/install/initializer.rb | lib/generators/templates/install/initializer.rb | # frozen_string_literal: true
Pwa.configure do |config|
# Define Progressive Web Apps for Rails apps
# config.define_app 'Subdomain', ['subdomain.example.com',
# 'subdomain.lvh.me:3000']
# config.define_app 'Example', ['example.com', 'localhost:3000',
# ... | ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
jonhue/pwa | https://github.com/jonhue/pwa/blob/93bdaf22b9d8584d3998fb31d93f92dcb6e829f7/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Pwa::Engine.routes.draw do
get 'offline', to: 'pwa/apps#offline'
get 'manifest', to: 'pwa/apps#manifest', defaults: { format: :json }
end
| ruby | MIT | 93bdaf22b9d8584d3998fb31d93f92dcb6e829f7 | 2026-01-04T17:37:35.037293Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/read_marks_clean_up_job.rb | app/jobs/read_marks_clean_up_job.rb | # frozen_string_literal: true
class ReadMarksCleanUpJob < ApplicationJob
def perform
ReadMark.readable_classes.each do |klass|
Rails.logger.debug(message: "Starting read marks cleanup job for #{klass} at #{Time.now}")
klass.cleanup_read_marks!
Rails.logger.debug(message: "Ended read marks cleanu... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/application_job.rb | app/jobs/application_job.rb | # frozen_string_literal: true
class ApplicationJob < ActiveJob::Base
queue_as :default
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/video_statistic_update_job.rb | app/jobs/video_statistic_update_job.rb | # frozen_string_literal: true
class VideoStatisticUpdateJob < ApplicationJob
private
rescue_from(ActiveJob::DeserializationError) do |_|
# Prevent the job from retrying due to deleted records
end
# Update video submission statistic for outdated cache.
# Compute total watch_freq and average percent_watch... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/user_email_database_cleanup_job.rb | app/jobs/user_email_database_cleanup_job.rb | # frozen_string_literal: true
class UserEmailDatabaseCleanupJob < ApplicationJob
def perform
ActsAsTenant.without_tenant do
@cutoff_timestamp = 6.months.ago
ActiveRecord::Base.transaction do
cleanup_unconfirmed_secondary_emails
cleanup_unconfirmed_users
end
end
end
priva... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/consolidated_item_email_job.rb | app/jobs/consolidated_item_email_job.rb | # frozen_string_literal: true
class ConsolidatedItemEmailJob < ApplicationJob
# Start with opening reminders.
def perform
# Find courses which are just past midnight, then create an opening reminder activity
# Use that activity to notify the course
midnight_time_zones = ActiveSupport::TimeZone.all.selec... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/course/user_deletion_job.rb | app/jobs/course/user_deletion_job.rb | # frozen_string_literal: true
class Course::UserDeletionJob < ApplicationJob
protected
def perform(course, course_user, current_user)
ActsAsTenant.without_tenant do
unless course_user.destroy
course_user.update_attribute(:deleted_at, nil)
Course::Mailer.
course_user_deletion_fai... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/course/experience_points_download_job.rb | app/jobs/course/experience_points_download_job.rb | # frozen_string_literal: true
class Course::ExperiencePointsDownloadJob < ApplicationJob
include TrackableJob
queue_as :lowest
retry_on StandardError, attempts: 0
protected
def perform_tracked(course, course_user_id)
service = Course::ExperiencePointsDownloadService.new(course, course_user_id)
csv_f... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/course/duplication_job.rb | app/jobs/course/duplication_job.rb | # frozen_string_literal: true
class Course::DuplicationJob < ApplicationJob
include TrackableJob
include Rails.application.routes.url_helpers
queue_as :duplication
protected
# Performs the duplication job.
#
# @param [Course] source_course The course to duplicate.
# @param [Hash] option A hash of dupl... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/course/object_duplication_job.rb | app/jobs/course/object_duplication_job.rb | # frozen_string_literal: true
class Course::ObjectDuplicationJob < ApplicationJob
include TrackableJob
include Rails.application.routes.url_helpers
queue_as :duplication
protected
# Performs the object duplication job.
#
# @param [Course] source_course Course to duplicate from.
# @param [Course] desti... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/course/lesson_plan/coursewide_personalized_timeline_update_job.rb | app/jobs/course/lesson_plan/coursewide_personalized_timeline_update_job.rb | # frozen_string_literal: true
class Course::LessonPlan::CoursewidePersonalizedTimelineUpdateJob < ApplicationJob
include Course::LessonPlan::PersonalizationConcern
queue_as :lowest
protected
def perform(lesson_plan_item)
instance = Course.unscoped { lesson_plan_item.course.instance }
ActsAsTenant.with... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/course/conditional/coursewide_conditional_satisfiability_evaluation_job.rb | app/jobs/course/conditional/coursewide_conditional_satisfiability_evaluation_job.rb | # frozen_string_literal: true
class Course::Conditional::CoursewideConditionalSatisfiabilityEvaluationJob < ApplicationJob
DELTA = 1.0
include TrackableJob
queue_as :delayed_medium_high
protected
# Performs conditional satisfiability evaluation for all users in the given course.
#
# @param [Course] cou... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/course/conditional/conditional_satisfiability_evaluation_job.rb | app/jobs/course/conditional/conditional_satisfiability_evaluation_job.rb | # frozen_string_literal: true
class Course::Conditional::ConditionalSatisfiabilityEvaluationJob < ApplicationJob
include TrackableJob
queue_as :delayed_medium_high
protected
# Performs conditional satisfiability evaluation for the given course user.
#
# @param [String|nil] redirect_to_path The path to be ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/jobs/course/rubric/rubric_evaluation_export_job.rb | app/jobs/course/rubric/rubric_evaluation_export_job.rb | # frozen_string_literal: true
class Course::Rubric::RubricEvaluationExportJob < ApplicationJob # rubocop:disable Metrics/ClassLength
include TrackableJob
queue_as :highest
def perform_tracked(course, rubric_id, question_id)
question = Course::Assessment::Question.includes(:actable).find(question_id)
rubr... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.