repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/spec/easy_captcha_spec.rb | spec/easy_captcha_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe EasyCaptcha do
describe :setup do
EasyCaptcha.setup do |config|
# Cache
config.cache = false
# Chars
config.chars = %w(2 3 4 5 6 7 9 A C D E F G H J K L M N P Q R S T U X Y Z)
# Length
config.length =... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
begin
require 'simplecov'
SimpleCov.start 'rails'
rescue LoadError
end
require 'easy_captcha'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha.rb | lib/easy_captcha.rb | require 'rails'
require 'action_controller'
require 'active_record'
require 'active_support'
# Captcha-Plugin for Rails
module EasyCaptcha
autoload :Espeak, 'easy_captcha/espeak'
autoload :Captcha, 'easy_captcha/captcha'
autoload :CaptchaController, 'easy_captcha/captcha_controller'
autoload :ModelHelpers, 'ea... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/generators/easy_captcha/install_generator.rb | lib/generators/easy_captcha/install_generator.rb | module EasyCaptcha
module Generators #:nodoc:
class InstallGenerator < Rails::Generators::Base #:nodoc:
source_root File.expand_path("../../templates", __FILE__)
desc "Install easy_captcha"
def copy_initializer #:nodoc:
template "easy_captcha.rb", "config/initializers/easy_captcha.rb"
... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/generators/templates/easy_captcha.rb | lib/generators/templates/easy_captcha.rb | EasyCaptcha.setup do |config|
# Cache
# config.cache = true
# Cache temp dir from Rails.root
# config.cache_temp_dir = Rails.root + 'tmp' + 'captchas'
# Cache size
# config.cache_size = 500
# Cache expire
# config.cache_expire = 1.days
# Chars
# config.chars = %w(2 3 4 5 6 7... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/version.rb | lib/easy_captcha/version.rb | module EasyCaptcha
VERSION = '0.6.5'
end
| ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/view_helpers.rb | lib/easy_captcha/view_helpers.rb | module EasyCaptcha
# helper class for ActionView
module ViewHelpers
# generate an image_tag for captcha image
def captcha_tag(*args)
options = { :alt => 'captcha', :width => EasyCaptcha.image_width, :height => EasyCaptcha.image_height }
options.merge! args.extract_options!
image_tag(captch... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/controller_helpers.rb | lib/easy_captcha/controller_helpers.rb | module EasyCaptcha
# helper class for ActionController
module ControllerHelpers
def self.included(base) #:nodoc:
base.class_eval do
helper_method :valid_captcha?, :captcha_valid?
end
end
# generate captcha image and return it as blob
def generate_captcha
if EasyCaptcha.ca... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/model_helpers.rb | lib/easy_captcha/model_helpers.rb | module EasyCaptcha
module ModelHelpers #:nodoc:
# helper class for ActiveRecord
def self.included(base) #:nodoc:
base.extend ClassMethods
end
module ClassMethods #:nodoc:
# to activate model captcha validation
def acts_as_easy_captcha
include InstanceMethods
attr... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/routes.rb | lib/easy_captcha/routes.rb | module ActionDispatch #:nodoc:
module Routing #:nodoc:
class Mapper #:nodoc:
# call to add default captcha root
def captcha_route
match 'captcha' => 'easy_captcha/captcha#captcha', :via => :get
end
end
end
end | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/captcha_controller.rb | lib/easy_captcha/captcha_controller.rb | module EasyCaptcha
# captcha controller
class CaptchaController < ActionController::Base
before_filter :overwrite_cache_control
# captcha action send the generated image to browser
def captcha
if params[:format] == "wav" and EasyCaptcha.espeak?
send_data generate_speech_captcha, :dispositi... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/generator.rb | lib/easy_captcha/generator.rb | module EasyCaptcha
# module for generators
module Generator
autoload :Base, 'easy_captcha/generator/base'
autoload :Default, 'easy_captcha/generator/default'
end
end | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/espeak.rb | lib/easy_captcha/espeak.rb | module EasyCaptcha
# espeak wrapper
class Espeak
# generator for captcha images
def initialize(&block)
defaults
yield self if block_given?
end
# set default values
def defaults
@amplitude = 80..120
@pitch = 30..70
@gap = 80
@voice = nil
end... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/captcha.rb | lib/easy_captcha/captcha.rb | # encoding: utf-8
module EasyCaptcha
# captcha generation class
class Captcha
# code for captcha generation
attr_reader :code
# blob of generated captcha image
attr_reader :image
# generate captcha by code
def initialize code
@code = code
generate_captcha
end
def inspec... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/generator/default.rb | lib/easy_captcha/generator/default.rb | # encoding: utf-8
module EasyCaptcha
module Generator
# default generator
class Default < Base
# set default values
def defaults
@font_size = 24
@font_fill_color = '#333333'
@font = File.expand_path('../../../../resources/captcha.ttf... | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
phatworx/easy_captcha | https://github.com/phatworx/easy_captcha/blob/d3a0281b00bd8fc67caf15a0380e185809f12252/lib/easy_captcha/generator/base.rb | lib/easy_captcha/generator/base.rb | module EasyCaptcha
module Generator
# base class for generators
class Base
# generator for captcha images
def initialize(&block)
defaults
yield self if block_given?
end
# default values for generator
def defaults
end
end
end
end | ruby | MIT | d3a0281b00bd8fc67caf15a0380e185809f12252 | 2026-01-04T17:55:31.126454Z | false |
reclaim-the-stack/actioncable-enhanced-postgresql-adapter | https://github.com/reclaim-the-stack/actioncable-enhanced-postgresql-adapter/blob/6e540411f33ec8374f290adb65d9859fadaf2ee9/test/common.rb | test/common.rb | # frozen_string_literal: true
require "concurrent"
require "active_support/core_ext/hash/indifferent_access"
require "pathname"
module CommonSubscriptionAdapterTest
WAIT_WHEN_EXPECTING_EVENT = 3
WAIT_WHEN_NOT_EXPECTING_EVENT = 0.2
def setup
server = ActionCable::Server::Base.new
server.config.cable = c... | ruby | MIT | 6e540411f33ec8374f290adb65d9859fadaf2ee9 | 2026-01-04T17:55:38.359026Z | false |
reclaim-the-stack/actioncable-enhanced-postgresql-adapter | https://github.com/reclaim-the-stack/actioncable-enhanced-postgresql-adapter/blob/6e540411f33ec8374f290adb65d9859fadaf2ee9/test/postgresql_test.rb | test/postgresql_test.rb | # frozen_string_literal: true
require_relative "test_helper"
require_relative "common"
require_relative "channel_prefix"
require "active_record"
require "action_cable/subscription_adapter/enhanced_postgresql"
class PostgresqlAdapterTest < ActionCable::TestCase
include CommonSubscriptionAdapterTest
include Chann... | ruby | MIT | 6e540411f33ec8374f290adb65d9859fadaf2ee9 | 2026-01-04T17:55:38.359026Z | false |
reclaim-the-stack/actioncable-enhanced-postgresql-adapter | https://github.com/reclaim-the-stack/actioncable-enhanced-postgresql-adapter/blob/6e540411f33ec8374f290adb65d9859fadaf2ee9/test/channel_prefix.rb | test/channel_prefix.rb | # frozen_string_literal: true
module ChannelPrefixTest
def test_channel_prefix
server2 = ActionCable::Server::Base.new(config: ActionCable::Server::Configuration.new)
server2.config.cable = alt_cable_config.with_indifferent_access
server2.config.logger = Logger.new(StringIO.new).tap { |l| l.level = Logge... | ruby | MIT | 6e540411f33ec8374f290adb65d9859fadaf2ee9 | 2026-01-04T17:55:38.359026Z | false |
reclaim-the-stack/actioncable-enhanced-postgresql-adapter | https://github.com/reclaim-the-stack/actioncable-enhanced-postgresql-adapter/blob/6e540411f33ec8374f290adb65d9859fadaf2ee9/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
require "debug"
require "action_cable"
require "active_support/testing/autorun"
require "active_support/testing/method_call_assertions"
require "minitest/reporters"
Minitest::Reporters.use!
# Set test adapter and logger
ActionCable.server.config.cable = { "adapter" => "test" }
ActionCa... | ruby | MIT | 6e540411f33ec8374f290adb65d9859fadaf2ee9 | 2026-01-04T17:55:38.359026Z | false |
reclaim-the-stack/actioncable-enhanced-postgresql-adapter | https://github.com/reclaim-the-stack/actioncable-enhanced-postgresql-adapter/blob/6e540411f33ec8374f290adb65d9859fadaf2ee9/lib/actioncable-enhanced-postgresql-adapter.rb | lib/actioncable-enhanced-postgresql-adapter.rb | require_relative "action_cable/subscription_adapter/enhanced_postgresql"
require_relative "railtie" if defined? Rails::Railtie
| ruby | MIT | 6e540411f33ec8374f290adb65d9859fadaf2ee9 | 2026-01-04T17:55:38.359026Z | false |
reclaim-the-stack/actioncable-enhanced-postgresql-adapter | https://github.com/reclaim-the-stack/actioncable-enhanced-postgresql-adapter/blob/6e540411f33ec8374f290adb65d9859fadaf2ee9/lib/railtie.rb | lib/railtie.rb | class ActionCable::SubscriptionAdapter::EnhancedPostgresql
class Railtie < ::Rails::Railtie
initializer "action_cable.enhanced_postgresql_adapter" do
ActiveSupport.on_load(:active_record) do
large_payloads_table = ActionCable::SubscriptionAdapter::EnhancedPostgresql::LARGE_PAYLOADS_TABLE
Act... | ruby | MIT | 6e540411f33ec8374f290adb65d9859fadaf2ee9 | 2026-01-04T17:55:38.359026Z | false |
reclaim-the-stack/actioncable-enhanced-postgresql-adapter | https://github.com/reclaim-the-stack/actioncable-enhanced-postgresql-adapter/blob/6e540411f33ec8374f290adb65d9859fadaf2ee9/lib/action_cable/subscription_adapter/enhanced_postgresql.rb | lib/action_cable/subscription_adapter/enhanced_postgresql.rb | # freeze_string_literal: true
require "action_cable/subscription_adapter/postgresql"
require "connection_pool"
module ActionCable
module SubscriptionAdapter
class EnhancedPostgresql < PostgreSQL
MAX_NOTIFY_SIZE = 7997 # documented as 8000 bytes, but there appears to be some overhead in transit
LARGE... | ruby | MIT | 6e540411f33ec8374f290adb65d9859fadaf2ee9 | 2026-01-04T17:55:38.359026Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/rails/init.rb | rails/init.rb | Dir[File.expand_path(File.join(File.dirname(__FILE__), 'lib', '**', '*.rb'))].uniq.each do |file|
require file
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/dry_model_generator.rb | generators/dry_model/dry_model_generator.rb | require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'dry_generator'))
class DryModelGenerator < DryGenerator
# Banner: Generator arguments and options.
BANNER_ARGS = [
"[_indexes:field,field+field,field,...]"
].freeze
BANNER_OPTIONS = [
"[--skip-timestamps]",
"[... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/prototypes/active_record_model.rb | generators/dry_model/prototypes/active_record_model.rb | class Duck < ActiveRecord::Base
belongs_to :owner
# object_daddy
generator_for(:name) { "AString" }
generator_for(:description) { "SomeText" }
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/prototypes/active_record_migration.rb | generators/dry_model/prototypes/active_record_migration.rb | class CreateDucks < ActiveRecord::Migration
def self.up
create_table :resources, :force => true do |t|
t.string :name
t.text :description
t.timestamps
end
add_index :resources, :name
add_index :resources, [:name, :description]
end
def self.down
drop_table :reso... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/prototypes/tests/rspec/unit_test.rb | generators/dry_model/prototypes/tests/rspec/unit_test.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe DuckTest do
fixtures :ducks
it "should be valid" do
DuckTest.new.should be_valid
end
end
| ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/prototypes/tests/shoulda/unit_test.rb | generators/dry_model/prototypes/tests/shoulda/unit_test.rb | require 'test_helper'
class DuckTest < ActiveRecord::TestCase
fixtures :ducks
should_have_db_column :name
should_have_db_column :description
context "A test context" do
setup do
end
should 'test something' do
assert true
end
end
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/prototypes/tests/test_unit/unit_test.rb | generators/dry_model/prototypes/tests/test_unit/unit_test.rb | require 'test_helper'
class DuckTest < ActiveRecord::TestCase
fixtures :ducks
setup do
end
test 'something' do
assert true
end
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/prototypes/fixture_data/factory_girl_factories.rb | generators/dry_model/prototypes/fixture_data/factory_girl_factories.rb | Factory.define :duck, :class => Duck do |f|
f.name "AString"
f.description "SomeText"
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/prototypes/fixture_data/machinist_blueprints.rb | generators/dry_model/prototypes/fixture_data/machinist_blueprints.rb | Sham.define do
end
Resource.blueprint do
name { "AString" }
description { "SomeText" }
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/templates/models/active_record_model.rb | generators/dry_model/templates/models/active_record_model.rb | class <%= class_name %> < ActiveRecord::Base
<% unless references.empty? -%>
<% references.each do |attribute| -%>
belongs_to :<%= attribute.name %>
<% end -%>
<% end -%>
<% if options[:object_daddy] -%>
<% attributes.each do |attribute| -%>
generator_for(:<%= attribute.name %>) { <%= attribute.default_for_fa... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/templates/models/active_record_migration.rb | generators/dry_model/templates/models/active_record_migration.rb | class <%= migration_name %> < ActiveRecord::Migration
def self.up
create_table :<%= table_name %> do |t|
<% attributes.each do |attribute| -%>
t.<%= attribute.type %> :<%= attribute.name %>
<% end -%>
<% unless options[:skip_timestamps] -%>
t.timestamps
<% end -%>
end
<% unless indexes.blan... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/templates/models/tests/rspec/unit_test.rb | generators/dry_model/templates/models/tests/rspec/unit_test.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= class_name %> do
<% if options[:fixtures] -%>
fixtures :<%= table_name %>
<% end -%>
it "should be valid" do
<%= class_name %>.new.should be_valid
end
end
| ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/templates/models/tests/shoulda/unit_test.rb | generators/dry_model/templates/models/tests/shoulda/unit_test.rb | require 'test_helper'
class <%= class_name %>Test < ActiveRecord::TestCase
<% if options[:fixtures] -%>
fixtures :<%= plural_name %>
<% end -%>
<% attributes.each do |attribute| -%>
should_have_db_column :<%= attribute.name %>
<% end -%>
context "A test context" do
setup do
end
s... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/templates/models/tests/test_unit/unit_test.rb | generators/dry_model/templates/models/tests/test_unit/unit_test.rb | require 'test_helper'
class <%= class_name %>Test < ActiveRecord::TestCase
<% if options[:fixtures] -%>
fixtures :<%= table_name %>
<% end -%>
setup do
end
test 'something' do
assert true
end
end
| ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/templates/models/fixture_data/factory_girl_factories.rb | generators/dry_model/templates/models/fixture_data/factory_girl_factories.rb | Factory.define :<%= singular_name %>, :class => <%= class_name %> do |f|
<% attributes.each do |attribute| -%>
f.<%= attribute.name %> <%= attribute.default_for_factory %>
<% end -%>
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_model/templates/models/fixture_data/machinist_blueprints.rb | generators/dry_model/templates/models/fixture_data/machinist_blueprints.rb | Sham.define do
end
<%= class_name %>.blueprint do
<% attributes.each do |attribute| -%>
<%= attribute.name %> { <%= attribute.default_for_factory %> }
<% end -%>
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dmodel/dmodel_generator.rb | generators/dmodel/dmodel_generator.rb | require File.join(File.dirname(__FILE__), '..', 'dry_model', 'dry_model_generator')
class DmodelGenerator < DryModelGenerator
def initialize(runtime_args, runtime_options = {})
super
# Make Rails look for templates within generator "dry_model" path
@source_root = options[:source] || File.join(spec.pat... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/dry_scaffold_generator.rb | generators/dry_scaffold/dry_scaffold_generator.rb | require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'dry_generator'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'dry_model', 'dry_model_generator'))
class DryScaffoldGenerator < DryGenerator
# Banner: Generator arguments and options.
BANNER_ARGS = [
"[_acti... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/helpers/helper.rb | generators/dry_scaffold/prototypes/helpers/helper.rb | module DucksHelper
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/helpers/tests/rspec/unit_test.rb | generators/dry_scaffold/prototypes/helpers/tests/rspec/unit_test.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe DucksHelperTest
it 'should do something' do
assert true
end
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/helpers/tests/shoulda/unit_test.rb | generators/dry_scaffold/prototypes/helpers/tests/shoulda/unit_test.rb | require 'test_helper'
class DucksHelperTest < ActionView::TestCase
should 'test something' do
assert true
end
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/helpers/tests/test_unit/unit_test.rb | generators/dry_scaffold/prototypes/helpers/tests/test_unit/unit_test.rb | require 'test_helper'
class DucksHelperTest < ActionView::TestCase
test 'something' do
assert true
end
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/controllers/action_controller.rb | generators/dry_scaffold/prototypes/controllers/action_controller.rb | class DucksController < ApplicationController
before_filter :load_resource, :only => [:show, :edit, :update, :destroy]
before_filter :load_and_paginate_resource, :only => [:index]
# GET /ducks
# GET /ducks.xml
# GET /ducks.json
def index
respond_to do |format|
format.html # index.html.haml
... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/controllers/inherited_resources_controller.rb | generators/dry_scaffold/prototypes/controllers/inherited_resources_controller.rb | class DucksController < InheritedResources::Base
actions :index, :show, :new, :create, :edit, :update, :destroy
respond_to :html, :xml, :json
respond_to :atom, :rss, :only => [:index]
# GET /ducks/custom_action
def custom_action
end
protected
def collection
paginate_options ||... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/controllers/tests/rspec/functional_test.rb | generators/dry_scaffold/prototypes/controllers/tests/rspec/functional_test.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe DucksController do
fixtures :all
integrate_views
it "index action should render index template" do
get :index
response.should render_template(:index)
end
it "show action should render show template" do
get :show, :id => Duck.first... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/controllers/tests/shoulda/functional_test.rb | generators/dry_scaffold/prototypes/controllers/tests/shoulda/functional_test.rb | require 'test_helper'
class DucksControllerTest < ActionController::TestCase
context 'create' do
context 'with success' do
setup do
Duck.any_instance.expects(:save).returns(true)
@duck = Factory(:duck)
post :create, :duck => @duck.attributes
@duck = Resource.find(:all).la... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/prototypes/controllers/tests/test_unit/functional_test.rb | generators/dry_scaffold/prototypes/controllers/tests/test_unit/functional_test.rb | require 'test_helper'
class DucksControllerTest < ActionController::TestCase
test 'create' do
Duck.any_instance.expects(:save).returns(true)
@duck = ducks(:basic)
post :create, :duck => @duck.attributes
assert_not_nil flash[:notice]
assert_response :redirect
end
test 'create with failur... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/helpers/helper.rb | generators/dry_scaffold/templates/helpers/helper.rb | module <%= controller_class_name %>Helper
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/helpers/tests/rspec/unit_test.rb | generators/dry_scaffold/templates/helpers/tests/rspec/unit_test.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= controller_class_name %>Helper do
it 'should do something' do
assert true
end
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/helpers/tests/shoulda/unit_test.rb | generators/dry_scaffold/templates/helpers/tests/shoulda/unit_test.rb | require 'test_helper'
class <%= controller_class_name %>HelperTest < ActionView::TestCase
should 'test something' do
assert true
end
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/helpers/tests/test_unit/unit_test.rb | generators/dry_scaffold/templates/helpers/tests/test_unit/unit_test.rb | require 'test_helper'
class <%= controller_class_name %>HelperTest < ActionView::TestCase
test 'something' do
assert true
end
end | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/controllers/action_controller.rb | generators/dry_scaffold/templates/controllers/action_controller.rb | class <%= controller_class_name %>Controller < ApplicationController
<% if actions -%>
before_filter :load_resource, :only => [<%= symbol_array_to_expression(actions & DryScaffoldGenerator::DEFAULT_MEMBER_AUTOLOAD_ACTIONS) %>]
<% end -%>
<% if actions -%>
before_filter :load_and_paginate_resources, :only => [<%=... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/controllers/inherited_resources_controller.rb | generators/dry_scaffold/templates/controllers/inherited_resources_controller.rb | class <%= controller_class_name %>Controller < InheritedResources::Base
<% if actions -%>
actions <%= symbol_array_to_expression(actions) %>
<% end -%>
<% if formats -%>
respond_to <%= symbol_array_to_expression(formats) %>
<% end -%>
<% (actions - DryScaffoldGenerator::DEFAULT_CONTROLLER_ACTIONS).each do |ac... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/controllers/tests/rspec/functional_test.rb | generators/dry_scaffold/templates/controllers/tests/rspec/functional_test.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= controller_class_name %>Controller do
<% if options[:fixtures] -%>
fixtures :all
<% end -%>
integrate_views
<% unless options[:factory_framework]==:fixtures %>
before(:each) do
<%= build_object %>
end
<% end %>
<% if actions.include?(:index) ... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/controllers/tests/shoulda/functional_test.rb | generators/dry_scaffold/templates/controllers/tests/shoulda/functional_test.rb | require 'test_helper'
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
<% if actions.include?(:create) -%>
context 'create' do
setup do
<%= resource_instance %> = <%= build_object %>
post :create, :<%= singular_name %> => <%= resource_instance %>.attributes
<%= r... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dry_scaffold/templates/controllers/tests/test_unit/functional_test.rb | generators/dry_scaffold/templates/controllers/tests/test_unit/functional_test.rb | require 'test_helper'
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
<% if actions.include?(:create) -%>
test 'create' do
<%= class_name %>.any_instance.expects(:save).returns(true)
<%= resource_instance %> = <%= build_object %>
post :create, :<%= singular_name %> => <%=... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/generators/dscaffold/dscaffold_generator.rb | generators/dscaffold/dscaffold_generator.rb | require File.join(File.dirname(__FILE__), '..', 'dry_scaffold', 'dry_scaffold_generator')
class DscaffoldGenerator < DryScaffoldGenerator
def initialize(runtime_args, runtime_options = {})
super
# Make Rails look for templates within generator "dry_scaffold" path
@source_root = options[:source] || Fil... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/lib/setup_helper.rb | lib/setup_helper.rb | module SetupHelper
# Add gem configuration to a specified Rails environment file
def config_gems(config_file, gems)
sentinel = 'Rails::Initializer.run do |config|'
config_line = ''
gems.each do |gem|
gem_info = gem.to_s.split('-')
if gem_info.size > 1
gem_owner = gem_info[0]
... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/lib/dry_generator.rb | lib/dry_generator.rb |
class DryGenerator < Rails::Generator::NamedBase
HAS_WILL_PAGINATE = defined?(WillPaginate)
HAS_FORMTASTIC = defined?(Formtastic)
HAS_INHERITED_RESOURCES = defined?(InheritedResources)
HAS_SHOULDA = defined?(Shoulda)
HAS_RSPEC = defined?(Rspec)
# Loa... | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
grimen/dry_scaffold | https://github.com/grimen/dry_scaffold/blob/7b54d447b4043d70cde6bfb316f2f4c0aecc37ad/lib/dry_scaffold/tasks.rb | lib/dry_scaffold/tasks.rb | require 'rubygems'
require 'rake'
# Make tasks visible for Rails also when used as gem.
load File.expand_path(File.join(File.dirname(__FILE__), *%w(.. .. tasks dry_scaffold.rake))) | ruby | MIT | 7b54d447b4043d70cde6bfb316f2f4c0aecc37ad | 2026-01-04T17:55:39.642122Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/test_helper.rb | test/test_helper.rb | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'worque'
require 'timecop'
require 'minitest/autorun'
| ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/acceptance_test.rb | test/acceptance_test.rb | require 'test_helper'
require 'worque'
require 'thor/runner'
require 'webmock/minitest'
require 'json'
describe Worque do
describe 'todo' do
before do
$stdout = StringIO.new
end
after do
system "rm -rf tmp/*"
end
it 'creates a notes for today' do
date = Date.new(2016, 7, 14)
... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/version_test.rb | test/lib/worque/version_test.rb | require 'test_helper'
describe Worque::VERSION do
it 'has version set' do
refute_nil Worque::VERSION
end
end
| ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/command/push/options_test.rb | test/lib/worque/command/push/options_test.rb | require 'test_helper'
describe Worque::Command::Push::Options do
describe '#initialize' do
it 'accepts mass assignments' do
opts = Worque::Command::Push::Options.new(channel: 'test', for: 'tomorrow', token: 'secret')
assert_equal 'secret', opts.token
assert_equal 'test', opts.channel
ass... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/command/push/action_test.rb | test/lib/worque/command/push/action_test.rb | require 'test_helper'
require 'webmock/minitest'
describe Worque::Command::Push::Action do
let(:action) { Worque::Command::Push::Action }
before do
# Clean up tmp directory
options = { path: 'tmp/hello/world', for: 'today' }
ENV['SLACK_API_TOKEN'] = 'test-token'
Worque::Command::Todo::Action.run(... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/command/todo/options_test.rb | test/lib/worque/command/todo/options_test.rb | require 'test_helper'
describe Worque::Command::Todo::Options do
describe '#initialize' do
it 'accepts mass assignments' do
opts = Worque::Command::Todo::Options.new(path: 'tmp', skip_weekend: true, for: 'tomorrow')
assert_equal 'tmp', opts.path
assert opts.skip_weekend?
assert_equal 'to... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/command/todo/action_test.rb | test/lib/worque/command/todo/action_test.rb | require 'test_helper'
describe Worque::Command::Todo::Action do
after do
# Clean up tmp directory
system('rm -rf tmp/*')
end
let(:action) { Worque::Command::Todo::Action }
describe '#call' do
describe 'when directory does not exist' do
it 'creates the directory' do
options = { path:... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/utils/command_test.rb | test/lib/worque/utils/command_test.rb | require 'test_helper'
describe Worque::Utils::Command do
before do
@helper = Worque::Utils::Command
system('rm -rf tmp/*')
end
after do
system('rm -rf tmp/*')
end
describe '.mkdir' do
it 'makes new dir' do
path = "#{ Dir.pwd }/tmp/hello/world"
@helper.mkdir(path)
assert Di... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/utils/business_day_test.rb | test/lib/worque/utils/business_day_test.rb | require 'test_helper'
require 'date'
describe Worque::Utils::BusinessDay do
before do
@helper = Worque::Utils::BusinessDay
end
describe '.next' do
it 'returns the next day' do
thursday = Date.new(2016, 7, 14)
assert_equal 5, @helper.next(thursday).wday
end
it 'skips weekend by defau... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/utils/slack_test.rb | test/lib/worque/utils/slack_test.rb | require 'test_helper'
require 'webmock/minitest'
require 'worque/utils/slack'
describe Worque::Utils::Slack do
describe '#post' do
before do
stubbed_result = {
"ok"=>true,
"channel"=>"secret",
"ts"=>"1469116417.000010",
"message" => {
"type"=>"message",
"... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/test/lib/worque/utils/config_file_test.rb | test/lib/worque/utils/config_file_test.rb | require 'test_helper'
require 'worque/default_config'
describe Worque::DefaultConfig do
describe '#initialize' do
it 'takes config' do
config = Worque::DefaultConfig.new(path: '/foo', slack_token: 'bar')
assert_equal({path: '/foo', slack_token: 'bar'}, config.data)
end
end
describe '#load!' ... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque.rb | lib/worque.rb | require "worque/version"
require 'worque/cli'
module Worque
InvalidPath = Class.new(StandardError)
end
| ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/version.rb | lib/worque/version.rb | module Worque
VERSION = "0.3.0"
end
| ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/default_config.rb | lib/worque/default_config.rb | module Worque
class Hash < ::Thor::CoreExt::HashWithIndifferentAccess; end
class DefaultConfig
attr_reader :data
def initialize(data = ::Worque::Hash.new)
@data = data
end
class << self
def load!
new(::Worque::Hash.new(parsed_config))
end
private
def parsed... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/cli.rb | lib/worque/cli.rb | require 'thor'
require 'worque/command/todo/action'
require 'worque/command/todo/options'
require 'worque/command/push/action'
require 'worque/command/push/options'
require 'worque/default_config'
module Worque
class CLI < ::Thor
package_name 'Worque CLI'
desc 'todo', 'Make a todo'
method_option :for, ... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/command/push/options.rb | lib/worque/command/push/options.rb | module Worque
module Command
class Push::Options
attr_reader :channel
attr_reader :token
attr_reader :for
attr_reader :path
def initialize(options)
@channel = options[:channel]
@path = options[:path]
@for = options[:for]
@token = options[:token]
... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/command/push/action.rb | lib/worque/command/push/action.rb | require 'worque/utils/slack'
require 'worque/utils/business_day'
require 'json'
module Worque
module Command
module Push
class Action
REPORT_FILE_PATH_FORMAT = "%<worque_path>s/notes-%<date_for>s.md".freeze
def initialize(options)
@options = options
end
def call
... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/command/todo/options.rb | lib/worque/command/todo/options.rb | require 'optparse'
require 'pathname'
module Worque
module Command
class Todo::Options
attr_accessor :path
attr_accessor :for
attr_accessor :append_task
attr_writer :skip_weekend
attr_reader :template_path
def initialize(opts)
@path = opts[:path]
@skip_weekend... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/command/todo/action.rb | lib/worque/command/todo/action.rb | require 'worque/utils/command'
require 'worque/utils/business_day'
require 'date'
module Worque
module Command
module Todo
class Action
FILE_PATH_FORMAT = "%<path>s/notes-%<date>s.md".freeze
def initialize(options)
@options = options
validate_options!
end
... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/utils/command.rb | lib/worque/utils/command.rb | require 'fileutils'
module Worque
module Utils
module Command
extend self
def mkdir(dir)
FileUtils.mkdir_p(dir)
end
def touch(path)
FileUtils.touch(path)
end
def append_text(path, text)
File.open(path, 'a') do |f|
f.puts "#{text}\n"
... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/utils/business_day.rb | lib/worque/utils/business_day.rb | module Worque
module Utils
module BusinessDay
extend self
def next(date, skip_weekend = true)
shift(date, 1, skip_weekend)
end
def previous(date, skip_weekend = true)
shift(date, -1, skip_weekend)
end
def previous_continuous(date)
shift(date, -1, fals... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
qcam/worque | https://github.com/qcam/worque/blob/dc90cca76063d4233e26769d5edc0498c8203a0a/lib/worque/utils/slack.rb | lib/worque/utils/slack.rb | require 'json'
require 'net/http'
module Worque
module Utils
class Slack
def initialize(token)
@token = token
end
def post(channel, message)
JSON.parse(post_form(channel, message).body)
end
private
def post_form(channel, message)
uri = URI.parse('htt... | ruby | MIT | dc90cca76063d4233e26769d5edc0498c8203a0a | 2026-01-04T17:55:06.898707Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/chat_result_spec.rb | spec/chat_result_spec.rb | require 'spec_helper'
RSpec.describe Intelligence::ChatResult, :unit do
describe '#initialize' do
context 'when initialized with choices and metrics' do
let ( :choice_attributes ) do
[
{
end_reason: :ended,
end_sequence: 'Goodbye.',
message: {
... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/adapter_error_spec.rb | spec/adapter_error_spec.rb | require 'spec_helper'
RSpec.describe Intelligence::AdapterError, :unit do
describe '#initialize' do
it 'sets the error message correctly based on adapter_type and text' do
error = described_class.new( :some_adapter, 'failed to initialize' )
expect( error.message ).to eq( 'The SomeAdapter adapter fai... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/message_spec.rb | spec/message_spec.rb | require 'spec_helper'
RSpec.describe Intelligence::Message, :unit do
let( :text_content ) {
Intelligence::MessageContent.build!( :text, text: 'text' )
}
let( :binary_content ) {
Intelligence::MessageContent.build!( :binary, content_type: 'image/jpg', bytes: '...bytes...' )
}
describe '.build' do
... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/conversation_spec.rb | spec/conversation_spec.rb | require 'spec_helper'
RSpec.describe Intelligence::Conversation, :unit do
describe '.build' do
context 'when given no attributes or configuration' do
it 'creates an empty conversation' do
conversation = described_class.build
expect( conversation.has_system_message? ).to be false
... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/chat_result_choice_spec.rb | spec/chat_result_choice_spec.rb | require 'spec_helper'
RSpec.describe Intelligence::ChatResultChoice, :unit do
describe '#initialize' do
context 'when initialized with message, end_reason, and end_sequence' do
let( :chat_choice_attributes ) do
{
end_reason: :ended,
end_sequence: 'Goodbye.',
message:... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/chat_metrics_spec.rb | spec/chat_metrics_spec.rb | require 'spec_helper'
RSpec.describe Intelligence::ChatMetrics, :unit do
describe '#initialize' do
context 'when initialized with all attributes' do
it 'sets the attributes correctly' do
attributes = {
duration: 1500,
input_tokens: 100,
output_tokens: 200
}
... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/adapter_configuration_spec.rb | spec/adapter_configuration_spec.rb | require 'spec_helper'
module Intelligence
module ConfigurationTest
class Adapter < Intelligence::Adapter::Base
schema do
api_key String, required: true
settings default: {} do
timeout Integer
debug [ TrueClass, FalseClass ], default: false
logging do
... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/error_result_spec.rb | spec/error_result_spec.rb | require 'spec_helper'
RSpec.describe Intelligence::ErrorResult, :unit do
describe '#initialize' do
context 'when initialized with all attributes' do
it 'sets the attributes correctly' do
error_attributes = {
error_type: :invalid_request_error,
error: 'Invalid request format',
... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/adapter_spec.rb | spec/adapter_spec.rb | require 'spec_helper'
# define a minimal adapter class for testing purposes
module Intelligence
module TestAdapter
class Adapter < Intelligence::Adapter::Base
schema do
key
end
end
end
end
RSpec.describe Intelligence::Adapter, :unit do
describe '.[]' do
context 'when adapter_t... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/message_content_spec.rb | spec/message_content_spec.rb | require 'spec_helper'
RSpec.describe Intelligence::MessageContent, :unit do
describe '.build' do
context 'when the class for the provided type exists' do
it 'creates an instance of the correct class' do
# define a mock class for the test
class Intelligence::MessageContent::TestType < Intel... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/spec_helper.rb | spec/spec_helper.rb | require 'rspec'
require 'vcr'
require 'debug'
require 'intelligence'
Dir[ File.join( __dir__, 'support', '**', '*.rb' ) ].each { |f| require f }
RSpec.configure do | config |
config.formatter = :documentation
# allows using "describe" instead of "RSpec.describe"
config.expose_dsl_globally = true
config.ex... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/support/vcr_helper.rb | spec/support/vcr_helper.rb | require 'vcr'
SENSITIVE_URL_PARAMETERS = %w(
key
)
SENSITIVE_REQUEST_HEADERS = %w(
x-api-key api-key
)
SENSITIVE_RESPONSE_HEADERS = %w(
set-cookie Set-Cookie cf-ray request-id x-request-id x-cloud-trace-context
openai-organization
)
VCR.configure do | config |
config.cassette_library_dir = File.join( _... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/support/fixture_helper.rb | spec/support/fixture_helper.rb | module FixtureHelperMethods
def fixture_file_path( file_name )
File.expand_path( File.join( '..', 'fixtures', 'files', file_name ), __dir__ )
end
end
RSpec.configure do | config |
config.include FixtureHelperMethods
end
| ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/support/intelligence_helper.rb | spec/support/intelligence_helper.rb | module IntelligenceHelper
def adapter_key( env_key )
raise "An #{env_key} must be defined in the environment." unless ENV[ env_key ]
ENV[ env_key ]
end
def adapter_connection
Faraday.new do | builder |
builder.adapter Faraday.default_adapter
builder.options.timeout = 240 # read... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
EndlessInternational/intelligence | https://github.com/EndlessInternational/intelligence/blob/2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a/spec/support/adapters/chat_requests_with_stop_sequence.rb | spec/support/adapters/chat_requests_with_stop_sequence.rb | require 'spec_helper'
RSpec.shared_examples 'chat requests with stop sequence' do | options = {} |
context 'where there is a single message that ends at stop sequence' do
it 'responds with generated text up to the stop sequence' do
response = create_and_make_chat_request(
send( options[ :adapte... | ruby | MIT | 2ea7d4c0121a2c3eb962bb6199df67d8a38cb50a | 2026-01-04T17:53:00.421273Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.