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 | chicagoruby/MongoDB_Koans | https://github.com/chicagoruby/MongoDB_Koans | koans/path_to_enlightenment.rb | Ruby | mit | 178 | master | 423 | # The path to Ruby Enlightenment starts with the following:
# files to test go here
require 'about_asserts'
require 'about_db_connect'
require 'about_crud'
require 'about_data_types'
require 'about_queries'
require 'about_query_options'
require 'about_query_conditions'
require 'about_updates'
require 'about_groups'
... |
github | chicagoruby/MongoDB_Koans | https://github.com/chicagoruby/MongoDB_Koans | koans/edgecase.rb | Ruby | mit | 178 | master | 4,464 | #!/usr/bin/env ruby
# -*- ruby -*-
require 'test/unit/assertions'
class FillMeInError < StandardError
end
def __(value="FILL ME IN")
value
end
def ___(value=FillMeInError)
value
end
module EdgeCase
class Sensei
attr_reader :failure, :failed_test
begin
AssertionError = Test::Unit::AssertionFailedErro... |
github | chicagoruby/MongoDB_Koans | https://github.com/chicagoruby/MongoDB_Koans | koans/about_updates.rb | Ruby | mit | 178 | master | 5,110 | require 'rubygems'
require 'mongo'
require 'edgecase'
# Make sure you start up mongod first :)
class AboutUpdates < EdgeCase::Koan
include Mongo
def setup
@mongo = Connection.new
@db = @mongo.db('hack0318')
@col = @db["stuff"]
@col.remove
@col.insert({:category => "sandwich", :type =>"peanu... |
github | chicagoruby/MongoDB_Koans | https://github.com/chicagoruby/MongoDB_Koans | koans/about_query_conditions.rb | Ruby | mit | 178 | master | 3,742 | require 'rubygems'
require 'mongo'
require 'edgecase'
class AboutQueryConditions < EdgeCase::Koan
include Mongo
def setup
@mongo = Connection.new
@db = @mongo.db('hack0318')
@numbers = @db["nums"]
(1..100).each {|i| @numbers.insert(:num => i, :string => i.to_s)}
@arrays = @db["arrays"]
@... |
github | chicagoruby/MongoDB_Koans | https://github.com/chicagoruby/MongoDB_Koans | koans/about_embedded.rb | Ruby | mit | 178 | master | 3,149 | require 'rubygems'
require 'mongo'
require 'edgecase'
class AboutEmbeddedDocuments < EdgeCase::Koan
include Mongo
def setup
@mongo = Connection.new
@db = @mongo.db('hack0318')
@embedded = @db["embedded"]
@embedded.remove
@embedded.insert({:order_num => 101, :customer => 'Acme', :ship_via => ... |
github | chicagoruby/MongoDB_Koans | https://github.com/chicagoruby/MongoDB_Koans | koans/about_query_options.rb | Ruby | mit | 178 | master | 1,769 | require 'rubygems'
require 'mongo'
require 'edgecase'
class AboutQueryOptions < EdgeCase::Koan
include Mongo
def setup
@mongo = Connection.new
@db = @mongo.db('hack0318')
@col = @db["num_strings"]
(1..100).each {|i| @col.insert(:item => i, :item_string => i.to_s)}
end
def teardown
@db... |
github | chicagoruby/MongoDB_Koans | https://github.com/chicagoruby/MongoDB_Koans | koans/about_groups.rb | Ruby | mit | 178 | master | 4,167 | require 'rubygems'
require 'mongo'
require 'edgecase'
class AboutGroups < EdgeCase::Koan
include Mongo
def setup
@mongo = Connection.new
@db = @mongo.db('hack0318')
@numbers = @db["nums"]
(1..100).each {|i| @numbers.insert(:num => i, :string => i.to_s)}
@addresses = @db["addresses"]
@add... |
github | chicagoruby/MongoDB_Koans | https://github.com/chicagoruby/MongoDB_Koans | koans/about_crud.rb | Ruby | mit | 178 | master | 2,410 | require 'rubygems'
require 'mongo'
require 'edgecase'
class AboutCRUD < EdgeCase::Koan
include Mongo
def setup
@mongo = Connection.new
@db = @mongo.db('hack0318')
@col = @db["stuff"]
end
def teardown
@db.collections.each do |collection|
@db.drop_collection(collection.name) unless co... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | model_probe.gemspec | Ruby | mit | 179 | main | 870 | # frozen_string_literal: true
require_relative "lib/model_probe/version"
Gem::Specification.new do |s|
s.name = "model_probe"
s.version = ModelProbe::VERSION
s.authors = ["Nathan Hopkins"]
s.email = ["natehop@gmail.com"]
s.summary = "ActiveRecord schema visualization and model organization made easy"
s.ho... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | lib/model_probe.rb | Ruby | mit | 179 | main | 1,334 | # frozen_string_literal: true
require "erb"
require "rainbow"
require_relative "model_probe/version"
require_relative "model_probe/railtie" if defined?(Rails)
require_relative "model_probe/probes"
module ModelProbe
include Probes
# Prints a stub that can be used for a test fixture
def print_fixture
puts ge... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | lib/model_probe/probes.rb | Ruby | mit | 179 | main | 636 | # frozen_string_literal: true
module ModelProbe::Probes; end
require_relative "probes/metadata"
require_relative "probes/columns"
require_relative "probes/indexes"
require_relative "probes/subclasses"
module ModelProbe::Probes
include Metadata
include Columns
include Indexes
include Subclasses
def probe
... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | lib/model_probe/railtie.rb | Ruby | mit | 179 | main | 238 | # frozen_string_literal: true
if Rails.env.development?
ActiveRecord::Base.extend ModelProbe
module ModelProbe
class Railtie < Rails::Railtie
rake_tasks do
load "tasks/model_probe.rake"
end
end
end
end |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | lib/model_probe/probes/metadata.rb | Ruby | mit | 179 | main | 2,768 | # frozen_string_literal: true
module ModelProbe::Probes::Metadata
def probe_metadata
puts Rainbow(name).green + Rainbow(" < ").dimgray.faint + Rainbow(superclass.name).green.faint
puts Rainbow(" Database engine ".ljust(24, ".")).darkgray + " " + Rainbow(connection.adapter_name).skyblue.bright + " " + Rainbo... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | lib/model_probe/probes/indexes.rb | Ruby | mit | 179 | main | 1,038 | # frozen_string_literal: true
module ModelProbe::Probes::Indexes
def probe_indexes
indexes = connection.indexes(table_name)
names = indexes.map(&:name).reject { |name| name.to_s.strip.empty? }
return puts Rainbow(" N/A").skyblue.faint if names.none?
name_pad = names.map(&:size).max + 1
indexes... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | lib/model_probe/probes/columns.rb | Ruby | mit | 179 | main | 2,756 | # frozen_string_literal: true
module ModelProbe::Probes::Columns
def probe_columns
name_pad = columns.map { |c| c.name.length }.max + 2
type_pad = columns.map { |c| c.type.length }.max + 2
sql_type_pad = columns.map { |c| c.sql_type.length }.max + 1
columns.sort_by(&:name).each do |column|
prob... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | lib/model_probe/probes/subclasses.rb | Ruby | mit | 179 | main | 2,217 | # frozen_string_literal: true
module ModelProbe::Probes::Subclasses
def probe_subclasses
eager_load_rails!
@count = 0
@max_name_size = 0
puts Rainbow(name).green + Rainbow(" < ").dimgray.faint + Rainbow(superclass.name).green.faint
grouped = subclasses.each_with_object({}) do |model, memo|
... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | lib/tasks/model_probe.rake | Ruby | mit | 179 | main | 617 | # frozen_string_literal: true
namespace :model_probe do
desc <<~DESC
Probe. Usage: `rails model:probe[User]`
DESC
task :probe, [:klass] => :environment do |task, args|
puts args.klass.constantize.probe
end
desc <<~DESC
Print fixture. Usage: `rails model:print_fixture[User]`
DESC
task :print_... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | test/test_helper.rb | Ruby | mit | 179 | main | 254 | # frozen_string_literal: true
require "minitest/autorun"
require "minitest/reporters"
Minitest::Reporters.use! Minitest::Reporters::DefaultReporter.new
require "pry"
require "model_probe"
# Test support files
require_relative "support/dummy_models" |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | test/model_probe_test.rb | Ruby | mit | 179 | main | 254 | # frozen_string_literal: true
require_relative "test_helper"
module ModelProbe
class ModelProbeTest < Minitest::Test
# Database-specific tests moved to test/model_probe/probes/sqlite_test.rb,
# postgresql_test.rb, and mysql_test.rb
end
end |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | test/model_probe/probes/metadata_test.rb | Ruby | mit | 179 | main | 2,697 | # frozen_string_literal: true
require_relative "../../test_helper"
module ModelProbe
module Probes
module Metadata
class DDLTest < Minitest::Test
def setup
reset_dummy_user_dll
end
def test_return_a_friendly_message_when_database_does_not_exist
database = Dummy... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | test/model_probe/probes/sqlite_test.rb | Ruby | mit | 179 | main | 1,127 | # frozen_string_literal: true
require_relative "../../test_helper"
module ModelProbe
module Probes
class SqliteTest < Minitest::Test
def setup
@model = DummyUser
end
def test_probe_outputs_metadata
assert_output(/DummyUser/) { @model.probe }
assert_output(/Database eng... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | test/model_probe/probes/mysql_test.rb | Ruby | mit | 179 | main | 1,353 | # frozen_string_literal: true
require_relative "../../test_helper"
if defined?(DummyUserMysql)
module ModelProbe
module Probes
class MysqlTest < Minitest::Test
def setup
@model = DummyUserMysql
end
def test_probe_outputs_metadata
assert_output(/DummyUserMysql/)... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | test/model_probe/probes/postgresql_test.rb | Ruby | mit | 179 | main | 1,382 | # frozen_string_literal: true
require_relative "../../test_helper"
if defined?(DummyUserPostgres)
module ModelProbe
module Probes
class PostgresqlTest < Minitest::Test
def setup
@model = DummyUserPostgres
end
def test_probe_outputs_metadata
assert_output(/Dummy... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | test/model_probe/probes/index_test.rb | Ruby | mit | 179 | main | 696 | # frozen_string_literal: true
require_relative "../../test_helper"
module ModelProbe
module Probes
module Indexes
class LowerCaseIndexTest < Minitest::Test
def setup
DummyUser.connection.execute <<-SQL
CREATE INDEX index_users_on_lower_address_city ON dummy_users (lower(addre... |
github | hopsoft/model_probe | https://github.com/hopsoft/model_probe | test/support/dummy_models.rb | Ruby | mit | 179 | main | 2,588 | # frozen_string_literal: true
require "active_record"
# Silence migration output in test output
ActiveRecord::Migration.verbose = false
# SQLite setup (always available)
class DummyUser < ActiveRecord::Base
establish_connection(adapter: "sqlite3", database: ":memory:")
extend ModelProbe
end
DummyUser.connection... |
github | lostisland/hurley | https://github.com/lostisland/hurley | hurley.gemspec | Ruby | mit | 177 | master | 1,047 | # coding: utf-8
lib = "hurley"
lib_file = File.expand_path("../lib/#{lib}.rb", __FILE__)
File.read(lib_file) =~ /\bVERSION\s*=\s*["'](.+?)["']/
version = $1
require "yaml"
contributors = YAML.load(IO.read(File.expand_path("../contributors.yaml", __FILE__)))
Gem::Specification.new do |spec|
spec.add_development_depe... |
github | lostisland/hurley | https://github.com/lostisland/hurley | Gemfile | Ruby | mit | 177 | master | 201 | source "https://rubygems.org"
gemspec
gem "addressable", "~> 2.3", ">= 2.3.6"
gem "rake", "~> 10.4.0", ">= 10.4.2"
group :test do
gem "minitest", "~> 5.6"
gem "sinatra", "~> 1.4", ">= 1.4.5"
end |
github | lostisland/hurley | https://github.com/lostisland/hurley | test/url_test.rb | Ruby | mit | 177 | master | 16,355 | require File.expand_path("../helper", __FILE__)
module Hurley
class UrlTest < TestCase
def test_integration_join
test = Test.new
["/foo/bar", "/foo", "/baz"].each do |path|
test.get("http://example.com" + path) do |req|
[200, {}, "#{path} http #{req.url.raw_query}".strip]
e... |
github | lostisland/hurley | https://github.com/lostisland/hurley | test/multipart_test.rb | Ruby | mit | 177 | master | 9,861 | require File.expand_path("../helper", __FILE__)
module Hurley
class MultipartTest < TestCase
def test_build_form_with_flat_query
ctype, body = Query::Flat.new(:a => [1,2,3]).to_form
assert_equal "application/x-www-form-urlencoded", ctype
assert_equal "a=1&a=2&a=3", body.read
end
def te... |
github | lostisland/hurley | https://github.com/lostisland/hurley | test/test_test.rb | Ruby | mit | 177 | master | 2,463 | require File.expand_path("../helper", __FILE__)
module Hurley
class TestTest < TestCase
def setup
@stubs = Test.new do |stub|
stub.get "/a/verboten" do |req|
[403, {}, ""]
end
stub.get("/a", :expires => false) do |req|
output = %w(fee fi fo fum)
[200,... |
github | lostisland/hurley | https://github.com/lostisland/hurley | test/header_test.rb | Ruby | mit | 177 | master | 2,930 | require File.expand_path("../helper", __FILE__)
module Hurley
class HeaderTest < TestCase
def test_integration
client = Client.new "https://example.com"
client.header["Client"] = "1"
client.header["Override"] = "1"
client.connection = Test.new do |t|
t.get("/a") do |req|
... |
github | lostisland/hurley | https://github.com/lostisland/hurley | test/query_test.rb | Ruby | mit | 177 | master | 5,781 | require File.expand_path("../helper", __FILE__)
module Hurley
class QueryTest < TestCase
def test_encode_and_parse_string_value
q = Query::Nested.new
q["a"] = 1
assert !q.key?("a+b")
assert_nil q["a+b"]
q["a+b"] = "1+2"
assert_equal "1+2", q["a+b"]
assert q.key?("a+b")
... |
github | lostisland/hurley | https://github.com/lostisland/hurley | test/client_test.rb | Ruby | mit | 177 | master | 18,634 | require File.expand_path("../helper", __FILE__)
module Hurley
class ClientTest < TestCase
def test_integration_verbs
verbs = [:get, :put, :post, :delete, :options]
client = Client.new "https://example.com"
client.connection = Test.new do |t|
verbs.each do |verb|
t.handle(verb,... |
github | lostisland/hurley | https://github.com/lostisland/hurley | test/helper.rb | Ruby | mit | 177 | master | 265 | require "minitest/autorun"
require "rack"
if ENV["HURLEY_ADDRESSABLE"]
require "addressable/uri"
end
require File.expand_path("../../lib/hurley", __FILE__)
Hurley.require_lib "test", "test/integration"
module Hurley
class TestCase < MiniTest::Test
end
end |
github | lostisland/hurley | https://github.com/lostisland/hurley | test/live/net_http_test.rb | Ruby | mit | 177 | master | 416 | require File.expand_path("../../helper", __FILE__)
Hurley.require_lib "connection"
module Hurley
module Live
class NetHttpTest < TestCase
features = []
if Hurley::Connection::ATTEMPT_GZIP && RUBY_VERSION >= "1.9"
features << :Compression
end
Hurley::Test::Integration.apply(self,... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley.rb | Ruby | mit | 177 | master | 1,941 | require "forwardable"
require "thread"
module Hurley
VERSION = "0.2".freeze
USER_AGENT = "Hurley v#{VERSION}".freeze
LIB_PATH = __FILE__[0...-3]
MUTEX = Mutex.new
def self.require_lib(*libs)
libs.each do |lib|
require File.join(LIB_PATH, lib)
end
end
def self.default_client
mutex do
... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/client.rb | Ruby | mit | 177 | master | 8,468 | require "forwardable"
require "set"
require "stringio"
module Hurley
class Client
attr_reader :url
attr_reader :header
attr_writer :connection
attr_reader :request_options
attr_reader :ssl_options
def initialize(endpoint = nil)
@before_callbacks = []
@after_callbacks = []
@... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/query.rb | Ruby | mit | 177 | master | 6,171 | require "cgi"
require "forwardable"
require "stringio"
module Hurley
class Query
def self.default
@default ||= Nested
end
def self.default=(klass)
@default = klass
end
def self.parse(raw_query)
default.parse(raw_query)
end
def initialize(initial = nil)
@hash = {... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/options.rb | Ruby | mit | 177 | master | 3,629 | require "openssl"
require "securerandom"
module Hurley
class RequestOptions < Struct.new(
# Integer or Fixnum number of seconds to wait for one block to be read.
:timeout,
# Integer or Fixnum number of seconds to wait for the connection to open.
:open_timeout,
# String boundary to use for multi... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/connection.rb | Ruby | mit | 177 | master | 3,477 | begin
require "net/https"
rescue LoadError
warn "Warning: no such file to load -- net/https. Make sure openssl is installed if you want ssl support"
require "net/http"
end
require "zlib"
module Hurley
class Connection
# https://bugs.ruby-lang.org/issues/9467
ATTEMPT_GZIP = RUBY_VERSION !~ /\A1\.9(\.|\z... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/tasks.rb | Ruby | mit | 177 | master | 3,347 | require "rake"
namespace :hurley do
desc "Start server for live tests. HURLEY_PORT=4000"
task :start_server do
without_verbose do
require File.expand_path("../test/server", __FILE__)
end
Hurley::Live.start_server(
:port => (ENV["HURLEY_PORT"] || 4000).to_i,
:ssl_key => ENV["HURLEY_S... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/multipart.rb | Ruby | mit | 177 | master | 6,096 | # Taken from multipart-post gem: https://github.com/nicksieger/multipart-post
# Removes coupling with net/http
module Hurley
# Convenience methods for dealing with files and IO that are to be uploaded.
class UploadIO
# Create an upload IO suitable for including in the body hash of a
# Hurley::Request.
... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/header.rb | Ruby | mit | 177 | master | 2,956 | require "forwardable"
module Hurley
class Header
def initialize(initial = nil)
@hash = {}
update(initial) if initial
end
extend Forwardable
def_delegators(:@hash,
:each,
:keys,
:size,
)
def [](key)
@hash[self.class.canonical(key)]
end
def []=(key... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/url.rb | Ruby | mit | 177 | master | 3,812 | require "base64"
require "erb"
require "forwardable"
require "set"
require "uri"
module Hurley
class Url
def self.escape_path(path)
ERB::Util.url_encode(path.to_s)
end
def self.escape_paths(*paths)
paths.map do |path|
escape_path(path)
end.join(SLASH)
end
def self.pars... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/test.rb | Ruby | mit | 177 | master | 3,090 | module Hurley
class Test
def initialize
@handlers = []
@handlers_by_verb_and_url = {}
yield self if block_given?
end
def get(url, options = nil)
handle(:get, url, options, &Proc.new)
end
alias head get
def put(url, options = nil)
handle(:put, url, options, &Pro... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/test/server.rb | Ruby | mit | 177 | master | 2,626 | require "sinatra/base"
require "zlib"
module Hurley
module Live
class Server < Sinatra::Base
set :environment, :test
disable :logging
disable :protection
[:get, :post, :put, :patch, :delete, :options].each do |method|
send(method, "/echo") do
out = [request.request_meth... |
github | lostisland/hurley | https://github.com/lostisland/hurley | lib/hurley/test/integration.rb | Ruby | mit | 177 | master | 8,812 | module Hurley
class Test
module Integration
class << self
attr_writer :live_endpoint
attr_writer :ssl_file
def live_endpoint
@live_endpoint ||= ENV["HURLEY_LIVE"].to_s
end
def ssl_file
@ssl_file ||= ENV["HURLEY_SSL_FILE"].to_s
end
... |
github | maclover7/trix | https://github.com/maclover7/trix | Appraisals | Ruby | mit | 177 | master | 512 | appraise "rails-4.2" do
gem "rails", "~> 4.2.0"
end
appraise "rails-5.0" do
gem "rails", "~> 5.0.0"
end
appraise "rails-5.1" do
gem "rails", "~> 5.1.0"
end
appraise "rails-master" do
gem "rails", git: "https://github.com/rails/rails.git", branch: "master"
gem "arel", git: "https://github.com/rails/arel.git... |
github | maclover7/trix | https://github.com/maclover7/trix | trix.gemspec | Ruby | mit | 177 | master | 1,272 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'trix/version'
Gem::Specification.new do |spec|
spec.name = 'trix'
spec.version = Trix::VERSION
spec.authors = 'Jon Moss'
spec.email = 'me@jonathanmoss.me'
... |
github | maclover7/trix | https://github.com/maclover7/trix | Rakefile | Ruby | mit | 177 | master | 219 | require 'rubygems'
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
require 'rubocop/rake_task'
RuboCop::RakeTask.new
task default: %i(rubocop spec) |
github | maclover7/trix | https://github.com/maclover7/trix | spec/spec_helper.rb | Ruby | mit | 177 | master | 260 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'trix'
require 'action_controller'
require 'action_view'
require 'rspec/rails'
require 'rspec/active_model/mocks'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f } |
github | maclover7/trix | https://github.com/maclover7/trix | spec/formtastic_integration_spec.rb | Ruby | mit | 177 | master | 735 | require 'spec_helper'
require 'formtastic/inputs/trix_editor_input'
describe TrixEditorInput, type: :view do
include FormtasticSpecHelper
let(:post) { mock_model('Post', body: 'body') }
let(:form) do
semantic_form_for(post) do |f|
f.input(:body, as: :trix_editor)
end
end
before do
@outpu... |
github | maclover7/trix | https://github.com/maclover7/trix | spec/trix_editor_helper_spec.rb | Ruby | mit | 177 | master | 1,999 | require 'spec_helper'
require 'trix/form'
describe TrixEditorHelper, type: :helper do
describe '#trix_editor' do
it 'returns a trix editor tag' do
blog = mock_model('Blog', text: 'Description')
assign(:blog, blog)
expect(helper.trix_editor(:blog, :text)).to include('trix-editor')
end
end... |
github | maclover7/trix | https://github.com/maclover7/trix | spec/support/formtastic_spec_helper.rb | Ruby | mit | 177 | master | 934 | require 'yaml'
require 'formtastic'
module FormtasticSpecHelper
include ActionPack
include ActionView::Context if defined?(ActionView::Context)
include ActionController::RecordIdentifier if defined?(ActionController::RecordIdentifier)
include ActionView::Helpers::FormHelper
include Formtastic::Helpers::FormH... |
github | maclover7/trix | https://github.com/maclover7/trix | spec/support/simple_form_spec_helper.rb | Ruby | mit | 177 | master | 204 | require 'simple_form'
::SimpleForm.setup do |config|
config.custom_inputs_namespaces << 'Trix::SimpleForm'
end
module SimpleFormSpecHelper
include ::SimpleForm::ActionViewExtensions::FormHelper
end |
github | maclover7/trix | https://github.com/maclover7/trix | spec/simple_form/simple_form_integration_spec.rb | Ruby | mit | 177 | master | 782 | require 'spec_helper'
require 'trix/simple_form/trix_editor_input'
describe Trix::SimpleForm::TrixEditorInput, type: :view do
include SimpleFormSpecHelper
let(:post) { mock_model('Post', body: 'My super awesome post content.') }
let(:form) do
simple_form_for(post, url: 'some-url') do |f|
f.input(:bod... |
github | maclover7/trix | https://github.com/maclover7/trix | lib/formtastic/inputs/trix_editor_input.rb | Ruby | mit | 177 | master | 493 | class TrixEditorInput < Formtastic::Inputs::StringInput
def to_html
input_wrapping do
editor_tag_params = {
input: input_html_options[:id],
class: 'trix-content'
}
editor_tag = template.content_tag('trix-editor', '', editor_tag_params)
hidden_field = builder.hidden_field(m... |
github | maclover7/trix | https://github.com/maclover7/trix | lib/trix/form.rb | Ruby | mit | 177 | master | 1,687 | require 'action_view'
require 'active_support/core_ext'
module TrixEditorHelper
mattr_accessor(:id, instance_accessor: false)
class_variable_set('@@id', 0)
def trix_editor_tag(name, value = nil, options = {})
options.symbolize_keys!
css_class = Array.wrap(options[:class]).join(' ')
attributes = { c... |
github | maclover7/trix | https://github.com/maclover7/trix | lib/trix/engine.rb | Ruby | mit | 177 | master | 396 | module Trix
class Engine < ::Rails::Engine
initializer 'trix.view_helpers' do
ActiveSupport.on_load(:action_view) do
require 'trix/form'
end
if defined? ::SimpleForm
require 'trix/simple_form/trix_editor_input'
::SimpleForm.setup do |config|
config.custom_inpu... |
github | maclover7/trix | https://github.com/maclover7/trix | lib/trix/simple_form/trix_editor_input.rb | Ruby | mit | 177 | master | 428 | module Trix
module SimpleForm
class TrixEditorInput < ::SimpleForm::Inputs::Base
def input(_wrapper_options)
editor_tag = template.content_tag('trix-editor', '', input: input_class, class: 'trix-content')
hidden_field = @builder.hidden_field(attribute_name, input_html_options)
templ... |
github | tagomoris/deferral | https://github.com/tagomoris/deferral | deferral.gemspec | Ruby | mit | 177 | master | 1,069 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "deferral/version"
Gem::Specification.new do |spec|
spec.name = "deferral"
spec.version = Deferral::VERSION
spec.authors = ["TAGOMORI Satoshi"]
spec.email = ["tagomoris@gmail.... |
github | tagomoris/deferral | https://github.com/tagomoris/deferral | Rakefile | Ruby | mit | 177 | master | 238 | require "bundler/gem_tasks"
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.test_files = FileList['test/**/*.rb']
test.warning = true
test.verbose = true
end
task :default => :test |
github | tagomoris/deferral | https://github.com/tagomoris/deferral | test/test_toplevel.rb | Ruby | mit | 177 | master | 1,060 | require 'test/unit'
require 'deferral/toplevel'
require_relative 'resource'
using Deferral::TopLevel
class DeferralTopLevelTest < ::Test::Unit::TestCase
class Consumer
attr_reader :buf
def initialize(resource)
@buf = ""
@r = resource
end
def yay
@buf << "yay1;"
defer{ @r.c... |
github | tagomoris/deferral | https://github.com/tagomoris/deferral | test/test_deferral.rb | Ruby | mit | 177 | master | 3,445 | require 'test/unit'
require 'deferral'
require_relative 'resource'
class DeferralTest < ::Test::Unit::TestCase
class Consumer
def initialize(resource)
@r = resource
end
def yay
Deferral.defer{ @r.close }
"do domething"
end
def yay!
Deferral.defer{ @r.close }
raise... |
github | tagomoris/deferral | https://github.com/tagomoris/deferral | lib/deferral.rb | Ruby | mit | 177 | master | 1,868 | require "deferral/version"
require "deferral/stack_frame"
require "digest"
module Deferral
### Can't add "suppressed" information, because TracePoint doesn't provide
### an exception was rescued or not after it was raised.
# module ErrorExt
# def suppressed
# @suppressed ||= []
# end
# end
mod... |
github | tagomoris/deferral | https://github.com/tagomoris/deferral | lib/deferral/deferred.rb | Ruby | mit | 177 | master | 995 | module Deferral
class Deferred
def self.get_local_variables(block)
vars = {}
block.binding.local_variables.each do |name|
vars[name] = block.binding.local_variable_get(name)
end
vars
end
def self.set_local_variables(block, vars)
vars.each_pair do |name, val|
... |
github | tagomoris/deferral | https://github.com/tagomoris/deferral | lib/deferral/stack_frame.rb | Ruby | mit | 177 | master | 396 | require_relative "./deferred"
module Deferral
class StackFrame
attr_reader :type
def initialize(type)
@type = type
@releases = []
end
def root?
@type == :root
end
def add(*args, **kwargs, &release)
@releases << Deferred.new(*args, **kwargs, &release)
end
de... |
github | wayspurrchen/moshy | https://github.com/wayspurrchen/moshy | moshy.gemspec | Ruby | mit | 177 | master | 992 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'moshy/version'
Gem::Specification.new do |spec|
spec.name = "moshy"
spec.version = Moshy::VERSION
spec.summary = "datamoshing utility kit for common tasks with AVI files"
s... |
github | wayspurrchen/moshy | https://github.com/wayspurrchen/moshy | lib/moshy.rb | Ruby | mit | 177 | master | 324 | require "aviglitch"
require "av"
require_relative "moshy/version"
require_relative "moshy/inspect"
require_relative "moshy/isplit"
require_relative "moshy/pdupe"
require_relative "moshy/bake"
require_relative "moshy/prep"
require_relative "moshy/ppulse"
module Moshy
# Empty skeleton - just used to include the others
... |
github | wayspurrchen/moshy | https://github.com/wayspurrchen/moshy | lib/moshy/bake.rb | Ruby | mit | 177 | master | 2,104 | module Moshy
class Bake
def cli(args)
opts = Slop::Options.new
opts.separator 'Required Parameters:'
opts.string '-i', '--input', 'Input file path - can be anything that ffmpeg supports.'
opts.string '-o', '--output', 'File output path - should end in .avi.'
opts.separator 'Optional Parameters:'
op... |
github | wayspurrchen/moshy | https://github.com/wayspurrchen/moshy | lib/moshy/prep.rb | Ruby | mit | 177 | master | 2,676 | module Moshy
class Prep
def cli(args)
opts = Slop::Options.new
opts.banner = "Usage: moshy.rb -m prep -i <file> -o <output> [options]\n"
opts.separator 'Required Parameters:'
opts.string '-i', '--input', 'Input file path - can be anything that ffmpeg supports.'
opts.string '-o', '--output', 'File outp... |
github | wayspurrchen/moshy | https://github.com/wayspurrchen/moshy | lib/moshy/pdupe.rb | Ruby | mit | 177 | master | 2,648 | module Moshy
class PDupe
def cli(args)
opts = Slop::Options.new
opts.banner = "Usage: moshy -m pdupe -i file.avi -o file_out.avi -f <integer>\nmoshy -m pdupe --help for details"
opts.separator 'Required Parameters:'
opts.string '-i', '--input', 'Input file path - must be an .avi.'
opts.string '-o', '-... |
github | wayspurrchen/moshy | https://github.com/wayspurrchen/moshy | lib/moshy/isplit.rb | Ruby | mit | 177 | master | 4,434 | module Moshy
class ISplit
def cli(args)
opts = Slop::Options.new
opts.banner = "Usage: moshy -m isplit -i file.avi -o file_out\nmoshy -m isplit --help for details"
opts.separator 'Required Parameters:'
opts.string '-i', '--input', 'Input file path - must be an .avi.'
opts.string '-o', '--output', 'Out... |
github | wayspurrchen/moshy | https://github.com/wayspurrchen/moshy | lib/moshy/ppulse.rb | Ruby | mit | 177 | master | 5,404 | module Moshy
class PPulse
def cli(args)
opts = Slop::Options.new
opts.banner = "Usage: moshy -m ppulse -i file.avi -o file_out.avi [options]\nmoshy -m inspect --help for details"
opts.separator 'Required Parameters:'
opts.string '-i', '--input', 'Input file path - must be an .avi. Clip to split in split ... |
github | wayspurrchen/moshy | https://github.com/wayspurrchen/moshy | lib/moshy/inspect.rb | Ruby | mit | 177 | master | 3,355 | module Moshy
class Inspect
def cli(args)
opts = Slop::Options.new
opts.banner = "Usage: moshy -m inspect -i file.avi\nmoshy -m inspect --help for details"
opts.separator 'Required Parameters:'
opts.string '-i', '--input', 'Input file path - must be an .avi.'
opts.on '-h', '--help' do
puts opts
... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | Gemfile | Ruby | mit | 177 | master | 403 | # frozen_string_literal: true
source "https://rubygems.org"
gem 'rake'
gem 'nokogiri', '~> 1.12'
gem 'minitest', '>= 5.15'
gem 'power_assert', '~> 3.0'
gem 'plat4m', '~> 1.1'
group :develop, optional: true do
gem 'ruby_memcheck', '~> 1.2'
end
group :samples, optional: true do
gem 'rmagick', '~> 5.1'
end
group :do... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | rakefile | Ruby | mit | 177 | master | 559 | ###
# wxRuby3 rake file
# Copyright (c) M.J.N. Corino, The Netherlands
###
# Influential environment variables
# WXRUBY_VERBOSE : define verbosity for (rake) build scripts
# WXRUBY_VERSION : define the version info (x.x.x) for this tree
# WXRUBY_EXCLUDED : exclude certain classes from being compiled, even if p... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | tools/check_swig_types.rb | Ruby | mit | 177 | master | 2,515 | require 'set'
ROOT = File.dirname(__dir__)
module Tool
SWIG_TYPES_USED = Set.new
SWIG_TYPES_USED_FILES = {}
SWIG_TYPES_WRAPPED = Set.new
class << self
def errors?
!!@errors
end
def set_errors(f = true)
@errors = f
end
def scan_sources
Dir[File.join(ROOT, 'ext', 'wxru... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | tools/scripts/docker/upload-release-pkg.rb | Ruby | mit | 177 | master | 2,659 | require 'uri'
require 'net/https'
require 'json'
$GITHUB_TOKEN = ENV['GITHUB_TOKEN'] || ''
if $GITHUB_TOKEN.empty?
$stderr.puts 'Please provide GitHub access token via GITHUB_TOKEN environment variable!'
exit(1)
end
$CIRRUS_TAG = ENV['CIRRUS_TAG'] || ''
uri = if $CIRRUS_TAG.empty?
URI('https://api.github.... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | tools/scripts/docker/get_release_tag.rb | Ruby | mit | 177 | master | 929 | require 'uri'
require 'net/https'
require 'json'
$GITHUB_TOKEN = ENV['GITHUB_TOKEN'] || ''
if $GITHUB_TOKEN.empty?
$stdout.puts 'ERROR: GitHub access token missing!'
exit(1)
end
uri = URI('https://api.github.com/repos/mcorino/wxruby3/releases/latest')
headers = {
'Accept' => 'application/vnd.github+json',
'X-... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | tools/scripts/docker/start_release_tasks.rb | Ruby | mit | 177 | master | 2,087 | require 'uri'
require 'net/https'
require 'json'
require 'yaml'
$CIRRUS_TOKEN = ENV['CIRRUS_TOKEN'] || ''
$release = false # actual release or manual test run
$refname = 'master'
$task_cfg = File.read(File.join(__dir__, 'cirrus-release.yml'))
until ARGV.empty?
arg = ARGV.shift
case arg
when '--release'
$rel... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx.rb | Ruby | mit | 177 | master | 690 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx all-in-one loader for wxRuby3
WX_GLOBAL_CONSTANTS=true unless defined? WX_GLOBAL_CONSTANTS
require 'wx/core'
require 'wx/rt'
require 'wx/prt' if Wx.has_feature?(:USE_PRINTING_ARCHITECTURE)
require 'wx/rtc' i... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/grid.rb | Ruby | mit | 177 | master | 465 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::GRID sub package loader for wxRuby3
require 'wx/core'
require 'wxruby_grid'
require_relative './grid/require'
::Wx.include(WxRubyStyleAccessors)
::Wx.include(::Wx::GRID) if defined?(::WX_GLOBAL_CONSTANT... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/rtc.rb | Ruby | mit | 177 | master | 534 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::RTC sub package loader for wxRuby3
require 'wx/core'
require 'wx/html'
require 'wx/prt' if Wx.has_feature?(:USE_PRINTING_ARCHITECTURE)
require 'wxruby_rtc'
require 'wx/rtc/require'
::Wx.include(WxRubySty... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/stc.rb | Ruby | mit | 177 | master | 460 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::STC sub package loader for wxRuby3
require 'wx/core'
require 'wxruby_stc'
require_relative './stc/require'
::Wx.include(WxRubyStyleAccessors)
::Wx.include(::Wx::STC) if defined?(::WX_GLOBAL_CONSTANTS) &... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/helpers.rb | Ruby | mit | 177 | master | 3,540 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
#
# Some parts are
# Copyright 2004-2007, wxRuby development team
# released under the MIT-like wxRuby2 license
# Various non-GUI helper functions for wxRuby3
module Wx
# A named parameter in a Wx named-arg p... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/aui.rb | Ruby | mit | 177 | master | 458 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::AUI sub package loader for wxRuby3
require 'wx/core'
require 'wxruby_aui'
require_relative './aui/require'
::Wx.include(WxRubyStyleAccessors)
::Wx.include(Wx::AUI) if defined?(::WX_GLOBAL_CONSTANTS) && ... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/rbn.rb | Ruby | mit | 177 | master | 460 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::RBN sub package loader for wxRuby3
require 'wx/core'
require 'wxruby_rbn'
require_relative './rbn/require'
::Wx.include(WxRubyStyleAccessors)
::Wx.include(::Wx::RBN) if defined?(::WX_GLOBAL_CONSTANTS) &... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/keyword_defs.rb | Ruby | mit | 177 | master | 22,491 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
#
# Some parts are
# Copyright 2004-2007, wxRuby development team
# released under the MIT-like wxRuby2 license
# Wx keyword ctor definitions for core classes
# Adapted from wxRuby2.
# Window : base class for all... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/accessors.rb | Ruby | mit | 177 | master | 2,370 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
#
# Some parts are
# Copyright 2004-2007, wxRuby development team
# released under the MIT-like wxRuby2 license
# = WxSugar - Accessors
#
# The default WxRuby interface has lots and lots of methods like
#
# * get... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/pg.rb | Ruby | mit | 177 | master | 456 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::AUI sub package loader for wxRuby3
require 'wx/core'
require 'wxruby_pg'
require_relative './pg/require'
::Wx.include(WxRubyStyleAccessors)
::Wx.include(::Wx::PG) if defined?(::WX_GLOBAL_CONSTANTS) && :... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/core.rb | Ruby | mit | 177 | master | 2,586 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx core package loader for wxRuby3
require_relative './startup' if File.exist?(File.join(__dir__, 'startup.rb'))
require 'wxruby_core'
# Load the version information (should be bundled with all released versio... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/prt.rb | Ruby | mit | 177 | master | 460 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::PRT sub package loader for wxRuby3
require 'wx/core'
require 'wxruby_prt'
require_relative './prt/require'
::Wx.include(WxRubyStyleAccessors)
::Wx.include(::Wx::PRT) if defined?(::WX_GLOBAL_CONSTANTS) &... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/rt.rb | Ruby | mit | 177 | master | 332 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::RT sub package loader for wxRuby3
require 'wx/core'
require 'wxruby_rt'
require 'wx/rt/require'
::Wx.include(WxRubyStyleAccessors)
::Wx.include(::Wx::RT) if defined?(::WX_GLOBAL_CONSTANTS) && ::WX_GLOBA... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/web.rb | Ruby | mit | 177 | master | 460 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::WEB sub package loader for wxRuby3
require 'wx/core'
require 'wxruby_web'
require_relative './web/require'
::Wx.include(WxRubyStyleAccessors)
::Wx.include(::Wx::WEB) if defined?(::WX_GLOBAL_CONSTANTS) &... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/html.rb | Ruby | mit | 177 | master | 529 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::HTML sub package loader for wxRuby3
require 'wx/core'
require 'wx/prt' if Wx.has_feature?(:USE_PRINTING_ARCHITECTURE)
require 'wxruby_html'
require_relative './html/require'
::Wx.include(WxRubyStyleAcces... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/keyword_ctors.rb | Ruby | mit | 177 | master | 9,038 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
#
# Some parts are
# Copyright 2004-2007, wxRuby development team
# released under the MIT-like wxRuby2 license
# WxRuby Extensions - Keyword Constructors for wxRuby3
# Adapted from wxRuby2.
module Wx
# = WxSug... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/global_const.rb | Ruby | mit | 177 | master | 2,726 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Global constant compatibility helper for wxRuby3
module WxGlobalConstants
class << self
def search_nested(mod, sym, path = [])
# check any nested modules and/or (enum) classes
const_val = nil
... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/pg/pg_properties.rb | Ruby | mit | 177 | master | 734 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# Wx::PG property (and related) classes
module Wx::PG
class SystemColourProperty < EnumProperty
# add some 'smart' conversions
wx_initialize = instance_method :initialize
wx_redefine_method :initia... |
github | mcorino/wxRuby3 | https://github.com/mcorino/wxRuby3 | lib/wx/pg/property_grid_interface.rb | Ruby | mit | 177 | master | 2,071 | # Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
module Wx::PG
# since wxWidgets 3.3.0
unless const_defined?(:PG_GETPROPERTYVALUES_FLAGS)
module PG_GETPROPERTYVALUES_FLAGS
PG_DONT_RECURSE = PGPropertyValuesFlags::DontRecurse
PG_KEEP_STRUCTURE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.