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 | NZKoz/cassandra_object | https://github.com/NZKoz/cassandra_object | lib/cassandra_object/associations/one_to_one.rb | Ruby | isc | 198 | master | 1,961 | module CassandraObject
class OneToOneAssociation
def initialize(association_name, owner_class, options)
@association_name = association_name.to_s
@owner_class = owner_class
@target_class_name = options[:class_name] || association_name.to_s.camelize
@options = options
... |
github | NZKoz/cassandra_object | https://github.com/NZKoz/cassandra_object | lib/cassandra_object/associations/one_to_many.rb | Ruby | isc | 198 | master | 3,640 | module CassandraObject
class OneToManyAssociation
def initialize(association_name, owner_class, options)
@association_name = association_name.to_s
@owner_class = owner_class
@target_class_name = options[:class_name] || association_name.to_s.singularize.camelize
@options = ... |
github | stve/capistrano-local-precompile | https://github.com/stve/capistrano-local-precompile | Gemfile | Ruby | mit | 198 | master | 221 | source 'https://rubygems.org'
gem 'rake'
gem 'yard'
group :development do
gem 'kramdown'
gem 'guard-rspec'
end
group :test do
gem 'rspec'
gem 'capistrano-spec'
gem 'simplecov', :require => false
end
gemspec |
github | stve/capistrano-local-precompile | https://github.com/stve/capistrano-local-precompile | Rakefile | Ruby | mit | 198 | master | 334 | #!/usr/bin/env rake
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
task :test => :spec
require 'yard'
namespace :doc do
YARD::Rake::YardocTask.new do |task|
task.files = ['LICENSE.md', 'lib/**/*.rb']
task.options = ['--markup', 'markdow... |
github | stve/capistrano-local-precompile | https://github.com/stve/capistrano-local-precompile | capistrano-local-precompile.gemspec | Ruby | mit | 198 | master | 857 | # encoding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |gem|
gem.name = 'capistrano-local-precompile'
gem.version = '1.2.0'
gem.homepage = 'https://github.com/spagalloco/capistrano-local-precompile'
gem.autho... |
github | stve/capistrano-local-precompile | https://github.com/stve/capistrano-local-precompile | spec/configuration_spec.rb | Ruby | mit | 198 | master | 1,848 | require 'spec_helper'
describe Capistrano::LocalPrecompile, "configuration" do
before do
@configuration = Capistrano::Configuration.new
@configuration.load do
def rails_env; 'production'; end
def rake; 'rake'; end
def asset_env; "RAILS_GROUPS=assets"; end
end
Capistrano::LocalPrecom... |
github | stve/capistrano-local-precompile | https://github.com/stve/capistrano-local-precompile | spec/integration_spec.rb | Ruby | mit | 198 | master | 2,347 | require 'spec_helper'
describe Capistrano::LocalPrecompile, "integration" do
before do
@configuration = Capistrano::Configuration.new
@configuration.load do
def rails_env; 'production'; end
def rake; 'rake'; end
def asset_env; "RAILS_GROUPS=assets"; end
end
Capistrano::LocalPrecompi... |
github | stve/capistrano-local-precompile | https://github.com/stve/capistrano-local-precompile | spec/spec_helper.rb | Ruby | mit | 198 | master | 454 | # coding: utf-8
unless ENV['CI']
require 'simplecov'
SimpleCov.start do
add_group 'Capistrano', 'lib/capistrano'
add_group 'Specs', 'spec/*'
add_filter '.bundle'
end
end
require 'capistrano-local-precompile'
require 'rspec'
require 'capistrano-spec'
RSpec.configure do |config|
config.include Capis... |
github | stve/capistrano-local-precompile | https://github.com/stve/capistrano-local-precompile | lib/capistrano/local_precompile.rb | Ruby | mit | 198 | master | 1,822 | namespace :load do
task :defaults do
set :assets_dir, "public/assets"
set :packs_dir, "public/packs"
set :rsync_cmd, "rsync -av --delete"
set :assets_role, "web"
after "bundler:install", "deploy:assets:prepare"
after "deploy:assets:prepare", "deploy:assets:rsync"
... |
github | yrgoldteeth/bootstrap-will_paginate | https://github.com/yrgoldteeth/bootstrap-will_paginate | bootstrap-will_paginate.gemspec | Ruby | mit | 198 | master | 1,031 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "bootstrap-will_paginate/version"
Gem::Specification.new do |s|
s.name = "bootstrap-will_paginate"
s.version = Bootstrap::Willpaginate::VERSION
s.authors = ["Nicholas Fine", "Isaac Bowen"]
s.email = ["nick@ndfin... |
github | yrgoldteeth/bootstrap-will_paginate | https://github.com/yrgoldteeth/bootstrap-will_paginate | config/initializers/will_paginate.rb | Ruby | mit | 198 | master | 2,336 | # config/initializers/will_paginate.rb
#
# This extension code was written by Isaac Bowen, originally found
# at http://isaacbowen.com/blog/using-will_paginate-action_view-and-bootstrap/
require 'will_paginate/view_helpers/action_view'
module WillPaginate
module ActionView
def will_paginate(collection = nil, op... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | timeasure.gemspec | Ruby | mit | 198 | master | 1,315 | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'timeasure/version'
Gem::Specification.new do |spec|
spec.name = 'timeasure'
spec.version = Timeasure::VERSION
spec.authors = ['Eliav Lavi']
spec.email = ['eliav@riskified.com... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | lib/timeasure.rb | Ruby | mit | 198 | master | 2,001 | require_relative 'timeasure/version'
require_relative 'timeasure/configuration'
require_relative 'timeasure/class_methods'
require_relative 'timeasure/measurement'
require_relative 'timeasure/profiling/manager'
module Timeasure
class << self
def configure
yield(configuration)
end
def configuration... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | lib/timeasure/measurement.rb | Ruby | mit | 198 | master | 647 | module Timeasure
class Measurement
attr_reader :klass_name, :method_name, :segment, :metadata, :t0, :t1
def initialize(klass_name:, method_name:, t0:, t1:, segment: nil, metadata: nil)
@klass_name = klass_name
@method_name = method_name
@t0 = t0
@t1 = t1
@segment = segment
... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | lib/timeasure/configuration.rb | Ruby | mit | 198 | master | 1,644 | module Timeasure
class Configuration
attr_accessor :post_measuring_proc, :rescue_proc, :enable_timeasure_proc,
:reported_methods_handler_set_proc, :reported_methods_handler_get_proc
def initialize
@post_measuring_proc = lambda do |measurement|
# Enables the configuration of wh... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | lib/timeasure/class_methods.rb | Ruby | mit | 198 | master | 1,526 | module Timeasure
module ClassMethods
def tracked_instance_methods(*method_names)
method_names.each do |method_name|
add_method_to_interceptor(instance_interceptor, method_name)
end
end
def tracked_class_methods(*method_names)
method_names.each do |method_name|
add_method... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | lib/timeasure/profiling/manager.rb | Ruby | mit | 198 | master | 1,064 | require 'logger'
require_relative 'reported_methods_handler'
require_relative 'reported_method'
module Timeasure
module Profiling
class Manager
class << self
def prepare
Timeasure.configuration.reported_methods_handler_set_proc.call(ReportedMethodsHandler.new)
end
def rep... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | lib/timeasure/profiling/reported_method.rb | Ruby | mit | 198 | master | 705 | module Timeasure
module Profiling
class ReportedMethod
attr_reader :klass_name, :method_name, :segment, :metadata, :full_path, :method_path, :runtime_sum, :call_count
def initialize(measurement)
@klass_name = measurement.klass_name
@method_name = measurement.method_name
@segme... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | lib/timeasure/profiling/reported_methods_handler.rb | Ruby | mit | 198 | master | 773 | module Timeasure
module Profiling
class ReportedMethodsHandler
def initialize
@reported_methods = {}
end
def report(measurement)
initialize_path_for(measurement) if path_uninitialized_for(measurement)
@reported_methods[measurement.full_path].increment_runtime_sum(measur... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | spec/timeasure_acceptence_spec.rb | Ruby | mit | 198 | master | 8,954 | require 'timeasure'
RSpec.describe Timeasure do
before(:each) { Timeasure::Profiling::Manager.prepare }
context 'direct interface' do
describe '.measure' do
let(:klass_name) { double }
let(:method_name) { double }
let(:segment) { double }
let(:metadata) { double }
context 'prope... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | spec/timeasure/profiling/method_reporting_spec.rb | Ruby | mit | 198 | master | 2,583 | require 'timeasure'
# This spec serves for both Timeasure::Profiling::ReportedMethodsHandler
# and Timeasure::Profiling::ReportedMethod as they represent one unit
RSpec.describe 'Timeasure::Profiling - Method Reporting' do
let(:reported_methods_handler) { Timeasure::Profiling::ReportedMethodsHandler.new }
let(:f... |
github | Riskified/timeasure | https://github.com/Riskified/timeasure | spec/timeasure/profiling/manager_spec.rb | Ruby | mit | 198 | master | 1,990 | require 'timeasure'
RSpec.describe Timeasure::Profiling::Manager do
before do
# this emulates 'unpreparing' the Profiling Manager. This way tests are independent regarding their running order.
Timeasure.configuration.reported_methods_handler_set_proc.call(nil)
end
describe '.report' do
let(:report) ... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | Gemfile | Ruby | mit | 198 | master | 443 | source 'https://rubygems.org'
gem 'sinatra', '~> 1.4.5'
gem 'github_api', '~> 0.13.0'
gem "redis", "~> 3.3.3"
gem 'hiredis', '~> 0.6.0'
gem 'haml', '~> 4.0.6'
gem 'json', '~> 2.1'
gem 'sidekiq', '~> 5.0.4'
gem 'mail', '~> 2.6.6'
gem 'puma', '~> 3.9.1'
gem 'newrelic_rpm', '~> 3.18.1'
gem 'rack_csrf', '~> 2.6.0'
gem 'ra... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | config.ru | Ruby | mit | 198 | master | 389 | GC::Profiler.enable
require 'sinatra/base'
require "sinatra/reloader"
require 'rack/csrf'
require 'rack-flash'
require 'yaml'
require 'redis'
require 'sidekiq'
require_relative 'workers/notifications_checker'
require_relative 'workers/send_email'
require_relative 'app.rb'
require 'newrelic-redis'
require 'newrelic_rpm... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | app.rb | Ruby | mit | 198 | master | 19,224 | #!/usr/bin/env ruby
require 'haml'
require 'json'
require 'github_api'
require 'datadog/statsd'
class GitNotifier < Sinatra::Base
@additional_js = nil
configure :development do
register Sinatra::Reloader
end
configure :production do
set :production, true
end
configure do
config_file = File... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | Capfile | Ruby | mit | 198 | master | 933 | # Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/puma'
require 'capistrano/puma/monit' #if you need the monit tasks
require 'capistrano/sidekiq'
require 'capistrano/sidekiq/monit' #to require monit tasks # Only for capistrano... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | sidekiq-web/config.ru | Ruby | mit | 198 | master | 678 | require 'yaml'
require 'sidekiq'
config_file = File.dirname(__FILE__) + '/../config.yml'
fail "Configuration file " + config_file + " missing!" unless File.exist?(config_file)
CONFIG = YAML.load_file(config_file)
redis_conn = proc {
Redis.new(
:driver => :hiredis,
:host => CONFIG['redis']['host'],
:port... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | scripts/delete_user_by_token.rb | Ruby | mit | 198 | master | 808 | require 'redis'
require 'pp'
require 'yaml'
config_file = File.dirname(__FILE__) + '/../config.yml'
fail "Configuration file " + config_file + " missing!" unless File.exist?(config_file)
CONFIG = YAML.load_file(config_file)
redis = Redis.new(:driver => :hiredis, :host => CONFIG['redis']['host'], :port => CONFIG['redi... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | scripts/job_enqueuer.rb | Ruby | mit | 198 | master | 3,249 | #!/usr/bin/env ruby
require 'sidekiq'
require 'redis'
require_relative '../workers/notifications_checker'
require_relative '../workers/email_builder'
require 'datadog/statsd'
require 'newrelic_rpm' # it should be the last entry in the require list
config_file = File.dirname(__FILE__) + '/../config.yml'
fail "Configur... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | scripts/add_users.rb | Ruby | mit | 198 | master | 1,668 | require 'redis'
require 'pp'
require 'yaml'
config_file = File.dirname(__FILE__) + '/../config.yml'
fail "Configuration file " + config_file + " missing!" unless File.exist?(config_file)
CONFIG = YAML.load_file(config_file)
redis = Redis.new(:driver => :hiredis, :host => CONFIG['redis']['host'], :port => CONFIG['redi... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | scripts/send_email.rb | Ruby | mit | 198 | master | 6,761 | #!/usr/bin/env ruby
require 'optparse'
require 'date'
require 'sidekiq'
require 'redis'
require 'pp'
require_relative '../workers/send_email'
require 'newrelic_rpm' # it should be the last entry in the require list
def time_rand from = 0.0, to = Time.now
Time.at(from + rand * (to.to_f - from.to_f))
end
def inject_... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | scripts/delete_user_by_email.rb | Ruby | mit | 198 | master | 988 | require 'redis'
require 'pp'
require 'yaml'
config_file = File.dirname(__FILE__) + '/../config.yml'
fail "Configuration file " + config_file + " missing!" unless File.exist?(config_file)
CONFIG = YAML.load_file(config_file)
redis = Redis.new(:driver => :hiredis, :host => CONFIG['redis']['host'], :port => CONFIG['redi... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | scripts/send_newsletter.rb | Ruby | mit | 198 | master | 2,033 | #!/usr/bin/env ruby
require 'sidekiq'
require 'redis'
require 'pp'
require_relative '../workers/send_email'
require 'newrelic_rpm' # it should be the last entry in the require list
config_file = File.dirname(__FILE__) + '/../config.yml'
fail "Configuration file " + config_file + " missing!" unless File.exist?(config_... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | scripts/migrations/0_add_last_queued_on.rb | Ruby | mit | 198 | master | 804 | #!/usr/bin/env ruby
require 'sidekiq'
require 'redis'
require 'newrelic_rpm' # it should be the last entry in the require list
config_file = File.dirname(__FILE__) + '/../../config.yml'
fail "Configuration file " + config_file + " missing!" unless File.exist?(config_file)
CONFIG = YAML.load_file(config_file)
conn = ... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | config/puma.rb | Ruby | mit | 198 | master | 4,099 | #!/usr/bin/env puma
@dir = File.expand_path File.dirname(__FILE__) + '/../'
# The directory to operate out of.
#
# The default is the current directory.
#
directory @dir
# Set the environment in which the rack's app will run. The value must be a string.
#
# The default is “development”.
#
#environment 'development'
... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | config/unicorn.rb | Ruby | mit | 198 | master | 516 | # set path to app that will be used to configure unicorn,
# note the trailing slash in this example
@dir = File.expand_path File.dirname(__FILE__)
worker_processes 1
working_directory @dir
timeout 30
# Specify path to socket unicorn listens to,
# we will use this in our nginx.conf later
listen "#{@dir}/tmp/sockets/p... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | workers/notifications_checker.rb | Ruby | mit | 198 | master | 6,178 | require 'github_api'
require 'pp'
require 'json'
require 'net/http'
require 'datadog/statsd'
class NotificationsChecker
include Sidekiq::Worker
sidekiq_options :queue => :notifications_checker, :retry => false, :dead => false
@first_time = nil
@new_events = nil
STATSD = Datadog::Statsd.new() unless defined? ... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | workers/send_email.rb | Ruby | mit | 198 | master | 2,901 | require 'json'
require 'erb'
require 'mail'
# This is trying to workaround an issue in `mail` gem
# Issue: https://github.com/mikel/mail/issues/912
#
# Since with current version (2.6.3) it is using `autoload`
# And as mentioned by a comment in the issue above
# It might not be thread-safe and
# might have problem in t... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | workers/init.rb | Ruby | mit | 198 | master | 931 | # encoding: utf-8
require 'datadog/statsd'
GC::Profiler.enable
config_file = File.dirname(__FILE__) + '/../config.yml'
fail "Configuration file " + config_file + " missing!" unless File.exist?(config_file)
CONFIG = YAML.load_file(config_file)
STATSD = Datadog::Statsd.new(CONFIG['statsd']['host'], CONFIG['statsd']['... |
github | andreausu/git-notifier | https://github.com/andreausu/git-notifier | workers/email_builder.rb | Ruby | mit | 198 | master | 4,820 | require 'openssl'
require 'pp'
require 'uri'
require_relative 'send_email'
class EmailBuilder
include Sidekiq::Worker
sidekiq_options :queue => :email_builder
STATSD = Datadog::Statsd.new() unless defined? STATSD
def perform(events_list_key)
STATSD.increment('ghntfr.workers.email_builder.start')
event... |
github | bitzesty/devise_zxcvbn | https://github.com/bitzesty/devise_zxcvbn | devise_zxcvbn.gemspec | Ruby | mit | 197 | master | 1,295 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'devise_zxcvbn/version'
Gem::Specification.new do |spec|
spec.name = "devise_zxcvbn"
spec.version = DeviseZxcvbn::VERSION
spec.authors = ["Bit Zesty"]
spec.email ... |
github | bitzesty/devise_zxcvbn | https://github.com/bitzesty/devise_zxcvbn | spec/spec_helper.rb | Ruby | mit | 197 | master | 263 | require 'byebug'
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_doubles = true
end
end |
github | bitzesty/devise_zxcvbn | https://github.com/bitzesty/devise_zxcvbn | spec/devise_zxcvbn/model_spec.rb | Ruby | mit | 197 | master | 3,931 | require 'active_model'
require 'devise'
require 'devise_zxcvbn'
require 'devise_zxcvbn/model'
describe Devise::Models::Zxcvbnable do
ValidDummyClass = Struct.new(:password, :skip_password_complexity, keyword_init: true) do
include ActiveModel::Validations
include Devise::Models::Zxcvbnable
def skip_pass... |
github | bitzesty/devise_zxcvbn | https://github.com/bitzesty/devise_zxcvbn | spec/devise_zxcvbn/devise_zxcbn_spec.rb | Ruby | mit | 197 | master | 726 | require "devise_zxcvbn"
describe 'Devise zxcvbn' do
it "Returns the default value for min_password_score of 4" do
expect(Devise.min_password_score).to eq(4)
end
it "Raises an error if min_password_score value is out of range" do
expect { Devise.min_password_score = 8 }.to raise_error("The min_password_s... |
github | bitzesty/devise_zxcvbn | https://github.com/bitzesty/devise_zxcvbn | spec/devise_zxcvbn/email_tokeniser_spec.rb | Ruby | mit | 197 | master | 547 | # encoding: UTF-8
require 'devise_zxcvbn/email_tokeniser'
describe DeviseZxcvbn::EmailTokeniser do
it "should split an email into tokens" do
expect(split("joe_bloggs@digital.gov-office.gov.uk")).to eq(%w(joe bloggs digital gov office gov uk))
end
it "should not split non-ascii characters" do
expect(spli... |
github | bitzesty/devise_zxcvbn | https://github.com/bitzesty/devise_zxcvbn | lib/devise_zxcvbn.rb | Ruby | mit | 197 | master | 618 | require "devise_zxcvbn/version"
require "devise"
require "zxcvbn"
module Devise
# The minimun score for a password.
mattr_reader :min_password_score
@@min_password_score = 4
def self.min_password_score=(score)
raise "The min_password_score must be an integer and between 0..4" unless (0..4).include?(score... |
github | bitzesty/devise_zxcvbn | https://github.com/bitzesty/devise_zxcvbn | lib/devise_zxcvbn/model.rb | Ruby | mit | 197 | master | 2,605 | require "devise_zxcvbn/email_tokeniser"
require "devise_zxcvbn/errors/devise_zxcvbn_error"
require "ostruct"
module Devise
module Models
module Zxcvbnable
extend ActiveSupport::Concern
delegate :min_password_score, to: "self.class"
delegate :zxcvbn_tester, to: "self.class"
included do
... |
github | forward/capify-ec2 | https://github.com/forward/capify-ec2 | capify-ec2.gemspec | Ruby | mit | 198 | master | 1,210 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "capify-ec2/version"
Gem::Specification.new do |s|
s.name = "capify-ec2"
s.version = Capify::Ec2::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Noah Cantor", "Siddharth Dawara", "Jon Spalding", "Ryan Conwa... |
github | forward/capify-ec2 | https://github.com/forward/capify-ec2 | lib/capify-ec2.rb | Ruby | mit | 198 | master | 17,726 | #!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'fog'
require 'colored'
require 'net/http'
require 'net/https'
require File.expand_path(File.dirname(__FILE__) + '/capify-ec2/server')
require File.expand_path(File.dirname(__FILE__) + '/capify-ec2/cloudwatch')
class CapifyEc2
attr_accessor :l... |
github | forward/capify-ec2 | https://github.com/forward/capify-ec2 | lib/capify-ec2/cloudwatch.rb | Ruby | mit | 198 | master | 1,865 | #!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'fog'
class CapifyCloudwatch
# Threshold => color
# Color is applied if metric exceeds the threshold, KEEP IN ORDER
Colors = {
0 => :green,
70 => :yellow,
90 => :red
}
def initialize(key_id, secret)
@ticks = %w[▁ ▂ ▃ ▄ ▅ ▆ ▇]
@cw = Fog... |
github | forward/capify-ec2 | https://github.com/forward/capify-ec2 | lib/capify-ec2/capistrano.rb | Ruby | mit | 198 | master | 12,121 | require File.join(File.dirname(__FILE__), '../capify-ec2')
require 'colored'
require 'pp'
Capistrano::Configuration.instance(:must_exist).load do
def capify_ec2
@capify_ec2 ||= CapifyEc2.new(fetch(:ec2_config, 'config/ec2.yml'), fetch(:stage, ''))
end
namespace :ec2 do
desc "Prints out all ec2 instance... |
github | forward/capify-ec2 | https://github.com/forward/capify-ec2 | lib/capify-ec2/server.rb | Ruby | mit | 198 | master | 316 | require 'rubygems'
require 'fog/aws/models/compute/server'
module Fog
module Compute
class AWS
class Server
def contact_point
dns_name || public_ip_address || private_ip_address
end
def name
tags["Name"] || id
end
end
end
end
end |
github | MightySignal/slackiq | https://github.com/MightySignal/slackiq | slackiq.gemspec | Ruby | mit | 198 | master | 1,068 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'slackiq/version'
Gem::Specification.new do |spec|
spec.name = "slackiq"
spec.version = Slackiq::VERSION
spec.authors = ['Jason Lew']
spec.email = ['jason@migh... |
github | MightySignal/slackiq | https://github.com/MightySignal/slackiq | lib/slackiq.rb | Ruby | mit | 198 | master | 4,250 | require 'slackiq/version'
require 'net/http'
require 'json'
require 'httparty'
require 'slackiq/time_helper'
require 'active_support' #for Hash#except
module Slackiq
class << self
# Configure all of the webhook URLs you're going to use
# @author Jason Lew
def configure(webhook_urls={})
r... |
github | MightySignal/slackiq | https://github.com/MightySignal/slackiq | lib/slackiq/time_helper.rb | Ruby | mit | 198 | master | 815 | require 'date'
module Slackiq
module TimeHelper
class << self
def elapsed_time_humanized(t0, t1)
humanize(elapsed_seconds(t0, t1))
end
def elapsed_seconds(t0, t1)
dt0 = t0.to_datetime
dt1 = t1.to_datetime
((dt1-dt0)*24*60*60).to_i
end
# ht... |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | espeak-ruby.gemspec | Ruby | mit | 197 | master | 820 | # frozen_string_literal: true
Gem::Specification.new do |gem|
gem.name = 'espeak-ruby'
gem.version = '1.1.0'
gem.summary = 'espeak-ruby is small Ruby API for utilizing ‘espeak’ and ‘lame’ to create Text-To-Speech mp3 files'
gem.description = 'espeak-ruby is small Ruby API for utilizing ‘espeak’ and ‘... |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | Gemfile | Ruby | mit | 197 | master | 218 | # frozen_string_literal: true
source 'http://rubygems.org'
gemspec
group :development do
gem 'rake'
gem 'rubocop'
gem 'test-unit'
end
gem 'racc', '~> 1.8'
gem 'ostruct', '~> 0.6.1'
gem 'base64', '~> 0.2.0' |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | Rakefile | Ruby | mit | 197 | master | 296 | # frozen_string_literal: true
require 'rake/testtask'
require 'rubocop/rake_task'
desc 'Default: run tests'
task default: :test
desc 'Test espeak-ruby'
Rake::TestTask.new(test: :rubocop) do |t|
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
RuboCop::RakeTask.new |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | demo/Gemfile | Ruby | mit | 197 | master | 202 | # frozen_string_literal: true
source 'https://rubygems.org'
gem 'espeak-ruby'
gem 'puma'
gem 'rack-test'
gem 'rackup'
gem 'rerun'
gem 'roda'
gem 'rspec'
gem 'rubocop'
gem 'tilt'
gem 'racc', '~> 1.8' |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | demo/lib/demo.rb | Ruby | mit | 197 | master | 442 | # frozen_string_literal: true
require 'roda'
require 'espeak'
# Demo app for espeak-ruby
class Demo < Roda
plugin :render
plugin :static, ['/css', '/js']
route do |r|
r.root do
@voices = ESpeak::Voice.all.sort_by(&:name)
render('demo')
end
r.get 'tts' do
print(r.params.inspect)
... |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | demo/spec/demo_spec.rb | Ruby | mit | 197 | master | 234 | # frozen_string_literal: true
require 'demo'
require 'rack/test'
describe Demo do
include Rack::Test::Methods
subject(:app) { Demo }
it 'responds OK for root path' do
get '/'
expect(last_response).to be_ok
end
end |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | lib/espeak/speech.rb | Ruby | mit | 197 | master | 2,650 | # frozen_string_literal: true
module ESpeak
# Speech represents an Text-To-Speech audio that can be played or saved to file
class Speech
attr_reader :options, :text
# filename - The file that will be generated
# options - Posible key, values
# :voice - use voice file of this name from espe... |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | lib/espeak/voice.rb | Ruby | mit | 197 | master | 768 | # frozen_string_literal: true
module ESpeak
# A voice that will be used for `Speech`
class Voice
attr_reader :language, :name, :gender, :file
def initialize(attributes)
@language = attributes[:language]
@name = attributes[:name]
@gender = attributes[:gender]
@file = attri... |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | test/cases/voice_test.rb | Ruby | mit | 197 | master | 367 | # frozen_string_literal: true
require 'test_helper'
class VoiceTest < Test::Unit::TestCase
include ESpeak
def test_all
all_voices = Voice.all
assert all_voices.size.positive?
assert %w[M F].include?(all_voices.first.gender)
end
def test_find_by_language
voice = Voice.find_by_language('en')
... |
github | dejan/espeak-ruby | https://github.com/dejan/espeak-ruby | test/cases/speech_test.rb | Ruby | mit | 197 | master | 384 | # frozen_string_literal: true
require 'test_helper'
require 'fileutils'
class SpeechTest < Test::Unit::TestCase
include ESpeak
def test_save
FileUtils.rm_rf('test/tmp')
FileUtils.mkdir_p('test/tmp')
assert Speech.new('Hello!').save('test/tmp/test.mp3')
assert File.exist?('test/tmp/test.mp3'), 'Mp... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | rspec-html-matchers.gemspec | Ruby | mit | 197 | main | 2,133 | # -*- encoding: utf-8 -*-
# frozen_string_literal: true
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rspec-html-matchers/version'
# NOTE: .dup is needed for ruby 1.9
ruby_version = Gem::Version.new(RUBY_VERSION.dup)
Gem::Specification.new do |s|
s.name... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | Rakefile | Ruby | mit | 197 | main | 921 | # frozen_string_literal: true
require 'bundler/setup'
require 'rspec/core/rake_task'
begin
require 'cucumber/rake/task'
rescue LoadError
# noop
end
Bundler::GemHelper.install_tasks
task :default => :test
desc 'Run RSpec and (if enabled and CUCUMBER!=false) cucumber tests'
task 'test' => 'spec'
RSpec::Core::Rak... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | spec/spec_helper.rb | Ruby | mit | 197 | main | 468 | # frozen_string_literal: true
if defined?(SimpleCov)
SimpleCov.start do
add_group 'Main', '/lib/'
add_filter '/spec/'
end
end
require 'rspec-html-matchers'
Dir[File.expand_path('../../spec/support/**/*.rb', __FILE__)].sort.each { |f| require f }
RSpec.configure do |config|
config.include RSpecHtmlMatc... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | spec/have_empty_tag_spec.rb | Ruby | mit | 197 | main | 917 | # encoding: UTF-8
# frozen_string_literal: true
require 'spec_helper'
describe 'have_empty_tag' do
context '[single element]' do
asset 'single_element'
it { expect(rendered).to have_empty_tag('div') }
it { expect(rendered).to have_empty_tag('div', :class => 'foo') }
it { expect(rendered).to have_em... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | spec/form_matchers_spec.rb | Ruby | mit | 197 | main | 9,581 | # frozen_string_literal: true
require 'spec_helper'
describe 'have_form' do
asset 'form'
context '[without &block]' do
it 'should find form' do
# sanity check
expect(rendered).to have_form('/books', :post)
expect(rendered).to have_form('/books', 'post', :with => { :id => 'new_book', :class ... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | spec/have_tag_spec.rb | Ruby | mit | 197 | main | 26,522 | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
describe 'have_tag' do
context '[through css selector]' do
asset 'search_and_submit'
it 'should have right description' do
expect(have_tag('div').description).to eq 'have at least 1 element matching "div"'
expect(have_tag('di... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | spec/issues_spec.rb | Ruby | mit | 197 | main | 423 | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
describe 'working on github issues' do
it '[seen Option Not Matching Seen Text (https://github.com/kucaahbe/rspec-html-matchers/issues/73)]' do
rendered = <<HTML
<p>
content with ignored
spaces
around
</... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | spec/support/raise_spec_error_helper.rb | Ruby | mit | 197 | main | 1,240 | # frozen_string_literal: true
RSpec::Matchers.define :raise_spec_error do |expected_exception_msg|
define_method :actual_msg do
@actual_msg
end
define_method :catched_exception do
@catched_exception
end
match do |block|
begin # rubocop:disable Style/RedundantBegin
block.call
false
... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | spec/support/asset_helpers.rb | Ruby | mit | 197 | main | 274 | # frozen_string_literal: true
module AssetHelpers
ASSETS = File.expand_path('../../fixtures/%s.html', __FILE__)
def asset name
f = fixtures[name] ||= File.read(ASSETS % name)
let(:rendered) { f }
end
private
def fixtures
@fixtures ||= {}
end
end |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | lib/rspec-html-matchers.rb | Ruby | mit | 197 | main | 14,066 | # encoding: UTF-8
# frozen_string_literal: true
require 'rspec-html-matchers/nokogiri_regexp_helper'
require 'rspec-html-matchers/nokogiri_text_helper'
require 'rspec-html-matchers/have_tag'
# RSpec global configuration:
#
# RSpec.configure do |config|
# config.include RSpecHtmlMatchers
# end
#
# RSpec per-te... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | lib/rspec-html-matchers/nokogiri_regexp_helper.rb | Ruby | mit | 197 | main | 313 | # encoding: UTF-8
# frozen_string_literal: true
module RSpecHtmlMatchers
# @api
# @private
# for nokogiri regexp matching
class NokogiriRegexpHelper
def initialize regex
@regex = regex
end
def regexp node_set
node_set.find_all { |node| node.content =~ @regex }
end
end
end |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | lib/rspec-html-matchers/nokogiri_text_helper.rb | Ruby | mit | 197 | main | 582 | # encoding: UTF-8
# frozen_string_literal: true
module RSpecHtmlMatchers
# @api
# @private
class NokogiriTextHelper
NON_BREAKING_SPACE = "\u00a0"
def initialize text, squeeze_text = false # rubocop:disable Style/OptionalBooleanParameter
@text = text
@squeeze_text = squeeze_text
end
... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | lib/rspec-html-matchers/have_tag.rb | Ruby | mit | 197 | main | 10,615 | # encoding: UTF-8
# frozen_string_literal: true
require 'nokogiri'
module RSpecHtmlMatchers
# @api
# @private
class HaveTag # rubocop:disable Metrics/ClassLength
DESCRIPTIONS = {
:have_at_least_one => %(have at least 1 element matching "%s"),
:have_n => %(have %i element(s) matching "... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | features/support/env.rb | Ruby | mit | 197 | main | 1,096 | # frozen_string_literal: true
# setup rspec matchers
require 'rspec/expectations'
World(RSpec::Matchers)
require 'sinatra/base'
require 'capybara/cucumber'
require 'rspec-html-matchers'
require 'webdrivers'
require 'selenium-webdriver'
World RSpecHtmlMatchers
# rubocop:disable Style/GlobalVars
$ASSETS_DIR = File.exp... |
github | kucaahbe/rspec-html-matchers | https://github.com/kucaahbe/rspec-html-matchers | features/step_definitions/steps.rb | Ruby | mit | 197 | main | 725 | # frozen_string_literal: true
Given /^I have following template:$/ do |string|
File.write($INDEX_HTML, string) # rubocop:disable Style/GlobalVars
end
When /^I open this template in browser$/ do
visit('/index.html')
end
Then /^I should be able to match static content$/ do
# capybara:
expect(page).to have_cont... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | lambdakiq.gemspec | Ruby | mit | 197 | main | 1,334 | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'lambdakiq/version'
Gem::Specification.new do |spec|
spec.name = "lambdakiq"
spec.version = Lambdakiq::VERSION
spec.authors = ["Ken Collins"]
spec.email = ["ken@metaskills.net... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | Rakefile | Ruby | mit | 197 | main | 299 | ENV['RUBYOPT'] = '-W:no-deprecated -W:no-experimental'
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/cases/**/*_test.rb"]
t.verbose = false
t.warning = false
end
task :default => :test |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper.rb | Ruby | mit | 197 | main | 1,181 | ENV['RAILS_ENV'] = 'test'
ENV['TEST_QUEUE_NAME'] ||= 'lambdakiq-JobsQueue-TESTING123.fifo'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup'
Bundler.require :default, :development, :test
require 'rails'
require 'aws-sdk-sqs'
require 'stringio'
require 'timeout'
require 'minit... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/jobs.rb | Ruby | mit | 197 | main | 297 | require 'test_helper/jobs/application_job'
require 'test_helper/jobs/basic_job'
require 'test_helper/jobs/basic_async_job'
require 'test_helper/jobs/basic_nofifo_job'
require 'test_helper/jobs/error_job'
require 'test_helper/jobs/error_job_no_retry'
require 'test_helper/jobs/error_job_one_retry' |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/log_helpers.rb | Ruby | mit | 197 | main | 593 | module TestHelper
module LogHelpers
extend ActiveSupport::Concern
included do
let(:logger) { Rails.logger.instance_variable_get(:@logdev).instance_variable_get(:@dev).string }
end
private
def logged_metric(event)
metric = logged_metrics.reverse.detect { |l| l.include?(event) }
... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/client_helpers.rb | Ruby | mit | 197 | main | 700 | module TestHelper
module ClientHelpers
extend ActiveSupport::Concern
included do
let(:max_receive_count) { 8 }
end
private
def client
Lambdakiq.client.sqs
end
def client_reset!
Lambdakiq.instance_variable_set :@client, nil
end
def client_stub_responses
... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/event_helpers.rb | Ruby | mit | 197 | main | 783 | require 'test_helper/events/base'
require 'test_helper/events/basic'
require 'securerandom'
module TestHelper
module EventHelpers
MESSAGE_ID = '9081fe74-bc79-451f-a03a-2fe5c6e2f807'.freeze
private
def event_basic(overrides = {})
Events::Basic.create(overrides)
end
def event_basic_delay(... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/perform_helpers.rb | Ruby | mit | 197 | main | 431 | module TestHelper
module PerformBuffer
def clear
values.clear
end
def add(value)
values << value
end
def values
@values ||= []
end
def last_value
values.last
end
extend self
end
module PerformHelpers
private
def perform_buffer_clear!
P... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/api_request_helpers.rb | Ruby | mit | 197 | main | 805 | module TestHelper
module ApiRequestHelpers
private
def delete_message
api_requests.reverse.detect do |r|
r[:operation_name] == :delete_message
end
end
def change_message_visibility
api_requests.reverse.detect do |r|
r[:operation_name] == :change_message_visibility
... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/response_helpers.rb | Ruby | mit | 197 | main | 858 | module TestHelper
module ResponseHelpers
extend ActiveSupport::Concern
private
def assert_response(response, failures: false, identifiers: [])
expect(response).must_be_instance_of Hash
expect(response[:batchItemFailures]).must_be_instance_of Array
if failures
assert_response_fa... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/jobs/error_job_one_retry.rb | Ruby | mit | 197 | main | 266 | module TestHelper
module Jobs
class ErrorJobOneRetry < ApplicationJob
lambdakiq_options retry: 1
def perform(object)
TestHelper::PerformBuffer.add "ErrorJobOneRetry with: #{object.inspect}"
raise('HELL')
end
end
end
end |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/jobs/basic_async_job.rb | Ruby | mit | 197 | main | 241 | module TestHelper
module Jobs
class BasicAsyncJob < ApplicationJob
lambdakiq_options async: true
def perform(object)
TestHelper::PerformBuffer.add "BasicAsyncJob with: #{object.inspect}"
end
end
end
end |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/jobs/error_job_no_retry.rb | Ruby | mit | 197 | main | 264 | module TestHelper
module Jobs
class ErrorJobNoRetry < ApplicationJob
lambdakiq_options retry: 0
def perform(object)
TestHelper::PerformBuffer.add "ErrorJobNoRetry with: #{object.inspect}"
raise('HELL')
end
end
end
end |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/jobs/error_job.rb | Ruby | mit | 197 | main | 217 | module TestHelper
module Jobs
class ErrorJob < ApplicationJob
def perform(object)
TestHelper::PerformBuffer.add "ErrorJob with: #{object.inspect}"
raise('HELL')
end
end
end
end |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/jobs/basic_nofifo_job.rb | Ruby | mit | 197 | main | 261 | module TestHelper
module Jobs
class BasicNofifoJob < ApplicationJob
queue_as ENV['TEST_QUEUE_NAME'].sub('.fifo','')
def perform(object)
TestHelper::PerformBuffer.add "BasicNofifoJob with: #{object.inspect}"
end
end
end
end |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/events/base.rb | Ruby | mit | 197 | main | 532 | module TestHelper
module Events
class Base
class_attribute :event, instance_writer: false
self.event = Hash.new
def self.create(overrides = {})
overrides[:messageId] ||= SecureRandom.uuid
job_class = overrides.delete(:job_class)
event.deep_dup.tap do |e|
e['Re... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/test_helper/events/basic.rb | Ruby | mit | 197 | main | 2,269 | module TestHelper
module Events
class Basic < Base
self.event = JSON.load('
{
"Records": [
{
"messageId": "abcdefgh-ijkl-mnop-qrst-uvwxyz012345",
"receiptHandle": "AQEBgbn8GmF1fMo4z3IIqlJYymS6e7NBynwE+LsQlzjjdcKtSIomGeKMe0noLC9UDSh... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/cases/event_test.rb | Ruby | mit | 197 | main | 365 | require 'test_helper'
class EventTest < LambdakiqSpec
it '.records' do
event = event_basic
records = Lambdakiq::Event.records(event)
expect(records).must_be_instance_of(Array)
expect(records.length).must_equal(1)
end
it '.jobs?' do
event = event_basic
jobs = Lambdakiq::Event.jobs?(event)... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/cases/record_test.rb | Ruby | mit | 197 | main | 972 | require 'test_helper'
class RecordTest < LambdakiqSpec
let(:event) { event_basic }
let(:records) { Lambdakiq::Event.records(event) }
let(:record) { Lambdakiq::Record.new(records.first) }
it '#body' do
expect(record.body).must_be_instance_of String
expect(JSON.parse(record.body)).must_be_instance_of... |
github | rails-lambda/lambdakiq | https://github.com/rails-lambda/lambdakiq | test/cases/queue_test.rb | Ruby | mit | 197 | main | 660 | require 'test_helper'
class QueueTest < LambdakiqSpec
let(:fifo_queue) { Lambdakiq.client.queues[queue_name] }
let(:non_fifo_queue) { Lambdakiq.client.queues['non-fifo-queue'] }
it '#fifo?' do
expect(fifo_queue.fifo?).must_equal true
expect(non_fifo_queue.fifo?).must_equal false
end
it '#max_receiv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.