source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/utils.rb
Ruby
mit
51,392
master
11,880
# frozen_string_literal: true module Jekyll module Utils extend self autoload :Ansi, "jekyll/utils/ansi" autoload :Exec, "jekyll/utils/exec" autoload :Internet, "jekyll/utils/internet" autoload :Platforms, "jekyll/utils/platforms" autoload :ThreadEvent, "jekyll/utils/thread_event" autoloa...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/layout.rb
Ruby
mit
51,392
master
1,405
# frozen_string_literal: true module Jekyll class Layout include Convertible attr_accessor :content, # content of layout :data, # the Hash that holds the metadata for this layout :ext # extension of layout attr_reader :name, # name of layout :...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/collection.rb
Ruby
mit
51,392
master
9,407
# frozen_string_literal: true module Jekyll class Collection attr_reader :site, :label, :metadata attr_writer :docs # Create a new Collection. # # site - the site to which this collection belongs. # label - the name of the collection # # Returns nothing. def initialize(site, labe...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/frontmatter_defaults.rb
Ruby
mit
51,392
master
7,346
# frozen_string_literal: true module Jekyll # This class handles custom defaults for YAML frontmatter settings. # These are set in _config.yml and apply both to internal use (e.g. layout) # and the data available to liquid. # # It is exposed via the frontmatter_defaults method on the site class. class Fron...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/entry_filter.rb
Ruby
mit
51,392
master
3,316
# frozen_string_literal: true module Jekyll class EntryFilter attr_reader :site SPECIAL_LEADING_CHAR_REGEX = %r!\A#{Regexp.union([".", "_", "#", "~"])}!o.freeze def initialize(site, base_directory = nil) @site = site @base_directory = derive_base_directory( @site, base_directory.to_...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/site.rb
Ruby
mit
51,392
master
17,801
# frozen_string_literal: true module Jekyll class Site attr_accessor :baseurl, :converters, :data, :drafts, :exclude, :file_read_opts, :future, :gems, :generators, :highlighter, :include, :inclusions, :keep_files, :layouts, :limit_posts, :lsi, :pages, :permal...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/page.rb
Ruby
mit
51,392
master
5,518
# frozen_string_literal: true module Jekyll class Page include Convertible attr_writer :dir attr_accessor :basename, :content, :data, :ext, :name, :output, :pager, :site alias_method :extname, :ext # Attributes for Liquid templates ATTRIBUTES_FOR_LIQUID = %w( content dir ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/liquid_renderer.rb
Ruby
mit
51,392
master
2,023
# frozen_string_literal: true require_relative "liquid_renderer/file" require_relative "liquid_renderer/table" module Jekyll class LiquidRenderer def initialize(site) @site = site Liquid::Template.error_mode = @site.config["liquid"]["error_mode"].to_sym reset end def reset @stat...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/excerpt.rb
Ruby
mit
51,392
master
5,847
# frozen_string_literal: true module Jekyll class Excerpt extend Forwardable attr_accessor :content, :doc, :ext attr_writer :output def_delegators :@doc, :site, :name, :ext, :extname, :collection, :related_posts, :type, :coffeescript_file?,...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/filters.rb
Ruby
mit
51,392
master
16,259
# frozen_string_literal: true require_all "jekyll/filters" module Jekyll module Filters include URLFilters include GroupingFilters include DateFilters # Convert a Markdown string into HTML output. # # input - The Markdown String to convert. # # Returns the HTML formatted String. ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/liquid_extensions.rb
Ruby
mit
51,392
master
526
# frozen_string_literal: true module Jekyll module LiquidExtensions # Lookup a Liquid variable in the given context. # # context - the Liquid context in question. # variable - the variable name, as a string. # # Returns the value of the variable in the context # or the variable name if...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/page_without_a_file.rb
Ruby
mit
51,392
master
425
# frozen_string_literal: true module Jekyll # A Jekyll::Page subclass to handle processing files without reading it to # determine the page-data and page-content based on Front Matter delimiters. # # The class instance is basically just a bare-bones entity with just # attributes "dir", "name", "path", "url" ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/renderer.rb
Ruby
mit
51,392
master
7,897
# frozen_string_literal: true module Jekyll class Renderer attr_reader :document, :site attr_writer :layouts, :payload def initialize(site, document, site_payload = nil) @site = site @document = document @payload = site_payload @layouts = nil end # Fetches the payl...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/converters/identity.rb
Ruby
mit
51,392
master
1,115
# frozen_string_literal: true module Jekyll module Converters # Identity converter. Returns same content as given. # For more info on converters see https://jekyllrb.com/docs/plugins/converters/ class Identity < Converter safe true priority :lowest # Public: Does the given extension m...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/converters/markdown.rb
Ruby
mit
51,392
master
3,704
# frozen_string_literal: true module Jekyll module Converters # Markdown converter. # For more info on converters see https://jekyllrb.com/docs/plugins/converters/ class Markdown < Converter highlighter_prefix "\n" highlighter_suffix "\n" safe true def setup return if @se...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/converters/smartypants.rb
Ruby
mit
51,392
master
1,996
# frozen_string_literal: true module Kramdown module Parser class SmartyPants < Kramdown::Parser::Kramdown def initialize(source, options) super @block_parsers = [:block_html, :content] @span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html] end de...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/converters/markdown/kramdown_parser.rb
Ruby
mit
51,392
master
6,580
# frozen_string_literal: true module Kramdown # A Kramdown::Document subclass meant to optimize memory usage from initializing # a kramdown document for parsing. # # The optimization is by using the same options Hash (and its derivatives) for # converting all Markdown documents in a Jekyll site. class Jeky...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/utils/ansi.rb
Ruby
mit
51,392
master
1,546
# frozen_string_literal: true module Jekyll module Utils module Ansi extend self ESCAPE = format("%c", 27) MATCH = %r!#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m!ix.freeze COLORS = { :red => 31, :green => 32, :black => 30, :magenta => 3...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/utils/platforms.rb
Ruby
mit
51,392
master
1,357
# frozen_string_literal: true module Jekyll module Utils module Platforms extend self def jruby? RUBY_ENGINE == "jruby" end def mri? RUBY_ENGINE == "ruby" end def windows? vanilla_windows? || bash_on_windows? end # Not a Windows Subsyste...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/utils/exec.rb
Ruby
mit
51,392
master
591
# frozen_string_literal: true require "open3" module Jekyll module Utils module Exec extend self # Runs a program in a sub-shell. # # *args - a list of strings containing the program name and arguments # # Returns a Process::Status and a String of output in an array in ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/utils/win_tz.rb
Ruby
mit
51,392
master
1,625
# frozen_string_literal: true module Jekyll module Utils module WinTZ extend self # Public: Calculate the Timezone for Windows when the config file has a defined # 'timezone' key. # # timezone - the IANA Time Zone specified in "_config.yml" # # Returns a string ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/utils/thread_event.rb
Ruby
mit
51,392
master
615
# frozen_string_literal: true module Jekyll module Utils # Based on the pattern and code from # https://emptysqua.re/blog/an-event-synchronization-primitive-for-ruby/ class ThreadEvent attr_reader :flag def initialize @lock = Mutex.new @cond = ConditionVariable.new @f...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/utils/internet.rb
Ruby
mit
51,392
master
1,028
# frozen_string_literal: true module Jekyll module Utils module Internet # Public: Determine whether the present device has a connection to # the Internet. This allows plugin writers which require the outside # world to have a neat fallback mechanism for offline building. # # Exampl...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/readers/page_reader.rb
Ruby
mit
51,392
master
641
# frozen_string_literal: true module Jekyll class PageReader attr_reader :site, :dir, :unfiltered_content def initialize(site, dir) @site = site @dir = dir @unfiltered_content = [] end # Create a new `Jekyll::Page` object for each entry in a given array. # # files - An arr...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/readers/post_reader.rb
Ruby
mit
51,392
master
2,583
# frozen_string_literal: true module Jekyll class PostReader attr_reader :site, :unfiltered_content def initialize(site) @site = site end # Read all the files in <source>/<dir>/_drafts and create a new # Document object with each one. # # dir - The String relative path of the dire...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/readers/data_reader.rb
Ruby
mit
51,392
master
3,161
# frozen_string_literal: true module Jekyll class DataReader attr_reader :site, :content def initialize(site, in_source_dir: nil) @site = site @content = {} @entry_filter = EntryFilter.new(site) @in_source_dir = in_source_dir || @site.method(:in_source_dir) @source_dir = @in_so...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/readers/theme_assets_reader.rb
Ruby
mit
51,392
master
1,348
# frozen_string_literal: true module Jekyll class ThemeAssetsReader attr_reader :site def initialize(site) @site = site end def read return unless site.theme&.assets_path Find.find(site.theme.assets_path) do |path| next if File.directory?(path) if File.symlink?(p...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/readers/layout_reader.rb
Ruby
mit
51,392
master
1,298
# frozen_string_literal: true module Jekyll class LayoutReader attr_reader :site def initialize(site) @site = site @layouts = {} end def read layout_entries.each do |layout_file| @layouts[layout_name(layout_file)] = \ Layout.new(site, layout_directory, layout_fil...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/readers/collection_reader.rb
Ruby
mit
51,392
master
484
# frozen_string_literal: true module Jekyll class CollectionReader SPECIAL_COLLECTIONS = %w(posts data).freeze attr_reader :site, :content def initialize(site) @site = site @content = {} end # Read in all collections specified in the configuration # # Returns nothing. d...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/readers/static_file_reader.rb
Ruby
mit
51,392
master
583
# frozen_string_literal: true module Jekyll class StaticFileReader attr_reader :site, :dir, :unfiltered_content def initialize(site, dir) @site = site @dir = dir @unfiltered_content = [] end # Create a new StaticFile object for every entry in a given list of basenames. # #...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/tags/include.rb
Ruby
mit
51,392
master
8,883
# frozen_string_literal: true module Jekyll module Tags class IncludeTag < Liquid::Tag VALID_SYNTAX = %r! ([\w-]+)\s*=\s* (?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w.-]+)) !x.freeze VARIABLE_SYNTAX = %r! (?<variable>[^{]*(\{\{\s*[\w\-.]+\s*(\|.*)?\}\}[^...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/tags/highlight.rb
Ruby
mit
51,392
master
4,125
# frozen_string_literal: true module Jekyll module Tags class HighlightBlock < Liquid::Block include Liquid::StandardFilters # The regular expression syntax checker. Start with the language specifier. # Follow that by zero or more space separated options that take one of three # forms: n...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/tags/post_url.rb
Ruby
mit
51,392
master
4,278
# frozen_string_literal: true module Jekyll module Tags class PostComparer # Deprecated (soft; No interpreter warnings). # To be removed in v5.0. # Use private constant `POST_PATH_MATCHER` instead. MATCHER = %r!^(.+/)*(\d+-\d+-\d+)-(.*)$!.freeze POST_PATH_MATCHER = %r!\A(.+/)*?(\d{...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/tags/link.rb
Ruby
mit
51,392
master
1,220
# frozen_string_literal: true module Jekyll module Tags class Link < Liquid::Tag include Jekyll::Filters::URLFilters class << self def tag_name name.split("::").last.downcase end end def initialize(tag_name, relative_path, tokens) super @relati...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/jekyll_drop.rb
Ruby
mit
51,392
master
526
# frozen_string_literal: true module Jekyll module Drops class JekyllDrop < Liquid::Drop class << self def global @global ||= JekyllDrop.new end end def version Jekyll::VERSION end def environment Jekyll.env end def to_h ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/url_drop.rb
Ruby
mit
51,392
master
2,885
# frozen_string_literal: true module Jekyll module Drops class UrlDrop < Drop extend Forwardable mutable false delegate_method :output_ext delegate_method_as :cleaned_relative_path, :path def collection @obj.collection.label end def name Utils.slugify...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/unified_payload_drop.rb
Ruby
mit
51,392
master
546
# frozen_string_literal: true module Jekyll module Drops class UnifiedPayloadDrop < Drop mutable true attr_accessor :content, :page, :layout, :paginator, :highlighter_prefix, :highlighter_suffix def jekyll JekyllDrop.global end def site @site_d...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/static_file_drop.rb
Ruby
mit
51,392
master
350
# frozen_string_literal: true module Jekyll module Drops class StaticFileDrop < Drop extend Forwardable delegate_methods :name, :extname, :modified_time, :basename delegate_method_as :relative_path, :path delegate_method_as :type, :collection private delegate_method_as :data, :fa...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/collection_drop.rb
Ruby
mit
51,392
master
381
# frozen_string_literal: true module Jekyll module Drops class CollectionDrop < Drop extend Forwardable mutable false delegate_method_as :write?, :output delegate_methods :label, :docs, :files, :directory, :relative_directory private delegate_method_as :metadata, :fallback_data ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/site_drop.rb
Ruby
mit
51,392
master
1,912
# frozen_string_literal: true module Jekyll module Drops class SiteDrop < Drop extend Forwardable mutable false delegate_method_as :site_data, :data delegate_methods :time, :pages, :static_files, :tags, :categories private delegate_method_as :config, :fallback_data def [](...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/drop.rb
Ruby
mit
51,392
master
9,517
# frozen_string_literal: true module Jekyll module Drops class Drop < Liquid::Drop include Enumerable NON_CONTENT_METHODS = [:fallback_data, :collapse_document].freeze NON_CONTENT_METHOD_NAMES = NON_CONTENT_METHODS.map(&:to_s).freeze private_constant :NON_CONTENT_METHOD_NAMES # A ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/document_drop.rb
Ruby
mit
51,392
master
2,021
# frozen_string_literal: true module Jekyll module Drops class DocumentDrop < Drop extend Forwardable NESTED_OBJECT_FIELD_BLACKLIST = %w( content output excerpt next previous ).freeze mutable false delegate_method_as :relative_path, :path private delegate_method_as ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/theme_drop.rb
Ruby
mit
51,392
master
727
# frozen_string_literal: true module Jekyll module Drops class ThemeDrop < Drop delegate_method_as :runtime_dependencies, :dependencies def root @root ||= ENV["JEKYLL_ENV"] == "development" ? @obj.root : "" end def authors @authors ||= gemspec.authors.join(", ") en...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/drops/excerpt_drop.rb
Ruby
mit
51,392
master
340
# frozen_string_literal: true module Jekyll module Drops class ExcerptDrop < DocumentDrop def layout @obj.doc.data["layout"] end def date @obj.doc.date end def excerpt nil end def name @obj.doc.data["name"] || @obj.doc.basename en...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/filters/date_filters.rb
Ruby
mit
51,392
master
3,262
# frozen_string_literal: true module Jekyll module Filters module DateFilters # Format a date in short format e.g. "27 Jan 2011". # Ordinal format is also supported, in both the UK # (e.g. "27th Jan 2011") and US ("e.g. Jan 27th, 2011") formats. # UK format is the default. # #...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/filters/grouping_filters.rb
Ruby
mit
51,392
master
1,746
# frozen_string_literal: true module Jekyll module Filters module GroupingFilters # Group an array of items by a property # # input - the inputted Enumerable # property - the property # # Returns an array of Hashes, each looking something like this: # {"name" => "larry...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/filters/url_filters.rb
Ruby
mit
51,392
master
2,993
# frozen_string_literal: true module Jekyll module Filters module URLFilters # Produces an absolute URL based on site.url and site.baseurl. # # input - the URL to make absolute. # # Returns the absolute URL as a String. def absolute_url(input) return if input.nil? ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/serve.rb
Ruby
mit
51,392
master
14,387
# frozen_string_literal: true module Jekyll module Commands class Serve < Command # Similar to the pattern in Utils::ThreadEvent except we are maintaining the # state of @running instead of just signaling an event. We have to maintain this # state since Serve is just called via class methods i...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/new_theme.rb
Ruby
mit
51,392
master
1,275
# frozen_string_literal: true require "erb" module Jekyll module Commands class NewTheme < Jekyll::Command class << self def init_with_program(prog) prog.command(:"new-theme") do |c| c.syntax "new-theme NAME" c.description "Creates a new Jekyll theme scaffold" ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/build.rb
Ruby
mit
51,392
master
2,781
# frozen_string_literal: true module Jekyll module Commands class Build < Command class << self # Create the Mercenary command for the Jekyll CLI for this Command def init_with_program(prog) prog.command(:build) do |c| c.syntax "build [options]" c.desc...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/new.rb
Ruby
mit
51,392
master
6,068
# frozen_string_literal: true require "erb" module Jekyll module Commands class New < Command class << self def init_with_program(prog) prog.command(:new) do |c| c.syntax "new PATH" c.description "Creates a new Jekyll site scaffold in PATH" c.option "...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/clean.rb
Ruby
mit
51,392
master
1,418
# frozen_string_literal: true module Jekyll module Commands class Clean < Command class << self def init_with_program(prog) prog.command(:clean) do |c| c.syntax "clean [subcommand]" c.description "Clean the site (removes site output and metadata file) without build...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/doctor.rb
Ruby
mit
51,392
master
6,051
# frozen_string_literal: true module Jekyll module Commands class Doctor < Command class << self def init_with_program(prog) prog.command(:doctor) do |c| c.syntax "doctor" c.description "Search site and print specific deprecation warnings" c.alias(:hyde...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/help.rb
Ruby
mit
51,392
master
990
# frozen_string_literal: true module Jekyll module Commands class Help < Command class << self def init_with_program(prog) prog.command(:help) do |c| c.syntax "help [subcommand]" c.description "Show the help message, optionally for a given subcommand." ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/serve/live_reload_reactor.rb
Ruby
mit
51,392
master
3,729
# frozen_string_literal: true require "em-websocket" require_relative "websockets" module Jekyll module Commands class Serve class LiveReloadReactor attr_reader :started_event, :stopped_event, :thread def initialize @websockets = [] @connections_count = 0 @s...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/serve/servlet.rb
Ruby
mit
51,392
master
6,525
# frozen_string_literal: true require "webrick" module Jekyll module Commands class Serve # This class is used to determine if the Servlet should modify a served file # to insert the LiveReload script tags class SkipAnalyzer BAD_USER_AGENTS = [%r!MSIE!].freeze def self.skip_pr...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/commands/serve/websockets.rb
Ruby
mit
51,392
master
2,868
# frozen_string_literal: true require "http/parser" module Jekyll module Commands class Serve # The LiveReload protocol requires the server to serve livereload.js over HTTP # despite the fact that the protocol itself uses WebSockets. This custom connection # class addresses the dual protocols...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/liquid_renderer/file.rb
Ruby
mit
51,392
master
1,685
# frozen_string_literal: true module Jekyll class LiquidRenderer class File def initialize(renderer, filename) @renderer = renderer @filename = filename end def parse(content) measure_time do @renderer.cache[@filename] ||= Liquid::Template.parse(content, :line...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
lib/jekyll/liquid_renderer/table.rb
Ruby
mit
51,392
master
1,019
# frozen_string_literal: true module Jekyll class LiquidRenderer class Table GAUGES = [:count, :bytes, :time].freeze def initialize(stats) @stats = stats end def to_s(num_of_rows = 50) Jekyll::Profiler.tabulate(data_for_table(num_of_rows)) end private ...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
features/step_definitions.rb
Ruby
mit
51,392
master
10,607
# frozen_string_literal: true Before do FileUtils.rm_rf(Paths.test_dir) if Paths.test_dir.exist? FileUtils.mkdir_p(Paths.test_dir) unless Paths.test_dir.directory? Dir.chdir(Paths.test_dir) @timezone_before_scenario = ENV["TZ"] end # After do FileUtils.rm_rf(Paths.test_dir) if Paths.test_dir.exist? Paths...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
features/support/helpers.rb
Ruby
mit
51,392
master
2,791
# frozen_string_literal: true require "jekyll" class Paths SOURCE_DIR = Pathname.new(File.expand_path("../..", __dir__)) def self.test_dir; source_dir.join("tmp", "jekyll"); end def self.theme_gem_dir; source_dir.join("tmp", "jekyll", "my-cool-theme"); end def self.output_file; test_dir.join("jekyll_output...
github
jekyll/jekyll
https://github.com/jekyll/jekyll
features/support/formatter.rb
Ruby
mit
51,392
master
2,183
# frozen_string_literal: true require "cucumber/formatter/io" module Jekyll module Cucumber class Formatter include ::Cucumber::Formatter::Io def initialize(path_or_io, error_stream) @io = ensure_io(path_or_io, error_stream) @timings = {} end def before_test_case(test_c...
github
huginn/huginn
https://github.com/huginn/huginn
Capfile
Ruby
mit
49,192
master
221
# Load DSL and set up stages require 'capistrano/setup' # Include default deployment tasks require 'capistrano/deploy' require 'capistrano/bundler' require 'capistrano/rails/assets' require 'capistrano/rails/migrations'
github
huginn/huginn
https://github.com/huginn/huginn
Gemfile
Ruby
mit
49,192
master
4,964
source 'https://rubygems.org' ruby '>=3.4.0' # Ensure github repositories are fetched using HTTPS git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end # Load vendored dotenv gem and .env file require File.join(File.dirname(__FILE__), 'lib/gemfile_helper.rb') GemfileHelper.load_dotenv do |do...
github
huginn/huginn
https://github.com/huginn/huginn
Rakefile
Ruby
mit
49,192
master
249
#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require_relative 'config/application' Huginn::Application.load_tasks
github
huginn/huginn
https://github.com/huginn/huginn
deployment/heroku/puma.rb
Ruby
mit
49,192
master
1,725
app_dir = File.expand_path("../..", __dir__) environment_name = ENV.fetch("RAILS_ENV", "production") threaded_worker_command = %w[bundle exec rails runner bin/threaded.rb] threaded_worker_env = { "RAILS_ENV" => environment_name } threaded_worker_pid = nil threaded_worker_monitor = nil shutdown_threaded_worker = lambda...
github
huginn/huginn
https://github.com/huginn/huginn
spec/spec_helper.rb
Ruby
mit
49,192
master
4,600
# 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 always be loaded, without a need to explicitly require ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/rails_helper.rb
Ruby
mit
49,192
master
2,778
ENV['RAILS_ENV'] ||= 'test' if ENV['COVERAGE'] require 'simplecov' SimpleCov.start 'rails' elsif ENV['CI'] == 'true' require 'simplecov' SimpleCov.start 'rails' do require 'simplecov-lcov' SimpleCov::Formatter::LcovFormatter.config do |c| c.report_with_single_file = true c.single_report_pat...
github
huginn/huginn
https://github.com/huginn/huginn
spec/capybara_helper.rb
Ruby
mit
49,192
master
1,658
require 'rails_helper' require 'capybara/rails' require 'capybara-select-2' require 'rspec/retry' CAPYBARA_TIMEOUT = ENV['CI'] == 'true' ? 60 : 5 def chrome_options(headless:) Selenium::WebDriver::Chrome::Options.new.tap do |options| options.binary = ENV["CHROME_BIN"] if ENV["CHROME_BIN"].present? options.a...
github
huginn/huginn
https://github.com/huginn/huginn
spec/importers/default_scenario_importer_spec.rb
Ruby
mit
49,192
master
1,968
require 'rails_helper' describe DefaultScenarioImporter do let(:user) { users(:bob) } describe '.import' do it 'imports a set of agents to get the user going when they are first created' do expect(DefaultScenarioImporter).to receive(:seed).with(kind_of(User)) allow(ENV).to receive(:[]) { nil } ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/importers/scenario_import_spec.rb
Ruby
mit
49,192
master
22,640
require 'rails_helper' describe ScenarioImport do let(:user) { users(:bob) } let(:guid) { "somescenarioguid" } let(:tag_fg_color) { "#ffffff" } let(:tag_bg_color) { "#000000" } let(:icon) { 'Star' } let(:description) { "This is a cool Huginn Scenario that does something useful!" } let(:name) { "A useful ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/edit_an_agent_spec.rb
Ruby
mit
49,192
master
616
require 'rails_helper' describe "Editing an agent", js: true do it "creates an alert if a agent with invalid json is submitted" do invalid_json = <<~JSON { "expected_receive_period_in_days": "2" "keep_event": "false" } JSON login_as(users(:bob)) visit("/agents/#{agents(:b...
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/form_configurable_feature_spec.rb
Ruby
mit
49,192
master
306
require 'capybara_helper' describe "form configuring agents", js: true do it 'completes fields with predefined array values' do login_as(users(:bob)) visit edit_agent_path(agents(:bob_csv_agent)) check('Propagate immediately') select2("serialize", from: "Mode", match: :first) end end
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/scenario_import_spec.rb
Ruby
mit
49,192
master
2,188
require 'rails_helper' describe ScenarioImportsController do let(:user) { users(:bob) } before do login_as(user) end it 'renders the import form' do visit new_scenario_imports_path expect(page).to have_text('Import a Public Scenario') end it 'requires a URL or file uplaod' do visit new_s...
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/java_script_agent_spec.rb
Ruby
mit
49,192
master
1,932
require 'rails_helper' describe "JavaScriptAgent", js: true do before do login_as(users(:bob)) end it "creates a JavaScriptAgent with code in the ace editor" do visit new_agent_path select2("Java Script Agent", search: "Java Script Agent", from: "Type") expect(page).to have_no_css("form.agent-fo...
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/dry_running_spec.rb
Ruby
mit
49,192
master
3,289
require 'rails_helper' describe "Dry running an Agent", js: true do let(:agent) { agents(:bob_website_agent) } let(:formatting_agent) { agents(:bob_formatting_agent) } let(:user) { users(:bob) } let(:emitter) { agents(:bob_weather_agent) } before(:each) do login_as(user) end def open_dry_run_m...
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/admin_users_spec.rb
Ruby
mit
49,192
master
3,512
require 'rails_helper' describe Admin::UsersController do it "requires to be signed in as an admin" do login_as(users(:bob)) visit admin_users_path expect(page).to have_text('Admin access required to view that page.') end context "as an admin" do before :each do login_as(users(:jane)) ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/create_an_agent_spec.rb
Ruby
mit
49,192
master
5,559
require 'rails_helper' describe "Creating a new agent", js: true do before(:each) do login_as(users(:bob)) end it "creates an agent" do visit "/" page.find("a", text: "Agents").hover click_on("New Agent") select_agent_type("Trigger Agent") fill_in(:agent_name, with: "Test Trigger Agent"...
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/toggle_visibility_of_disabled_agents.rb
Ruby
mit
49,192
master
563
require 'capybara_helper' describe "Toggling the visibility of an agent", js: true do it "hides them if they are disabled" do login_as(users(:bob)) visit("/agents") expect { click_on("Show/Hide Disabled Agents") }.to change{ find_all(".table-striped tr").count }.by(-1) end it "shows them ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/features/undefined_agents_spec.rb
Ruby
mit
49,192
master
549
require 'capybara_helper' describe "handling undefined agents" do before do login_as(users(:bob)) agent = agents(:bob_website_agent) agent.update_attribute(:type, 'Agents::UndefinedAgent') end it 'renders the error page' do visit agents_path expect(page).to have_text("Error: Agent(s) are 'mi...
github
huginn/huginn
https://github.com/huginn/huginn
spec/jobs/agent_reemit_job_spec.rb
Ruby
mit
49,192
master
1,766
require 'rails_helper' describe AgentReemitJob do subject { described_class.new } let(:agent) { agents(:bob_website_agent) } let(:agent_event) { events(:bob_website_agent_event) } it "re-emits all events created by the given Agent" do 2.times { agent_event.dup.save! } expect { subject.perform(a...
github
huginn/huginn
https://github.com/huginn/huginn
spec/jobs/agent_propagate_job_spec.rb
Ruby
mit
49,192
master
710
require 'rails_helper' describe AgentPropagateJob do it "calls Agent.receive! when run" do expect(Agent).to receive(:receive!) AgentPropagateJob.new.perform end context "#can_enqueue?" do it "is truthy when no propagation job is queued" do expect(AgentPropagateJob.can_enqueue?).to be_truthy ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/routing/webhooks_controller_spec.rb
Ruby
mit
49,192
master
1,366
require 'rails_helper' describe "routing for web requests", :type => :routing do it "routes to handle_request" do resulting_params = { :user_id => "6", :agent_id => "2", :secret => "foobar" } expect(get("/users/6/web_requests/2/foobar")).to route_to("web_requests#handle_request", resulting_params) expect...
github
huginn/huginn
https://github.com/huginn/huginn
spec/helpers/jobs_helper_spec.rb
Ruby
mit
49,192
master
1,187
require 'rails_helper' describe JobsHelper do let(:job) { Delayed::Job.new } describe '#status' do it "works for failed jobs" do job.failed_at = Time.now expect(status(job)).to eq('<span class="label label-danger">failed</span>') end it "works for running jobs" do job.locked_at = Ti...
github
huginn/huginn
https://github.com/huginn/huginn
spec/helpers/markdown_helper_spec.rb
Ruby
mit
49,192
master
278
require 'rails_helper' describe MarkdownHelper do describe '#markdown' do it 'renders HTML from a markdown text' do expect(markdown('# Header')).to match(/<h1>Header<\/h1>/) expect(markdown('## Header 2')).to match(/<h2>Header 2<\/h2>/) end end end
github
huginn/huginn
https://github.com/huginn/huginn
spec/helpers/dot_helper_spec.rb
Ruby
mit
49,192
master
3,492
require 'rails_helper' describe DotHelper do describe "with example Agents" do class Agents::DotFoo < Agent default_schedule "2pm" def check create_event :payload => {} end end class Agents::DotBar < Agent cannot_be_scheduled! def check create_event :paylo...
github
huginn/huginn
https://github.com/huginn/huginn
spec/helpers/scenario_helper_spec.rb
Ruby
mit
49,192
master
1,101
require 'rails_helper' describe ScenarioHelper do let(:scenario) { users(:bob).scenarios.build(name: 'Scene', tag_fg_color: '#AAAAAA', tag_bg_color: '#000000') } describe '#style_colors' do it 'returns a css style-formated version of the scenario foreground and background colors' do expect(style_colors(...
github
huginn/huginn
https://github.com/huginn/huginn
spec/helpers/application_helper_spec.rb
Ruby
mit
49,192
master
7,595
require 'rails_helper' describe ApplicationHelper do describe '#icon_tag' do it 'returns a Glyphicon icon element' do icon = icon_tag('glyphicon-help') expect(icon).to be_html_safe expect(Nokogiri(icon).at('span.glyphicon.glyphicon-help')).to be_a Nokogiri::XML::Element end it 'returns...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/user_credentials_controller_spec.rb
Ruby
mit
49,192
master
4,093
require 'rails_helper' describe UserCredentialsController do def valid_attributes(options = {}) { :credential_name => "some_name", :credential_value => "some_value" }.merge(options) end before do sign_in users(:bob), scope: :user @file = fixture_file_upload('user_credentials.json') ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/jobs_controller_spec.rb
Ruby
mit
49,192
master
3,804
require 'rails_helper' describe JobsController do describe "GET index" do before do async_handler_yaml = "--- !ruby/object:ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper\njob_data:\n job_class: AgentCheckJob\n job_id: 123id\n queue_name: default\n arguments:\n - %d\n" Delayed::...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/scenario_imports_controller_spec.rb
Ruby
mit
49,192
master
770
require 'rails_helper' describe ScenarioImportsController do before do sign_in users(:bob), scope: :user end describe "GET new" do it "initializes a new ScenarioImport and renders new" do get :new expect(assigns(:scenario_import)).to be_a(ScenarioImport) expect(response).to render_temp...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/scenarios_controller_spec.rb
Ruby
mit
49,192
master
7,070
require 'rails_helper' describe ScenariosController do def valid_attributes(options = {}) { :name => "some_name" }.merge(options) end before do sign_in users(:bob), scope: :user end describe "GET index" do it "only returns Scenarios for the current user" do get :index expect(assigns...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/agents_controller_spec.rb
Ruby
mit
49,192
master
19,054
require 'rails_helper' describe AgentsController do def valid_attributes(options = {}) { :type => "Agents::WebsiteAgent", :name => "Something", :options => agents(:bob_website_agent).options, :source_ids => [agents(:bob_weather_agent).id, ""] }.merge(options) end describe...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/web_requests_controller_spec.rb
Ruby
mit
49,192
master
8,022
require 'rails_helper' describe WebRequestsController do class Agents::WebRequestReceiverAgent < Agent cannot_receive_events! cannot_be_scheduled! def receive_web_request(params, method, format) if params.delete(:secret) == options[:secret] memory[:web_request_values] = params memo...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/omniauth_callbacks_controller_spec.rb
Ruby
mit
49,192
master
2,983
require 'rails_helper' describe OmniauthCallbacksController do before do sign_in users(:bob), scope: :user OmniAuth.config.test_mode = true request.env["devise.mapping"] = Devise.mappings[:user] end describe "accepting a callback url" do it "should update the user's credentials" do request...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/services_controller_spec.rb
Ruby
mit
49,192
master
1,176
require 'rails_helper' describe ServicesController do before do sign_in users(:bob), scope: :user end describe "GET index" do it "only returns sevices of the current user" do get :index expect(assigns(:services).all? {|i| expect(i.user).to eq(users(:bob)) }).to eq(true) end end desc...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/logs_controller_spec.rb
Ruby
mit
49,192
master
1,490
require 'rails_helper' describe LogsController do describe "GET index" do it "can filter by Agent" do sign_in users(:bob), scope: :user get :index, params: {:agent_id => agents(:bob_weather_agent).id} expect(assigns(:logs).length).to eq(agents(:bob_weather_agent).logs.length) expect(assig...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/events_controller_spec.rb
Ruby
mit
49,192
master
2,585
require 'rails_helper' describe EventsController do before do expect(Event.where(:user_id => users(:bob).id).count).to be > 0 expect(Event.where(:user_id => users(:jane).id).count).to be > 0 end describe "GET index" do it "only returns Events created by Agents of the current user" do sign_in u...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/users/registrations_controller_spec.rb
Ruby
mit
49,192
master
1,143
require 'rails_helper' module Users describe RegistrationsController do describe "POST create" do before do @request.env["devise.mapping"] = Devise.mappings[:user] end context 'with valid params' do it "imports the default scenario for the new user" do expect(DefaultS...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/agents/dry_runs_controller_spec.rb
Ruby
mit
49,192
master
4,674
require 'rails_helper' describe Agents::DryRunsController do def valid_attributes(options = {}) { type: "Agents::WebsiteAgent", name: "Something", options: agents(:bob_website_agent).options, source_ids: [agents(:bob_weather_agent).id, ""] }.merge(options) end before do sign_...