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 | arthurnn/cheatly | https://github.com/arthurnn/cheatly | lib/cheatly/renderer.rb | Ruby | mit | 48 | master | 1,133 | require "colorize"
module Cheatly
class Renderer < Redcarpet::Render::Base
def normal_text(text)
text
end
def block_code(code, language = nil)
code = code.each_line
code = code.map { |l| " #{l}" }
"\n#{code.join}\n"
end
def codespan(code)
"`#{code}`"
end
... |
github | arthurnn/cheatly | https://github.com/arthurnn/cheatly | lib/cheatly/adapter/github.rb | Ruby | mit | 48 | master | 598 | require "base64"
require "octokit"
module Cheatly
module Adapter
class GitHub
FOLDER = 'sheets'
REPO = 'arthurnn/cheatly'
def find(path)
response = Octokit.contents(REPO, path: "#{FOLDER}/#{path}.md")
Base64.decode64(response.content)
end
def all
response =... |
github | arthurnn/cheatly | https://github.com/arthurnn/cheatly | lib/cheatly/adapter/file.rb | Ruby | mit | 48 | master | 510 | require "tempfile"
module Cheatly
module Adapter
class File
def find(name)
path = "sheets/#{name}.md"
::File.read(path)
end
def all
Dir["sheets/*.md"].map { |f| f.scan(/sheets\/(.*).md/)[0][0] }
end
def create(name, body)
f = ::File.new("sheets/#{na... |
github | rails/activesupport-json_encoder | https://github.com/rails/activesupport-json_encoder | Rakefile | Ruby | mit | 48 | master | 200 | #!/usr/bin/env rake
require 'bundler/gem_tasks'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs = ['test']
t.pattern = 'test/**/*_test.rb'
t.ruby_opts = ['-w']
end
task default: :test |
github | rails/activesupport-json_encoder | https://github.com/rails/activesupport-json_encoder | activesupport-json_encoder.gemspec | Ruby | mit | 48 | master | 889 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |gem|
gem.name = 'activesupport-json_encoder'
gem.version = '1.1.0'
gem.authors = ["David Heinemeier Hansson"]
gem.email = ["david@... |
github | rails/activesupport-json_encoder | https://github.com/rails/activesupport-json_encoder | test/active_support_encoder_test.rb | Ruby | mit | 48 | master | 15,671 | # encoding: utf-8
require 'test_helper'
require 'securerandom'
require 'active_support/core_ext/string/inflections'
require 'activesupport/json_encoder'
class TestJSONEncoding < ActiveSupport::TestCase
class Foo
def initialize(a, b)
@a, @b = a, b
end
end
class Hashlike
def to_hash
{ :foo... |
github | rails/activesupport-json_encoder | https://github.com/rails/activesupport-json_encoder | test/test_helper.rb | Ruby | mit | 48 | master | 443 | require 'active_support/core_ext/kernel/reporting'
silence_warnings do
Encoding.default_internal = "UTF-8"
Encoding.default_external = "UTF-8"
end
require 'bundler/setup'
require 'minitest/autorun'
require 'active_support'
require 'active_support/test_case'
require 'active_support/testing/autorun'
Thread.abort_o... |
github | rails/activesupport-json_encoder | https://github.com/rails/activesupport-json_encoder | lib/active_support/json/encoding/active_support_encoder.rb | Ruby | mit | 48 | master | 6,596 | require 'active_support'
require 'active_support/json'
require 'active_support/core_ext/module/delegation'
require 'set'
require 'bigdecimal'
module ActiveSupport
module JSON
module Encoding
class CircularReferenceError < StandardError; end
class ActiveSupportEncoder
attr_reader :options
... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | capybara_select2.gemspec | Ruby | mit | 48 | master | 1,782 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'capybara_select2/version'
Gem::Specification.new do |spec|
spec.name = "capybara-select-2"
spec.version = CapybaraSelect2::VERSION
spec.authors = ["Dzmitry Kavalionak"]... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | spec/versions_spec.rb | Ruby | mit | 48 | master | 208 | SupportedVersions.each do |select2_version|
Dir[File.join(__dir__, 'shared', '**', '*_spec.rb')].each do |spec|
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
#{File.read(spec)}
RUBY
end
end |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | spec/spec_helper.rb | Ruby | mit | 48 | master | 1,338 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'capybara_select2'
require 'capybara/dsl'
require 'pry'
Dir[File.join(__dir__, "support/**/*.rb")].sort.each { |f| require f }
server = Select2Examples::App.boot
Capybara.app_host = "http://#{server.host}:#{server.port}"
require 'selenium-webdriver'... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | spec/support/select2_examples/app.rb | Ruby | mit | 48 | master | 371 | require 'sinatra/base'
module Select2Examples
class App < Sinatra::Base
def self.boot
instance = new
Capybara::Server.new(instance).tap { |server| server.boot }
end
get '/select2/v:version/examples' do
select2_version = params['version']
ERB.new(File.read(File.join(__dir__, 'ind... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | spec/shared/select2_spec.rb | Ruby | mit | 48 | master | 4,971 | require 'spec_helper'
select2_version ||= ENV['SELECT2_VERSION'] || SupportedVersions.first
def get_values(selector)
page.evaluate_script "$('#{selector}').select2('val')"
end
alias :get_value :get_values
describe CapybaraSelect2, type: :feature do
context "with select2 version #{select2_version}" do
befor... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | spec/shared/helpers_spec.rb | Ruby | mit | 48 | master | 2,659 | require 'spec_helper'
require 'capybara_select2/helpers'
select2_version ||= ENV['SELECT2_VERSION'] || SupportedVersions.first
def get_values(selector)
page.evaluate_script "$('#{selector}').select2('val')"
end
alias :get_value :get_values
describe CapybaraSelect2 do
include CapybaraSelect2::Helpers
context ... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | spec/shared/matchers_spec.rb | Ruby | mit | 48 | master | 1,173 | require 'spec_helper'
select2_version ||= ENV['SELECT2_VERSION'] || SupportedVersions.first
def open_select2(selector)
page.execute_script "$('#{selector}').select2('open')"
end
describe CapybaraSelect2 do
context "with select2 version #{select2_version}" do
before { visit "/select2/v#{select2_version}/exa... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | lib/capybara_select2.rb | Ruby | mit | 48 | master | 1,035 | require "capybara_select2/version"
require 'capybara_select2/utils'
require 'capybara_select2/helpers'
module CapybaraSelect2
def select2(*args)
options = args.pop
values = args
Utils.validate_options!(options)
container = Utils.find_select2_container(options, page)
version = Utils.detect_sele... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | lib/capybara_select2/utils.rb | Ruby | mit | 48 | master | 1,397 | module CapybaraSelect2
module Utils
def self.set_option_aliases(options)
options.dup.tap { |o| o[:from] ||= o[:label] }
end
def self.detect_select2_version(container)
if container['class'] =~ /^select2\s/
'4'
elsif container['id'] =~ /^s2id_/
'3'
else
'2'
... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | lib/capybara_select2/selectors.rb | Ruby | mit | 48 | master | 1,401 | module CapybaraSelect2
module Selectors
module_function
OpenerSelectors = {
'2' => ".select2-choice, .select2-search-field",
'3' => ".select2-choice, .select2-search-field",
'4' => ".select2-selection"
}.freeze
def opener_selector(select2_version)
OpenerSelectors.fetch(selec... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | lib/capybara_select2/helpers.rb | Ruby | mit | 48 | master | 1,694 | require 'capybara_select2/utils'
require 'capybara_select2/selectors'
module CapybaraSelect2
module Helpers
module_function
def select2_open(options)
options = Utils.set_option_aliases(options)
Utils.validate_options!(options)
_, container, version = Utils.get_page_container_and_version(o... |
github | Hirurg103/capybara_select2 | https://github.com/Hirurg103/capybara_select2 | lib/capybara_select2/rspec/matchers.rb | Ruby | mit | 48 | master | 609 | require 'rspec/expectations'
require 'capybara_select2/selectors'
RSpec::Matchers.define :have_select2_option do |expected|
def option_matcher(element)
select2_container = element.find('.select2-container', match: :first)
select2_version = CapybaraSelect2::Utils.detect_select2_version(select2_container)
... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | Gemfile | Ruby | apache-2.0 | 48 | main | 752 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "cucumber", "~> 9.2"
gem "minitest", ">= 5.26", "< 7"
gem "minitest-focus", "~> 1.4"
gem "minitest-rg", "~> 5.3"
gem "rack", "~> 3.2"
gem "redcarpet", "~> 3.6" unless ::RUBY_PLATFORM == "java"
gem "rubocop", "~> 1.82"
gem "toys-core", "~> 0.19"
g... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | cloud_events.gemspec | Ruby | apache-2.0 | 48 | main | 1,410 | # frozen_string_literal: true
require_relative "lib/cloud_events/version"
version = ::CloudEvents::VERSION
::Gem::Specification.new do |spec|
spec.name = "cloud_events"
spec.version = version
spec.licenses = ["Apache-2.0"]
spec.authors = ["Daniel Azuma"]
spec.email = ["dazuma@gmail.com"]
spec.summary = "... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/test_text_format.rb | Ruby | apache-2.0 | 48 | main | 1,741 | # frozen_string_literal: true
require_relative "helper"
require "date"
require "json"
require "stringio"
require "uri"
describe CloudEvents::TextFormat do
let(:text_format) { CloudEvents::TextFormat.new }
let(:content) { '{"foo":"bar"}' }
describe "decode_data" do
[
"text/plain",
"text/plain; ... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/test_content_type.rb | Ruby | apache-2.0 | 48 | main | 6,023 | # frozen_string_literal: true
require_relative "helper"
describe CloudEvents::ContentType do
it "recognizes simple media type and subtype" do
content_type = CloudEvents::ContentType.new("application/cloudevents")
assert_equal "application", content_type.media_type
assert_equal "cloudevents", content_typ... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/test_examples.rb | Ruby | apache-2.0 | 48 | main | 1,753 | # frozen_string_literal: true
require_relative "helper"
require "io/wait"
require "toys/compat"
require "toys/utils/exec"
describe "examples" do
let(:exec_util) { Toys::Utils::Exec.new }
let(:examples_dir) { File.join(File.dirname(__dir__), "examples") }
let(:client_dir) { File.join(examples_dir, "client") }
... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/test_json_format.rb | Ruby | apache-2.0 | 48 | main | 25,825 | # frozen_string_literal: true
require_relative "helper"
require "date"
require "json"
require "stringio"
require "uri"
describe CloudEvents::JsonFormat do
let(:json_format) { CloudEvents::JsonFormat.new }
let(:my_id) { "my_id" }
let(:my_source_string) { "/my_source" }
let(:my_source) { URI.parse(my_source_st... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/test_kafka_binding.rb | Ruby | apache-2.0 | 48 | main | 21,361 | # frozen_string_literal: true
require_relative "helper"
require "date"
require "json"
require "uri"
describe CloudEvents::KafkaBinding do
let(:kafka_binding) { CloudEvents::KafkaBinding.default }
let(:minimal_kafka_binding) { CloudEvents::KafkaBinding.new }
let(:my_id) { "my_id" }
let(:my_source_string) { "/... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/test_event.rb | Ruby | apache-2.0 | 48 | main | 1,177 | # frozen_string_literal: true
require_relative "helper"
describe CloudEvents::Event do
let(:my_id) { "my_id" }
let(:my_source) { "/my_source" }
let(:my_type) { "my_type" }
it "recognizes spec version 0" do
event = CloudEvents::Event.create(id: my_id,
source... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/test_http_binding.rb | Ruby | apache-2.0 | 48 | main | 19,443 | # frozen_string_literal: true
require_relative "helper"
require "date"
require "json"
require "stringio"
require "uri"
describe CloudEvents::HttpBinding do
let(:http_binding) { CloudEvents::HttpBinding.default }
let(:minimal_http_binding) { CloudEvents::HttpBinding.new }
let(:my_id) { "my_id" }
let(:my_sourc... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/event/test_opaque.rb | Ruby | apache-2.0 | 48 | main | 1,184 | # frozen_string_literal: true
require_relative "../helper"
describe CloudEvents::Event::Opaque do
let(:my_content_type_string) { "text/plain; charset=us-ascii" }
let(:my_content_type) { CloudEvents::ContentType.new(my_content_type_string) }
let(:my_content) { "12345" }
it "handles non-batch" do
event = C... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/event/test_v1.rb | Ruby | apache-2.0 | 48 | main | 16,441 | # frozen_string_literal: true
require_relative "../helper"
require "date"
require "uri"
describe CloudEvents::Event::V1 do
let(:my_id) { "my_id" }
let(:my_source_string) { "/my_source" }
let(:my_source) { URI.parse(my_source_string) }
let(:my_source2_string) { "/my_source2" }
let(:my_source2) { URI.parse(m... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | test/event/test_v0.rb | Ruby | apache-2.0 | 48 | main | 13,372 | # frozen_string_literal: true
require_relative "../helper"
require "date"
require "uri"
describe CloudEvents::Event::V0 do
let(:my_id) { "my_id" }
let(:my_source_string) { "/my_source" }
let(:my_source) { URI.parse(my_source_string) }
let(:my_source2_string) { "/my_source2" }
let(:my_source2) { URI.parse(m... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events.rb | Ruby | apache-2.0 | 48 | main | 889 | # frozen_string_literal: true
require "cloud_events/content_type"
require "cloud_events/errors"
require "cloud_events/event"
require "cloud_events/format"
require "cloud_events/http_binding"
require "cloud_events/kafka_binding"
require "cloud_events/json_format"
require "cloud_events/text_format"
##
# CloudEvents imp... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/http_binding.rb | Ruby | apache-2.0 | 48 | main | 20,441 | # frozen_string_literal: true
module CloudEvents
##
# HTTP binding for CloudEvents.
#
# This class implements HTTP binding, including unmarshalling of events from
# Rack environment data, and marshalling of events to Rack environment data.
# It supports binary (i.e. header-based) HTTP content, as well as s... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/json_format.rb | Ruby | apache-2.0 | 48 | main | 13,107 | # frozen_string_literal: true
require "json"
module CloudEvents
##
# An implementation of JSON format and JSON batch format.
#
# Supports the CloudEvents 0.3 and CloudEvents 1.0 variants of this format.
# See https://github.com/cloudevents/spec/blob/v0.3/json-format.md and
# https://github.com/cloudevents... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/event.rb | Ruby | apache-2.0 | 48 | main | 3,230 | # frozen_string_literal: true
require "date"
require "uri"
require "cloud_events/event/opaque"
require "cloud_events/event/v0"
require "cloud_events/event/v1"
module CloudEvents
##
# An Event object represents a complete CloudEvent, including both data and
# context attributes. The following are true of all ev... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/format.rb | Ruby | apache-2.0 | 48 | main | 11,541 | # frozen_string_literal: true
require "json"
module CloudEvents
##
# This module documents the method signatures that may be implemented by
# formatters.
#
# A formatter is an object that implements "structured" event encoding and
# decoding strategies for a particular format (such as JSON). In general,
... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/text_format.rb | Ruby | apache-2.0 | 48 | main | 2,615 | # frozen_string_literal: true
require "json"
module CloudEvents
##
# An data encoder/decoder for text content types. This handles any media type
# of the form `text/*` or `application/octet-stream`, and passes strings
# through as-is.
#
class TextFormat
# @private
UNSPECIFIED = ::Object.new.freeze... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/kafka_binding.rb | Ruby | apache-2.0 | 48 | main | 16,364 | # frozen_string_literal: true
module CloudEvents
##
# Kafka protocol binding for CloudEvents.
#
# This class implements the Kafka protocol binding, including decoding of
# events from Kafka message hashes, and encoding of events to Kafka message
# hashes. It supports binary (header-based) and structured (b... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/content_type.rb | Ruby | apache-2.0 | 48 | main | 6,831 | # frozen_string_literal: true
module CloudEvents
##
# A parsed content-type header.
#
# This object represents the information contained in a Content-Type,
# obtained by parsing the header according to RFC 2045.
#
# Case-insensitive fields, such as media_type and subtype, are normalized
# to lower case... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/errors.rb | Ruby | apache-2.0 | 48 | main | 2,223 | # frozen_string_literal: true
module CloudEvents
##
# Base class for all CloudEvents errors.
#
class CloudEventsError < ::StandardError
end
##
# An error raised when a protocol binding was asked to decode a CloudEvent
# from input data, but does not believe that the data was intended to be a
# Cloud... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/event/v1.rb | Ruby | apache-2.0 | 48 | main | 13,781 | # frozen_string_literal: true
require "date"
require "uri"
require "cloud_events/event/field_interpreter"
require "cloud_events/event/utils"
module CloudEvents
module Event
##
# A CloudEvents V1 data type.
#
# This object represents a complete CloudEvent, including the event data
# and context ... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/event/v0.rb | Ruby | apache-2.0 | 48 | main | 8,678 | # frozen_string_literal: true
require "date"
require "uri"
require "cloud_events/event/field_interpreter"
require "cloud_events/event/utils"
module CloudEvents
module Event
##
# A CloudEvents V0 data type.
#
# This object represents a complete CloudEvent, including the event data
# and context ... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/event/opaque.rb | Ruby | apache-2.0 | 48 | main | 2,254 | # frozen_string_literal: true
module CloudEvents
module Event
##
# This object represents opaque event data that arrived in structured
# content mode but was not in a recognized format. It may represent a
# single event or a batch of events.
#
# The event data is retained in a form that can b... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/event/utils.rb | Ruby | apache-2.0 | 48 | main | 1,120 | # frozen_string_literal: true
module CloudEvents
module Event
##
# A variety of helper methods.
# @private
#
module Utils
class << self
def deep_freeze(obj)
case obj
when ::Hash
obj.each do |key, val|
deep_freeze(key)
deep_... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | lib/cloud_events/event/field_interpreter.rb | Ruby | apache-2.0 | 48 | main | 4,879 | # frozen_string_literal: true
require "cloud_events/event/utils"
module CloudEvents
module Event
##
# A helper that extracts and interprets event fields from an input hash.
# @private
#
class FieldInterpreter
def initialize(args)
@args = Utils.keys_to_strings(args)
@attribu... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | examples/client/send.rb | Ruby | apache-2.0 | 48 | main | 550 | # frozen_string_literal: true
require "cloud_events"
require "net/http"
require "uri"
data = { message: "Hello, CloudEvents!" }
event = CloudEvents::Event.create(
spec_version: "1.0",
id: "1234-1234-1234",
source: "/mycontext",
type: "com.example.someevent",
data_... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | examples/server/app.rb | Ruby | apache-2.0 | 48 | main | 250 | # frozen_string_literal: true
require "sinatra"
require "cloud_events"
cloud_events_http = CloudEvents::HttpBinding.default
post("/") do
event = cloud_events_http.decode_event(request.env)
logger.info("Received CloudEvent: #{event.to_h}")
end |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | .toys/.toys.rb | Ruby | apache-2.0 | 48 | main | 468 | # frozen_string_literal: true
toys_version! ">= 0.20"
expand :clean, paths: :gitignore, preserve: ".claude/"
expand :minitest, libs: ["lib"], bundler: true
expand :rubocop, bundler: true
expand :yardoc do |t|
t.generate_output_flag = true
t.fail_on_warning = true
t.fail_on_undocumented_objects = true
t.use... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | .toys/ci.rb | Ruby | apache-2.0 | 48 | main | 713 | # frozen_string_literal: true
load_gem "toys-ci"
desc "CI target that runs CI jobs in this repo"
flag :bundle_update, "--update", "--bundle-update", desc: "Update instead of install bundles"
expand(Toys::CI::Template) do |ci|
ci.only_flag = true
ci.fail_fast_flag = true
ci.job("Bundle install", flag: :bundle... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | .toys/cucumber.rb | Ruby | apache-2.0 | 48 | main | 619 | # frozen_string_literal: true
toys_version! ">= 0.16"
desc "Run cucumber tests"
remaining_args :features
include :bundler
include :exec, e: true
include :git_cache
include :fileutils
def run
setup_features
cmd = ["cucumber", "--publish-quiet"]
cmd += (verbosity > 0 ? ["--format=pretty"] : ["--format=progress... |
github | cloudevents/sdk-ruby | https://github.com/cloudevents/sdk-ruby | features/step_definitions/steps.rb | Ruby | apache-2.0 | 48 | main | 2,229 | # frozen_string_literal: true
require "webrick"
require "stringio"
require "rack"
Given "HTTP Protocol Binding is supported" do
@http_binding = CloudEvents::HttpBinding.default
end
Given "an HTTP request" do |str|
# WEBrick parsing wants the lines delimited by \r\n, but the input
# content-length assumes \n wi... |
github | teejayvanslyke/sassafras | https://github.com/teejayvanslyke/sassafras | Rakefile | Ruby | mit | 48 | master | 1,787 | require 'rubygems'
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "sassafras"
s.executables = "sassafras"
s.description = "Sass color scheme generator"
s.email = "teejay.vanslyke@gmail.com"
s.homepage = "http://github.com/teejayvanslyke/sassafras"
s.authors = ["T.... |
github | teejayvanslyke/sassafras | https://github.com/teejayvanslyke/sassafras | sassafras.gemspec | Ruby | mit | 48 | master | 2,368 | # Generated by jeweler
# DO NOT EDIT THIS FILE
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{sassafras}
s.version = "0.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_vers... |
github | teejayvanslyke/sassafras | https://github.com/teejayvanslyke/sassafras | spec/sassafras_spec.rb | Ruby | mit | 48 | master | 4,923 | require File.dirname(__FILE__) + '/spec_helper.rb'
describe Sassafras do
describe Sassafras::Theme do
def red_values
{
'lightest' => '#ffe6e6',
'lighter' => '#ffb3b3',
'light' => '#ff8080',
'mid' => '#ff0000',
'dark' => '#800000',
'darker'... |
github | teejayvanslyke/sassafras | https://github.com/teejayvanslyke/sassafras | lib/columns.rb | Ruby | mit | 48 | master | 596 | class String
def align_left(width)
str = truncate(width)
str << " " * (width - str.length)
end
def align_right(width)
str = truncate(width)
" " * (width - str.length) << str
end
def align_center(width)
str = truncate(width)
padding = (width - str.length) / 2
" " * padding << str... |
github | teejayvanslyke/sassafras | https://github.com/teejayvanslyke/sassafras | lib/sassafras.rb | Ruby | mit | 48 | master | 4,535 | $:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
require 'rubygems'
require File.dirname(__FILE__) + '/sassafras/version'
gem 'color-tools'
require 'color'
gem 'activesupport'
require 'activesupport'
require 'erb'
modu... |
github | teejayvanslyke/sassafras | https://github.com/teejayvanslyke/sassafras | tasks/rspec.rake | Ruby | mit | 48 | master | 414 | begin
require 'spec'
rescue LoadError
require 'rubygems'
require 'spec'
end
begin
require 'spec/rake/spectask'
rescue LoadError
puts <<-EOS
To use rspec for testing you must install rspec gem:
gem install rspec
EOS
exit(0)
end
desc "Run the specs under spec/models"
Spec::Rake::SpecTask.new do |t|
t.s... |
github | teejayvanslyke/sassafras | https://github.com/teejayvanslyke/sassafras | tasks/examples.rake | Ruby | mit | 48 | master | 384 | task :build_examples do
def build_example(sassafras_options, output_file)
sh "#{File.dirname(__FILE__)}/../bin/sassafras #{sassafras_options} > #{File.dirname(__FILE__)}/../examples/#{output_file}"
end
build_example '-t split_complementary -b blue -f html', 'split_complementary_blue.html'
build_example '-t... |
github | flyerhzm/regexp_crawler | https://github.com/flyerhzm/regexp_crawler | Rakefile | Ruby | mit | 48 | master | 824 | require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'jeweler'
desc "Run all specs in spec directory"
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts = ['--exclude', 'spec,config,Library,usr/lib/ruby']
t.rcov_dir = File.join(F... |
github | flyerhzm/regexp_crawler | https://github.com/flyerhzm/regexp_crawler | regexp_crawler.gemspec | Ruby | mit | 48 | master | 1,728 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{regexp_crawler}
s.version = "0.9.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :req... |
github | flyerhzm/regexp_crawler | https://github.com/flyerhzm/regexp_crawler | example/github_projects.rb | Ruby | mit | 48 | master | 1,005 | require 'rubygems'
require 'regexp_crawler'
class Project
attr_accessor :title, :description, :body, :url
def initialize(options)
options.each do |k, v|
self.instance_variable_set("@#{k}", v)
end
end
end
projects = []
crawler = RegexpCrawler::Crawler.new(
:start_page => "http://github.com/flyer... |
github | flyerhzm/regexp_crawler | https://github.com/flyerhzm/regexp_crawler | lib/regexp_crawler.rb | Ruby | mit | 48 | master | 445 | require 'net/http'
require 'uri'
require 'iconv'
require 'logger'
require 'regexp_crawler/http'
require 'regexp_crawler/crawler'
module RegexpCrawler
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def regexp_crawler(options)
@crawlers ||= []
@crawlers << Crawler.ne... |
github | flyerhzm/regexp_crawler | https://github.com/flyerhzm/regexp_crawler | lib/regexp_crawler/http.rb | Ruby | mit | 48 | master | 201 | module Net
class HTTP
def HTTP.get_response_with_headers(uri, headers)
response = start(uri.host, uri.port) do |http|
http.get(uri.request_uri, headers)
end
end
end
end |
github | flyerhzm/regexp_crawler | https://github.com/flyerhzm/regexp_crawler | lib/regexp_crawler/crawler.rb | Ruby | mit | 48 | master | 3,333 | module RegexpCrawler
class Crawler
attr_accessor :start_page, :continue_regexp, :named_captures, :model, :save_method, :headers, :encoding, :need_parse
def initialize(options = {})
@start_page = options[:start_page]
@continue_regexp = options[:continue_regexp]
@capture_regexp = options[:cap... |
github | flyerhzm/regexp_crawler | https://github.com/flyerhzm/regexp_crawler | spec/regexp_crawler_spec.rb | Ruby | mit | 48 | master | 5,156 | require File.expand_path(File.dirname(__FILE__) + "/spec_helper.rb")
describe RegexpCrawler::Crawler do
context '#simple html' do
it 'should parse data according to regexp' do
success_page('/resources/simple.html', 'http://simple.com/')
crawl = RegexpCrawler::Crawler.new(:start_page => 'http://simpl... |
github | flyerhzm/regexp_crawler | https://github.com/flyerhzm/regexp_crawler | spec/spec_helper.rb | Ruby | mit | 48 | master | 300 | require 'rubygems'
require 'spec/autorun'
require 'date'
require 'mocha'
require File.join(File.dirname(__FILE__), '/../lib/regexp_crawler.rb')
require File.join(File.dirname(__FILE__), '/../lib/regexp_crawler/crawler.rb')
require File.join(File.dirname(__FILE__), '/../lib/regexp_crawler/http.rb') |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | yard-chef.gemspec | Ruby | mit | 48 | master | 1,154 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |gem|
gem.name = 'yard-chef'
gem.version = IO.read(File.join(File.dirname(__FILE__), 'VERSION')).chomp
gem.platform = Gem::Platform::RUBY
gem.authors = ['Douglas Thrift', 'Nick Stakanov', 'Nitin Mohan', 'Alex Semyonov', 'Aleksey Hariton']
... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef.rb | Ruby | mit | 48 | master | 3,194 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/code_objects/chef_object.rb | Ruby | mit | 48 | master | 3,713 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/code_objects/action_object.rb | Ruby | mit | 48 | master | 1,806 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/code_objects/cookbook_object.rb | Ruby | mit | 48 | master | 3,664 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/code_objects/provider_object.rb | Ruby | mit | 48 | master | 3,175 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/code_objects/attribute_object.rb | Ruby | mit | 48 | master | 3,159 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/code_objects/resource_object.rb | Ruby | mit | 48 | master | 2,831 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/code_objects/dependency_object.rb | Ruby | mit | 48 | master | 1,863 | # Copyright (c) 2015 Aleksey Hariton
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# d... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/code_objects/recipe_object.rb | Ruby | mit | 48 | master | 1,926 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/handlers/actions.rb | Ruby | mit | 48 | master | 2,164 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/handlers/dependency.rb | Ruby | mit | 48 | master | 2,004 | # Copyright (c) 2015 Aleksey Hariton
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# d... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/handlers/attribute.rb | Ruby | mit | 48 | master | 4,381 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/handlers/recipe.rb | Ruby | mit | 48 | master | 3,013 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/handlers/cookbook.rb | Ruby | mit | 48 | master | 3,711 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/handlers/define.rb | Ruby | mit | 48 | master | 1,582 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/handlers/base.rb | Ruby | mit | 48 | master | 2,966 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | lib/yard-chef/handlers/action.rb | Ruby | mit | 48 | master | 2,005 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/fulldoc/html/setup.rb | Ruby | mit | 48 | master | 3,910 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/attribute/html/setup.rb | Ruby | mit | 48 | master | 1,243 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/definition/html/setup.rb | Ruby | mit | 48 | master | 1,228 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/chef_tags/setup.rb | Ruby | mit | 48 | master | 971 | def init
tags = Tags::Library.visible_tags
create_tag_methods(tags - %i[example see note])
sections :index, tags.map { |t| t.to_s.tr('.', '_').to_sym }
end
private
def tag(name, opts = nil)
return unless object.has_tag?(name)
opts ||= options_for_tag(name)
@no_names = true if opts[:no_names]
@no_types =... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/resource/html/setup.rb | Ruby | mit | 48 | master | 1,590 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/provider/html/setup.rb | Ruby | mit | 48 | master | 1,202 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/chef/html/setup.rb | Ruby | mit | 48 | master | 1,225 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/recipe/html/setup.rb | Ruby | mit | 48 | master | 1,229 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/action/html/setup.rb | Ruby | mit | 48 | master | 1,179 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/layout/html/setup.rb | Ruby | mit | 48 | master | 2,531 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | rightscale-cookbooks/yard-chef | https://github.com/rightscale-cookbooks/yard-chef | templates/default/cookbook/html/setup.rb | Ruby | mit | 48 | master | 1,611 | # Copyright (c) 2012 RightScale, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | typingpool.gemspec | Ruby | mit | 48 | master | 1,303 | #!/usr/bin/env gem build
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'typingpool/version'
Gem::Specification.new do |s|
s.name = 'typingpool'
s.version = Typingpool::VERSION
s.date = Time.now.strftime("%Y-%m-%d")
s.description = 'An app for transcribing audio using Mechanical Turk'
... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | Rakefile | Ruby | mit | 48 | master | 1,047 | #!/usr/bin/env ruby
require 'rake'
require 'rake/testtask'
task :default => [:test]
desc "Run all tests (mocking network calls)"
task :test => ['test-unit'.to_sym, 'test-integration'.to_sym]
desc "Run all tests (with live network calls)"
task 'test-live'.to_sym => ['test-unit-live'.to_sym, 'test-integration-live'.t... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_collect_fixture_6.rb | Ruby | mit | 48 | master | 1,482 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
fixture_name='tp-review-7'
transcripts_dir = File.join(fixtures_dir, 'tp_review3_project_temp')
output = tp_revi... |
github | ryantate/typingpool | https://github.com/ryantate/typingpool | test/make_tp_collect_fixture_7.rb | Ruby | mit | 48 | master | 1,501 | #!/usr/bin/env ruby
$:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
require 'typingpool'
require 'typingpool/utility/test/script'
require 'fileutils'
include Typingpool::Utility::Test::Script
fixture_name='tp-review-8'
transcripts_dir = File.join(fixtures_dir, 'tp_review3_project_temp')
output = tp_revi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.