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 |
|---|---|---|---|---|---|---|---|---|
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode/cldr_regex_collection.rb | lib/validates_zipcode/cldr_regex_collection.rb | # frozen_string_literal: true
# Regex source: http://unicode.org/cldr/trac/browser/trunk/common/supplemental/postalCodeData.xml
# 159 countries supported
#
module ValidatesZipcode
module CldrRegexpCollection
ZIPCODES_REGEX = {
GB: /\AGIR ?0AA|((([A-Z]\d{1,2})|(([A-Z][A-HJ-Y]\d{1,2})|(([A-Z]\d[A-Z])|([A-Z][A... | ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode/formatter.rb | lib/validates_zipcode/formatter.rb | # frozen_string_literal: true
module ValidatesZipcode
class Formatter
WORD_CHAR_AND_DIGIT = /[A-Z0-9]/.freeze
ZIPCODES_TRANSFORMATIONS = {
AT: ->(z) { z.scan(/\d/).join },
ES: :AT,
CA: ->(z) { z.upcase.scan(WORD_CHAR_AND_DIGIT).insert(3, ' ').join },
CZ: ->(z) { z.scan(/\d/).insert(3,... | ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode/invalid_zipcode_error.rb | lib/validates_zipcode/invalid_zipcode_error.rb | # frozen_string_literal: true
module ValidatesZipcode
class InvalidZipcodeError < RuntimeError
end
end
| ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/repository.rb | assets/lib/repository.rb | # frozen_string_literal: true
require_relative 'filters/all'
require_relative 'filters/fork'
require_relative 'filters/label'
require_relative 'filters/path'
require_relative 'filters/ci_skip'
require_relative 'filters/mergeable'
require_relative 'filters/approval'
class Repository
attr_reader :name
def initiali... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/pull_request.rb | assets/lib/pull_request.rb | # frozen_string_literal: true
require 'octokit'
class PullRequest
def self.from_github(repo:, id:)
pr = Octokit.pull_request(repo.name, id)
PullRequest.new(pr: pr)
end
def initialize(pr:)
@pr = pr
end
def from_fork?
base_repo != head_repo
end
def review_approved?
Octokit.pull_requ... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/input.rb | assets/lib/input.rb | # frozen_string_literal: true
require 'json'
require 'ostruct'
class Input
class Params < OpenStruct
class Merge < OpenStruct
def method
self['method']
end
end
def merge
Merge.new(self['merge'] || {})
end
def git
OpenStruct.new(self['git'] || {})
end
end
... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/status.rb | assets/lib/status.rb | # frozen_string_literal: true
require 'octokit'
class Status
def initialize(state:, atc_url:, sha:, repo:, context: 'concourse-ci')
@atc_url = atc_url
@context = context
@repo = repo
@sha = sha
@state = state
end
def create!
Octokit.create_status(
@repo.name,
@sha,
... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/commands/in.rb | assets/lib/commands/in.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'English'
require 'json'
require 'shellwords'
require_relative 'base'
module Commands
class In < Commands::Base
attr_reader :destination
def initialize(destination:, input: Input.instance)
@destination = destination
super(input: input)
... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/commands/base.rb | assets/lib/commands/base.rb | # frozen_string_literal: true
require 'faraday'
require 'octokit'
require 'faraday-http-cache'
require 'active_support/cache'
require 'active_support/cache/file_store'
stack = Faraday::RackBuilder.new do |builder|
storer = ActiveSupport::Cache::FileStore.new('/tmp', namespace: 'pullrequest')
builder.use Faraday::... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/commands/check.rb | assets/lib/commands/check.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require_relative 'base'
require_relative '../repository'
module Commands
class Check < Commands::Base
def output
repo.pull_requests
end
private
def repo
@repo ||= Repository.new(name: input.source.repo)
end
end
end
... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/commands/out.rb | assets/lib/commands/out.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require_relative 'base'
require_relative '../repository'
require_relative '../status'
module Commands
class Out < Commands::Base
attr_reader :destination
def initialize(destination:, input: Input.instance)
@destination = destination
... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/filters/approval.rb | assets/lib/filters/approval.rb | # frozen_string_literal: true
module Filters
class Approval
def initialize(pull_requests:, input: Input.instance)
@pull_requests = pull_requests
@input = input
end
def pull_requests
if @input.source.require_review_approval
@pull_requests.delete_if { |x| !x.review_approved? }
... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/filters/path.rb | assets/lib/filters/path.rb | # frozen_string_literal: true
require_relative '../input'
module Filters
class Path
def initialize(pull_requests:, input: Input.instance)
@pull_requests = pull_requests
@input = input
end
def pull_requests
paths = @input.source.paths || []
ignore_paths = @input.source.ign... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/filters/ci_skip.rb | assets/lib/filters/ci_skip.rb | # frozen_string_literal: true
module Filters
class CISkip
def initialize(pull_requests:, input: Input.instance)
@pull_requests = pull_requests
@input = input
end
def pull_requests
if !@input.source.ci_skip
@pull_requests
else
@memoized ||= @pull_requests.delete_if... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/filters/mergeable.rb | assets/lib/filters/mergeable.rb | # frozen_string_literal: true
module Filters
class Mergeable
def initialize(pull_requests:, input: Input.instance)
@pull_requests = pull_requests
@input = input
end
def pull_requests
if @input.source.only_mergeable
@memoized ||= @pull_requests.delete_if do |pr|
respo... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/filters/fork.rb | assets/lib/filters/fork.rb | # frozen_string_literal: true
module Filters
class Fork
def initialize(pull_requests:, input: Input.instance)
@pull_requests = pull_requests
@input = input
end
def pull_requests
if @input.source.disable_forks
@memoized ||= @pull_requests.delete_if(&:from_fork?)
else
... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/filters/label.rb | assets/lib/filters/label.rb | # frozen_string_literal: true
module Filters
class Label
def initialize(pull_requests:, input: Input.instance)
@pull_requests = pull_requests
@input = input
end
def pull_requests
if @input.source.label
@memoized ||= @pull_requests.select do |pr|
issue = Octokit.issue... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/assets/lib/filters/all.rb | assets/lib/filters/all.rb | # frozen_string_literal: true
require 'octokit'
require_relative '../pull_request'
module Filters
class All
def initialize(pull_requests: [], input: Input.instance)
@input = input
end
def pull_requests
@pull_requests ||= Octokit.pulls(input.source.repo, pull_options).map do |pr|
Pul... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require_relative 'support/proxy'
require_relative 'support/cli'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doub... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/support/proxy.rb | spec/support/proxy.rb | # frozen_string_literal: true
require 'billy'
Billy.configure do |c|
c.cache = true
c.merge_cached_responses_whitelist = [/github/]
c.non_successful_error_level = :error
c.non_whitelisted_requests_disabled = true
end
| ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/support/cli.rb | spec/support/cli.rb | # frozen_string_literal: true
require 'open3'
module CliIntegration
def check(payload)
path = ['./assets/check', '/opt/resource/check'].find { |p| File.exist? p }
payload[:source][:skip_ssl_verification] = true
output = `echo '#{JSON.generate(payload)}' | env http_proxy=#{proxy.url} #{path}`
JSON.p... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/integration/check_spec.rb | spec/integration/check_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'json'
describe 'check' do
def check(payload)
path = ['./assets/check', '/opt/resource/check'].find { |p| File.exist? p }
payload[:source][:skip_ssl_verification] = true
output = `echo '#{JSON.generate(payload)}' | env http_proxy=#{proxy.url} ... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/integration/in_spec.rb | spec/integration/in_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'json'
require 'tmpdir'
describe 'get' do
include CliIntegration
let(:proxy) { Billy::Proxy.new }
let(:dest_dir) { Dir.mktmpdir }
let(:git_dir) { Dir.mktmpdir }
let(:git_uri) { "file://#{git_dir}" }
before { proxy.start }
after { proxy.res... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/integration/out_spec.rb | spec/integration/out_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'fileutils'
describe 'out' do
include CliIntegration
let(:proxy) { Billy::Proxy.new }
let(:dest_dir) { Dir.mktmpdir }
before { proxy.start }
after { proxy.reset }
def git(cmd, dir = dest_dir)
Dir.chdir(dir) { `git #{cmd}`.chomp }
end
... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/commands/check_spec.rb | spec/commands/check_spec.rb | # frozen_string_literal: true
require_relative '../../assets/lib/commands/check'
require 'webmock/rspec'
require 'json'
describe Commands::Check do
def check(payload)
payload['source']['skip_ssl_verification'] = true
Input.instance(payload: payload)
Commands::Check.new.output.map &:as_json
end
def... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/commands/in_spec.rb | spec/commands/in_spec.rb | # frozen_string_literal: true
require 'json'
require 'tmpdir'
require 'webmock/rspec'
require_relative '../../assets/lib/commands/in'
describe Commands::In do
def git_dir
@git_dir ||= Dir.mktmpdir
end
def git_uri
"file://#{git_dir}"
end
let(:dest_dir) { Dir.mktmpdir }
def get(payload)
paylo... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/commands/out_spec.rb | spec/commands/out_spec.rb | # frozen_string_literal: true
require 'json'
require 'tmpdir'
require 'webmock/rspec'
require_relative '../../assets/lib/commands/out'
describe Commands::Out do
let(:dest_dir) { Dir.mktmpdir }
def git(cmd, dir = dest_dir)
Dir.chdir(dir) { `git #{cmd}`.chomp }
end
def commit(msg)
git("-c user.name='t... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/filters/path_spec.rb | spec/filters/path_spec.rb | # frozen_string_literal: true
require_relative '../../assets/lib/filters/path'
require_relative '../../assets/lib/pull_request'
require 'webmock/rspec'
describe Filters::Path do
let(:ignore_pr) do
PullRequest.new(pr: { 'number' => 1 })
end
let(:pr) do
PullRequest.new(pr: { 'number' => 2 })
end
let... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/filters/ci_skip_spec.rb | spec/filters/ci_skip_spec.rb | # frozen_string_literal: true
require_relative '../../assets/lib/filters/ci_skip'
require_relative '../../assets/lib/pull_request'
require_relative '../../assets/lib/input'
require 'webmock/rspec'
describe Filters::CISkip do
let(:ignore_pr) do
PullRequest.new(pr: { 'number' => 1, 'head' => { 'sha' => 'abc' } })... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/filters/label_spec.rb | spec/filters/label_spec.rb | # frozen_string_literal: true
require_relative '../../assets/lib/filters/label'
require_relative '../../assets/lib/pull_request'
require_relative '../../assets/lib/input'
require 'webmock/rspec'
describe Filters::Label do
let(:ignore_pr) do
PullRequest.new(pr: { 'number' => 1 })
end
let(:pr) do
PullReq... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/filters/approval_spec.rb | spec/filters/approval_spec.rb | # frozen_string_literal: true
require_relative '../../assets/lib/filters/approval'
require_relative '../../assets/lib/pull_request'
require_relative '../../assets/lib/input'
require 'webmock/rspec'
describe Filters::Approval do
let(:ignore_pr) do
PullRequest.new(pr: { 'number' => 1, 'head' => { 'sha' => 'abc' }... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
jtarchie/github-pullrequest-resource | https://github.com/jtarchie/github-pullrequest-resource/blob/aea5861a46480896ca73049a22b4a279c8e13be1/spec/filters/mergeable_spec.rb | spec/filters/mergeable_spec.rb | # frozen_string_literal: true
require_relative '../../assets/lib/filters/mergeable'
require_relative '../../assets/lib/pull_request'
require_relative '../../assets/lib/input'
require 'webmock/rspec'
describe Filters::Mergeable do
let(:ignore_pr) do
PullRequest.new(pr: { 'number' => 1, 'head' => { 'sha' => 'abc'... | ruby | MIT | aea5861a46480896ca73049a22b4a279c8e13be1 | 2026-01-04T17:40:25.880849Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/schema.rb | db/schema.rb | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130514062148_create_delayed_jobs.rb | db/migrate/20130514062148_create_delayed_jobs.rb | class CreateDelayedJobs < ActiveRecord::Migration
def up
create_table :delayed_jobs do |t|
t.integer :priority, :default => 0
t.integer :attempts, :default => 0
t.text :handler
t.string :last_error
t.datetime :run_at
t.datetime :locked_at
t.datetime :failed_at
t.str... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130426165010_create_states.rb | db/migrate/20130426165010_create_states.rb | class CreateStates < ActiveRecord::Migration
def up
create_table :states do |t|
t.string :name
t.string :state
t.timestamps
end
end
def down
drop_table :states
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130508001711_add_api_key_to_users.rb | db/migrate/20130508001711_add_api_key_to_users.rb | class AddApiKeyToUsers < ActiveRecord::Migration
def up
add_column :users, :api_key, :string
end
def down
remove_column :users, :api_key
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130517010210_add_ci_to_projects.rb | db/migrate/20130517010210_add_ci_to_projects.rb | class AddCiToProjects < ActiveRecord::Migration
def up
add_column :projects, :ci, :boolean, :default => true
end
def down
remove_column :projects, :ci
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130414012805_create_projects.rb | db/migrate/20130414012805_create_projects.rb | class CreateProjects < ActiveRecord::Migration
def up
create_table :projects do |t|
t.string :name
t.string :repo_url
t.string :deploy_type
t.timestamps
end
end
def down
drop_table :projects
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130525001332_add_notification_url_to_users.rb | db/migrate/20130525001332_add_notification_url_to_users.rb | class AddNotificationUrlToUsers < ActiveRecord::Migration
def up
add_column :users, :notification_url, :string
end
def down
remove_column :users, :notification_url
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130516042149_change_delayed_job_last_error_to_text.rb | db/migrate/20130516042149_change_delayed_job_last_error_to_text.rb | class ChangeDelayedJobLastErrorToText < ActiveRecord::Migration
def up
change_column :delayed_jobs, :last_error, :text
end
def down
change_column :delayed_jobs, :last_error, :string
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130509014935_create_deploys.rb | db/migrate/20130509014935_create_deploys.rb | class CreateDeploys < ActiveRecord::Migration
def up
create_table :deploys do |t|
t.text :actions
t.string :branch
t.string :environment
t.string :box
t.text :variables
t.string :commit
t.datetime :started_at
t.datetime :finished_at
t.boolean :in_progress, :de... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20131127022704_remove_deploy_type_and_ci_from_projects.rb | db/migrate/20131127022704_remove_deploy_type_and_ci_from_projects.rb | class RemoveDeployTypeAndCiFromProjects < ActiveRecord::Migration
def up
remove_column :projects, :ci
remove_column :projects, :deploy_type
end
def down
add_column :projects, :ci, :string
add_column :projects, :deploy_type, :string
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/db/migrate/20130501003758_create_users.rb | db/migrate/20130501003758_create_users.rb | class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :email
t.string :password_digest
t.timestamps
end
end
def down
drop_table :users
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_ci_service_test.rb | test/deep_thought_ci_service_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtCIServiceTest < MiniTest::Unit::TestCase
def setup
DatabaseCleaner.start
DeepThought::CIService.adapters = {}
DeepThought::CIService.ci_service = nil
end
def teardown
DatabaseCleaner.clean
end
def test_no_ci_service
... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_api_test.rb | test/deep_thought_api_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtApiTest < MiniTest::Unit::TestCase
include Rack::Test::Methods
def setup
DatabaseCleaner.start
if File.directory?(".projects/_test")
FileUtils.rm_rf(".projects/_test")
end
deployer = mock('class')
deployer.stubs(:n... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_shell_test.rb | test/deep_thought_shell_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtShellTest < MiniTest::Unit::TestCase
def setup
DatabaseCleaner.start
DeepThought::Deploy.any_instance.stubs(:queue)
deployer = mock('class')
deployer.stubs(:new).returns(deployer)
deployer.stubs(:setup?).returns(true)
D... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/test_helper.rb | test/test_helper.rb | require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
ENV['RACK_ENV'] = 'test'
ENV['SESSION_SECRET'] = 'secret'
require... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_app_test.rb | test/deep_thought_app_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtAppTest < MiniTest::Unit::TestCase
include Rack::Test::Methods
include Capybara::DSL
def setup
DatabaseCleaner.start
@deployer = mock('class')
@deployer.stubs(:new).returns(@deployer)
@deployer.stubs(:setup?).returns(true)
... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_notifier_test.rb | test/deep_thought_notifier_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtNotifierTest < MiniTest::Unit::TestCase
def setup
DatabaseCleaner.start
DeepThought::Deployer.adapters = {}
@deployer = mock('class')
@deployer.expects(:new).returns(@deployer)
@deployer.expects(:setup?).returns(true)
... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_git_test.rb | test/deep_thought_git_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtGitTest < MiniTest::Unit::TestCase
def setup
DatabaseCleaner.start
if File.directory?(".projects/_test")
FileUtils.rm_rf(".projects/_test")
end
deployer = mock('class')
deployer.stubs(:new).returns(deployer)
deplo... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_deployer_test.rb | test/deep_thought_deployer_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtDeployerTest < MiniTest::Unit::TestCase
def setup
DatabaseCleaner.start
DeepThought::Deployer.adapters = {}
@deployer = mock('class')
@deployer.stubs(:new).returns(@deployer)
@deployer.stubs(:setup?).returns(true)
DeepT... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_janky_test.rb | test/deep_thought_janky_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtJankyTest < MiniTest::Unit::TestCase
def setup
DatabaseCleaner.start
@janky = DeepThought::CIService::Janky.new
end
def teardown
DatabaseCleaner.clean
end
def test_janky_setup_success
@janky.setup?({"CI_SERVICE_ENDPOIN... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/test/deep_thought_project_test.rb | test/deep_thought_project_test.rb | require File.expand_path '../test_helper.rb', __FILE__
class DeepThoughtProjectTest < MiniTest::Unit::TestCase
def setup
DatabaseCleaner.start
if File.directory?(".projects/_test")
FileUtils.rm_rf(".projects/_test")
end
deployer = mock('class')
deployer.stubs(:new).returns(deployer)
d... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought.rb | lib/deep_thought.rb | require 'active_record'
require 'delayed_job_active_record'
require 'deep_thought/app'
require 'deep_thought/api'
require 'deep_thought/models/deploy'
require 'deep_thought/models/project'
require 'deep_thought/models/state'
require 'deep_thought/models/user'
require 'deep_thought/deployer'
require 'deep_thought/deplo... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/version.rb | lib/deep_thought/version.rb | module DeepThought
VERSION = "0.2.1"
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/ci_service.rb | lib/deep_thought/ci_service.rb | module DeepThought
module CIService
class CIServiceNotFoundError < StandardError; end
class CIServiceSetupFailedError < StandardError; end
class CIBuildNotGreenError < StandardError; end
class CIProjectAccessError < StandardError; end
class << self
attr_accessor :adapters, :ci_service
e... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/api.rb | lib/deep_thought/api.rb | require 'sinatra'
require 'sinatra/json'
require 'rack/ssl'
require 'deep_thought/git'
require 'deep_thought/deployer'
module DeepThought
class Api < Sinatra::Base
helpers Sinatra::JSON
if ENV['RACK_ENV'] != 'development' && ENV['RACK_ENV'] != 'test'
use Rack::SSL
end
before '*' do
if !... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/app.rb | lib/deep_thought/app.rb | require 'sinatra'
require 'sinatra/json'
require 'rack/ssl'
require 'rack/csrf'
require 'haml'
module DeepThought
class App < Sinatra::Base
helpers Sinatra::JSON
set :root, File.dirname(__FILE__)
set :public_folder, File.join(root, 'public')
set :views, File.join(root, 'views')
set :haml, :layou... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/notifier.rb | lib/deep_thought/notifier.rb | require 'httparty'
module DeepThought
module Notifier
def self.notify(user, message)
begin
HTTParty.post("#{user.notification_url}", :body => {:message => message}.to_json, :headers => {'Content-Type' => 'application/json'})
rescue
'poop'
end
end
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/deployer.rb | lib/deep_thought/deployer.rb | require 'yaml'
require 'deep_thought/git'
module DeepThought
module Deployer
class DeployerNotFoundError < StandardError; end
class DeployerSetupFailedError < StandardError; end
class DeploymentFailedError < StandardError; end
class DeploymentInProgressError < StandardError; end
class << self
... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/tasks.rb | lib/deep_thought/tasks.rb | require "rake"
require "rake/tasklib"
require "active_record"
module DeepThought
module Tasks
extend Rake::DSL
desc "Create a user"
task :create_user, [:email, :password] do |t, args|
user = DeepThought::User.create(:email => "#{args[:email]}", :password => "#{args[:password]}", :password_confirma... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/git.rb | lib/deep_thought/git.rb | require 'rugged'
module DeepThought
module Git
class GitRepositoryNotFoundError < StandardError; end
class GitBranchNotFoundError < StandardError; end
def self.setup(project)
if !File.directory?(".projects/#{project.name}/.git")
exit_status = system "git clone #{project.repo_url} .projects... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/scaler.rb | lib/deep_thought/scaler.rb | require 'httparty'
module DeepThought
module Scaler
def self.scale
if (ENV['RACK_ENV'] != 'development' && ENV['RACK_ENV'] != 'test') && (ENV['HEROKU_APP'] && ENV['HEROKU_APP'] != '') && (ENV['HEROKU_API_KEY'] && ENV['HEROKU_API_KEY'] != '')
if Delayed::Job.count > 0
scale_up
else... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/models/project.rb | lib/deep_thought/models/project.rb | require 'fileutils'
module DeepThought
class ProjectConfigNotFoundError < StandardError; end
class Project < ActiveRecord::Base
has_many :deploys
before_destroy :delete_repo
validates :name, presence: true, uniqueness: true
validates :repo_url, presence: true
def setup
if DeepThought:... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/models/state.rb | lib/deep_thought/models/state.rb | module DeepThought
class State < ActiveRecord::Base
validates :name, presence: true, uniqueness: true
validates :state, presence: true
end
end
| ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/models/deploy.rb | lib/deep_thought/models/deploy.rb | module DeepThought
class Deploy < ActiveRecord::Base
belongs_to :project
belongs_to :user
after_create :queue
validates_presence_of :branch
validates_presence_of :commit
validates_presence_of :project
validates_presence_of :user
def queue
Delayed::Job.enqueue self
DeepT... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/models/user.rb | lib/deep_thought/models/user.rb | require 'bcrypt'
require 'securerandom'
require 'base64'
module DeepThought
class User < ActiveRecord::Base
has_many :deploys
attr_accessor :password, :password_confirmation
before_save :generate_password_digest
validates_presence_of :email
validates_uniqueness_of :email
validates_format_o... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/deployer/shell.rb | lib/deep_thought/deployer/shell.rb | require 'deep_thought/deployer/deployer'
module DeepThought
module Deployer
class Shell < DeepThought::Deployer::Deployer
def execute?(deploy, config)
environment = deploy.environment || "development"
root = config['root'] || "script/deploy"
command = "#{root} #{environment} deplo... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/deployer/deployer.rb | lib/deep_thought/deployer/deployer.rb | module DeepThought
module Deployer
class Deployer
def initialize
if self.class.name == 'DeepThought::Deployer::Deployer'
raise "#{self.class.name} is abstract, you cannot instantiate it directly."
end
end
def setup?(project, config)
true
end
def ex... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/ci_service/janky.rb | lib/deep_thought/ci_service/janky.rb | require 'httparty'
require 'deep_thought/ci_service/ci_service'
module DeepThought
module CIService
class Janky < DeepThought::CIService::CIService
def is_branch_green?(app, branch, hash)
is_green = false
response = HTTParty.get("#{@endpoint}/_hubot/#{app}/#{branch}", {:basic_auth => {:use... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
redhotvengeance/deep_thought | https://github.com/redhotvengeance/deep_thought/blob/c2ded3cbbdae2303a92ccaeb92939c1d58944095/lib/deep_thought/ci_service/ci_service.rb | lib/deep_thought/ci_service/ci_service.rb | module DeepThought
module CIService
class CIService
attr_accessor :endpoint, :username, :password
def initialize
if self.class.name == 'DeepThought::CIService::CIService'
raise "#{self.class.name} is abstract, you cannot instantiate it directly."
end
end
def set... | ruby | MIT | c2ded3cbbdae2303a92ccaeb92939c1d58944095 | 2026-01-04T17:40:31.502717Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/view_spec.rb | spec/view_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Noticent::View do
it "should require a valid file" do
expect { Noticent::View.new("bad_file", channel: binding) }.to raise_error Noticent::ViewNotFound
end
it "should render views with layout" do
@payload = build(:post_payload)
ch = Notic... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/dispatcher_spec.rb | spec/dispatcher_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Noticent::Dispatcher do
it "should find scope by alert" do
p1 = build(:post_payload)
Noticent.configure do
scope :post do
alert(:foo) { notify :users }
end
end
dispatcher = Noticent::Dispatcher.new(
Noticent.conf... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/active_record_opt_in_provider_spec.rb | spec/active_record_opt_in_provider_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Noticent::ActiveRecordOptInProvider do
it "opt in" do
Noticent::OptIn.delete_all
provider = Noticent::ActiveRecordOptInProvider.new
provider.opt_in(recipient_id: 1, scope: :test, alert_name: :foo, entity_id: 10, channel_name: :email)
exp... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/factories.rb | spec/factories.rb | # frozen_string_literal: true
FactoryBot.define do
sequence :email do |n|
"person#{n}@example.com"
end
sequence(:id) do |n|
n
end
factory :recipient, class: Noticent::Testing::Recipient do
email { generate(:email) }
end
factory :post_payload, class: Noticent::Testing::PostPayload do
po... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/proc_map_spec.rb | spec/proc_map_spec.rb | require 'spec_helper'
describe Noticent::ProcMap do
it 'map works' do
map = Noticent::ProcMap.new(Noticent::Config.new)
map.use(:test, ->(payload) {return "here #{payload}"})
expect(map.fetch(:test).call(:foo)).to eq('here foo')
expect { map.use(:bar, -> { return 'there' }) }.to raise_error(Noticent... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/config_spec.rb | spec/config_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Noticent::Config do
it 'is configured' do
Noticent.configure {}
expect(Noticent.configuration.opt_in_provider).not_to be_nil
end
it 'should be configurable' do
ENV['NOTICENT_RSPEC'] = '0'
Noticent.configure do |config|
config.ba... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/schema.rb | spec/schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
self.verbose = false
create_table :opt_ins, force: true do |t|
t.integer :recipient_id
t.integer :entity_id
t.string :scope
t.string :alert_name
t.string :channel_name
t.timestamps
end
add_index :opt_ins, %i[recipient_id en... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/channel_spec.rb | spec/channel_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Noticent::Channel do
it "should have protected properties" do
Noticent.configure
ch = Noticent::Channel.new(Noticent.configuration, [], { foo: :bar }, {})
expect(ch).not_to be_nil
expect(ch.send(:recipients)).not_to be_nil
expect(ch.s... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require "bundler"
Bundler.require :default, :development
#Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
Combustion.initialize! :all
require_relative "../lib/noticent"
Dir["#{File.dirname(__FILE__)}/../testing/**/*.rb"].each { |f| require f }
ActiveR... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/install_generator_spec.rb | spec/install_generator_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "generator_spec"
require "generator_spec/test_case"
module Noticent
module Generators
describe InstallGenerator, type: :generator do
include GeneratorSpec::TestCase
root_dir = File.expand_path("../../../../../tmp", __dir__)
destinati... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/definitions/hooks_spec.rb | spec/definitions/hooks_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Noticent::Definitions::Hooks do
it 'should validate fetch' do
h = Noticent::Definitions::Hooks.new
expect { h.fetch(:bad) }.to raise_error(::ArgumentError)
expect { h.fetch(:pre_channel_registration) }.not_to raise_error
end
it 'should r... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/definitions/scope_spec.rb | spec/definitions/scope_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Noticent::Definitions::Scope do
it 'should construct a scope' do
Noticent.configure {}
expect { Noticent::Definitions::Scope.new(Noticent.configuration, :post) }.not_to raise_error
end
it 'should validate the scope class' do
expect do
... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/definitions/alert_spec.rb | spec/definitions/alert_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Noticent::Definitions::Alert do
it "should validate fetch" do
h = Noticent::Definitions::Hooks.new
expect { h.fetch(:bad) }.to raise_error(::ArgumentError)
expect { h.fetch(:pre_channel_registration) }.not_to raise_error
end
it "should ru... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/definitions/product_group_spec.rb | spec/definitions/product_group_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Noticent::Definitions::ProductGroup do
it 'can be created' do
Noticent.configure
pg = Noticent::Definitions::ProductGroup.new(Noticent.configuration)
expect(pg).not_to be_nil
end
it 'should build up' do
Noticent.configure do
p... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/definitions/product_spec.rb | spec/definitions/product_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Noticent::Definitions::Product do
it 'can be created' do
Noticent.configure
product = Noticent::Definitions::Product.new(Noticent.configuration, :foo)
expect(product).not_to be_nil
end
it 'should only accept symbol names' do
Noticent... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/definitions/channel_spec.rb | spec/definitions/channel_spec.rb | # frozen_string_literal: true
require "spec_helper"
describe Noticent::Definitions::Channel do
it "can be configured" do
Noticent.configure { }
ch = Noticent::Definitions::Channel.new(Noticent.configuration, :foo, group: :test, klass: Integer)
expect(ch.klass).to eq(Integer)
expect(ch.name).to eq(:... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/internal/db/schema.rb | spec/internal/db/schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
# Set up any tables you need to exist for your test suite that don't belong
# in migrations.
end
| ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/spec/internal/config/routes.rb | spec/internal/config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
get :hello, controller: :dummy, action: :dummy
end
| ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/models/receipient.rb | testing/models/receipient.rb | # frozen_string_literal: true
require 'active_record'
module Noticent
module Testing
class Recipient < ActiveRecord::Base
end
end
end
| ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/payloads/post_payload.rb | testing/payloads/post_payload.rb | require_relative 'payload'
module Noticent
module Testing
# this is an example payload for post as scope
class PostPayload < Noticent::Testing::Payload
attr_accessor :some_attribute
attr_accessor :_users
attr_accessor :post_id
def users
@_users
end
def owners
... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/payloads/comment_payload.rb | testing/payloads/comment_payload.rb | module Noticent
module Testing
# this is a example payload for comment as scope
class CommentPayload < Noticent::Testing::Payload
attr_accessor :comment_id
attr_reader :users
def self.three
# nop
end
def self.new_signup
# nop
end
end
end
end | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/payloads/payload.rb | testing/payloads/payload.rb | # frozen_string_literal: true
module Noticent
module Testing
class Payload
attr_accessor :current_user
end
end
end
| ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/channels/boo.rb | testing/channels/boo.rb | module Noticent
module Testing
class Boo < ::Noticent::Channel
def foo
render
end
def boo
render
end
end
end
end | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/channels/exclusive.rb | testing/channels/exclusive.rb | module Noticent
module Testing
class Exclusive < ::Noticent::Channel
def only_here
render
end
end
end
end
| ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/channels/foo.rb | testing/channels/foo.rb | module Noticent
module Testing
class Foo < ::Noticent::Channel
attr_accessor :buzz
def boo
render
end
end
end
end | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/channels/email.rb | testing/channels/email.rb | module Noticent
module Testing
class Email < ::Noticent::Channel
def new_signup
# NOTE: This is only for testing
{ recipients: recipients, payload: payload }
end
def some_event
@some_value = 1
render
end
def foo
render
end
end
e... | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/channels/slack.rb | testing/channels/slack.rb | module Noticent
module Testing
class Slack < ::Noticent::Channel
def foo
render
end
end
end
end | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/channels/simple.rb | testing/channels/simple.rb | module Noticent
module Testing
class Simple < ::Noticent::Channel
def some_event
render
end
end
end
end
| ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
cloud66-oss/noticent | https://github.com/cloud66-oss/noticent/blob/5e65d0e1c26e84863314944d3426ea486cb754cf/testing/channels/webhook.rb | testing/channels/webhook.rb | module Noticent
module Testing
class Webhook < ::Noticent::Channel
def foo
render
end
end
end
end | ruby | Apache-2.0 | 5e65d0e1c26e84863314944d3426ea486cb754cf | 2026-01-04T17:40:31.692194Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.