source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/language_test.rb
Ruby
mit
46
main
347
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class LanguageTest < Minitest::Test def setup @clause = Language end def test_clause assert_equal %w(LANGUAGE en), @clause.new(language: "en").clause end ...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/slop_test.rb
Ruby
mit
46
main
469
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class SlopTest < Minitest::Test def setup @clause = Slop end def test_clause assert_equal ["SLOP", 1], @clause.new(slop: 1).clause end def test_in...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/in_order_test.rb
Ruby
mit
46
main
325
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class InOrderTest < Minitest::Test def setup @clause = InOrder end def test_clause assert_equal ["INORDER"], @clause.new.clause end end end end...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/no_content_test.rb
Ruby
mit
46
main
331
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class NoContentTest < Minitest::Test def setup @clause = NoContent end def test_clause assert_equal ["NOCONTENT"], @clause.new.clause end end end...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/no_stop_words_test.rb
Ruby
mit
46
main
337
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class NoStopWordsTest < Minitest::Test def setup @clause = NoStopWords end def test_clause assert_equal ["NOSTOPWORDS"], @clause.new.clause end end ...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/sort_by_test.rb
Ruby
mit
46
main
889
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class SortByTest < Minitest::Test def setup @clause = SortBy end def test_clause assert_equal( ["SORTBY", :field, :asc], @clause.new(field:...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/limit_test.rb
Ruby
mit
46
main
977
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class LimitTest < Minitest::Test def setup @clause = Limit end def test_clause assert_equal ["LIMIT", 0, 1], @clause.new(total: 1).clause end def ...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/return_test.rb
Ruby
mit
46
main
527
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class ReturnTest < Minitest::Test def setup @clause = Return end def test_clause assert_equal( ["RETURN", 2, :foo, :bar], @clause.new(fields: %i(foo ba...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/highlight_test.rb
Ruby
mit
46
main
1,371
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class HighlightTest < Minitest::Test def setup @clause = Highlight end def test_returns_highlight_keyword assert_equal ["HIGHLIGHT", "TAGS", "<b>", "</b>"], @claus...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/with_scores_test.rb
Ruby
mit
46
main
334
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class WithScoresTest < Minitest::Test def setup @clause = WithScores end def test_clause assert_equal ["WITHSCORES"], @clause.new.clause end end ...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/search/clauses/verbatim_test.rb
Ruby
mit
46
main
328
# frozen_string_literal: true require "test_helper" module RediSearch class Search module Clauses class VerbatimTest < Minitest::Test def setup @clause = Verbatim end def test_clause assert_equal ["VERBATIM"], @clause.new.clause end end end ...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/document/finder_test.rb
Ruby
mit
46
main
1,708
# frozen_string_literal: true require "test_helper" module RediSearch class Document class FinderTest < Minitest::Test def setup @index = Index.new(:users) do text_field :first text_field :last end end def test_get_with_id finder = Document::Finder....
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/schema/numeric_field_test.rb
Ruby
mit
46
main
859
# frozen_string_literal: true require "test_helper" module RediSearch class Schema class NumericFieldTest < Minitest::Test def test_default_options assert_equal( %w(temp_field NUMERIC), NumericField.new("temp_field").to_a ) end def test_sortable_option ...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/schema/geo_field_test.rb
Ruby
mit
46
main
792
# frozen_string_literal: true require "test_helper" module RediSearch class Schema class GeoFieldTest < Minitest::Test def test_default_options assert_equal %w(temp_field GEO), GeoField.new("temp_field").to_a end def test_sortable_option assert_equal( %w(temp_field G...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/schema/tag_field_test.rb
Ruby
mit
46
main
1,072
# frozen_string_literal: true require "test_helper" module RediSearch class Schema class TagFieldTest < Minitest::Test def test_default_options schema = TagField.new("temp_field") assert_equal %w(temp_field TAG SEPARATOR ,), schema.to_a end def test_sortable_option sc...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/schema/text_field_test.rb
Ruby
mit
46
main
1,737
# frozen_string_literal: true require "test_helper" module RediSearch class Schema class TextFieldTest < Minitest::Test def test_default_options assert_equal( ["temp_field", "TEXT", "WEIGHT", 1.0], TextField.new("temp_field").to_a ) end def test_sortable_op...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/validations/numericality_test.rb
Ruby
mit
46
main
1,967
# frozen_string_literal: true require "test_helper" module RediSearch module Validations class NumericalityTest < Minitest::Test def test_validate_success validator = Validations::Numericality.new(field: :field, within: 0..1) mock = Minitest::Mock.new mock.expect(:field, 0.5) ...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/validations/presence_test.rb
Ruby
mit
46
main
1,163
# frozen_string_literal: true require "test_helper" module RediSearch module Validations class PresenceTest < Minitest::Test def test_validate_success validator = Validations::Presence.new(field: :field) mock = Minitest::Mock.new.expect(:field, true) assert validator.validate!(moc...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/validations/inclusion_test.rb
Ruby
mit
46
main
1,252
# frozen_string_literal: true require "test_helper" module RediSearch module Validations class InclusionTest < Minitest::Test def test_validate_success validator = Validations::Inclusion.new(field: :field, within: [1]) mock = Minitest::Mock.new.expect(:field, 1) assert validator.v...
github
npezza93/redi_search
https://github.com/npezza93/redi_search
test/unit/redi_search/client/response_test.rb
Ruby
mit
46
main
722
# frozen_string_literal: true require "test_helper" module RediSearch class Client class ResponseTest < Minitest::Test def test_ok_with_string assert_predicate Response.new("OK"), :ok? end def test_not_ok_when_string_not_ok refute_predicate Response.new("NOTOK"), :ok? en...
github
percy/percy-capybara
https://github.com/percy/percy-capybara
percy-capybara.gemspec
Ruby
mit
46
master
1,299
require_relative './lib/percy/version' Gem::Specification.new do |spec| spec.name = 'percy-capybara' spec.version = PercyCapybara::VERSION spec.authors = ['Perceptual Inc.'] spec.email = ['team@percy.io'] spec.summary = %q{Percy visual testing for Capybara} spec.descripti...
github
percy/percy-capybara
https://github.com/percy/percy-capybara
Gemfile
Ruby
mit
46
master
322
source 'https://rubygems.org' # Specify your gem's dependencies in percy-capybara.gemspec gemspec gem 'guard-rspec', require: false # (for development) # gem 'percy-client', path: '~/src/percy-client' group :test, :development do gem 'pry' gem 'puma', '5.6.6' gem 'webmock' gem 'simplecov', require: false en...
github
percy/percy-capybara
https://github.com/percy/percy-capybara
Guardfile
Ruby
mit
46
master
343
guard :rspec, cmd: 'bundle exec rspec' do require 'guard/rspec/dsl' dsl = Guard::RSpec::Dsl.new(self) # RSpec files rspec = dsl.rspec watch(rspec.spec_helper) { rspec.spec_dir } watch(rspec.spec_support) { rspec.spec_dir } watch(rspec.spec_files) # Ruby files ruby = dsl.ruby dsl.watch_spec_files_f...
github
percy/percy-capybara
https://github.com/percy/percy-capybara
spec/spec_helper.rb
Ruby
mit
46
master
1,837
# This must be required & started before any app code (for proper coverage) require 'simplecov' SimpleCov.start SimpleCov.minimum_coverage 100 require 'capybara/rspec' require 'webmock/rspec' require 'percy/capybara' require 'selenium-webdriver' RSpec.configure do |config| config.expect_with :rspec do |expectations...
github
percy/percy-capybara
https://github.com/percy/percy-capybara
spec/lib/percy/percy_capybara_spec.rb
Ruby
mit
46
master
5,166
LABEL = PercyCapybara::PERCY_LABEL # rubocop:disable RSpec/MultipleDescribes RSpec.describe PercyCapybara, type: :feature do before(:each) do WebMock.disable_net_connect!(allow: '127.0.0.1', disallow: 'localhost') page.__percy_clear_cache! end describe 'snapshot', type: :feature do it 'disables when...
github
percy/percy-capybara
https://github.com/percy/percy-capybara
lib/percy/capybara.rb
Ruby
mit
46
master
3,245
require 'net/http' require 'uri' require 'capybara/dsl' require_relative './version' module PercyCapybara CLIENT_INFO = "percy-capybara/#{VERSION}".freeze ENV_INFO = "capybara/#{Capybara::VERSION} ruby/#{RUBY_VERSION}".freeze PERCY_DEBUG = ENV['PERCY_LOGLEVEL'] == 'debug' PERCY_SERVER_ADDRESS = ENV['PERCY_SER...
github
monorkin/twice
https://github.com/monorkin/twice
auth/Gemfile
Ruby
mit
46
main
2,518
source "https://rubygems.org" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 8.0.2" # The modern asset pipeline for Rails [https://github.com/rails/propshaft] gem "propshaft" # Use sqlite3 as the database for Active Record gem "sqlite3", ">= 2.1" # Use the Puma web ser...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/controllers/application_controller.rb
Ruby
mit
46
main
229
class ApplicationController < ActionController::Base include Authentication # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. allow_browser versions: :modern end
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/controllers/products_controller.rb
Ruby
mit
46
main
1,146
# frozen_string_literal: true class ProductsController < ApplicationController before_action :set_product, only: %i[show edit update destroy] def index products = Product.all products = products.search(params[:search][:query]) if params.dig(:search, :query).present? set_page_and_extract_portion_from p...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/controllers/sessions_controller.rb
Ruby
mit
46
main
624
class SessionsController < ApplicationController allow_unauthenticated_access only: %i[ new create ] rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." } def new end def create user = User.authenticate_by(params.permit(:email_address, :...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/controllers/developers_controller.rb
Ruby
mit
46
main
1,234
# frozen_string_literal: true class DevelopersController < ApplicationController before_action :set_developer, only: %i[show edit update destroy] def index developers = Developer.all developers = developers.search(params[:search][:query]) if params.dig(:search, :query).present? set_page_and_extract_po...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/controllers/licenses_controller.rb
Ruby
mit
46
main
1,127
# frozen_string_literal: true class LicensesController < ApplicationController before_action :set_customer before_action :set_license, only: %i[destroy] def index licenses = @customer.licenses licenses = licenses.search(params[:search][:query]) if params.dig(:search, :query).present? set_page_and_ex...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/controllers/customers_controller.rb
Ruby
mit
46
main
1,175
# frozen_string_literal: true class CustomersController < ApplicationController before_action :set_customer, only: %i[show edit update destroy] def index customers = Customer.all customers = customers.search(params[:search][:query]) if params.dig(:search, :query).present? set_page_and_extract_portion_...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/controllers/registry_controller.rb
Ruby
mit
46
main
1,118
# frozen_string_literal: true class RegistryController < ApplicationController allow_unauthenticated_access # GET|POST /registry/auth def auth authenticate_or_request_with_http_basic do |email, license_key| user = User.find_by(email_address: email) deny_access and return if user.blank? li...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/controllers/install_controller.rb
Ruby
mit
46
main
1,073
# frozen_string_literal: true class InstallController < ApplicationController allow_unauthenticated_access before_action :set_license rate_limit to: 5, within: 1.minute, if: -> { @license.blank? } rate_limit to: 30, within: 1.minute, if: -> { @license.present? } def install respond_to do |format| ...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/customer.rb
Ruby
mit
46
main
314
# frozen_string_literal: true class Customer < User include Search before_validation :generate_password, on: :create def purchase(product) self.licenses.create!(product: product) end def generate_password if password_digest.blank? self.password = SecureRandom.hex(32) end end end
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/license.rb
Ruby
mit
46
main
224
# frozen_string_literal: true class License < ApplicationRecord include KeyGenerator include Search belongs_to :owner, class_name: "User" belongs_to :product validates :key, presence: true, uniqueness: true end
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/product.rb
Ruby
mit
46
main
296
# frozen_string_literal: true class Product < ApplicationRecord include RepositoryValidations include Search has_many :licenses, dependent: :destroy normalizes :repository, with: -> { it.strip.downcase } validates :name, presence: true validates :repository, uniqueness: true end
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/user.rb
Ruby
mit
46
main
437
# frozen_string_literal: true class User < ApplicationRecord include DockerRegistryAuth has_secure_password has_many :sessions, dependent: :destroy has_many :licenses, dependent: :destroy, foreign_key: :owner_id has_many :products, through: :licenses normalizes :email_address, with: ->(e) { e.strip.downc...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/license/key_generator.rb
Ruby
mit
46
main
356
# frozen_string_literal: true module License::KeyGenerator KEY_LENGTH = 16 extend ActiveSupport::Concern included do before_validation :generate_key end def generate_key(length: KEY_LENGTH) loop do self.key = SecureRandom.base36(length).scan(/.{1,4}/).join("-") break unless self.class....
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/license/search.rb
Ruby
mit
46
main
317
# frozen_string_literal: true module License::Search extend ActiveSupport::Concern class_methods do def search(query) return all if query.blank? query = query.strip.downcase left_joins(:product).where("key LIKE :query OR products.name LIKE :query", query: "%#{query}%") end end end
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/docker_registry/access_request.rb
Ruby
mit
46
main
651
# frozen_string_literal: true class DockerRegistry::AccessRequest < Data.define(:type, :name, :actions) def self.full_access_to_registry [ new("repository", "*", ["pull", "push"]), new("registry", "*", ["pull", "push"]), ] end def self.pull_access_to_repository(repository) new("repositor...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/docker_registry/token.rb
Ruby
mit
46
main
1,763
# frozen_string_literal: true class DockerRegistry::Token ISSUER = ENV.fetch("TOKEN_ISSUER", "registry-auth") PRIVATE_KEY_PATH = Rails.root.join("storage", "docker_registry.key").freeze PUBLIC_KEY_PATH = Rails.root.join("storage", "docker_registry.crt").freeze PRIVATE_KEY = begin OpenSSL::PKey::RSA.new(PRI...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/user/docker_registry_auth.rb
Ruby
mit
46
main
1,413
# frozen_string_literal: true module User::DockerRegistryAuth class Error < StandardError; end class UnpermittedScope < Error; end extend ActiveSupport::Concern DEFAULT_TOKEN_DURATION = 5.minutes def generate_full_access_registry_token(duration: DEFAULT_TOKEN_DURATION, service: nil) access_requests = ...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/customer/search.rb
Ruby
mit
46
main
337
# frozen_string_literal: true module Customer::Search extend ActiveSupport::Concern class_methods do def search(query) return all if query.blank? query = query.strip.downcase left_joins(:licenses).distinct.where("email_address LIKE :query OR licenses.key LIKE :query", query: "%#{query}%") ...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/product/search.rb
Ruby
mit
46
main
294
# frozen_string_literal: true module Product::Search extend ActiveSupport::Concern class_methods do def search(query) return all if query.blank? query = query.strip.downcase where("name LIKE :query OR repository LIKE :query", query: "%#{query}%") end end end
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/product/repository_validations.rb
Ruby
mit
46
main
1,770
# frozen_string_literal: true module Product::RepositoryValidations extend ActiveSupport::Concern REPOSITORY_NAME_FORMAT = /\A[a-z0-9._-]+\Z/ included do validate :validate_repository_format end def validate_repository_format repository = self.repository if repository.blank? errors.add(...
github
monorkin/twice
https://github.com/monorkin/twice
auth/app/models/developer/search.rb
Ruby
mit
46
main
279
# frozen_string_literal: true module Developer::Search extend ActiveSupport::Concern class_methods do def search(query) return all if query.blank? query = query.strip.downcase where("email_address LIKE :query", query: "%#{query}%") end end end
github
monorkin/twice
https://github.com/monorkin/twice
auth/db/schema.rb
Ruby
mit
46
main
2,278
# 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. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
monorkin/twice
https://github.com/monorkin/twice
auth/db/migrate/20250511092359_create_products.rb
Ruby
mit
46
main
472
class CreateProducts < ActiveRecord::Migration[8.0] def change create_table :products do |t| t.string :name, null: false t.string :repository, index: { unique: true }, null: false t.timestamps end create_table :licenses do |t| t.string :key, index: { unique: true }, null: false ...
github
monorkin/twice
https://github.com/monorkin/twice
auth/db/migrate/20250511092350_create_users.rb
Ruby
mit
46
main
291
class CreateUsers < ActiveRecord::Migration[8.0] def change create_table :users do |t| t.string :email_address, null: false, index: { unique: true } t.string :password_digest, null: false t.string :type, null: false, index: true t.timestamps end end end
github
monorkin/twice
https://github.com/monorkin/twice
auth/config/application.rb
Ruby
mit
46
main
989
require_relative "boot" require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Twice class Application < Rails::Application # Initialize configuration defaults for originally generated Rails ver...
github
monorkin/twice
https://github.com/monorkin/twice
auth/config/routes.rb
Ruby
mit
46
main
687
Rails.application.routes.draw do root to: redirect("/customers") resources :products resources :developers resources :customers do resources :licenses, except: %i[ show edit update ] end match "/registry/auth", to: "registry#auth", as: :registry_auth, via: %i[ get post ] get "/install/:license_key"...
github
yuki24/pushing
https://github.com/yuki24/pushing
pushing.gemspec
Ruby
mit
46
master
1,166
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'pushing/version' Gem::Specification.new do |spec| spec.name = "pushing" spec.version = Pushing::VERSION spec.authors = ["Yuki Nishijima"] spec.email = ["yk.ni...
github
yuki24/pushing
https://github.com/yuki24/pushing
Appraisals
Ruby
mit
46
master
823
appraise "rails_edge" do git 'git://github.com/rails/rails.git' do gem "railties" gem "actionpack" gem "actionview" gem "activejob" end end appraise "rails_52" do gem "railties", '~> 5.2.0.rc1' gem "actionpack", '~> 5.2.0.rc1' gem "actionview", '~> 5.2.0.rc1' gem "activejob", '~> 5.2.0.rc1'...
github
yuki24/pushing
https://github.com/yuki24/pushing
Gemfile
Ruby
mit
46
master
322
source 'https://rubygems.org' # Specify your gem's dependencies in pushing.gemspec gemspec # APNs gem 'houston', require: false gem 'apnotic', '>= 1.2.0', require: false gem 'lowdown', require: false # FCM gem 'andpush', require: false gem 'fcm', require: false # Debugging gem 'pry' gem 'pry-byebug', platforms: :mr...
github
yuki24/pushing
https://github.com/yuki24/pushing
Rakefile
Ruby
mit
46
master
551
require "bundler/gem_tasks" require "rake/testtask" Rake::TestTask.new(:test) do |t| t.libs << "test" t.libs << "lib" t.test_files = FileList['test/**/*_test.rb'] - FileList['test/integration/**/*'] - ["test/railtie_test.rb"] end Rake::TestTask.new('test:integration') do |t| t.libs << "test" t.libs << "lib"...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing.rb
Ruby
mit
46
master
492
require "active_support/dependencies/autoload" require "pushing/version" module Pushing extend ::ActiveSupport::Autoload autoload :Adapters autoload :Base autoload :DeliveryJob autoload :NotificationDelivery autoload :Platforms def self.configure(&block) Base.configure(&block) Base.config.each ...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/generators/pushing/notifier_generator.rb
Ruby
mit
46
master
1,624
module Pushing class NotifierGenerator < Rails::Generators::NamedBase source_root File.expand_path("../templates", __FILE__) argument :actions, type: :array, default: [], banner: "method method" check_class_collision suffix: "Notifier" def create_notifier_file template "notifier.rb", File.joi...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/generators/pushing/templates/initializer.rb
Ruby
mit
46
master
2,470
Pushing.configure do |config| # Adapter that is used to send push notifications through FCM config.fcm.adapter = Rails.env.test? ? :test : :andpush # Your FCM servery key that can be found here: https://console.firebase.google.com/project/_/settings/cloudmessaging config.fcm.server_key = 'YOUR_FCM_SERVER_KEY' ...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/generators/pushing/templates/notifier.rb
Ruby
mit
46
master
229
<% module_namespacing do -%> class <%= class_name %>Notifier < ApplicationNotifier <% actions.each do |action| -%> def <%= action %> @greeting = "Hi" push apn: "device-token", fcm: true end <% end -%> end <% end -%>
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/template_handlers.rb
Ruby
mit
46
master
355
# frozen-string-literal: true module Pushing module TemplateHandlers extend ActiveSupport::Autoload autoload :JbuilderHandler def self.lookup(template) const_get("#{template.to_s.camelize}Handler") rescue NameError raise NotImplementedError.new("The template engine `#{template}' is not ...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/adapters.rb
Ruby
mit
46
master
1,476
# frozen-string-literal: true module Pushing module Adapters extend ActiveSupport::Autoload autoload :HoustonAdapter, 'pushing/adapters/apn/houston_adapter' autoload :ApnoticAdapter, 'pushing/adapters/apn/apnotic_adapter' autoload :LowdownAdapter, 'pushing/adapters/apn/lowdown_adapter' autoload ...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/delivery_job.rb
Ruby
mit
46
master
788
require 'active_job' module Pushing class DeliveryJob < ActiveJob::Base # :nodoc: queue_as { Pushing::Base.deliver_later_queue_name } if ActiveSupport::VERSION::MAJOR > 4 rescue_from StandardError, with: :handle_exception_with_notifier_class end def perform(notifier, mail_method, delivery_met...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/platforms.rb
Ruby
mit
46
master
3,687
# frozen-string-literal: true require 'active_support/core_ext/hash/keys' module Pushing module Platforms class << self def configure(&block) #:nodoc: ActiveSupport::Deprecation.warn "`Pushing::Platforms.configure' is deprecated and will be removed in 0.4.0. " \ ...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/notification_delivery.rb
Ruby
mit
46
master
2,758
require "delegate" module Pushing class NotificationDelivery < Delegator def initialize(notifier_class, action, *args) #:nodoc: @notifier_class, @action, @args = notifier_class, action, args # The notification is only processed if we try to call any methods on it. # Typical usage will leave it...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/railtie.rb
Ruby
mit
46
master
1,532
require "active_job/railtie" require "rails" require "abstract_controller/railties/routes_helpers" module Pushing class Railtie < Rails::Railtie # :nodoc: config.eager_load_namespaces << Pushing initializer "pushing.logger" do ActiveSupport.on_load(:pushing) { self.logger ||= Rails.logger } end ...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/log_subscriber.rb
Ruby
mit
46
master
1,291
require "active_support/log_subscriber" require "active_support/core_ext/string/indent" module Pushing # Implements the ActiveSupport::LogSubscriber for logging notifications when # a push notification is delivered. class LogSubscriber < ActiveSupport::LogSubscriber # A notification was delivered. def de...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/rescuable.rb
Ruby
mit
46
master
524
require 'active_support/rescuable' module Pushing #:nodoc: module Rescuable extend ActiveSupport::Concern include ActiveSupport::Rescuable class_methods do def handle_exception(exception) #:nodoc: rescue_with_handler(exception) || raise(exception) end end def handle_exceptio...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/base.rb
Ruby
mit
46
master
6,346
# frozen-string-literal: true require "abstract_controller" require 'active_support/core_ext/module/attribute_accessors' require 'active_support/core_ext/object/blank' require 'pushing/log_subscriber' require 'pushing/rescuable' require 'pushing/platforms' require 'pushing/template_handlers' module Pushing class B...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/template_handlers/jbuilder_handler.rb
Ruby
mit
46
master
404
# frozen-string-literal: true require 'jbuilder/jbuilder_template' module Pushing module TemplateHandlers class JbuilderHandler < ::JbuilderHandler def self.call(*) super.gsub("json.target!", "json.attributes!").gsub("new(self)", "new(self, key_formatter: ::Pushing::TemplateHandlers::JbuilderHandl...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/adapters/test_adapter.rb
Ruby
mit
46
master
801
require 'active_support/core_ext/module/attribute_accessors' module Pushing module Adapters class TestAdapter class Deliveries include Enumerable def initialize @deliveries = [] end delegate :each, :empty?, :clear, :<<, :length, :size, to: :@deliveries d...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/adapters/apn/apnotic_adapter.rb
Ruby
mit
46
master
3,180
# frozen-string-literal: true require 'apnotic' require 'active_support/core_ext/hash/keys' module Pushing module Adapters class ApnoticAdapter APS_DICTIONARY_KEYS = %i[ alert badge sound content_available category url_args mutable_content ].fr...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/adapters/apn/lowdown_adapter.rb
Ruby
mit
46
master
2,315
# frozen-string-literal: true require 'json' require 'delegate' module Pushing module Adapters class LowdownAdapter attr_reader :clients def initialize(apn_settings) # Don't load lowdown earlier as it may load Celluloid (and start it) # before daemonizing the workers spun up by a ge...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/adapters/apn/houston_adapter.rb
Ruby
mit
46
master
1,017
require 'houston' module Pushing module Adapters class HoustonAdapter attr_reader :certificate_path, :client def initialize(apn_settings) @certificate_path = apn_settings.certificate_path @client = { production: Houston::Client.production, development: Houston::C...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/adapters/fcm/andpush_adapter.rb
Ruby
mit
46
master
1,098
# frozen-string-literal: true require 'andpush' require 'active_support/core_ext/hash/transform_values' module Pushing module Adapters class AndpushAdapter attr_reader :server_key def initialize(fcm_settings) @server_key = fcm_settings.server_key end def push!(notification) ...
github
yuki24/pushing
https://github.com/yuki24/pushing
lib/pushing/adapters/fcm/fcm_gem_adapter.rb
Ruby
mit
46
master
1,624
# frozen-string-literal: true require 'json' require 'fcm' require 'active_support/core_ext/hash/slice' module Pushing module Adapters class FcmGemAdapter SUCCESS_CODES = (200..299).freeze attr_reader :server_key def initialize(fcm_settings) @server_key = fcm_settings.server_key ...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/url_helper_test.rb
Ruby
mit
46
master
2,856
# frozen_string_literal: true require 'test_helper' require "action_controller" class WelcomeController < ActionController::Base end AppRoutes = ActionDispatch::Routing::RouteSet.new Pushing::Base.include AppRoutes.url_helpers class UrlTestNotifier < Pushing::Base self.default_url_options[:host] = "example.org" ...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/test_helper.rb
Ruby
mit
46
master
1,550
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'active_support/core_ext/kernel/reporting' require 'pushing' # These are the normal settings that will be set up by Railties # TODO: Have these tests support other combinations of these values silence_warnings do Encoding.default_internal = "UTF-8" ...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/base_test.rb
Ruby
mit
46
master
7,756
require 'test_helper' require "set" require "action_dispatch" require "active_support/time" require 'notifiers/base_notifier' class BaseTest < ActiveSupport::TestCase setup do BaseNotifier.deliveries.clear end test "method call to notification does not raise error" do assert_nothing_raised { BaseNotifi...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/platforms_test.rb
Ruby
mit
46
master
2,285
require 'test_helper' class PlatformsTest < ActiveSupport::TestCase setup do @id = 1 @expiration = 1.hour.from_now @priority = 5 @topic = 'com.yuki.ios' @collapse_id = 'pushing-testing' end test "APN headers are normalized" do payload = Pushing::Platforms::ApnPayload.n...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/notification_delivery_test.rb
Ruby
mit
46
master
5,303
require 'test_helper' require 'active_job' require 'notifiers/base_notifier' require 'notifiers/delayed_notifier' class NotificationDeliveryTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do @previous_logger = ActiveJob::Base.logger @previous_deliver_later_queue_name = Pushing::Base.del...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/generator_test.rb
Ruby
mit
46
master
1,193
require "test_helper" require "rails/generators/test_case" require 'generators/pushing/notifier_generator' class NotifierGeneratorTest < Rails::Generators::TestCase tests Pushing::NotifierGenerator arguments %w(TweetNotifier new_mention_in_tweet) destination File.join(File.expand_path('../', File.dirname(__FILE...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/railtie_test.rb
Ruby
mit
46
master
1,162
require "isolated_test_helper" class RailtieTest < ActiveSupport::TestCase include ActiveSupport::Testing::Isolation include Generation setup do build_app FileUtils.rm_rf "#{app_path}/config/environments" end teardown do teardown_app end test "sets pushing load paths" do add_to_config ...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/log_subscriber_test.rb
Ruby
mit
46
master
2,009
require "test_helper" require "notifiers/base_notifier" require "active_support/core_ext/string/strip" require "active_support/log_subscriber/test_helper" class LogSubscriberTest < ActiveSupport::TestCase include ActiveSupport::LogSubscriber::TestHelper def setup super Pushing::LogSubscriber.attach_to :pu...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/isolated_test_helper.rb
Ruby
mit
46
master
3,620
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require "active_support" require 'active_support/core_ext/kernel/reporting' require 'active_support/deprecation' require 'active_support/testing/autorun' require 'minitest/pride' require 'pry' require 'pry-byebug' if RUBY_ENGINE == 'ruby' require "rails/railt...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/notifiers/notifier_with_rescue_handler.rb
Ruby
mit
46
master
459
class NotifierWithRescueHandler < Pushing::Base cattr_accessor :last_response_from_apn cattr_accessor :last_response_from_fcm rescue_from Pushing::ApnDeliveryError do |exception| self.class.last_response_from_apn = exception.response end rescue_from Pushing::FcmDeliveryError do |exception| self.clas...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/notifiers/maintainer_notifier.rb
Ruby
mit
46
master
569
class MaintainerNotifier < Pushing::Base def build_result(adapter, apn: false, fcm: false) @adapter = adapter @ruby_version = RUBY_DESCRIPTION @rails_version = Rails::VERSION::STRING push apn: (apn == true ? ENV.fetch('APN_TEST_DEVICE_TOKEN') : apn), fcm: fcm end def build_result_with_custom_apn...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/notifiers/base_notifier.rb
Ruby
mit
46
master
517
class BaseNotifier < Pushing::Base def welcome(hash = {}) push apn: 'device-token', fcm: true end def missing_apn_template push apn: 'device-token' end def missing_fcm_template push fcm: true end def with_apn_template push apn: 'device-token' end def with_no_apn_device_token pu...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/notifiers/delayed_notifier.rb
Ruby
mit
46
master
627
require "active_job/arguments" class DelayedNotifierError < StandardError; end class DelayedNotifier < Pushing::Base cattr_accessor :last_error cattr_accessor :last_rescue_from_instance if ActiveSupport::VERSION::MAJOR > 4 rescue_from DelayedNotifierError do |error| @@last_error = error @@last_...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/apn_http2_test_cases.rb
Ruby
mit
46
master
2,169
module ApnHttp2TestCases def setup super Pushing::Adapters.const_get(:ADAPTER_INSTANCES).clear end def test_actually_push_notification responses = MaintainerNotifier.build_result(adapter, apn: true).deliver_now! response = responses.first assert_equal 200, response.code assert_nil respo...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/fcm_test_cases.rb
Ruby
mit
46
master
2,293
module FcmTestCases def test_actually_push_notification responses = MaintainerNotifier.build_result(adapter, fcm: true).deliver_now! response = responses.first assert_equal 200, response.code assert_equal 1, response.json[:success] assert_equal "application/json; charset=UTF-8", response.heade...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/apn_tcp_test_cases.rb
Ruby
mit
46
master
897
module ApnTcpTestCases def setup super Pushing::Adapters.const_get(:ADAPTER_INSTANCES).clear end def test_actually_push_notification assert_nothing_raised do MaintainerNotifier.build_result(adapter, apn: true).deliver_now! end end def test_actually_push_notification_with_custom_config ...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/test_helper.rb
Ruby
mit
46
master
628
require 'test_helper' require 'webmock/minitest' require 'notifiers/maintainer_notifier' require 'notifiers/notifier_with_rescue_handler' WebMock.allow_net_connect! Pushing::Base.logger = Logger.new(STDOUT) Pushing.configure do |config| config.fcm.server_key = ENV.fetch('FCM_TEST_SERVER_KEY') config.apn.environ...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/adapters/lowdown_test.rb
Ruby
mit
46
master
432
require 'integration/test_helper' require 'integration/apn_http2_test_cases' class LowdownTest < ActiveSupport::TestCase include ApnHttp2TestCases setup do Pushing.config.apn.adapter = :lowdown Pushing.config.apn.connection_scheme = :certificate Pushing.config.apn.certificate_path = File.join(File.exp...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/adapters/fcm_adapter_test.rb
Ruby
mit
46
master
260
require 'integration/test_helper' require 'integration/fcm_test_cases' class FcmAdapterIntegrationTest < ActiveSupport::TestCase include FcmTestCases setup do Pushing.config.fcm.adapter = :fcm_gem end private def adapter 'fcm' end end
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/adapters/houston_test.rb
Ruby
mit
46
master
383
require 'integration/test_helper' require 'integration/apn_tcp_test_cases' class HoustonIntegrationTest < ActiveSupport::TestCase include ApnTcpTestCases setup do Pushing.config.apn.adapter = :houston Pushing.config.apn.certificate_path = File.join(File.expand_path("./"), ENV.fetch('APN_TEST_CERTIFICATE_P...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/adapters/apnotic_test.rb
Ruby
mit
46
master
954
require 'integration/test_helper' require 'integration/apn_http2_test_cases' class ApnoticIntegrationForCertificateConnectionTest < ActiveSupport::TestCase include ApnHttp2TestCases setup do Pushing.config.apn.adapter = :apnotic Pushing.config.apn.connection_scheme = :certificate Pushing.config.apn.ce...
github
yuki24/pushing
https://github.com/yuki24/pushing
test/integration/adapters/andpush_test.rb
Ruby
mit
46
master
261
require 'integration/test_helper' require 'integration/fcm_test_cases' class AndpushIntegrationTest < ActiveSupport::TestCase include FcmTestCases setup do Pushing.config.fcm.adapter = :andpush end private def adapter 'andpush' end end
github
chikamichi/amb
https://github.com/chikamichi/amb
amb.gemspec
Ruby
mit
46
master
565
require './lib/amb/version' Gem::Specification.new do |s| s.name = "amb" s.author = "Jean-Denis Vauguet <jd@vauguet.fr>" s.email = "jd@vauguet.fr" s.homepage = "http://www.github.com/chikamichi/amb" s.summary = "McCarty's ambiguous function/operator implementations" s.description = "This gem is a compilati...