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
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/api_project_resource.rb
Ruby
mit
96
master
1,103
# frozen_string_literal: true module CircleCi ## # # Class for interacting with project API resources class ApiProjectResource < ApiResource VALID_VCS_TYPES = %w[github bitbucket].freeze DEFAULT_VCS_TYPE = VALID_VCS_TYPES.first.freeze attr_reader :build, :vcs_type ## # # Initialize a ...
github
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/user.rb
Ruby
mit
96
master
833
# frozen_string_literal: true module CircleCi ## # # User class to access user details for a specific API key class User < ApiResource ## # # Initialize a new User API interaction # # @param conf [CircleCi::Config] - Optional config to use for request # @return [CircleCi::User] ...
github
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/build.rb
Ruby
mit
96
master
1,168
# frozen_string_literal: true module CircleCi ## # # Class for interacting with and managing builds class Build < ApiProjectResource ## # # Get artifacts for a specific build of a project # # @return [CircleCi::Response] - Response object def artifacts CircleCi.request(conf, "#{ba...
github
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/project.rb
Ruby
mit
96
master
5,889
# frozen_string_literal: true module CircleCi ## # # Class for interacting with Projects class Project < ApiProjectResource ## # # Initialize a new Project API interaction # # @param username [String] - The vcs username or org name for project # @param project [String] - The project na...
github
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/request.rb
Ruby
mit
96
master
2,002
# frozen_string_literal: true require 'openssl' # frozen_string_literal: true module CircleCi ## # # Request class to handle HTTP API interactions # class Request DEFAULT_OPTIONS = { use_ssl: true, verify_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_PEER }.freeze DEFAULT_HEADE...
github
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/response.rb
Ruby
mit
96
master
1,035
# frozen_string_literal: true require 'forwardable' # frozen_string_literal: true module CircleCi ## # # Response class is used to get access to raw HTTP request info class Response extend Forwardable def_delegators :@resp, :code, :message, :uri attr_reader :body ## # Initializing respo...
github
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/api_resource.rb
Ruby
mit
96
master
621
# frozen_string_literal: true module CircleCi ## # # ApiResource is a parent class for rest resources for the # CircleCI API. It allows for request conifugration to be # set per request if needed, otherwise the default global # CircleCi.config is used class ApiResource attr_reader :conf, :project, :u...
github
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/config.rb
Ruby
mit
96
master
1,506
# frozen_string_literal: true module CircleCi ## # # Config class used internally. # Configure API calls using CircleCi.configure class Config DEFAULT_VERSION = 'v1.1'.freeze DEFAULT_HOST = 'https://circleci.com'.freeze DEFAULT_URI = "#{DEFAULT_HOST}/api/#{DEFAULT_VERSION}".freeze DEFAULT_POR...
github
mtchavez/circleci
https://github.com/mtchavez/circleci
lib/circleci/recent_builds.rb
Ruby
mit
96
master
695
# frozen_string_literal: true module CircleCi ## # # Class for interacting with recent builds class RecentBuilds < ApiResource ## # # Initialize a new RecentBuilds API interaction # # @param conf [CircleCi::Config] - Optional config to use for request # @return [CircleCi::RecentBuil...
github
benbalter/jekyll-titles-from-headings
https://github.com/benbalter/jekyll-titles-from-headings
jekyll-titles-from-headings.gemspec
Ruby
mit
96
main
1,114
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("lib", __dir__) require "jekyll-titles-from-headings/version" Gem::Specification.new do |s| s.name = "jekyll-titles-from-headings" s.version = JekyllTitlesFromHeadings::VERSION s.authors = ["Ben Balter"] s.email = [...
github
benbalter/jekyll-titles-from-headings
https://github.com/benbalter/jekyll-titles-from-headings
spec/spec_helper.rb
Ruby
mit
96
main
1,121
# frozen_string_literal: true require "jekyll-titles-from-headings" 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 config...
github
benbalter/jekyll-titles-from-headings
https://github.com/benbalter/jekyll-titles-from-headings
spec/jekyll-titles-from-headings/context_spec.rb
Ruby
mit
96
main
438
# frozen_string_literal: true RSpec.describe JekyllTitlesFromHeadings::Context do subject { described_class.new(site) } let(:site) { fixture_site("site") } it "returns the site" do expect(subject.site).to be_a(Jekyll::Site) end it "returns the registers" do expect(subject.registers).to be_a(Hash) ...
github
benbalter/jekyll-titles-from-headings
https://github.com/benbalter/jekyll-titles-from-headings
spec/jekyll-titles-from-headings/generator_spec.rb
Ruby
mit
96
main
7,903
# frozen_string_literal: true RSpec.describe JekyllTitlesFromHeadings::Generator do subject { described_class.new(site) } let(:config) { {} } let(:site) { fixture_site("site", config) } let(:page) { page_by_path(site, "page.md") } let(:page_with_title) { page_by_path(site, "page-with-title.md") } let(:pag...
github
benbalter/jekyll-titles-from-headings
https://github.com/benbalter/jekyll-titles-from-headings
spec/jekyll-titles-from-headings/filters_spec.rb
Ruby
mit
96
main
541
# frozen_string_literal: true RSpec.describe JekyllTitlesFromHeadings::Filters do subject { described_class.new(site) } let(:site) { fixture_site("site") } it "markdownifies" do html = subject.markdownify("# test") expect(html).to eql("<h1 id=\"test\">test</h1>\n") end it "strips html" do stri...
github
benbalter/jekyll-titles-from-headings
https://github.com/benbalter/jekyll-titles-from-headings
lib/jekyll-titles-from-headings/generator.rb
Ruby
mit
96
main
3,744
# frozen_string_literal: true module JekyllTitlesFromHeadings class Generator < Jekyll::Generator attr_accessor :site TITLE_REGEX = %r! \A\s* # Beginning and whitespace (?: # either \#{1,3}\s+(.*)(?:\s+\#{1,3})? # at...
github
oswaldlabs/chef-rundeck
https://github.com/oswaldlabs/chef-rundeck
chef-rundeck.gemspec
Ruby
apache-2.0
96
master
2,359
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "chef-rundeck" s.version = "2.2.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rub...
github
oswaldlabs/chef-rundeck
https://github.com/oswaldlabs/chef-rundeck
Rakefile
Ruby
apache-2.0
96
master
1,462
require 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "chef-rundeck" gem.summary = %Q{Integrates Chef with RunDeck} gem.description = %Q{Provides a resource endpoint for RunDeck from a Chef Server} gem.email = "adam@opscode.com" gem.homepage = "http://...
github
oswaldlabs/chef-rundeck
https://github.com/oswaldlabs/chef-rundeck
spec/spec_helper.rb
Ruby
apache-2.0
96
master
380
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'chef-rundeck' require 'sinatra' require 'rspec' require 'rack/test' set :environment, :test set :run, false set :raise_errors, true set :logging, false def app ChefRundeck.new end RSpec.con...
github
oswaldlabs/chef-rundeck
https://github.com/oswaldlabs/chef-rundeck
spec/chef-rundeck_spec.rb
Ruby
apache-2.0
96
master
6,157
require 'spec_helper' require 'nokogiri' describe 'ChefRundeck' do before do # setup for the following tests ChefRundeck.config_file = "#{ENV['TRAVIS_BUILD_DIR']}/spec/support/client.rb" ChefRundeck.username = ENV['USER'] ChefRundeck.web_ui_url = 'https://manage.opscode.com' ChefRundeck.project_c...
github
oswaldlabs/chef-rundeck
https://github.com/oswaldlabs/chef-rundeck
spec/support/client.rb
Ruby
apache-2.0
96
master
284
log_level :debug log_location STDOUT chef_server_url "https://api.opscode.com/organizations/chef-rundeck" web_ui_url "https://manage.opscode.com" client_key "#{ENV["TRAVIS_BUILD_DIR"]}" + "/spec/support/travis.pem" node_name "travis" username "travis"
github
oswaldlabs/chef-rundeck
https://github.com/oswaldlabs/chef-rundeck
lib/partial_search.rb
Ruby
apache-2.0
96
master
2,584
# # Author:: Adam Jacob (<adam@opscode.com>) # Author:: John Keiser (<jkeiser@opscode.com>) # Copyright:: Copyright (c) 2012 Opscode, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
github
oswaldlabs/chef-rundeck
https://github.com/oswaldlabs/chef-rundeck
lib/chef-rundeck.rb
Ruby
apache-2.0
96
master
12,321
# # Copyright 2010, Opscode, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
github
linjer/jekyll-katex
https://github.com/linjer/jekyll-katex
jekyll-katex.gemspec
Ruby
mit
96
master
1,642
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'jekyll-katex/version' Gem::Specification.new do |spec| spec.name = 'jekyll-katex' spec.version = Jekyll::Katex::VERSION spec.authors = ['Jerry Lin'] spec....
github
linjer/jekyll-katex
https://github.com/linjer/jekyll-katex
Rakefile
Ruby
mit
96
master
440
# frozen_string_literal: true require 'bundler/gem_tasks' task default: :build task :js_i do sh 'yarn', 'install' cp 'node_modules/katex/dist/katex.min.js', 'lib/assets/js/katex.min.js' end task build: %i[js_i] do sh 'gem', 'build', 'jekyll-katex.gemspec' end task clobber: [:clean] do rm_rf Rake::FileList....
github
linjer/jekyll-katex
https://github.com/linjer/jekyll-katex
spec/spec_helper.rb
Ruby
mit
96
master
1,181
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('../../lib', __dir__) require 'simplecov' SimpleCov.start require 'jekyll' require 'jekyll-katex' Jekyll.logger.log_level = :error RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus config.order ...
github
linjer/jekyll-katex
https://github.com/linjer/jekyll-katex
lib/jekyll-katex.rb
Ruby
mit
96
master
245
# frozen_string_literal: true require 'jekyll' require 'jekyll/tags/katex' require 'jekyll/tags/katex_math_mode' Liquid::Template.register_tag('katex', Jekyll::Tags::Katex) Liquid::Template.register_tag('katexmm', Jekyll::Tags::KatexMathMode)
github
linjer/jekyll-katex
https://github.com/linjer/jekyll-katex
lib/jekyll/tags/katex.rb
Ruby
mit
96
master
813
# frozen_string_literal: true require 'jekyll-katex/configuration' require 'jekyll-katex/katex_js' module Jekyll module Tags # Defines the custom Liquid tag for compile-time rendering of KaTeX math # {% katex %} # <latex math> # {% endkatex %} class Katex < Liquid::Block LOG_TOPIC = ...
github
linjer/jekyll-katex
https://github.com/linjer/jekyll-katex
lib/jekyll/tags/katex_math_mode.rb
Ruby
mit
96
master
1,787
# frozen_string_literal: true require 'jekyll-katex/configuration' require 'jekyll-katex/katex_js' module Jekyll module Tags # Defines the custom Liquid tag for compile-time rendering of KaTeX math. # This differs from the katex tag in that it allows use of `$` and `$$` fencing to mark math mode blocks simi...
github
linjer/jekyll-katex
https://github.com/linjer/jekyll-katex
lib/jekyll-katex/configuration.rb
Ruby
mit
96
master
1,623
# frozen_string_literal: true require 'jekyll' require 'jekyll-katex/lib_root' module Jekyll module Katex # For holding configuration values specific to the jekyll-katex plugin class Configuration LOG_TOPIC = 'Katex Configuration:' CONFIG_DEFAULTS = { 'js_filename' => 'katex.min.js', ...
github
linjer/jekyll-katex
https://github.com/linjer/jekyll-katex
lib/jekyll-katex/katex_js.rb
Ruby
mit
96
master
318
# frozen_string_literal: true require 'execjs' require 'jekyll-katex/configuration' # Holds reference to the katex.min.js lib module Jekyll # Katex fast math rendering, see https://github.com/Khan/KaTeX module Katex KATEX_JS ||= ExecJS.compile(File.open(Jekyll::Katex::Configuration.js_path).read) end end
github
XlogicX/irasm
https://github.com/XlogicX/irasm
irasm.rb
Ruby
mit
96
master
169,007
#!/usr/bin/ruby require 'readline' $debug = 0 #-------------------------------------------- # Process for each instruction # #-------------------------------------------- # 1. Parse instruction name (happens in main) and pass control to instruction function (with same name) # 2. Instruction function passes machine...
github
XlogicX/irasm
https://github.com/XlogicX/irasm
asmshell.rb
Ruby
mit
96
master
601
#!/usr/bin/ruby def main(bits) while 1 do print 'asmshell > ' asm = gets.chomp if /(quit|(?<!s)exit)/i.match(asm) exit end nasm(asm,bits) end end def nasm (data,bits) file = File.open("tmp.asm", "w") if bits == 32 then file.write("[BITS 32]\n" + data + "\n") else file.write("[BITS 16]\n" + data + ...
github
kdan-mobile-software-ltd/service_caller
https://github.com/kdan-mobile-software-ltd/service_caller
service_caller.gemspec
Ruby
mit
96
master
860
Gem::Specification.new do |s| s.name = 'service_caller' s.version = File.read("./VERSION.md") s.platform = Gem::Platform::RUBY s.summary = 'Ruby Service Basic Class' s.description = 'basic implement of service object' s.authors = ['JiaRou Lee'] s.email = 'laura34963@kdanmobile....
github
kdan-mobile-software-ltd/service_caller
https://github.com/kdan-mobile-software-ltd/service_caller
lib/service_error.rb
Ruby
mit
96
master
584
class ServiceError < StandardError attr_reader :key attr_reader :error_obj class << self def generate_from_exception(exception, append_info={}) error_obj = {error_message: "#{exception.class.name}: #{exception.message}"} error_obj.merge!(append_info) service_err = new(:internal_error, error...
github
kdan-mobile-software-ltd/service_caller
https://github.com/kdan-mobile-software-ltd/service_caller
lib/service_caller.rb
Ruby
mit
96
master
295
require 'service_extend/callable' require 'service_extend/handler' require 'service_error' class ServiceCaller include ServiceExtend::Callable extend ServiceExtend::Callable::ClassMethods def self.inherited(child_class) child_class.prepend(ServiceExtend::Handler) super end end
github
kdan-mobile-software-ltd/service_caller
https://github.com/kdan-mobile-software-ltd/service_caller
lib/service_extend/handler.rb
Ruby
mit
96
master
699
module ServiceExtend module Handler def call if defined?(::Rails::Engine) && defined?(::ActiveRecord) begin super rescue ServiceError => e @error = e rescue ActiveRecord::RecordNotFound => e @error = ServiceError.new(:record_not_found, error_message: e....
github
kdan-mobile-software-ltd/service_caller
https://github.com/kdan-mobile-software-ltd/service_caller
lib/service_extend/callable.rb
Ruby
mit
96
master
309
module ServiceExtend module Callable attr_reader :error, :result module ClassMethods def call(*args, **hsh) service = new(*args, **hsh) service.call service end end def success? error.nil? end def failed? !success? end end end
github
y-crdt/yrb
https://github.com/y-crdt/yrb
y-rb.gemspec
Ruby
mit
96
main
1,615
# frozen_string_literal: true begin require_relative "lib/y/version" rescue LoadError puts "WARNING: Could not load Y::VERSION" end Gem::Specification.new do |spec| spec.name = "y-rb" spec.version = defined?(Y::VERSION) ? Y::VERSION : "0.0.0" spec.authors = ["Hannes Moser"] spec.email = %w[hmoser@gitlab.c...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
Gemfile
Ruby
mit
96
main
321
# frozen_string_literal: true source "https://rubygems.org" # Specify your gem's dependencies in y-rb.gemspec gemspec gem "benchmark" gem "benchmark-ips" gem "benchmark-memory" gem "github-markup" gem "redcarpet" gem "rspec" gem "rspec-benchmark" gem "rubocop" gem "rubocop-performance" gem "rubocop-rspec" gem "yard"
github
y-crdt/yrb
https://github.com/y-crdt/yrb
Rakefile
Ruby
mit
96
main
1,801
# frozen_string_literal: true require "bundler/gem_tasks" require "rubygems/package_task" require "rake_compiler_dock" require "rake/testtask" require "rake/extensiontask" require "rb_sys" ruby_cc_version = RakeCompilerDock.ruby_cc_version([">= 3.1", "< 3.5"]) cross_platforms = %w[ aarch64-linux-gnu aarch64-linux...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/spec_helper.rb
Ruby
mit
96
main
477
# frozen_string_literal: true require "rspec-benchmark" require "y" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching!...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/doc_spec.rb
Ruby
mit
96
main
4,709
# frozen_string_literal: true RSpec.describe Y::Doc do it "creates a transaction" do doc = described_class.new transaction = doc.current_transaction { |tx| tx } expect(transaction).to be_instance_of(Y::Transaction) end it "returns diff" do local_doc = described_class.new remote_doc = descr...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/transaction_spec.rb
Ruby
mit
96
main
1,452
# frozen_string_literal: true RSpec.describe Y::Transaction do it "creates array type" do doc = Y::Doc.new doc.get_array("my array") # creates array arr = doc.current_transaction { |tx| tx.get_array("my array") } expect(arr).to be_instance_of(Y::Array) end it "creates map type" do doc = Y:...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/xml_text_spec.rb
Ruby
mit
96
main
5,670
# frozen_string_literal: true RSpec.describe Y::XMLText do it "create XMLElement by name" do doc = Y::Doc.new xml_text = doc.get_xml_text("my text") expect(xml_text.attrs).to eq({}) end it "appends a string to the end of the XMLText" do doc = Y::Doc.new xml_text = doc.get_xml_text("my text"...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/xml_fragment_spec.rb
Ruby
mit
96
main
2,644
# frozen_string_literal: true RSpec.describe Y::XMLFragment do it "creates new XMLFragment" do doc = Y::Doc.new xml_fragment = doc.get_xml_fragment("default") expect(xml_fragment.to_s).to eq("") end it "inserts new node at index" do doc = Y::Doc.new xml_fragment = doc.get_xml_fragment("defa...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/bugs_spec.rb
Ruby
mit
96
main
8,618
# frozen_string_literal: true require "base64" RSpec.describe "Bugs" do it "issue #45" do diffs = [[1, 3, 197, 134, 244, 186, 10, 0, 7, 1, 7, 100, 101, 102, 97, 117, 108, 116, 3, 9, 112, 97, 114, 97, 103, 114, 97, 112, 104, 7, 0, 197, 134, 244, 186, 10, 0, 6, 4, 0, 197, 134, 244, 186, 10, 1, 1, 115, 0], ...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/map_spec.rb
Ruby
mit
96
main
5,533
# frozen_string_literal: true RSpec.describe Y::Map do it "creates new map" do doc = Y::Doc.new map = doc.get_map("my map") expect(map).to be_instance_of(described_class) end it "inserts element to map" do doc = Y::Doc.new map = doc.get_map("my map") map[:hello] = "world" expect(m...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/array_spec.rb
Ruby
mit
96
main
5,212
# frozen_string_literal: true RSpec.describe Y::Array do it "creates a new array" do doc = Y::Doc.new arr = doc.get_array("my array") expect(arr).to be_empty end it "adds element to the end" do doc = Y::Doc.new arr = doc.get_array("my array") arr << 1 expect(arr.to_a).to eq([1]) ...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/text_spec.rb
Ruby
mit
96
main
5,058
# frozen_string_literal: true RSpec.describe Y::Text do it "appends string to text" do doc = Y::Doc.new text = doc.get_text("my text") text << "Hello, World!" expect(text.size).to eq("Hello, World!".size) end it "formats text" do doc = Y::Doc.new text = doc.get_text("my text") text ...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/xml_element_spec.rb
Ruby
mit
96
main
9,123
# frozen_string_literal: true RSpec.describe Y::XMLElement do it "creates new XMLElement" do doc = Y::Doc.new xml_element = doc.get_xml_element("root") expect(xml_element.to_s).to eq("<root></root>") end it "inserts new node at index" do doc = Y::Doc.new xml_element = doc.get_xml_element("r...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/y/awareness_spec.rb
Ruby
mit
96
main
2,442
# frozen_string_literal: true RSpec.describe Y::Awareness do let(:state) { { "cursor" => { "pos" => 0 } } } let(:local_awareness) { described_class.new } let(:local_id) { local_awareness.client_id } it "applies an update" do local_awareness.local_state = state remote_awareness = described_class.new ...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/bench/traces_spec.rb
Ruby
mit
96
main
372
# frozen_string_literal: true RSpec.describe "Measure real-world traces", :bench do let!(:diff) do file = File.join(__dir__, "./input/b4-update.bin") File.read(file.to_s).unpack("C*") end let(:doc) { Y::Doc.new } it "sync b4-update.bin (~400k) must be faster than 5ms" do expect { doc.sync(diff) }...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
spec/bench/insert_spec.rb
Ruby
mit
96
main
389
# frozen_string_literal: true RSpec.describe "Measure inserts", :bench do let!(:diff) do file = File.join(__dir__, "./input/b4-update.bin") File.read(file.to_s).unpack("C*") end let(:doc) { Y::Doc.new } let(:array) { doc.get_array("array") } it "insert element into array has a linear trend" do ...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y-rb.rb
Ruby
mit
96
main
518
# rubocop:disable Naming/FileName # frozen_string_literal: true # load native extension begin ruby_version = /(\d+\.\d+)/.match(RUBY_VERSION) require_relative "#{ruby_version}/yrb" rescue LoadError require "yrb" end require_relative "y/array" require_relative "y/awareness" require_relative "y/diff" require_rela...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y/doc.rb
Ruby
mit
96
main
9,808
# frozen_string_literal: true require_relative "transaction" module Y # @example Create a local and remote doc and syncs the diff # local = Y::Doc.new # local_map = local.get_map("my map") # local_map[:hello] = "world" # # remote = Y::Doc.new # # diff = local.diff(remote.state) # remote....
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y/transaction.rb
Ruby
mit
96
main
4,832
# frozen_string_literal: true module Y class Transaction # @!attribute [r] document # # @return [Y::Doc] The document this array belongs to attr_accessor :document def initialize(doc = nil) @document = doc super() end # Applies the encoded update on this document. This will...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y/map.rb
Ruby
mit
96
main
4,937
# frozen_string_literal: true require "json" module Y # A map can be used to store and retrieve key-value pairs. # # The map is the replicated counterpart to a Hash. It supports a subset # of the Hash operations, like adding, getting and deleting values by key. # # Someone should not instantiate a map dir...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y/awareness.rb
Ruby
mit
96
main
10,156
# frozen_string_literal: true module Y # The Awareness class implements a simple shared state protocol that can be # used for non-persistent data like awareness information (cursor, username, # status, ..). Each client can update its own local state and listen to state # changes of remote clients. # # Each...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y/xml.rb
Ruby
mit
96
main
30,221
# frozen_string_literal: true module Y # rubocop:disable Metrics/ClassLength # A XMLElement # # Someone should not instantiate an element directly, but use # {Y::Doc#get_xml_element} instead # # @example # doc = Y::Doc.new # xml_element = doc.get_xml_element("my xml") # # puts xml_element....
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y/array.rb
Ruby
mit
96
main
10,023
# frozen_string_literal: true module Y # An array can be used to store and retrieve elements. # # The array is the replicated counterpart to a Ruby Array. It supports a # subset of the Ruby Array operations, like adding, getting and deleting # values by position or ranges. # # Someone should not instanti...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y/diff.rb
Ruby
mit
96
main
781
# frozen_string_literal: true module Y # A representation of an uniformly-formatted chunk of rich context stored by # Text or XmlText. It contains a value (which could be a string, embedded # object or another shared type) with optional formatting attributes wrapping # around this chunk. class Diff # @re...
github
y-crdt/yrb
https://github.com/y-crdt/yrb
lib/y/text.rb
Ruby
mit
96
main
9,819
# frozen_string_literal: true module Y # A text can be used insert and remove string fragments. It also supports # formatting and the concept of embeds, which are supported data types that # added as metadata. # # The text is the replicated counterpart to a String. It supports a subset # of String operatio...
github
mongoid/kiqstand
https://github.com/mongoid/kiqstand
kiqstand.gemspec
Ruby
mit
96
master
695
# encoding: utf-8 lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) require "kiqstand/version" Gem::Specification.new do |s| s.name = "kiqstand" s.version = Kiqstand::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Durran Jordan"] s.email = ["d...
github
mongoid/kiqstand
https://github.com/mongoid/kiqstand
Rakefile
Ruby
mit
96
master
821
require "bundler" Bundler.setup require "rake" require "rspec/core/rake_task" $LOAD_PATH.unshift File.expand_path("../lib", __FILE__) require "kiqstand/version" task :gem => :build task :build do system "gem build kiqstand.gemspec" end task :install => :build do system "sudo gem install kiqstand-#{Kiqstand::VER...
github
mongoid/kiqstand
https://github.com/mongoid/kiqstand
Gemfile
Ruby
mit
96
master
248
source "https://rubygems.org" gemspec gem "rake" platforms :mri_19 do unless ENV["CI"] gem "debugger" end end group :test do gem "rspec", "~> 2.11" unless ENV["CI"] gem "guard", "1.2.1" gem "guard-rspec", "~> 0.7" end end
github
mongoid/kiqstand
https://github.com/mongoid/kiqstand
spec/spec_helper.rb
Ruby
mit
96
master
474
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib")) MODELS = File.join(File.dirname(__FILE__), "app/models") $LOAD_PATH.unshift(MODELS) require "kiqstand" require "mongoid" require "rspec" Mongoid.configure do |config| config.connect_to("kiqstand_test") c...
github
mongoid/kiqstand
https://github.com/mongoid/kiqstand
spec/kiqstand/middleware_spec.rb
Ruby
mit
96
master
859
require "spec_helper" describe Kiqstand::Middleware do class Model include Mongoid::Document end describe "#call" do let(:middleware) do described_class.new end context "when the identity map has items" do before do Mongoid::IdentityMap.set(Model.new) middleware.c...
github
mongoid/kiqstand
https://github.com/mongoid/kiqstand
lib/kiqstand/middleware.rb
Ruby
mit
96
master
695
# encoding: utf-8 module Kiqstand # This is the middleware for ensuring Moped sessions are diconnected after # a worker runs, and that the identity map is cleared. class Middleware # Ensures that after each worker runs, the identity map is cleared in case # it was accidentally enabled in this environmen...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
Gemfile
Ruby
mit
96
master
223
source 'https://rubygems.org' gemspec gem 'sqlite3' gem 'will_paginate' gem 'kaminari' gem 'activerecord', '>= 4.0.0', '< 5.0.0' gem 'actionpack', '>= 4.0.0', '< 5.0.0' gem 'rspec' gem 'simplecov', :require => false
github
kidpollo/tanker
https://github.com/kidpollo/tanker
tanker.gemspec
Ruby
mit
96
master
1,038
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'tanker/version' Gem::Specification.new do |spec| spec.name = "tanker" spec.version = Tanker::VERSION spec.authors = ['Francisco Viramontes', 'Jack Danger Canty'] spec...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
Rakefile
Ruby
mit
96
master
412
require 'bundler/gem_tasks' require 'rake/testtask' require 'rspec' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| spec.pattern = 'spec/{tanker,utilities}_spec.rb' spec.rspec_opts = ['--backtrace'] end task :default => :spec desc 'Run Integration Specs' RSpec::Core::RakeTask.new(:integr...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/indextank_client.rb
Ruby
mit
96
master
7,493
require 'net/http' require 'uri' require 'rubygems' require 'json' module IndexTank private class RestClient def GET(path, params={}) path = "#{path}?#{to_query(params)}" if params request = Net::HTTP::Get.new "#{@uri.path}#{path}" authorize request ret...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/tanker.rb
Ruby
mit
96
master
14,051
require 'indextank_client' require 'tanker/configuration' require 'tanker/utilities' require 'tanker/version' require 'tanker/railtie' if defined?(Rails) module Tanker class NotConfigured < StandardError; end class BadConfiguration < StandardError; end class NoBlockGiven < StandardError; end class NoIndexName ...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/tanker/pagination.rb
Ruby
mit
96
master
864
module Tanker module Pagination autoload :WillPaginate, 'tanker/pagination/will_paginate' autoload :Kaminari, 'tanker/pagination/kaminari' def self.create(results, total_hits, options = {}, categories = {}) begin backend = Tanker.configuration[:pagination_backend].to_s.gsub(/\/(.?)/) { "::...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/tanker/utilities.rb
Ruby
mit
96
master
1,104
module Tanker module Utilities class << self def get_model_classes Tanker.included_in ? Tanker.included_in : [] end def get_available_indexes get_model_classes.map{|model| model.tanker_config.index_name}.uniq.compact end def clear_all_indexes get_available_i...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/tanker/railtie.rb
Ruby
mit
96
master
784
require 'rails' module Tanker class Railtie < Rails::Railtie config.index_tank_url = nil config.tanker_pagination_backend = nil initializer "tanker.boot" do Tanker.configuration = {}.tap do |_new_conf| _new_conf[:url] = config.index_tank_url if config.index_tank_url _new_conf[:pagi...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/tanker/configuration.rb
Ruby
mit
96
master
471
module Tanker module Configuration def configuration @@configuration || raise(NotConfigured, "Please configure Tanker. Set Tanker.configuration = {:url => ''}") end def configuration=(new_configuration) # the default pagination backend is WillPaginate @@configuration = new_configuration...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/tanker/pagination/will_paginate.rb
Ruby
mit
96
master
459
begin require 'will_paginate/collection' rescue LoadError raise(Tanker::BadConfiguration, "Tanker: Please add 'will_paginate' to your Gemfile to use will_paginate pagination backend") end module Tanker module Pagination class WillPaginate def self.create(results, total_hits, options = {}) ::Wil...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/tanker/pagination/kaminari.rb
Ruby
mit
96
master
971
unless defined? Kaminari raise(Tanker::BadConfiguration, "Tanker: Please add 'kaminari' to your Gemfile to use kaminari pagination backend") end module Tanker module Pagination class Kaminari < Array include ::Kaminari::ConfigurationMethods::ClassMethods include ::Kaminari::PageScopeMethods ...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
lib/tanker/tasks/tanker.rake
Ruby
mit
96
master
1,766
namespace :tanker do desc "Reindex all models" task :reindex => :environment do puts "reindexing all models" load_models Tanker::Utilities.reindex_all_models end desc "Update IndexTank functions" task :functions => :environment do puts "reindexing all IndexTank functions" load_models ...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
spec/utilities_spec.rb
Ruby
mit
96
master
651
require 'spec_helper' describe Tanker::Utilities do before(:each) do @included_in = Tanker.instance_variable_get :@included_in Tanker.instance_variable_set :@included_in, [] class Dummy include Tanker tankit 'dummy index' do indexes :name end end end after(:each) d...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
spec/spec_helper.rb
Ruby
mit
96
master
1,173
require 'simplecov' SimpleCov.start require 'tanker' RSpec.configure do |c| c.mock_with :rspec end Tanker.configuration = {:url => 'http://api.indextank.com'} $frozen_moment = Time.now class Person attr_accessor :name, :last_name def initialize(attrs = {}) attrs.each {|k,v| self.send "#{k}=", v } se...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
spec/integration_spec.rb
Ruby
mit
96
master
10,453
require 'spec_helper' require 'integration_spec_conf' require 'active_record' require 'logger' ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Base.establish_connection( 'adapter' => 'sqlite3', 'database' => ':memory:' ) ActiveRecord::Schema.define do create_table :products do |t| t.string :nam...
github
kidpollo/tanker
https://github.com/kidpollo/tanker
spec/tanker_spec.rb
Ruby
mit
96
master
20,295
require 'spec_helper' describe Tanker do describe "configuration" do it 'sets configuration' do conf = {:url => 'http://api.indextank.com', :pagination_backend => :will_paginate} Tanker.configuration = conf Tanker.configuration.should == conf end it 'adds default values to configur...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
hovercraft.gemspec
Ruby
mit
96
master
1,375
# -*- encoding: utf-8 -*- require File.expand_path('../lib/hovercraft/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ['vanstee'] gem.email = ['vanstee@highgroove.com'] gem.description = %q{Generate a RESTful API from a directory of ActiveRecord models} gem.summary = %q{...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
spec/hovercraft/caller_spec.rb
Ruby
mit
96
master
840
require 'hovercraft/caller' describe Hovercraft::Caller do describe '#directory' do before { subject.stub(caller_file: '/gems/futurama/parallel_universe_box.rb:10 in `universe`') } it 'returns the directory of the file at the top of the execution stack' do subject.directory.should == '/gems/futurama' ...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
spec/hovercraft/builder_spec.rb
Ruby
mit
96
master
2,114
require 'hovercraft/builder' describe Hovercraft::Builder do let(:model) { stub(name: 'Robot') } let(:models) { Array.new(3) { model } } let(:params) { models.map { |m| [m, 'robot', 'robots'] } } before do subject.stub(:with_each_model). and_yield(*params[0]). and_yield(*params[1]). and...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
spec/hovercraft/routes_spec.rb
Ruby
mit
96
master
4,039
require 'hovercraft/routes' require 'hovercraft/helpers' require 'sinatra' require 'rack/test' describe Hovercraft::Routes do include Rack::Test::Methods let(:application) { Sinatra.new } let(:model_name) { 'employee' } let(:model_name_pluralize) { 'employees' } let(:model_class) ...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
spec/hovercraft/loader_spec.rb
Ruby
mit
96
master
611
require 'hovercraft/loader' describe Hovercraft::Loader do let(:model) { stub(name: 'Robot') } let(:models) { Array.new(3) { model } } let(:params) { models.map { |m| [m, 'robot', 'robots'] } } describe '#with_each_model' do before { subject.stub(models: models) } it 'yields the class, name, and plu...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
spec/hovercraft/helpers_spec.rb
Ruby
mit
96
master
2,885
require 'hovercraft/helpers' describe Hovercraft::Helpers do subject { Class.new { extend Hovercraft::Helpers } } let(:model_to_json) { stub } let(:model) { stub(to_json: model_to_json) } describe '.registered' do let(:application) { stub } it 'includes the helpers in the application' do applic...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
spec/hovercraft/filters_spec.rb
Ruby
mit
96
master
706
require 'hovercraft/filters' require 'hovercraft/helpers' require 'sinatra' require 'rack/test' describe Hovercraft::Filters do include Rack::Test::Methods let(:application) { Sinatra.new } alias :app :application before do application.register(Hovercraft::Helpers) application.register(Hovercraft::F...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
lib/hovercraft/server.rb
Ruby
mit
96
master
225
require 'hovercraft/builder' module Hovercraft class Server def initialize builder = Builder.new @application = builder.application end def call(env) @application.call(env) end end end
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
lib/hovercraft/caller.rb
Ruby
mit
96
master
1,201
module Hovercraft class Caller CALLERS_TO_IGNORE = [ /\/hovercraft(\/(caller|loader|builder|server))?\.rb$/, # hovercraft libary /\/sinatra(\/(base|main|showexceptions))?\.rb$/, # sinatra library /^\(.*\)$/, # generated code /lib\/ruby/, ...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
lib/hovercraft/loader.rb
Ruby
mit
96
master
820
require 'hovercraft/caller' require 'active_support/inflector' module Hovercraft class Loader def initialize @caller = Caller.new end def with_each_model models.each do |model_class| model_name = model_class.name.underscore plural_model_name = model_name.pluralize yie...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
lib/hovercraft/helpers.rb
Ruby
mit
96
master
934
module Hovercraft module Helpers def self.registered(application) application.helpers(Hovercraft::Helpers) end def authenticate_with_warden warden.authenticate! if warden end def warden env.fetch('warden') end def respond_with(content) if content.respond_to?(form...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
lib/hovercraft/routes.rb
Ruby
mit
96
master
1,579
module Hovercraft module Routes def generate_index(model_class, model_name, plural_model_name) get(%r{^/#{plural_model_name}(\.(?<format>[^\./?#]+))?$}) do model_instances = model_class.all status 200 respond_with model_instances end end def generate_create(model_class...
github
vanstee/hovercraft
https://github.com/vanstee/hovercraft
lib/hovercraft/builder.rb
Ruby
mit
96
master
1,336
require 'hovercraft/loader' require 'hovercraft/helpers' require 'hovercraft/filters' require 'hovercraft/routes' require 'sinatra/base' require 'rack/contrib/post_body_content_type_parser' require 'forwardable' module Hovercraft class Builder extend Forwardable def_delegator :@loader, :with_each_model ...
github
ryanfelton/textile-editor-helper
https://github.com/ryanfelton/textile-editor-helper
Rakefile
Ruby
mit
96
master
581
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the textile_editor_helper plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the textile_...
github
ryanfelton/textile-editor-helper
https://github.com/ryanfelton/textile-editor-helper
lib/textile_editor_helper.rb
Ruby
mit
96
master
8,079
module ActionView module Helpers class FormBuilder def textile_editor(method, options = {}) @template.textile_editor(@object_name, method, options.merge(:object => @object)) end end module PrototypeHelper end module FormHelper # Returns a textarea opening and c...
github
ryanfelton/textile-editor-helper
https://github.com/ryanfelton/textile-editor-helper
lib/tasks/textile_editor_helper_tasks.rake
Ruby
mit
96
master
1,287
namespace :textile_editor_helper do PLUGIN_ROOT = File.dirname(__FILE__) + '/../..' ASSET_FILES = Dir[PLUGIN_ROOT + '/assets/**/*'].select { |e| File.file?(e) } desc 'Installs required assets' task :install do #ENV['FORCE'] = true #Rake::Task[:update].invoke #force = ENV['FORCE'] || false ver...