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 | pocke/graphql-coverage | https://github.com/pocke/graphql-coverage | graphql-coverage.gemspec | Ruby | mit | 19 | master | 1,298 | # frozen_string_literal: true
require_relative "lib/graphql/coverage/version"
Gem::Specification.new do |spec|
spec.name = "graphql-coverage"
spec.version = GraphQL::Coverage::VERSION
spec.authors = ["Masataka Pocke Kuwabara"]
spec.email = ["kuwabara@pocke.me"]
spec.summary = "Coverage for GraphQL"
spec.... |
github | pocke/graphql-coverage | https://github.com/pocke/graphql-coverage | Rakefile | Ruby | mit | 19 | master | 256 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
require "rubocop/rake_task"
RuboCop::RakeTask.new
task :steep do
sh 'steep', 'check'
end
task default: %i[rubocop steep spec] |
github | pocke/graphql-coverage | https://github.com/pocke/graphql-coverage | spec/spec_helper.rb | Ruby | mit | 19 | master | 664 | # frozen_string_literal: true
require "graphql/coverage"
require 'tmpdir'
require 'pathname'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
confi... |
github | pocke/graphql-coverage | https://github.com/pocke/graphql-coverage | spec/graphql/coverage_spec.rb | Ruby | mit | 19 | master | 6,806 | # frozen_string_literal: true
RSpec.describe GraphQL::Coverage do
let(:schema) { TestSchema }
def execute!(query)
schema.execute(query).tap do |result|
raise result.to_h.inspect if result['errors']
end
end
before do
GraphQL::Coverage.enable(schema)
end
describe '.result' do
context... |
github | pocke/graphql-coverage | https://github.com/pocke/graphql-coverage | spec/exe/graphql-coverage_spec.rb | Ruby | mit | 19 | master | 3,684 | # frozen_string_literal: true
require 'open3'
RSpec.describe 'graphql-coverage' do
describe '#run' do
include_context :mktmpdir
let(:fixture_path) { File.expand_path('../fixtures/schema.rb', __dir__) }
let(:exe) { File.expand_path('../../exe/graphql-coverage', __dir__) }
context 'when the coverage... |
github | pocke/graphql-coverage | https://github.com/pocke/graphql-coverage | spec/support/graphql_schema.rb | Ruby | mit | 19 | master | 696 | class TestSchema < GraphQL::Schema
class FixedLazy
def value = 42
end
class ArticleType < GraphQL::Schema::Object
graphql_name 'Article'
field :title, String, null: false
field :body, String, null: false
end
class QueryType < GraphQL::Schema::Object
graphql_name 'Query'
field :foo,... |
github | pocke/graphql-coverage | https://github.com/pocke/graphql-coverage | lib/graphql/coverage.rb | Ruby | mit | 19 | master | 2,746 | # frozen_string_literal: true
require 'graphql'
require 'json'
require_relative "coverage/version"
require_relative "coverage/trace"
require_relative "coverage/store"
require_relative "coverage/call"
require_relative "coverage/errors"
require_relative "coverage/result"
module GraphQL
module Coverage
class << s... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | code_teams.gemspec | Ruby | mit | 19 | main | 1,053 | Gem::Specification.new do |spec|
spec.name = 'code_teams'
spec.version = '1.3.0'
spec.authors = ['Gusto Engineers']
spec.email = ['dev@gusto.com']
spec.summary = 'A low-dependency gem for declaring and querying engineering teams'
spec.description = 'A low-dependency gem fo... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | Gemfile | Ruby | mit | 19 | main | 219 | source 'https://rubygems.org'
# Specify your gem's dependencies in code_teams.gemspec
gemspec
gem 'pry'
gem 'rake'
gem 'rspec', '~> 3.0'
gem 'rubocop'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'sorbet'
gem 'tapioca' |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | lib/code_teams.rb | Ruby | mit | 19 | main | 3,831 | # frozen_string_literal: true
# typed: strict
require 'yaml'
require 'pathname'
require 'sorbet-runtime'
require 'code_teams/plugin'
require 'code_teams/plugins/identity'
require 'code_teams/utils'
module CodeTeams
extend T::Sig
class IncorrectPublicApiUsageError < StandardError; end
class TeamNotFoundError <... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | lib/code_teams/plugin.rb | Ruby | mit | 19 | main | 2,550 | # typed: strict
module CodeTeams
# Plugins allow a client to add validation on custom keys in the team YML.
# For now, only a single plugin is allowed to manage validation on a top-level key.
# In the future we can think of allowing plugins to be gracefully merged with each other.
class Plugin
extend T::He... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | lib/code_teams/utils.rb | Ruby | mit | 19 | main | 931 | # frozen_string_literal: true
#
# typed: strict
module CodeTeams
module Utils
extend T::Sig
module_function
sig { params(string: String).returns(String) }
def underscore(string)
string.gsub('::', '/')
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | lib/code_teams/testing.rb | Ruby | mit | 19 | main | 2,374 | # frozen_string_literal: true
#
# typed: strict
require 'securerandom'
require 'code_teams'
require 'code_teams/testing/rspec_helpers'
module CodeTeams
# Utilities for tests that need a controlled set of teams without writing YML
# files to disk.
#
# Opt-in by requiring `code_teams/testing`.
module Testing
... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | lib/code_teams/plugins/identity.rb | Ruby | mit | 19 | main | 869 | # typed: true
module CodeTeams
module Plugins
class Identity < Plugin
extend T::Sig
extend T::Helpers
IdentityStruct = Struct.new(:name)
sig { returns(IdentityStruct) }
def identity
IdentityStruct.new(
@team.raw_hash['name']
)
end
sig { overr... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | lib/code_teams/testing/rspec_helpers.rb | Ruby | mit | 19 | main | 398 | # frozen_string_literal: true
#
# typed: false
require 'securerandom'
require 'code_teams/testing'
module CodeTeams
module Testing
module RSpecHelpers
def code_team_with_config(team_config = {})
team_config = team_config.dup
team_config[:name] ||= "Fake Team #{SecureRandom.hex(4)}"
... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | spec/spec_helper.rb | Ruby | mit | 19 | main | 710 | require 'bundler/setup'
require 'pry'
require 'code_teams'
Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f }
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods g... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | spec/support/io_helpers.rb | Ruby | mit | 19 | main | 411 | module IOHelpers
def write_team_yml(extra_data: false)
write_file('config/teams/my_team.yml', YAML.dump({
name: 'My Team',
extra_data: extra_data
}.transform_keys(&:to_s)))
end
def write_file(path, content = '')
pathname = Pathname.new(path)
FileUtils.mkdir_p(pathname.dirname)
pat... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | spec/lib/code_teams_spec.rb | Ruby | mit | 19 | main | 2,719 | RSpec.describe CodeTeams do
let(:team_yml) do
<<~YML.strip
name: My Team
YML
end
before do
write_file('config/teams/my_team.yml', team_yml)
described_class.bust_caches!
allow(CodeTeams::Plugin).to receive(:registry).and_return({})
end
describe '.all' do
it 'correctly parses the... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | spec/lib/code_teams/testing_spec.rb | Ruby | mit | 19 | main | 480 | require 'code_teams/testing'
CodeTeams::Testing.enable!
RSpec.describe CodeTeams::Testing do
describe '.create_code_team' do
it 'adds the team to CodeTeams.all and CodeTeams.find' do
team = described_class.create_code_team({ name: 'Temp Team', extra_data: { foo: { bar: 1 } } })
expect(CodeTeams.all... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | spec/lib/code_teams/plugin_spec.rb | Ruby | mit | 19 | main | 1,363 | module TestNamespace; end
RSpec.describe CodeTeams::Plugin do
describe '.bust_caches!' do
it 'clears all plugins team registries ensuring cached configs are purged' do
test_plugin_class = Class.new(described_class) do
def extra_data
@team.raw_hash['extra_data']
end
end
... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | spec/lib/code_teams/testing/r_spec_helpers_integration_spec.rb | Ruby | mit | 19 | main | 456 | require 'code_teams/testing'
CodeTeams::Testing.enable!
RSpec.describe CodeTeams::Testing::RSpecHelpers do
it 'exposes code_team_with_config and makes the team discoverable' do
code_team_with_config(name: 'RSpec Team')
expect(CodeTeams.find('RSpec Team')).not_to be_nil
end
it 'cleans up testing teams ... |
github | rubyatscale/code_teams | https://github.com/rubyatscale/code_teams | spec/code_teams/plugin_helper_integration_spec.rb | Ruby | mit | 19 | main | 1,643 | RSpec.describe CodeTeams::Plugin do
before do
CodeTeams.bust_caches!
write_team_yml(extra_data: { 'foo' => 'foo', 'bar' => 'bar' })
end
let(:team) { CodeTeams.find('My Team') }
describe 'helper methods' do
context 'with a single implicit method' do
before do
test_plugin_class = Class... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | Gemfile | Ruby | mit | 19 | main | 537 | # frozen_string_literal: true
ruby '3.3.3'
source 'https://rubygems.org'
gem 'dotenv', '~> 3.1', '>= 3.1.2'
gem 'rack', '~> 3.1', '>= 3.1.4'
gem 'rack-cors', '~> 2.0', '>= 2.0.2'
gem 'rackup', '~> 2.1'
gem 'puma', '~> 6.4', '>= 6.4.2'
gem 'rack-attack', '~> 6.7'
gem 'roda', '~> 3.81'
gem 'concurrent-ruby', '~> 1.... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | config.ru | Ruby | mit | 19 | main | 250 | # frozen_string_literal: true
require 'dotenv/load'
require 'newrelic_rpm' if ENV.fetch('NANO_BOTS_NEW_RELIC', nil).to_s == 'true'
require_relative 'controllers/app'
require_relative 'controllers/boot'
BootController.boot!
run AppController.app |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | static/api.rb | Ruby | mit | 19 | main | 516 | # frozen_string_literal: true
require 'nano-bots'
API = {
project: 'Nano Bots API',
version: '1.9.0',
'nano-bots': { version: NanoBot.version, specification: NanoBot.specification },
documentation: 'https://spec.nbots.io',
'live-editor': 'https://clinic.nbots.io',
github: 'https://github.com/icebaker/nano... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | controllers/debug.rb | Ruby | mit | 19 | main | 696 | # frozen_string_literal: true
require_relative '../static/api'
require 'rainbow'
require 'nano-bots'
module DebugController
def self.handler(params, request, environment)
{
ruby: {
version: RUBY_VERSION
},
api: API,
'nano-bots': {
version: NanoBot.version
},
r... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | controllers/boot.rb | Ruby | mit | 19 | main | 295 | # frozen_string_literal: true
require 'rainbow'
require_relative '../components/log'
require_relative '../components/ddos'
module BootController
def self.boot!
DDOS.setup!
Rainbow.enabled = true
Log.instance.logger.info("Starting server on port #{ENV.fetch('PORT')}")
end
end |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | controllers/cartridges.rb | Ruby | mit | 19 | main | 5,219 | # frozen_string_literal: true
require 'nano-bots'
require 'newrelic_rpm' if ENV.fetch('NANO_BOTS_NEW_RELIC', nil).to_s == 'true'
require './components/stream'
require './logic/safety'
module CartridgesController
def self.index(environment)
components = {}
if environment[:NANO_BOTS_CARTRIDGES_PATH]
... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | controllers/app.rb | Ruby | mit | 19 | main | 403 | # frozen_string_literal: true
require 'roda'
require 'rack/cors'
require 'rack/attack'
require_relative '../ports/http'
class AppController < Roda
plugin :json
plugin :all_verbs
use Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: %i[get post options head delete]
en... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | spec/logic/safety_spec.rb | Ruby | mit | 19 | main | 820 | # frozen_string_literal: true
require './logic/safety'
RSpec.describe SafetyLogic do
it 'makes cartridge safe to run' do
ENV['FORCE_SANDBOXED'] = 'false'
expect(SafetyLogic.ensure_cartridge_is_safe_to_run({}, {})[:safety][:tools][:confirmable]).to eq(false)
expect(SafetyLogic.ensure_cartridge_is_safe_to... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | ports/http.rb | Ruby | mit | 19 | main | 2,363 | # frozen_string_literal: true
require_relative '../controllers/index'
require_relative '../controllers/debug'
require_relative '../controllers/cartridges'
require 'newrelic_rpm' if ENV.fetch('NANO_BOTS_NEW_RELIC', nil).to_s == 'true'
module HTTP
def self.routes(route, request, response)
new_relic = ENV.fetch('... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | components/stream.rb | Ruby | mit | 19 | main | 611 | # frozen_string_literal: true
require 'securerandom'
require 'singleton'
require 'concurrent-ruby'
class Stream
include Singleton
attr_reader :logger
def initialize
@streams = Concurrent::Map.new
end
def get(id)
@streams[id]
end
def self.template
{
id: nil,
started_at: nil,
... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | components/ddos.rb | Ruby | mit | 19 | main | 1,245 | # frozen_string_literal: true
require_relative 'fake_redis'
class DDOS
SECONDS = 1
def self.setup!
active = ENV.fetch('NANO_BOTS_RACK_ATTACK', nil)
return unless ['true', true].include?(active)
Rack::Attack.cache.store = FakeRedis.new
# No access without the NANO_BOTS_END_USER header.
Rack... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | components/fake_redis.rb | Ruby | mit | 19 | main | 365 | # frozen_string_literal: true
class FakeRedis
def initialize
@store = {}
end
def read(key)
@store[key]
end
def write(key, value, _options = {})
@store[key] = value
end
def increment(key, amount, _options = {})
@store[key] ||= 0
@store[key] += amount
end
def fetch(key, _options... |
github | icebaker/nano-bots-api | https://github.com/icebaker/nano-bots-api | logic/safety.rb | Ruby | mit | 19 | main | 1,909 | # frozen_string_literal: true
require 'yaml'
module SafetyLogic
def self.symbolize_keys(object)
case object
when ::Hash
object.each_with_object({}) do |(key, value), result|
result[key.to_sym] = symbolize_keys(value)
end
when Array
object.map { |e| symbolize_keys(e) }
else
... |
github | drecom/barrage | https://github.com/drecom/barrage | Rakefile | Ruby | mit | 19 | master | 208 | require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
desc "pry console"
task :console do
require "pry"
require "barrage"
binding.pry
end |
github | drecom/barrage | https://github.com/drecom/barrage | Guardfile | Ruby | mit | 19 | master | 317 | # A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard :rspec,
cmd: "bundle exec rspec",
all_after_pass: true,
all_on_start: true do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end |
github | drecom/barrage | https://github.com/drecom/barrage | barrage.gemspec | Ruby | mit | 19 | master | 1,230 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'barrage/version'
Gem::Specification.new do |spec|
spec.name = "barrage"
spec.version = Barrage::VERSION
spec.authors = ["gussan"]
spec.email = ["egussan@gmail... |
github | drecom/barrage | https://github.com/drecom/barrage | Gemfile | Ruby | mit | 19 | master | 423 | source 'https://rubygems.org'
# Specify your gem's dependencies in barrage.gemspec
gemspec
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
gem "activesupport", "< 5.0.0"
end
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.3")
gem "listen", "< 3.1.0"
end
if Gem::Version.create... |
github | drecom/barrage | https://github.com/drecom/barrage | lib/barrage.rb | Ruby | mit | 19 | master | 1,291 | require "barrage/version"
require "active_support/core_ext/string/inflections"
class Barrage
class InvalidOption < StandardError; end
attr_reader :generators
#
# generators:
# - name: msec
# length: 40
# start_at: 1396278000000 # 2014-04-01 00:00:00 +0900 (msec)
# - name: pid
# lengt... |
github | drecom/barrage | https://github.com/drecom/barrage | lib/barrage/generators/redis_worker_id.rb | Ruby | mit | 19 | master | 3,475 | require 'redis'
require 'barrage/generators/base'
class Barrage
module Generators
class RedisWorkerId < Base
RACE_CONDITION_TTL = 30
self.required_options += %w(ttl)
def initialize(options = {})
@worker_id = nil
@worker_ttl = 0
@real_ttl = 0
super
@dat... |
github | drecom/barrage | https://github.com/drecom/barrage | lib/barrage/generators/sequence.rb | Ruby | mit | 19 | master | 322 | require 'barrage/generators/base'
class Barrage
module Generators
class Sequence < Base
def initialize(options)
@sequence = 0
super
end
def generate
@sequence = (@sequence + 1) & (2 ** length - 1)
end
def current
@sequence
end
end
end
en... |
github | drecom/barrage | https://github.com/drecom/barrage | lib/barrage/generators/base.rb | Ruby | mit | 19 | master | 902 | require 'barrage/generators'
require 'active_support/core_ext/class/attribute'
class Barrage
module Generators
class Base
attr_reader :options
class_attribute :required_options, :available_options
self.required_options = %w(length)
self.available_options = []
def initialize(options... |
github | drecom/barrage | https://github.com/drecom/barrage | lib/barrage/generators/msec.rb | Ruby | mit | 19 | master | 351 | require 'barrage/generators/base'
class Barrage
module Generators
class Msec < Base
self.required_options += %w(start_at)
def generate
((Time.now.to_f * 1000).round - start_at) & (2 ** length - 1)
end
alias_method :current, :generate
def start_at
options["start_at... |
github | drecom/barrage | https://github.com/drecom/barrage | lib/barrage/generators/pid.rb | Ruby | mit | 19 | master | 215 | require 'barrage/generators/base'
class Barrage
module Generators
class Pid < Base
def generate
Process.pid & (2 ** length-1)
end
alias_method :current, :generate
end
end
end |
github | drecom/barrage | https://github.com/drecom/barrage | spec/spec_helper.rb | Ruby | mit | 19 | master | 311 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'bundler/setup'
require 'rspec/its'
require 'delorean'
require 'coveralls'
Coveralls.wear!
require 'barrage'
RSpec.configure do |config|
include Delorean
config.filter_run focus: true
config.run_all_when_everything_filtered = true
end |
github | drecom/barrage | https://github.com/drecom/barrage | spec/barrage_spec.rb | Ruby | mit | 19 | master | 1,423 | require 'spec_helper'
describe Barrage do
it 'has a version number' do
expect(Barrage::VERSION).not_to be nil
end
context "when initialized" do
subject { Barrage.new(options) }
context "with empty generators" do
let(:options) { {"generators" => []} }
its(:generators) { is_expected.to be... |
github | drecom/barrage | https://github.com/drecom/barrage | spec/barrage/generators/msec_spec.rb | Ruby | mit | 19 | master | 1,430 | require 'spec_helper'
require 'barrage/generators/msec'
describe Barrage::Generators::Msec do
context "When initialized" do
subject { described_class.new(options) }
context "with empty hash" do
let(:options) { {} }
it { expect { subject }.to raise_error(ArgumentError) }
end
context "wi... |
github | drecom/barrage | https://github.com/drecom/barrage | spec/barrage/generators/redis_worker_id_spec.rb | Ruby | mit | 19 | master | 2,101 | require 'spec_helper'
require 'barrage/generators/redis_worker_id'
describe Barrage::Generators::RedisWorkerId do
context "When initialized" do
subject { described_class.new(options) }
context "with empty hash" do
let(:options) { {} }
it { expect { subject }.to raise_error(ArgumentError) }
... |
github | drecom/barrage | https://github.com/drecom/barrage | spec/barrage/generators/sequence_spec.rb | Ruby | mit | 19 | master | 1,536 | require 'spec_helper'
require 'barrage/generators/sequence'
describe Barrage::Generators::Sequence do
context "When initialized" do
subject { described_class.new(options) }
context "with empty hash" do
let(:options) { {} }
it { expect { subject }.to raise_error(ArgumentError) }
end
con... |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | Gemfile | Ruby | mit | 19 | main | 1,729 | source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "~> 3.0"
gem "rails", "~> 7.1.2"
# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"
# Use Puma as the app server
gem 'puma'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webp... |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | app/controllers/application_controller.rb | Ruby | mit | 19 | main | 424 | class ApplicationController < ActionController::Base
include DetectDevice
before_action :set_ie_warning
private
def set_ie_warning
if @browser.ie?
flash.now[:alert] = "本站点必须在Chrome, Edge, Firefox等非IE浏览器下浏览,Chrome浏览器可以从<a href='https://www.google.cn/intl/zh-CN/chrome/'>https://www.google.cn/int... |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | app/controllers/concerns/detect_device.rb | Ruby | mit | 19 | main | 267 | module DetectDevice
extend ActiveSupport::Concern
included do
before_action :set_variant_and_browser
end
def set_variant_and_browser
@browser = Browser.new(request.user_agent)
if @browser.mobile?
request.variant = :phone
end
end
end |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | config/routes.rb | Ruby | mit | 19 | main | 255 | Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
# Almost every application defines a route for the root path ("/") at the top of this file.
root "home#index"
end |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | config/application.rb | Ruby | mit | 19 | main | 1,123 | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action... |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | config/initializers/application_controller_renderer.rb | Ruby | mit | 19 | main | 216 | # Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: "example.org",
# https: false
# )
# end |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | config/environments/development.rb | Ruby | mit | 19 | main | 2,137 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for developme... |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | config/environments/test.rb | Ruby | mit | 19 | main | 2,117 | require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data the... |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | config/environments/production.rb | Ruby | mit | 19 | main | 4,648 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | db/schema.rb | Ruby | mit | 19 | main | 758 | # 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 | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | test/application_system_test_case.rb | Ruby | mit | 19 | main | 954 | require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
# removes noisy logs when launching tests
Capybara.server = :puma, {Silent: true}
Capybara.register_driver :headless_chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new(args: %w[headless window-size=1400,10... |
github | Eric-Guo/tailwindcss-jit-stimulus | https://github.com/Eric-Guo/tailwindcss-jit-stimulus | test/system/homes_test.rb | Ruby | mit | 19 | main | 224 | require "application_system_test_case"
class HomesTest < ApplicationSystemTestCase
test "visiting the root" do
visit root_url
wait_for_stimulus_loading
assert_selector "h1", text: "Hello, Stimulus!"
end
end |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | Gemfile | Ruby | bsd-3-clause | 19 | master | 313 | source :rubygems
gem 'sqlite3'
group :test do
gem 'rspec-rails', '= 2.6.1'
gem 'database_cleaner', '= 0.6.7'
gem 'nokogiri'
gem 'capybara', '1.0.1'
gem 'faker'
gem 'factory_girl'
# yes it's needed here (despite gemspec) for dummy app generator to work
gem 'globalize3', '>= 0.0.9'
end
gemspec |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | Rakefile | Ruby | bsd-3-clause | 19 | master | 741 | require 'rake'
require 'rake/testtask'
require 'rake/packagetask'
require 'rubygems/package_task'
require 'rspec/core/rake_task'
#require 'cucumber/rake/task'
require 'spree_core/testing_support/common_rake'
RSpec::Core::RakeTask.new
# Cucumber::Rake::Task.new
# task :default => [:spec, :cucumber ]
task :default => [... |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | globalize_spree.gemspec | Ruby | bsd-3-clause | 19 | master | 832 | Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'globalize_spree'
s.version = '0.2.1'
s.summary = 'Globalize3-Spree integration'
s.description = 'A Spree extension that integrates Globalize3 gem for model translations.'
s.required_ruby_version = '>= 1.8.7'
s.auth... |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | spec/spec_helper.rb | Ruby | bsd-3-clause | 19 | master | 1,245 | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
# Run any available migration
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
# Requires supporting ruby files with custom matchers an... |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | spec/models/product_spec.rb | Ruby | bsd-3-clause | 19 | master | 215 | require 'spec_helper'
describe Product do
context "instance methods" do
before(:all) do
@product = Factory(:product)
end
it "should return true" do
true.should eql true
end
end
end |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | db/migrate/20101107175511_add_globalize_to_products.rb | Ruby | bsd-3-clause | 19 | master | 315 | class AddGlobalizeToProducts < ActiveRecord::Migration
def self.up
Product.create_translation_table! :name => :string, :description => :text
# save old values into brand new translations table
Product.migrate_translated_fields
end
def self.down
Product.drop_translation_table!
end
end |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | db/migrate/20101107185551_add_globalize_to_taxons.rb | Ruby | bsd-3-clause | 19 | master | 307 | class AddGlobalizeToTaxons < ActiveRecord::Migration
def self.up
Taxon.create_translation_table! :name => :string, :description => :text
# save old values into brand new translations table
Taxon.migrate_translated_fields
end
def self.down
Taxon.drop_translation_table!
end
end |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | lib/globalize_spree.rb | Ruby | bsd-3-clause | 19 | master | 819 | require 'spree_core'
module GlobalizeSpree
class Engine < Rails::Engine
engine_name 'globalize_spree'
config.autoload_paths += %W(#{config.root}/lib)
def self.activate
#easy-globalize-accessors functionality
ActiveRecord::Base.send :include, ActiveRecord::GlobalizeAccessors
Dir.... |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | lib/globalize/migratable.rb | Ruby | bsd-3-clause | 19 | master | 339 | module Globalize::Migratable
def migrate_translated_fields
I18n.locale = :en
self.all.each do |entity|
puts entity.id
entity.translated_attributes.each do |k,v|
entity[k] = entity.read_attribute_before_type_cast(k)
puts "-- #{k} => #{entity[k]}"
end
entity.save
end
... |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | lib/active_record/globalize_accessors.rb | Ruby | bsd-3-clause | 19 | master | 901 | module ActiveRecord
module GlobalizeAccessors
def self.included(base)
base.extend ActMethods
end
module ActMethods
def globalize_accessors(*attr_names)
languages = attr_names
attribs = translated_attribute_names
attribs.each do |attr_name|
languages.each ... |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | lib/tasks/install.rake | Ruby | bsd-3-clause | 19 | master | 588 | namespace :globalize_spree do
desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
task :install do
Rake::Task['globalize_spree:install:migrations'].invoke
end
namespace :install do
desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
task :migra... |
github | tomash/globalize-spree | https://github.com/tomash/globalize-spree | app/overrides/product_globalize_form_left.rb | Ruby | bsd-3-clause | 19 | master | 241 | Deface::Override.new(:virtual_path => "admin/products/_form",
:replace => "[data-hook='admin_product_form_left']",
:partial => "admin/shared/product_globalize_form_left",
:name => "product_globalize_form_left") |
github | fluent-plugins-nursery/fluent-plugin-grepcounter | https://github.com/fluent-plugins-nursery/fluent-plugin-grepcounter | Rakefile | Ruby | mit | 19 | master | 346 | # encoding: utf-8
require "bundler/gem_tasks"
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end
task :default => :spec
desc 'Open an irb session preloaded with the gem library'
task :console do
sh 'irb -rubygems -I lib... |
github | fluent-plugins-nursery/fluent-plugin-grepcounter | https://github.com/fluent-plugins-nursery/fluent-plugin-grepcounter | fluent-plugin-grepcounter.gemspec | Ruby | mit | 19 | master | 1,096 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = "fluent-plugin-grepcounter"
s.version = "0.6.0"
s.authors = ["Naotoshi Seo"]
s.email = ["sonots@gmail.com"]
s.homepage = "https://github.com/sonots/fluent-plugin-grepcounter"
... |
github | fluent-plugins-nursery/fluent-plugin-grepcounter | https://github.com/fluent-plugins-nursery/fluent-plugin-grepcounter | spec/spec_helper.rb | Ruby | mit | 19 | master | 388 | # encoding: UTF-8
require 'rubygems'
require 'bundler'
Bundler.setup(:default, :test)
Bundler.require(:default, :test)
if ENV['TRAVIS']
require 'coveralls'
Coveralls.wear!
end
require 'fluent/test'
require 'rspec'
require 'rspec/its'
require 'pry'
# require 'delorean'
$TESTING=true
$:.unshift File.join(File.dirn... |
github | fluent-plugins-nursery/fluent-plugin-grepcounter | https://github.com/fluent-plugins-nursery/fluent-plugin-grepcounter | spec/out_grepcounter_spec.rb | Ruby | mit | 19 | master | 17,949 | # encoding: UTF-8
require_relative 'spec_helper'
class Fluent::Test::OutputTestDriver
def emit_with_tag(record, time=Time.now, tag = nil)
@tag = tag if tag
emit(record, time)
end
end
class Hash
def delete!(key)
self.tap {|h| h.delete(key) }
end
end
describe Fluent::GrepCounterOutput do
before {... |
github | fluent-plugins-nursery/fluent-plugin-grepcounter | https://github.com/fluent-plugins-nursery/fluent-plugin-grepcounter | lib/fluent/plugin/out_grepcounter.rb | Ruby | mit | 19 | master | 14,550 | require 'fluent/output'
# encoding: UTF-8
class Fluent::GrepCounterOutput < Fluent::Output
Fluent::Plugin.register_output('grepcounter', self)
# To support log_level option implemented by Fluentd v0.10.43
unless method_defined?(:log)
define_method("log") { $log }
end
# Define `router` method of v0.12 t... |
github | OSC/ood_core | https://github.com/OSC/ood_core | Rakefile | Ruby | mit | 19 | master | 324 | require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "minitest/test_task"
require_relative 'lib/tasks/slurm'
RSpec::Core::RakeTask.new(:spec)
Minitest::TestTask.create(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.warning = false
t.test_globs = ["test/**/*_test.rb"]
end
task :default => :s... |
github | OSC/ood_core | https://github.com/OSC/ood_core | ood_core.gemspec | Ruby | mit | 19 | master | 1,673 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ood_core/version'
Gem::Specification.new do |spec|
spec.name = "ood_core"
spec.version = OodCore::VERSION
spec.authors = ["Eric Franz", "Morgan Rodgers", "Jeremy Nickla... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core.rb | Ruby | mit | 19 | master | 1,256 | require "ood_core/version"
require "ood_core/errors"
require "ood_core/cluster"
require "ood_core/clusters"
require "ood_core/invalid_cluster"
require "ood_core/data_formatter"
require "ood_core/helpers/openstack"
# The main namespace for ood_core
module OodCore
# A namespace for job access
module Job
require ... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/tasks/slurm.rb | Ruby | mit | 19 | master | 465 | # frozen_string_literal: true
require_relative '../ood_core'
require_relative '../ood_core/job/adapters/slurm'
namespace :slurm do
desc 'Get squeue output in the format this gem expects'
task :squeue do
fields = OodCore::Job::Adapters::Slurm::Batch.new.all_squeue_fields
args = OodCore::Job::Adapters::Slu... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/clusters.rb | Ruby | mit | 19 | master | 4,080 | require "yaml"
module OodCore
# An enumerable that contains a list of {Cluster} objects
class Clusters
include Enumerable
# The format version of the configuration file
CONFIG_VERSION = ['v2', 'v1']
class << self
# Parse a configuration file or a set of configuration files in a
# dire... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/errors.rb | Ruby | mit | 19 | master | 801 | module OodCore
# Generic {OodCore} exception class
class Error < StandardError; end
# Raised when cannot find configuration file specified
class ConfigurationNotFound < Error; end
# Raised when adapter not specified in configuration
class AdapterNotSpecified < Error; end
# Raised when cannot find adapt... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/invalid_cluster.rb | Ruby | mit | 19 | master | 795 | module OodCore
# A special case of an OodCore::Cluster where something went awry in the
# creation and it's invalid for some reason. Users should only be able
# to rely on id and metadata.error_msg. All *allow? related functions
# false, meaning nothing is allowed.
class InvalidCluster < Cluster
# Jobs a... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/data_formatter.rb | Ruby | mit | 19 | master | 313 | module OodCore
module DataFormatter
# Determine whether to upcase account strings when returning adapter#accounts
def upcase_accounts?
env_var = ENV['OOD_UPCASE_ACCOUNTS']
if env_var.nil? || env_var.to_s.downcase == 'false'
false
else
true
end
end
end
end |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/cluster.rb | Ruby | mit | 19 | master | 7,251 | require "ostruct"
require "ood_core/refinements/hash_extensions"
module OodCore
# An object that describes a cluster and its given features that third-party
# code can take advantage of.
class Cluster
using Refinements::HashExtensions
# The unique identifier for a given cluster
# @return [Symbol] t... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/batch_connect/template.rb | Ruby | mit | 19 | master | 12,232 | require "ood_core/refinements/hash_extensions"
module OodCore
module BatchConnect
# A template class that renders a batch script designed to facilitate
# external connections to the running job
class Template
using Refinements::HashExtensions
using Refinements::ArrayExtensions
# The co... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/batch_connect/factory.rb | Ruby | mit | 19 | master | 1,643 | require "ood_core/refinements/hash_extensions"
module OodCore
module BatchConnect
# A factory that builds a batch connect template object from a
# configuration.
class Factory
using Refinements::HashExtensions
class << self
# Build a batch connect template from a configuration
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/batch_connect/templates/basic.rb | Ruby | mit | 19 | master | 629 | require "ood_core/refinements/hash_extensions"
module OodCore
module BatchConnect
class Factory
using Refinements::HashExtensions
# Build the basic template from a configuration
# @param config [#to_h] the configuration for the batch connect template
def self.build_basic(config)
... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/batch_connect/templates/vnc_container.rb | Ruby | mit | 19 | master | 11,583 | require "ood_core/refinements/hash_extensions"
require "securerandom"
module OodCore
module BatchConnect
class Factory
using Refinements::HashExtensions
# Build the VNC template from a configuration
# @param config [#to_h] the configuration for the batch connect template
def self.build_v... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/batch_connect/templates/vnc.rb | Ruby | mit | 19 | master | 10,903 | require "ood_core/refinements/hash_extensions"
module OodCore
module BatchConnect
class Factory
using Refinements::HashExtensions
# Build the VNC template from a configuration
# @param config [#to_h] the configuration for the batch connect template
def self.build_vnc(config)
cont... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/refinements/hash_extensions.rb | Ruby | mit | 19 | master | 2,486 | module OodCore
# Namespace for Ruby refinements
module Refinements
# This module provides refinements for manipulating the Ruby {Hash} class.
# Some elements have been taken from Rails (https://github.com/rails/rails)
# and it's LICENSE has been added as RAILS-LICENSE in the root directory of this proje... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/refinements/array_extensions.rb | Ruby | mit | 19 | master | 600 | module OodCore
# Namespace for Ruby refinements
module Refinements
# This module provides refinements for manipulating the Ruby {Array} class.
module ArrayExtensions
# Wrap its argument in an array unless it is already an array (or
# array-like)
# @see http://apidock.com/rails/Array/wrap/c... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/refinements/drmaa_extensions.rb | Ruby | mit | 19 | master | 862 | require 'singleton'
module DRMAA
# The one and only connection with DRMAA
# Attempting to instantiate a DRMAA::Session more than once causes it to crash
class SessionSingleton < DRMAA::Session
include Singleton
end
DRMMA_TO_OOD_STATE_MAP = {
DRMAA::STATE_UNDETERMINED => :undetermined,
D... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/helpers/openstack.rb | Ruby | mit | 19 | master | 3,309 | require "fog/openstack"
require "json"
require "etc"
module OodCore
class OpenStackHelper
attr_reader :auth_url, :openstack_instance
def initialize(token_file:, openstack_instance:)
@token_file = token_file
@openstack_instance = openstack_instance
@auth_url = "https://identity.#{openstack_... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/acl/adapter.rb | Ruby | mit | 19 | master | 520 | require "ood_support"
module OodCore
module Acl
# A class that handles the permissions for a resource through an ACL
# @abstract
class Adapter
# Whether this ACL allows access for the principle
# @abstract Subclass is expected to implement {#allow?}
# @raise [NotImplementedError] if sub... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/acl/factory.rb | Ruby | mit | 19 | master | 1,502 | require "ood_core/refinements/hash_extensions"
module OodCore
module Acl
# A factory that builds acl adapter objects from a configuration.
class Factory
using Refinements::HashExtensions
class << self
# Build an acl adapter from a configuration
# @param config [#to_h] configurati... |
github | OSC/ood_core | https://github.com/OSC/ood_core | lib/ood_core/acl/adapters/group.rb | Ruby | mit | 19 | master | 2,160 | require "ood_core/refinements/hash_extensions"
module OodCore
module Acl
class Factory
using Refinements::HashExtensions
# Build the group acl adapter from a configuration
# @param config [#to_h] the configuration for an acl adapter
# @option config [Array<#to_s>] :groups The list of gro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.