source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/integration/filtering/dynamic_spec.rb
Ruby
mit
88
main
850
require "rails_helper" RSpec.describe "dynamic filtering" do it "returns results matching the input term" do eebs = create(:author, username: "eebs") sally = create(:author, username: "sally") eebs_post = create(:post, author: eebs) create(:post, author: sally) result = Yuriita.filter( Pos...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/integration/search/keyword_spec.rb
Ruby
mit
88
main
1,655
require "rails_helper" RSpec.describe "searching by keyword" do it "returns results including the keyword" do cat_post = create(:post, title: "Cats are great") create(:post, title: "Ducks are okay too") result = Yuriita.filter( Post.all, "cats", PostDefinition.build ) expect(r...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/query_spec.rb
Ruby
mit
88
main
5,481
RSpec.describe Yuriita::Query do describe "#keywords" do it "returns only keywords" do active = build(:expression, qualifier: "is", term: "active") author = build(:expression, qualifier: "author", term: "eebs") keyword = build(:keyword, value: "keyword") query = described_class.new( ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/lexer_spec.rb
Ruby
mit
88
main
2,319
RSpec.describe Yuriita::Lexer do describe ".lex" do it "recognizes colon separated words" do expect("is:active").to produce_tokens( [ "WORD(is)", "COLON", "WORD(active)", "EOS" ] ) end it "recognizes bare words" do expect("first la...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/query_builder_spec.rb
Ruby
mit
88
main
1,120
RSpec.describe Yuriita do describe "#build" do it "returns an error result when the input could not be parsed" do relation = double(:relation) definition = double(:definition) result = Yuriita.filter(relation, "invalid::", definition) expect(result).not_to be_successful end it "...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/collection_spec.rb
Ruby
mit
88
main
1,976
require "rails_helper" RSpec.describe Yuriita::Collection do describe ".routing" do end describe ".route" do it "routes by string" do collection = Class.new(described_class) do routing "is:published", to: :published def published(relation) "abc123" end end ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/router_spec.rb
Ruby
mit
88
main
1,673
RSpec.describe Yuriita::Router do describe "string routing" do it "routes " do collection = build_collection router = described_class.new router.append_route(collection, "is:published", to: :published) input = expression("is", "published") relation = {} router.route(input, rel...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/option_spec.rb
Ruby
mit
88
main
409
RSpec.describe Yuriita::Option do it "equality is based on the option's name" do filter = double(:filter) option_a = described_class.new(name: "One", filter:) option_b = described_class.new(name: "One", filter:) option_c = described_class.new(name: "Two", filter:) expect(option_a).to eq(option_a)...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/parser_spec.rb
Ruby
mit
88
main
4,482
RSpec.describe Yuriita::Parser do describe "#parse" do it "parses an empty string" do query = parse(tokens([:EOS])) expect(query.inputs).to eq [] end it "parses keywords" do query = parse(tokens([:WORD, "hello"], [:EOS])) expect(query.inputs).to eq [keyword("hello")] end ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/table_spec.rb
Ruby
mit
88
main
2,263
RSpec.describe Yuriita::Table do describe "#q" do it "returns the default input if none is given" do table = described_class.new( relation: double(:relation), configuration: double(:configuration, default_input: "is:published"), params: {} ) expect(table.q).to eq "is:pub...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/configuration_spec.rb
Ruby
mit
88
main
1,423
RSpec.describe Yuriita::Configuration do describe "#each" do it "yields each definition" do published = double(:definition) sort = double(:definition) config = described_class.new({published: published, sort: sort}) expect do |b| config.each(&b) end.to yield_successive_args...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/selects/multiple_spec.rb
Ruby
mit
88
main
2,121
RSpec.describe Yuriita::Selects::Multiple do describe "filters" do it "returns the selected option's filters" do active_input = build(:expression, qualifier: "is", term: "active") active_filter = build(:expression_filter, input: active_input) active_option = build(:option, name: "Active", filter...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/selects/all_or_explicit_spec.rb
Ruby
mit
88
main
2,213
RSpec.describe Yuriita::Selects::AllOrExplicit do describe "filters" do context "when there are no selected options" do it "returns the all option's filters" do title_input = build(:expression, qualifier: "in", term: "title") title_filter = build(:search_filter, input: title_input) t...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/selects/exclusive_spec.rb
Ruby
mit
88
main
4,434
RSpec.describe Yuriita::Selects::Exclusive do describe "filter" do context "when there are no selected options" do it "returns the default option's filter" do active_input = build(:expression, qualifier: "is", term: "active") active_filter = build(:expression_filter, input: active_input) ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/selects/single_spec.rb
Ruby
mit
88
main
3,862
RSpec.describe Yuriita::Selects::Single do describe "filter" do context "when there are no selected options" do it "returns the selected option's filter" do active_input = build(:expression, qualifier: "is", term: "active") active_filter = build(:expression_filter, input: active_input) ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/clauses/search_spec.rb
Ruby
mit
88
main
896
require "rails_helper" RSpec.describe Yuriita::Clauses::Search do describe "#apply" do it "combines the applied filters using the combination" do cats_post = create(:post, title: "cats") ducks_post = create(:post, title: "ducks", description: "cats") title_filter = build( :search_filte...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/clauses/filter_spec.rb
Ruby
mit
88
main
738
require "rails_helper" RSpec.describe Yuriita::Clauses::Filter do describe "#apply" do it "combines the applied filters using the combination" do published = create(:post, :published) draft = create(:post, :draft) published_filter = build( :expression_filter, block: ->(relation...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
spec/yuriita/clauses/identity_spec.rb
Ruby
mit
88
main
312
require "rails_helper" RSpec.describe Yuriita::Clauses::Identity do describe "#apply" do it "returns the given relation with no changes" do relation = double(:relation) clause = described_class.new result = clause.apply(relation) expect(result).to eq(relation) end end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita.rb
Ruby
mit
88
main
502
require "zeitwerk" loader = Zeitwerk::Loader.for_gem loader.ignore("#{__dir__}/yuri-ita.rb") loader.collapse("#{__dir__}/yuriita/errors") loader.setup module Yuriita def self.filter(relation, input, configuration) query = build_query(input) relation = Runner.new(relation: relation, configuration: configurati...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/query.rb
Ruby
mit
88
main
1,095
module Yuriita class Query include Enumerable attr_reader :inputs def initialize(inputs: []) @inputs = inputs end def ==(other) other.is_a?(self.class) && other.inputs == inputs end def keywords inputs.select { |input| input.is_a?(Yuriita::Inputs::Keyword) } end ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/expression_filter.rb
Ruby
mit
88
main
256
module Yuriita class ExpressionFilter attr_reader :input def initialize(input:, &block) @input = input @block = block end def apply(relation) block.call(relation) end private attr_reader :block end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/executor.rb
Ruby
mit
88
main
277
module Yuriita class Executor def initialize(clauses) @clauses = clauses end def run(relation) clauses.reduce(relation) do |chain, clause| chain.merge(clause.apply(relation)) end end private attr_reader :clauses end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/query_builder.rb
Ruby
mit
88
main
439
module Yuriita class QueryBuilder def self.build(input) new.build(input) end def initialize(lexer: Lexer, parser: Parser) @lexer = Lexer @parser = Parser end def build(input) tokens = lexer.lex(input) parser.parse(tokens) rescue RLTK::LexingError, RLTK::NotInLan...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/search_filter.rb
Ruby
mit
88
main
485
module Yuriita class SearchFilter attr_reader :input def initialize(input:, combination:, &block) @input = input @combination = combination @block = block end def apply(relation, keywords) relations = keywords.map do |keyword| block.call(relation, keyword.to_s) ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/option.rb
Ruby
mit
88
main
306
module Yuriita class Option attr_reader :name, :filter def initialize(name:, filter:) @name = name @filter = filter end def input filter.input end def ==(other) other.is_a?(self.class) && other.name == name end alias_method :eql?, :== end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/table.rb
Ruby
mit
88
main
1,446
require "active_support" require "active_model" require "yuriita/runner" module Yuriita class Table include ActiveModel::Model SPACE = " ".freeze EMPTY_STRING = "".freeze def initialize( relation:, params:, configuration:, param_key: :q ) @relation = relation ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/or_combination.rb
Ruby
mit
88
main
413
module Yuriita class OrCombination def initialize(base_relation:, relations:) @base_relation = base_relation @relations = relations end def combine base_relation.merge(combined_relations) end private attr_reader :base_relation, :relations def combined_relations ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/lexer.rb
Ruby
mit
88
main
509
require "rltk/lexer" module Yuriita class Lexer < RLTK::Lexer DATETIME_REGEX = %r{ ([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9]) ( T ((2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])) (Z|[+-](2[0-3]|[01][0-9])(:[0-5][0-9])?) )? }x rule(/[ \t\f]+/) { :SPACE } ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/routing.rb
Ruby
mit
88
main
367
module Yuriita module Routing extend ::ActiveSupport::Concern included do cattr_accessor :router, default: Yuriita::Router.new end class_methods do def routing(matcher, to:) router.append_route(self, matcher, to: to) end def route(input, relation) router.rout...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/runner.rb
Ruby
mit
88
main
485
module Yuriita class Runner def initialize(relation:, configuration:, **options) @relation = relation @configuration = configuration @executor = options.fetch(:executor, Executor) @assembler = options.fetch(:assembler, Assembler) end def run(query) clauses = assembler.new(co...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/search.rb
Ruby
mit
88
main
211
require "active_model" module Yuriita class Search include ActiveModel::Model def initialize(table, param_key) define_singleton_method(param_key) do table.q end end end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/route.rb
Ruby
mit
88
main
788
module Yuriita class Route attr_reader :collection def initialize(collection, matcher, to) @collection = collection @matcher = matcher @to = to end def match?(input) case matcher when String # TODO better matching # This won't work for string matching be...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/assembler.rb
Ruby
mit
88
main
267
module Yuriita class Assembler attr_reader :configuration def initialize(configuration) @configuration = configuration end def build(query) configuration.map do |definition| definition.apply(query:) end end end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/dynamic_filter.rb
Ruby
mit
88
main
283
module Yuriita class DynamicFilter attr_reader :qualifier def initialize(qualifier:, &block) @qualifier = qualifier @block = block end def apply(relation, input) block.call(relation, input) end private attr_reader :block end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/collection.rb
Ruby
mit
88
main
1,226
module Yuriita class Collection include Yuriita::Routing attr_reader :input class << self def dispatch(name, input, relation) new(input).dispatch(name, relation) end def action_methods @action_methods ||= begin internal_methods = superclass.public_instance_me...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/and_combination.rb
Ruby
mit
88
main
417
module Yuriita class AndCombination def initialize(base_relation:, relations:) @base_relation = base_relation @relations = relations end def combine base_relation.merge(combined_relations) end private attr_reader :base_relation, :relations def combined_relations ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/configuration.rb
Ruby
mit
88
main
556
module Yuriita class Configuration include Enumerable EMPTY_STRING = "".freeze attr_reader :default_input def initialize(definitions, default_input: EMPTY_STRING) @definitions = definitions @default_input = default_input end def find_definition(key) definitions.fetch(key) ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/router.rb
Ruby
mit
88
main
504
module Yuriita class Router def initialize @routes = [] end def append_route(collection, matcher, to:) routes.append Route.new(collection, matcher, to) end def route(input, relation) if (route = match_for(input)) collection = route.collection collection.dispatch...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/parser.rb
Ruby
mit
88
main
1,445
require "rltk/parser" module Yuriita class Parser < RLTK::Parser left :SPACE production(:query) do clause("SPACE? .input_list SPACE?") do |inputs| Query.new(inputs: inputs) end clause("SPACE?") { |_| Query.new } end production(:input_list) do clause(".input") { |inpu...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/result.rb
Ruby
mit
88
main
509
module Yuriita class Result def self.error(exception) new(exception: exception) end def self.success(relation) new(relation: relation) end attr_reader :relation, :exception def initialize(relation: nil, exception: nil) @relation = relation @exception = exception ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/clauses/search.rb
Ruby
mit
88
main
476
module Yuriita module Clauses class Search def initialize(filters:, keywords:, combination:) @filters = filters @keywords = keywords @combination = combination end def apply(relation) relations = filters.map { |filter| filter.apply(relation, keywords) } c...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/clauses/dynamic.rb
Ruby
mit
88
main
289
module Yuriita module Clauses class Dynamic def initialize(filter:, input:) @filter = filter @input = input end def apply(relation) filter.apply(relation, input) end private attr_reader :filter, :input end end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/clauses/filter.rb
Ruby
mit
88
main
415
module Yuriita module Clauses class Filter def initialize(filters:, combination:) @filters = filters @combination = combination end def apply(relation) relations = filters.map { |filter| filter.apply(relation) } combination.new(base_relation: relation, relations:...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/definitions/multiple.rb
Ruby
mit
88
main
565
module Yuriita module Definitions class Multiple attr_reader :options, :combination def initialize(options:, combination:) @options = options @combination = combination end def apply(query:) filters = selected_filters(query) if filters.present? ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/definitions/dynamic.rb
Ruby
mit
88
main
697
module Yuriita module Definitions class Dynamic def initialize(filter:) @filter = filter end def apply(query:) input = select_input(query) if input.present? Clauses::Dynamic.new(filter:, input:) else Clauses::Identity.new end en...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/definitions/single.rb
Ruby
mit
88
main
558
module Yuriita module Definitions class Single attr_reader :options def initialize(options:) @options = options end def apply(query:) filter = selected_filter(query) if filter.present? Clauses::Filter.new(filters: [filter], combination:) else ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/definitions/exclusive.rb
Ruby
mit
88
main
575
module Yuriita module Definitions class Exclusive attr_reader :options, :default def initialize(options:, default:) @options = options @default = default end def apply(query:) filter = selected_filter(query) Clauses::Filter.new(filters: [filter], combinat...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/definitions/scope.rb
Ruby
mit
88
main
661
module Yuriita module Definitions class Scope attr_reader :options, :combination def initialize(options:, combination:) @options = options @combination = combination end def apply(query:) filters = selected_filters(query) keywords = query.keywords ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/errors/collection/action_not_found.rb
Ruby
mit
88
main
293
module Yuriita class Collection class ActionNotFound < Yuriita::Error attr_reader :collection, :action def initialize(message = nil, collection = nil, action = nil) @collection = collection @action = action super(message) end end end end
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/selects/all_or_explicit.rb
Ruby
mit
88
main
495
module Yuriita module Selects class AllOrExplicit def initialize(options:, query:) @options = options @query = query end def filters active_options.map(&:filter) end private attr_reader :options, :query def active_options explicit_optio...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/selects/exclusive.rb
Ruby
mit
88
main
906
module Yuriita module Selects class Exclusive def initialize(options:, default:, query:) @options = options @default = default @query = query end def filter active_option.filter end def selected?(option) active_option == option end ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/selects/single.rb
Ruby
mit
88
main
913
module Yuriita module Selects class Single def initialize(options:, query:) @options = options @query = query end def filter if active_option.present? active_option.filter end end def selected?(option) if active_option.present? ...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/selects/multiple.rb
Ruby
mit
88
main
486
module Yuriita module Selects class Multiple def initialize(options:, query:) @options = options @query = query end def filters active_options.map(&:filter) end def selected?(option) active_options.include?(option) end private att...
github
thoughtbot/yuri-ita
https://github.com/thoughtbot/yuri-ita
lib/yuriita/inputs/expression.rb
Ruby
mit
88
main
247
module Yuriita module Inputs Expression = Struct.new(:qualifier, :term) do def to_s if term.match?(" ") "#{qualifier}:\"#{term}\"" else "#{qualifier}:#{term}" end end end end end
github
mtslzr/homebrew-marmaduke-chromium
https://github.com/mtslzr/homebrew-marmaduke-chromium
Casks/marmaduke-chromium-ungoogled.rb
Ruby
mit
89
master
401
cask 'marmaduke-chromium-ungoogled' do version '146.7680.143' sha256 '9e124312a60d14234c82a05449f9ce10620d6d65a1f87f93f5face6a95af9568' url 'https://github.com/macchrome/macstable/releases/download/v146.7680.143-M146.0.7680.143-r1582197-macOS/Chromium.app.ungoogled-146.0.7680.143.tar.xz' name 'Chromium' home...
github
mtslzr/homebrew-marmaduke-chromium
https://github.com/mtslzr/homebrew-marmaduke-chromium
Casks/marmaduke-chromium-nosync.rb
Ruby
mit
89
master
369
cask 'marmaduke-chromium-nosync' do version '84.0.4147.89' sha256 '1fcb785f59b201962dfe88aab7f48a80a5d292acb53ea25298f0cae0f2b1b859' url "https://github.com/macchrome/macstable/releases/download/v#{version}-r768962-macOS/Chromium.#{version}.nosync.app.zip" name 'Chromium' homepage 'https://github.com/macchro...
github
mtslzr/homebrew-marmaduke-chromium
https://github.com/mtslzr/homebrew-marmaduke-chromium
Casks/marmaduke-chromium.rb
Ruby
mit
89
master
381
cask 'marmaduke-chromium' do version '127.6533.61' sha256 '2cf14c65d08b6c754b2a4d2abbb4b4c4197e10d3fcab229b392c754b9d6f9c3c' url 'https://github.com/macchrome/macstable/releases/download/v127.6533.61-M127.0.6533.61-r1313161-macOS/Chromium.app.sync-127.0.6533.61.tar.xz' name 'Chromium' homepage 'https://githu...
github
statianzo/que-web
https://github.com/statianzo/que-web
que-web.gemspec
Ruby
bsd-3-clause
88
master
1,018
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = "que-web" spec.version = "0.10.0" spec.authors = ["Jason Staten", "Bruno Porto"] spec.email = ["code.rubygems@jxs.me", "br...
github
statianzo/que-web
https://github.com/statianzo/que-web
lib/que/web.rb
Ruby
bsd-3-clause
88
master
5,593
require "sinatra/base" require "cgi" module Que class Web < Sinatra::Base PAGE_SIZE = 10 FLASH_KEY = 'que.web.flash'.freeze use Rack::MethodOverride set :root, File.expand_path("../../../web", __FILE__) set :public_folder, proc { "#{root}/public" } set :views, proc { File.expand_path("views...
github
statianzo/que-web
https://github.com/statianzo/que-web
lib/que/web/sql.rb
Ruby
bsd-3-clause
88
master
3,261
lock_job_sql = <<-SQL.freeze SELECT id, pg_try_advisory_lock(id) AS locked FROM que_jobs WHERE id = $1::bigint SQL lock_all_failing_jobs_sql = <<-SQL.freeze SELECT id, pg_try_advisory_lock(id) AS locked FROM que_jobs WHERE error_count > 0 SQL lock_all_scheduled_jobs_sql = <<-SQL.freeze SEL...
github
statianzo/que-web
https://github.com/statianzo/que-web
lib/que/web/pager.rb
Ruby
bsd-3-clause
88
master
508
class Que::Web::Pager attr_reader :current_page, :page_size, :total, :page_count def initialize(page_no, page_size, total) @current_page = page_no > 1 ? page_no : 1 @page_size = page_size @total = total @page_count = total > 0 ? (total / page_size.to_f).ceil : 1 end def next_page @current...
github
statianzo/que-web
https://github.com/statianzo/que-web
lib/que/web/viewmodels/job.rb
Ruby
bsd-3-clause
88
master
602
module Que::Web::Viewmodels class Job < Struct.new( :priority, :run_at, :id, :job_class, :error_count, :last_error_message, :queue, :last_error_backtrace, :finished_at, :expired_at, :args, :data, :backend_pid) def initialize(job) members.each do |m| self[m] = job[m] end ...
github
statianzo/que-web
https://github.com/statianzo/que-web
lib/que/web/viewmodels/job_list.rb
Ruby
bsd-3-clause
88
master
316
module Que::Web::Viewmodels class JobList extend Forwardable attr_reader :page_jobs, :pager def_delegators :@pager, :total, :next_page, :prev_page, :current_page, :page_count def initialize(page_jobs, pager) @page_jobs = page_jobs.map{|j| Job.new(j)} @pager = pager end end end
github
statianzo/que-web
https://github.com/statianzo/que-web
spec/spec_helper.rb
Ruby
bsd-3-clause
88
master
386
require "bundler/setup" require "que/web" require "minitest/autorun" class CustomFilter def self.filter(bt) return ['No backtrace'] unless bt new_bt = bt.take_while { |line| line !~ %r{minitest} } new_bt = bt.select { |line| line !~ %r{minitest} } if new_bt.empty? new_bt = bt.dup if new_bt.empty...
github
statianzo/que-web
https://github.com/statianzo/que-web
spec/pager_spec.rb
Ruby
bsd-3-clause
88
master
1,306
require "spec_helper" require "que/web/pager" describe Que::Web::Pager do subject { Que::Web::Pager.new(4, 10, 105) } it "provides passed values" do _(subject.current_page).must_equal 4 _(subject.page_size).must_equal 10 _(subject.total).must_equal 105 end it "provides a page count" do _(subj...
github
statianzo/que-web
https://github.com/statianzo/que-web
spec/web_spec.rb
Ruby
bsd-3-clause
88
master
1,879
require 'spec_helper' describe Que::Web::Helpers do let(:search) { '' } let(:params) { { 'search' => search } } subject do # Capture the params into an ivar so the params method block below captures it params_to_use = params Class.new do include Que::Web::Helpers define_method(:params)...
github
statianzo/que-web
https://github.com/statianzo/que-web
spec/que/web_spec.rb
Ruby
bsd-3-clause
88
master
1,787
require "spec_helper" require "que/web" describe Que::Web::Helpers do subject { Que::Web::Helpers.new(4, 10, 105) } def subject_with_attributes(**attributes) Class.new do include Que::Web::Helpers attributes.each { |attr, value| define_method(attr) { value } } end.new end describe '#sear...
github
statianzo/que-web
https://github.com/statianzo/que-web
spec/viewmodels/dashboard_spec.rb
Ruby
bsd-3-clause
88
master
335
require "spec_helper" describe Que::Web::Viewmodels::Dashboard do let(:dashboard_stats) { { total: 10, running: 6, failing: 2, scheduled: 2 } } let(:subject) { Que::Web::Viewmodels::Dashboard.new(dashboard_stats) } it 'passes through values' do _(subject.scheduled).must_equ...
github
statianzo/que-web
https://github.com/statianzo/que-web
spec/viewmodels/job_list_spec.rb
Ruby
bsd-3-clause
88
master
710
require "spec_helper" describe Que::Web::Viewmodels::JobList do let(:job) { {priority: 100, run_at: Time.now, id: 555, job_class: "SuccessJob", args: ["arg1", {name: "foo", age: 10}], error_count: 0, last_error_message: nil, last_error_backtrace: nil, queue: "foo" } } let(:p...
github
statianzo/que-web
https://github.com/statianzo/que-web
spec/viewmodels/job_spec.rb
Ruby
bsd-3-clause
88
master
1,252
require "spec_helper" describe Que::Web::Viewmodels::Job do let(:source_job) { {priority: 100, run_at: Time.now - 3600, job_id: 555, job_class: "SuccessJob", args: ["arg1", {name: "foo", age: 10}], error_count: 0, last_error_message: nil, last_error_backtracd: nil, queue: "foo" ...
github
statianzo/que-web
https://github.com/statianzo/que-web
examples/rack/boot.rb
Ruby
bsd-3-clause
88
master
575
require 'bundler/setup' require 'sequel' require 'que' require 'logger' require 'open-uri' require 'securerandom' Que.logger = Logger.new(STDOUT) Que.logger.level = Logger::INFO Que.connection = Sequel.connect("postgres://localhost/quewebtest", max_connections: 1) Que.migrate!(version: 4) $stdout.sync = true class Fa...
github
statianzo/que-web
https://github.com/statianzo/que-web
examples/rack/config.ru
Ruby
bsd-3-clause
88
master
1,176
require File.expand_path('../boot', __FILE__) require 'que/web' map '/que' do use Rack::Session::Cookie, :secret => 'insecure', :key => 'que.examples.rack' run Que::Web end map '/success' do run lambda { |env| SuccessJob.enqueue 'arg1', {name: 'foo', age: 10} [200, {}, ['Success job enqueued']] } end ...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
react-rails-hot-loader.gemspec
Ruby
mit
87
master
1,565
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'hot_loader/version' Gem::Specification.new do |spec| spec.name = "react-rails-hot-loader" spec.version = React::Rails::HotLoader::VERSION spec.authors = ["Robert Mosolg...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
Guardfile
Ruby
mit
87
master
513
guard :minitest do watch(%r{^test/(.*)\/?(.*)_test\.rb$}) watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}#{m[2]}_test.rb" } watch(%r{^test/test_helper\.rb$}) { 'test' } end guard :bundler do require 'guard/bundler' require 'guard/bundler/verify' helper = Guard::Bundler::Verify.new files ...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
test/test_helper.rb
Ruby
mit
87
master
493
require 'simplecov' SimpleCov.start require 'minitest/autorun' # Configure Rails Environment ENV["RAILS_ENV"] = "test" require File.expand_path("../dummy/config/environment.rb", __FILE__) Rails.backtrace_cleaner.remove_silencers! # Load support files Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| requi...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
test/hot_loader/asset_change_set_test.rb
Ruby
mit
87
master
2,855
require 'test_helper' TEST_ASSET_1 = %|var testAsset1 = function () { return React.createElement( "span", null, "test asset 1" ); }; | TEST_STYLES_1 = %|header h1 { color: red; } | describe React::Rails::HotLoader::AssetChangeSet do it 'notes javascripts that changed' do since = Time.now ...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
test/hot_loader/asset_path_test.rb
Ruby
mit
87
master
524
require 'test_helper' describe React::Rails::HotLoader::AssetPath do before do @gem_asset_path = File.expand_path('../../../lib/assets', __FILE__) end it 'points to the real thing' do path = React::Rails::HotLoader::AssetPath.new real_path = @gem_asset_path assert_equal(real_path, path.to_s) e...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
test/hot_loader/server_test.rb
Ruby
mit
87
master
1,796
require 'test_helper' describe React::Rails::HotLoader::Server do before do @server = React::Rails::HotLoader::Server.new(port: 7070) @server.restart @client = WebSocketExpectationClient.new("ws://localhost:7070") end it 'sends asset paths which have changed since that time' do touch_asset("test...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
test/support/web_socket_expectation_client.rb
Ruby
mit
87
master
991
require 'websocket-client-simple' # records responses for testing the WS Server class WebSocketExpectationClient attr_reader :received, :ws def initialize(url) @received = [] client = self begin @ws = WebSocket::Client::Simple.connect(url) ws.on :open do client.log "ExpectationClie...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
test/dummy/Gemfile
Ruby
mit
87
master
217
source 'https://rubygems.org' gem 'rails', '4.2.2' gem 'sqlite3' gem 'sass-rails', '~> 5.0' gem 'jquery-rails' gem 'thin' gem 'react-rails-hot-loader', path: '../../' group :development, :test do gem 'spring' end
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
test/dummy/config/application.rb
Ruby
mit
87
master
1,134
require File.expand_path('../boot', __FILE__) require 'rails/all' require 'react-rails' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Dummy class Application < Rails::Application # Settings in config/envir...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
lib/hot_loader.rb
Ruby
mit
87
master
636
module React module Rails module HotLoader mattr_accessor :server mattr_accessor :port self.port = 8082 # Start _or_ restart the server def self.restart self.server ||= Server.new(port: port) self.server.restart rescue StandardError => err React::Rails:...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
lib/hot_loader/railtie.rb
Ruby
mit
87
master
1,175
module React module Rails module HotLoader class Railtie < ::Rails::Railtie config.before_initialize do |app| asset_path = React::Rails::HotLoader::AssetPath.new(dummy: !(::Rails.env.development?)) app.config.assets.paths << asset_path.to_s end config.after_initi...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
lib/hot_loader/asset_path.rb
Ruby
mit
87
master
449
module React module Rails module HotLoader # We want to include different files in dev/prod. The production (dummy) file is empty! class AssetPath GEM_LIB_PATH = Pathname.new('../../').expand_path(__FILE__) attr_reader :to_s def initialize(dummy: false) asset_path ...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
lib/hot_loader/server.rb
Ruby
mit
87
master
2,880
require 'em-websocket' module React module Rails module HotLoader class Server attr_reader :host, :port, :change_set_class def initialize(host: "0.0.0.0", port:, change_set_class: React::Rails::HotLoader::AssetChangeSet) @host = host @port = port @change_set_c...
github
rmosolgo/react-rails-hot-loader
https://github.com/rmosolgo/react-rails-hot-loader
lib/hot_loader/asset_change_set.rb
Ruby
mit
87
master
2,031
module React module Rails module HotLoader class AssetChangeSet attr_reader :since, :path, :changed_files, :changed_file_names class_attribute :asset_glob, :bankruptcy_count # Search for changes with this glob self.asset_glob = "/**/*.{css,sass,scss,js,coffee}*" # If ...
github
ebeigarts/signer
https://github.com/ebeigarts/signer
Rakefile
Ruby
mit
87
master
318
#!/usr/bin/env rake require "bundler/gem_tasks" require "rspec/core/rake_task" Bundler::GemHelper.install_tasks RSpec::Core::RakeTask.new(:spec) task :default => :spec task :generate_cert_and_private_key do system "openssl req -new -x509 -keyout spec/fixtures/key.pem -out spec/fixtures/cert.pem -days 365" end
github
ebeigarts/signer
https://github.com/ebeigarts/signer
signer.gemspec
Ruby
mit
87
master
804
# -*- encoding: utf-8 -*- require File.expand_path('../lib/signer/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Edgars Beigarts"] gem.email = ["edgars.beigarts@gmail.com"] gem.description = %q{WS Security XML signer} gem.summary = gem.description gem.homepage ...
github
ebeigarts/signer
https://github.com/ebeigarts/signer
lib/signer.rb
Ruby
mit
87
master
19,682
require "nokogiri" require "base64" require "digest/sha1" require "openssl" require "signer/digester" require "signer/version" class Signer attr_accessor :document, :private_key, :signature_algorithm_id, :ds_namespace_prefix, :wss attr_reader :cert attr_writer :security_node, :signature_node, :security_token_id...
github
ebeigarts/signer
https://github.com/ebeigarts/signer
lib/signer/digester.rb
Ruby
mit
87
master
2,246
require 'openssl' class Signer # Digest algorithms supported "out of the box" DIGEST_ALGORITHMS = { # SHA 1 sha1: { name: 'SHA1', id: 'http://www.w3.org/2000/09/xmldsig#sha1', digester: lambda { OpenSSL::Digest::SHA1.new }, }, # SHA 256 sha256: { name: 'SHA256', i...
github
ebeigarts/signer
https://github.com/ebeigarts/signer
spec/signer_spec.rb
Ruby
mit
87
master
14,374
require "spec_helper" describe Signer do it "should digest and sign SOAP XML with security node and digested binary token" do input_xml_file = File.join(File.dirname(__FILE__), 'fixtures', 'input_1.xml') cert_file = File.join(File.dirname(__FILE__), 'fixtures', 'cert.pem') private_key_file = Fil...
github
teracyhq/dev
https://github.com/teracyhq/dev
Berksfile
Ruby
bsd-3-clause
87
master
202
source "https://supermarket.chef.io" cookbook 'vim', '~> 2.0' cookbook 'magic_shell', '~> 1.0' cookbook 'docker', '~> 2.15' cookbook 'docker_compose', '~> 0.1' cookbook 'compat_resource', '~> 12.19.0'
github
teracyhq/dev
https://github.com/teracyhq/dev
Vagrantfile
Ruby
bsd-3-clause
87
master
17,762
# -*- mode: ruby -*- # vi: set ft=ruby : require 'json' load File.dirname(__FILE__) + '/lib/utility.rb' load File.dirname(__FILE__) + '/lib/provisioner.rb' # Load default setting file = File.read(File.dirname(__FILE__) + '/vagrant_config.json') data_hash = JSON.parse(file) override_hash = nil # Check and override if...
github
teracyhq/dev
https://github.com/teracyhq/dev
Rakefile
Ruby
bsd-3-clause
87
master
3,879
require "bundler/setup" task :default => [:list] desc "List all the tasks." task :list do puts "Tasks: \n- #{(Rake::Task.tasks).join("\n- ")}" end desc "Checks for required dependencies." task :check do environemnt_vars = [ 'OPSCODE_USER', 'OPSCODE_ORGNAME', 'KNIFE_CLIENT_KEY_FOLDER', 'KNIFE_VALI...
github
teracyhq/dev
https://github.com/teracyhq/dev
Gemfile
Ruby
bsd-3-clause
87
master
244
source 'http://rubygems.org' ruby '2.4.0' gem 'rake', '~> 11.3' group:development do gem 'chef', '~> 13.1' gem 'chefspec', '~> 7.1' gem 'foodcritic', '~> 8.1' gem 'knife-spork', '~> 1.6' gem 'berkshelf', '~> 5.2' gem "rspec" end
github
teracyhq/dev
https://github.com/teracyhq/dev
config/rake.rb
Ruby
bsd-3-clause
87
master
944
# Configure the Rakefile's tasks. ### # Company and SSL Details # Used with the ssl_cert task. ### # The company name - used for SSL certificates, and in srvious other places COMPANY_NAME = "Teracy, Inc." # The Country Name to use for SSL Certificates SSL_COUNTRY_NAME = "VN" # The State Name to use for SSL Certific...
github
teracyhq/dev
https://github.com/teracyhq/dev
lib/provisioner.rb
Ruby
bsd-3-clause
87
master
17,094
# provisioner lib for dynamic settings provision from provided config file # see: https://www.vagrantup.com/docs/provisioning/ # TODO(hoatle): should loop over and set the key dynamically # https://www.vagrantup.com/docs/provisioning/file.html private def file_settings(file, config) file.source = config['source'] ...
github
teracyhq/dev
https://github.com/teracyhq/dev
lib/utility.rb
Ruby
bsd-3-clause
87
master
4,895
# Utility functions def overrides(obj1, obj2) obj2.each do |key, value| replaced_key = key.to_s.sub(/_u?[ra]_/, '') if !obj1.has_key?(replaced_key) if value.class.name == 'Hash' obj1[key] = {} elsif value.class.name == 'Array' obj1[replaced_key] = [] end end # replace ...
github
teracyhq/dev
https://github.com/teracyhq/dev
vendor-cookbooks/docker_compose/resources/application.rb
Ruby
bsd-3-clause
87
master
989
# # Cookbook Name:: docker_compose # Resource:: application # # Copyright (c) 2016 Sebastian Boschert, All Rights Reserved. property :project_name, kind_of: String, name_property: true property :compose_files, kind_of: Array, required: true property :remove_orphans, kind_of: [TrueClass, FalseClass], default: false de...
github
teracyhq/dev
https://github.com/teracyhq/dev
vendor-cookbooks/docker_compose/recipes/installation.rb
Ruby
bsd-3-clause
87
master
831
# # Cookbook Name:: docker_compose # Recipe:: installation # # Copyright (c) 2016 Sebastian Boschert, All Rights Reserved. def get_install_url release = node['docker_compose']['release'] kernel_name = node['kernel']['name'] machine_hw_name = node['kernel']['machine'] "https://github.com/docker/compose/releases...