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 | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/live_redis_protocol_spec.rb | Ruby | mit | 220 | master | 10,413 | require 'spec_helper'
describe EventMachine::Hiredis, "connected to an empty db" do
it "sets a string value" do
connect do |redis|
redis.set("foo", "bar") do |r|
r.should == "OK"
done
end
end
end
it "increments the value of a string" do
connect do |redis|
redis.incr... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/lock_spec.rb | Ruby | mit | 220 | master | 2,602 | require 'spec_helper'
describe EventMachine::Hiredis::Lock do
def start(timeout = 1)
connect(timeout) do |redis|
@redis = redis
yield
end
end
def new_lock
EventMachine::Hiredis::Lock.new(@redis, "test-lock", 2)
end
it "can be acquired" do
start {
new_lock.acquire.callback... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/connection_spec.rb | Ruby | mit | 220 | master | 1,384 | require 'spec_helper'
describe EventMachine::Hiredis, "connecting" do
let(:replies) do
# shove db number into PING reply since redis has no way
# of exposing the currently selected DB
replies = {
:select => lambda { |db| $db = db; "+OK" },
:ping => lambda { "+PONG #{$db}" },
:auth =... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/pubsub_spec.rb | Ruby | mit | 220 | master | 9,813 | require 'spec_helper'
describe EventMachine::Hiredis::PubsubClient, '(un)subscribe' do
describe "subscribing" do
it "should return deferrable which succeeds with subscribe call result" do
connect do |redis|
df = redis.pubsub.subscribe("channel") { }
df.should be_kind_of(EventMachine::Defaul... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/base_client_spec.rb | Ruby | mit | 220 | master | 3,170 | require 'spec_helper'
describe EM::Hiredis::BaseClient do
it "should be able to connect to redis (required for all tests!)" do
em {
redis = EM::Hiredis.connect
redis.callback {
done
}
redis.errback {
puts "CHECK THAT THE REDIS SERVER IS RUNNING ON PORT 6379"
fail
... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/inactivity_check_spec.rb | Ruby | mit | 220 | master | 1,562 | require 'spec_helper'
require 'support/inprocess_redis_mock'
def connect_mock(timeout = 10, url = "redis://localhost:6381", server = nil, &blk)
em(timeout) do
IRedisMock.start
redis = EventMachine::Hiredis.connect(url)
blk.call(redis)
IRedisMock.stop
end
end
describe EM::Hiredis::BaseClient do
i... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/url_param_spec.rb | Ruby | mit | 220 | master | 1,077 | # adapted from redis-rb
require 'spec_helper'
describe EventMachine::Hiredis, "URL parsing" do
it "defaults URL defaults to 127.0.0.1:6379" do
redis = EventMachine::Hiredis.setup
redis.host.should == "127.0.0.1"
redis.port.should == 6379
redis.db.should == 0
redis.password.should == nil
end
... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/redis_commands_spec.rb | Ruby | mit | 220 | master | 26,722 | require 'spec_helper'
describe EventMachine::Hiredis, "commands" do
it "pings" do
connect do |redis|
redis.ping { |r| r.should == 'PONG'; done }
end
end
it "SETs and GETs a key" do
connect do |redis|
redis.set('foo', 'nik')
redis.get('foo') { |r| r.should == 'nik'; done }
end
... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/spec_helper.rb | Ruby | mit | 220 | master | 425 | $:.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'em-hiredis'
require 'rspec'
require 'em-spec/rspec'
require 'support/connection_helper'
require 'support/redis_mock'
require 'stringio'
RSpec.configure do |config|
config.include ConnectionHelper
config.include EventMachine::SpecHelper
con... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/support/redis_mock.rb | Ruby | mit | 220 | master | 1,493 | # nabbed from redis-rb, thanks!
require "socket"
module RedisMock
def self.start(port = 6380)
server = TCPServer.new("127.0.0.1", port)
loop do
session = server.accept
while line = session.gets
parts = Array.new(line[1..-3].to_i) do
bytes = session.gets[1..-3].to_i
a... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/support/connection_helper.rb | Ruby | mit | 220 | master | 342 | module ConnectionHelper
# Use db 9 for tests to avoid flushing the main db
# It would be nice if there was a standard db number for testing...
def connect(timeout = 1, url = "redis://localhost:6379/9", &blk)
em(timeout) do
redis = EventMachine::Hiredis.connect(url)
redis.flushdb
blk.call(red... |
github | mloughran/em-hiredis | https://github.com/mloughran/em-hiredis | spec/support/inprocess_redis_mock.rb | Ruby | mit | 220 | master | 1,666 | module IRedisMock
def self.start(replies = {})
@sig = EventMachine::start_server("127.0.0.1", 6381, Connection)
@received = []
@replies = replies
@paused = false
end
def self.stop
EventMachine::stop_server(@sig)
end
def self.received
@received ||= []
end
def self.pause
@paus... |
github | zenhob/hcl | https://github.com/zenhob/hcl | Rakefile | Ruby | mit | 220 | master | 1,085 | require 'rubygems/tasks'
Gem::Tasks.new
# I am dumb and keep forgetting to update the bundle before releasing
task :update_bundle do
system("bundle")
system("git commit -am 'update gemfile.lock'")
end
task :release => [:update_bundle]
require 'fileutils'
task :clean do
FileUtils.rm_rf %w[ pkg coverage doc man/h... |
github | zenhob/hcl | https://github.com/zenhob/hcl | hcl.gemspec | Ruby | mit | 220 | master | 1,242 | $:.unshift(File.dirname(__FILE__) + '/lib')
require 'hcl'
Gem::Specification.new do |s|
s.name = "hcl"
s.version = HCl::VERSION
s.authors = ["Zack Hobson"]
s.email = "zack@zackhobson.com"
s.description = "HCl is a command-line client for manipulating Harvest time sheets."
s.executables = ["hcl"]
s.files... |
github | zenhob/hcl | https://github.com/zenhob/hcl | test/test_helper.rb | Ruby | mit | 220 | master | 1,265 | require 'bundler'
begin
require 'simplecov'
SimpleCov.start do
add_filter '/test/'
add_filter '/vendor/' # for travis-ci
add_filter do |source_file|
source_file.lines.count < 15
end
# source: https://travis-ci.org/zenhob/hcl
minimum_coverage 80
end
rescue LoadError
$stderr.puts 'N... |
github | zenhob/hcl | https://github.com/zenhob/hcl | test/utility_test.rb | Ruby | mit | 220 | master | 899 | require 'test_helper'
class UtilityTest < HCl::TestCase
include HCl::Utility
def test_get_task_ids
@settings = {'task.taco'=>'123 456'}
assert_equal ['123', '456'], get_task_ids('taco', [])
end
def test_get_ident_with_symbol
assert_equal 'taco', get_ident(%w[ +:25 @taco makin tacos ])
end
de... |
github | zenhob/hcl | https://github.com/zenhob/hcl | test/net_test.rb | Ruby | mit | 220 | master | 1,640 | require 'test_helper'
class NetTest < HCl::TestCase
def test_configure
assert_equal 'bob', http.login
assert_equal 'secret', http.password
assert_equal 'bobclock', http.subdomain
end
def test_redirect_failure
register_status(:get, "/taco", 302)
assert_raises(HCl::HarvestMiddleware::Failure)... |
github | zenhob/hcl | https://github.com/zenhob/hcl | test/day_entry_test.rb | Ruby | mit | 220 | master | 1,948 | require 'test_helper'
class DayEntryTest < HCl::TestCase
def test_project_info
register_uri(:get, '/daily', {projects:[], day_entries:[{project_id:123}]})
register_uri(:get, '/projects/123', {project:{name:'fun times'}})
assert_equal 'fun times', HCl::DayEntry.today(http).first.project_info(http).name
... |
github | zenhob/hcl | https://github.com/zenhob/hcl | test/app_test.rb | Ruby | mit | 220 | master | 2,077 | require 'test_helper'
class AppTest < HCl::TestCase
def setup
super
# touch config to avoid triggering manual config
FileUtils.mkdir_p HCl::App::HCL_DIR
FileUtils.touch File.join(HCl::App::HCL_DIR, "config.yml")
end
def test_commands
app = HCl::App.new
assert HCl::Commands.instance_metho... |
github | zenhob/hcl | https://github.com/zenhob/hcl | test/command_test.rb | Ruby | mit | 220 | master | 4,498 | require 'test_helper'
class CommandTest < HCl::TestCase
include HCl::Commands
include HCl::Utility
def setup
super
@settings = {}
end
# the current_time utility method needs to be deterministic
def current_time
'high noon'
end
# stub settings helpers
def write_settings; end
def read_s... |
github | zenhob/hcl | https://github.com/zenhob/hcl | test/task_test.rb | Ruby | mit | 220 | master | 1,879 | class TaskTest < HCl::TestCase
def test_cache_file
assert_equal "#{HCl::App::HCL_DIR}/cache/tasks.yml", HCl::Task.cache_file
end
def test_cache_tasks_hash
HCl::Task.cache_tasks_hash({ projects: [ {
name: "taco tasks",
id: 3,
client: "Taco Town",
tasks: [{
name: "... |
github | zenhob/hcl | https://github.com/zenhob/hcl | test/ext/capture_output.rb | Ruby | mit | 220 | master | 379 | module CaptureOutput
def before_setup
super
@stderr = StringIO.new
@stdout = StringIO.new
$stderr = @stderr
$stdout = @stdout
end
def after_teardown
super
$stderr = STDERR
$stdout = STDOUT
end
def error_output
@stderr.string
end
def standard_output
@stdout.string
... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl.rb | Ruby | mit | 220 | master | 425 | module HCl
autoload :VERSION, 'hcl/version'
autoload :App, 'hcl/app'
autoload :Net, 'hcl/net'
autoload :Commands, 'hcl/commands'
autoload :Console, 'hcl/console'
autoload :TimesheetResource, 'hcl/timesheet_resource'
autoload :Utility, 'hcl/utility'
autoload :Project, 'hcl/project'
autoload :Task, 'hcl... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/harvest_middleware.rb | Ruby | mit | 220 | master | 1,615 | require 'faraday'
class HCl::HarvestMiddleware < Faraday::Request::BasicAuthentication
Faraday::Middleware.register_middleware harvest: ->{ self }
MIME_TYPE = 'application/json'.freeze
dependency do
require 'yajl'
require 'escape_utils'
end
def call(env)
# encode with and accept json
env[:r... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/app.rb | Ruby | mit | 220 | master | 6,101 | require 'yaml'
require 'fileutils'
require 'trollop'
require 'highline/import'
module HCl
class App
include HCl::Utility
include HCl::Commands
HCL_DIR = (ENV['HCL_DIR'] || "#{ENV['HOME']}/.hcl").freeze
SETTINGS_FILE = "#{HCL_DIR}/settings.yml".freeze
ALIAS_LIST = "#{HCL_DIR}/aliases".freeze
... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/day_entry.rb | Ruby | mit | 220 | master | 1,677 | module HCl
class DayEntry < TimesheetResource
include Utility
collection_name :day_entries
resources :today, 'daily', load_cb:->(data) { Task.cache_tasks_hash data }
resources(:daily) {|date| date ? "daily/#{date.strftime '%j/%Y'}" : 'daily' }
resource(:project_info, class_name:'Project') { "proj... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/task.rb | Ruby | mit | 220 | master | 1,711 | require 'yaml'
require 'fileutils'
module HCl
class Task < TimesheetResource
def self.cache_tasks_hash day_entry_hash
tasks = day_entry_hash[:projects].
map { |p| p[:tasks].map {|t| new t.merge(project:Project.new(p)) } }.flatten.uniq
unless tasks.empty?
FileUtils.mkdir_p(cache_dir)
... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/utility.rb | Ruby | mit | 220 | master | 1,577 | module HCl
class CommandError < StandardError; end
module Utility
def fail *message
raise CommandError, message.join(' ')
end
def get_task_ids ident, args
if @settings.key? "task.#{ident}"
@settings["task.#{ident}"].split(/\s+/)
else
[ident, args.shift]
end
e... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/commands.rb | Ruby | mit | 220 | master | 5,680 | require 'chronic'
require 'highline'
module HCl
module Commands
class Error < StandardError; end
def self.deprecate command, explanation
private_command = :"_deprecated_#{command}"
alias_method private_command, command
define_method command do |*args|
$stderr.puts "warning: #{comma... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/console.rb | Ruby | mit | 220 | master | 519 | require 'pp'
require 'pry'
module HCl
class Console
attr_reader :hcl
def initialize app
@hcl = app
prompt = $PROGRAM_NAME.split('/').last + "> "
columns = HighLine::SystemExtensions.terminal_size[0] rescue 80
binding.pry quiet: true,
prompt:[->(a,b,c){ prompt }],
print... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/timesheet_resource.rb | Ruby | mit | 220 | master | 2,091 | module HCl
class TimesheetResource
def initialize params
@data = params
end
def id
@data[:id]
end
def method_missing method, *args
@data.key?(method.to_sym) ? @data[method] : super
end
def respond_to? method, include_all=false
(@data && @data.key?(method.to_sym))... |
github | zenhob/hcl | https://github.com/zenhob/hcl | lib/hcl/net.rb | Ruby | mit | 220 | master | 949 | require 'hcl/harvest_middleware'
require 'faraday'
module HCl
class Net
# configuration accessors
CONFIG_VARS = [ :login, :password, :subdomain ].freeze.
each { |config_var| attr_reader config_var }
def config_hash
CONFIG_VARS.inject({}) {|c,k| c.update(k => send(k)) }
end
def initi... |
github | michelson/espinita | https://github.com/michelson/espinita | Rakefile | Ruby | mit | 220 | master | 691 | require 'rspec/core/rake_task'
require 'bundler'
require "bundler/setup"
require 'bundler/gem_tasks'
require 'appraisal'
require 'rspec/core/rake_task'
Bundler::GemHelper.install_tasks
desc 'Default: run unit tests.'
task :default => [:all]
desc 'Test the plugin under all supported Rails versions.'
task :all => ["a... |
github | michelson/espinita | https://github.com/michelson/espinita | Gemfile | Ruby | mit | 220 | master | 589 | source "https://rubygems.org"
# Declare your gem's dependencies in espinita.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead of in
... |
github | michelson/espinita | https://github.com/michelson/espinita | Appraisals | Ruby | mit | 220 | master | 322 | appraise "4.0" do
gem "rails", "~> 4.0.0"
gem "rspec-collection_matchers"
gem "shoulda", "3.5.0"
end
appraise "4.1" do
gem "rails", "~> 4.1.4"
gem 'rspec-collection_matchers'
gem "shoulda", "3.5.0"
end
appraise "5.1" do
gem 'rails', '~> 5.1.0'
gem 'rspec-collection_matchers'
gem "shoulda", "3.5.0"
e... |
github | michelson/espinita | https://github.com/michelson/espinita | espinita.gemspec | Ruby | mit | 220 | master | 1,199 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "espinita/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "espinita"
s.version = Espinita::VERSION
s.authors = ["Miguel Michelson"]
s.email = ["miguelmiche... |
github | michelson/espinita | https://github.com/michelson/espinita | lib/espinita.rb | Ruby | mit | 220 | master | 437 | require "espinita/engine"
require "request_store"
module Espinita
autoload :Auditor, "espinita/auditor"
autoload :AuditorBehavior, "espinita/auditor_behavior"
autoload :AuditorRequest, "espinita/auditor_request"
class << self
attr_accessor :current_user_method
def current_user_method
@curr... |
github | michelson/espinita | https://github.com/michelson/espinita | lib/espinita/auditor_request.rb | Ruby | mit | 220 | master | 521 | module Espinita::AuditorRequest
extend ActiveSupport::Concern
included do
if Rails.version >= '5.1'
before_action :store_audited_user
else
before_filter :store_audited_user
end
end
def store_audited_user
# assign current_user if defined
RequestStore.store[:audited_user] = sel... |
github | michelson/espinita | https://github.com/michelson/espinita | lib/espinita/engine.rb | Ruby | mit | 220 | master | 523 | module Espinita
class Engine < ::Rails::Engine
isolate_namespace Espinita
config.generators do |g|
g.test_framework :rspec,
:fixture_replacement => :factory_girl ,
:dir => "spec/factories"
g.integration_tool :rspec
end
initializer "inc... |
github | michelson/espinita | https://github.com/michelson/espinita | lib/espinita/auditor_behavior.rb | Ruby | mit | 220 | master | 5,765 | module Espinita
module AuditorBehavior
extend ActiveSupport::Concern
included do
class_attribute :excluded_cols
class_attribute :audit_callbacks
attr_accessor :audit_comment
end
module ClassMethods
@@default_excluded = %w(lock_version created_at updated_at created_on updat... |
github | michelson/espinita | https://github.com/michelson/espinita | spec/spec_helper.rb | Ruby | mit | 220 | master | 748 | require 'coveralls'
Coveralls.wear!
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'rspec/collection_matchers'
require "factory_girl_rails"
require "database_cleaner"
require 'capybara'
require 'capybara/rspec... |
github | michelson/espinita | https://github.com/michelson/espinita | spec/controllers/audits_controller_spec.rb | Ruby | mit | 220 | master | 1,477 | require 'spec_helper'
class AuditsController < ActionController::Base
def audit
@general_model = FactoryGirl.create(:general_model)
render :nothing => true
end
def update_user
current_user.update_attributes( :password => 'foo')
render :nothing => true
end
private
attr_accessor :custom_us... |
github | michelson/espinita | https://github.com/michelson/espinita | spec/support/schema.rb | Ruby | mit | 220 | master | 853 | require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
#ActiveRecord::Base.logger = Logger.new(SPEC_ROOT.join('debug.log'))
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
create_table :users do |t|
t.string :name
... |
github | michelson/espinita | https://github.com/michelson/espinita | spec/dummy/db/schema.rb | Ruby | mit | 220 | master | 1,892 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... |
github | michelson/espinita | https://github.com/michelson/espinita | spec/dummy/db/migrate/20131029211126_create_general_models.rb | Ruby | mit | 220 | master | 251 | class CreateGeneralModels < ActiveRecord::Migration
def change
create_table :general_models do |t|
t.references :user, index: true
t.string :name
t.text :settings
t.integer :position
t.timestamps
end
end
end |
github | michelson/espinita | https://github.com/michelson/espinita | spec/dummy/config/application.rb | Ruby | mit | 220 | master | 882 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "espinita"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/i... |
github | michelson/espinita | https://github.com/michelson/espinita | spec/dummy/config/initializers/secret_token.rb | Ruby | mit | 220 | master | 659 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... |
github | michelson/espinita | https://github.com/michelson/espinita | spec/models/models/general_model_spec.rb | Ruby | mit | 220 | master | 13,874 | require 'spec_helper'
describe GeneralModel do
it{should have_many :audits}
let(:current_user) do
FactoryGirl.create(:user)
end
describe "model" do
let(:general_model) do
GeneralModel
end
it "general model checks" do
expect(subject.audits).to be_empty
end
it "general a... |
github | michelson/espinita | https://github.com/michelson/espinita | spec/factories/auditable_audits.rb | Ruby | mit | 220 | master | 254 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :espinita_audit, :class => 'Audit' do
auditable nil
user nil
audited_changes "MyText"
version 1
remote_address "MyString"
end
end |
github | michelson/espinita | https://github.com/michelson/espinita | spec/factories/general_models.rb | Ruby | mit | 220 | master | 200 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :general_model do
user nil
name "MyString"
settings "MyText"
position 1
end
end |
github | michelson/espinita | https://github.com/michelson/espinita | app/models/espinita/audit.rb | Ruby | mit | 220 | master | 1,486 | module Espinita
class Audit < ActiveRecord::Base
belongs_to :auditable, polymorphic: true
belongs_to :user, polymorphic: true
scope :descending, ->{ reorder("version DESC")}
scope :creates, ->{ where({:action => 'create'})}
scope :updates, ->{ where({:action => 'update'})}
sco... |
github | michelson/espinita | https://github.com/michelson/espinita | db/migrate/20131029200927_create_auditable_audits.rb | Ruby | mit | 220 | master | 398 | class CreateAuditableAudits < ActiveRecord::Migration
def change
create_table :espinita_audits do |t|
t.references :auditable, polymorphic: true, index: true
t.references :user, polymorphic: true, index: true
t.text :audited_changes
t.string :comment
t.integer :version
t.string... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | eeepub.gemspec | Ruby | mit | 220 | master | 819 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "eeepub"
s.version = "0.8.1"
s.platform = Gem::Platform::RUBY
s.authors = ["jugyo"]
s.email = ["jugyo.org@gmail.com"]
s.homepage = "http://github.com/jugyo/eeepub"
s.summary = %q{ePub generator}
s.descriptio... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | Rakefile | Ruby | mit | 220 | master | 431 | require 'bundler'
Bundler::GemHelper.install_tasks
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = ['--color']
end
rescue LoadError => e
puts "RSpec not installed"
end
task :default => :spec
begin
require 'yard'
YARD::Rake::YardocTask.new
rescue LoadError
task :... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | lib/eeepub.rb | Ruby | mit | 220 | master | 300 | require 'eeepub/container_item'
require 'eeepub/opf'
require 'eeepub/ocf'
require 'eeepub/ncx'
require 'eeepub/maker'
require 'eeepub/easy'
module EeePub
# Make ePub
#
# @param [Proc] block the block for initialize EeePub::Maker
def self.make(&block)
EeePub::Maker.new(&block)
end
end |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | lib/eeepub/container_item.rb | Ruby | mit | 220 | master | 2,773 | require 'builder'
module EeePub
# Abstract base class for container item of ePub. Provides some helper methods.
#
# @abstract
class ContainerItem
class << self
private
# Set default value to attribute
#
# @param [Symbol] name the attribute name
# @param [Object] default the ... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | lib/eeepub/ncx.rb | Ruby | mit | 220 | master | 1,978 | module EeePub
class NCX < ContainerItem
attr_accessor :uid,
:depth,
:total_page_count,
:max_page_number,
:doc_title,
:nav_map
attr_alias :title, :doc_title
attr_alias :nav, :nav_map
default_value :depth, 1
... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | lib/eeepub/opf.rb | Ruby | mit | 220 | master | 4,025 | module EeePub
class OPF < ContainerItem
attr_accessor :unique_identifier,
:title,
:language,
:identifier,
:date,
:subject,
:description,
:relation,
:creator,
... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | lib/eeepub/maker.rb | Ruby | mit | 220 | master | 4,031 | require 'tmpdir'
require 'fileutils'
module EeePub
# The class to make ePub easily
#
# Note on unique identifiers:
#
# At least one 'identifier' must be the unique identifer represented by the name
# given to 'uid' and set via the hash option :id => {name}. The default name for
# uid is 'BookId' a... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | lib/eeepub/easy.rb | Ruby | mit | 220 | master | 2,494 | require 'tmpdir'
require 'fileutils'
module EeePub
# The class to make ePub more easily
#
# @example
# epub = EeePub::Easy.new do
# title 'sample'
# creator 'jugyo'
# identifier 'http://example.com/book/foo', :scheme => 'URL'
# uid 'http://example.com/book/foo'
# end
#
# ... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | lib/eeepub/ocf.rb | Ruby | mit | 220 | master | 3,282 | require 'zip/zip'
module EeePub
# Class to create OCF
class OCF
# Class for 'container.xml' of OCF
class Container < ContainerItem
attr_accessor :rootfiles
# @param [String or Array or Hash]
#
# @example
# # with String
# EeePub::OCF::Container.new('container.opf')
... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | examples/simple_epub.rb | Ruby | mit | 220 | master | 674 | $:.unshift(File.dirname(__FILE__) + '/../lib')
require 'rubygems'
require 'eeepub'
dir = File.join(File.dirname(__FILE__), 'files')
epub = EeePub.make do
title 'sample'
creator 'jugyo'
publisher 'jugyo.org'
date '2010-05-06'
uid 'BookId'
identifier 'http://example.com/book/foo'... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | spec/spec_helper.rb | Ruby | mit | 220 | master | 269 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'eeepub'
require 'rspec'
require 'nokogiri'
require 'rr'
require 'simplecov'
RSpec.configure do |config|
config.mock_with :rr
end
SimpleCov.start |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | spec/eeepub/ncx_spec.rb | Ruby | mit | 220 | master | 2,906 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'tmpdir'
require 'fileutils'
describe "EeePub::NCX" do
before do
@ncx = EeePub::NCX.new(
:uid => 'uid',
:nav_map => [
{:label => 'foo', :content => 'foo.html'},
{:label => 'bar', :content => 'bar.html'}
... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | spec/eeepub/easy_spec.rb | Ruby | mit | 220 | master | 1,744 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "EeePub::Easy" do
before do
@easy = EeePub::Easy.new do
title 'sample'
creator 'jugyo'
identifier 'http://example.com/book/foo', :scheme => 'URL'
uid 'http://example.com/book/foo'
end
@easy.sections << ... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | spec/eeepub/opf_spec.rb | Ruby | mit | 220 | master | 9,110 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'date'
describe "EeePub::OPF" do
before do
@opf = EeePub::OPF.new(
:identifier => {:value => '978-4-00-310101-8', :scheme => 'ISBN'},
:files => ['foo.html', 'bar.html', 'picture.png'],
:ncx => 'toc.ncx'
)
end
... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | spec/eeepub/container_item_spec.rb | Ruby | mit | 220 | master | 581 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "EeePub::ContainerItem" do
context 'guess media type' do
before :each do
@container_item = EeePub::ContainerItem.new []
end
it 'should be application/xhtml+xml' do
media_type = 'application/xhtml+xml'
['t... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | spec/eeepub/maker_spec.rb | Ruby | mit | 220 | master | 4,577 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "EeePub::Maker" do
before do
@maker = EeePub::Maker.new do
title 'sample'
creator 'jugyo'
publisher 'jugyo.org'
date "2010-05-06"
language 'en'
subject 'epub sample'
description 'this is epub s... |
github | jugyo/eeepub | https://github.com/jugyo/eeepub | spec/eeepub/ocf_spec.rb | Ruby | mit | 220 | master | 1,487 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'tmpdir'
require 'fileutils'
describe "EeePub::OCF" do
before do
@tmpdir = File.join(Dir.tmpdir, 'eeepub_test')
FileUtils.mkdir_p(@tmpdir)
@container = EeePub::OCF::Container.new('foo.opf')
@ocf = EeePub::OCF.new(:dir => @t... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | health-monitor-rails.gemspec | Ruby | mit | 219 | master | 862 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path('lib', __dir__)
require 'health_monitor/version'
Gem::Specification.new do |s|
s.name = 'health-monitor-rails'
s.version = HealthMonitor::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Leonid Beder']
s.email = ['leonid.beder@gmail.com']
... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | Gemfile | Ruby | mit | 219 | master | 497 | # frozen_string_literal: true
source 'https://rubygems.org'
gem 'appraisal'
gem 'capybara'
gem 'capybara-screenshot'
gem 'database_cleaner'
gem 'delayed_job_active_record', '>= 4.1'
gem 'mock_redis'
gem 'pry'
gem 'rake'
gem 'redis-client'
gem 'resque'
gem 'rspec-rails'
gem 'rubocop'
gem 'rubocop-capybara'
gem 'ruboco... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | Rakefile | Ruby | mit | 219 | master | 250 | #!/usr/bin/env rake
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
RSpec::Core::RakeTask.new('spec')
Bundler::GemHelper.install_tasks
task default: :spec
RuboCop::RakeTask.new |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | config/routes.rb | Ruby | mit | 219 | master | 231 | # frozen_string_literal: true
HealthMonitor::Engine.routes.draw do
path =
if HealthMonitor.configuration.path.present?
HealthMonitor.configuration.path
else
:check
end
get path, to: 'health#check'
end |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | extra/check_rails.rb | Ruby | mit | 219 | master | 2,336 | #!/usr/bin/env ruby
# frozen_string_literal: true
#===============================================================================
# FILE: check_rails.rb
# USAGE: ./check_rails.rb -u <uri>
# DESCRIPTION: check Rails application status
# AUTHOR: Rodriguez Nicolas <nicoladmin@free.fr>
# LICENS... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | app/controllers/health_monitor/health_controller.rb | Ruby | mit | 219 | master | 1,372 | # frozen_string_literal: true
module HealthMonitor
class HealthController < ActionController::Base
protect_from_forgery with: :exception
if Rails.version.starts_with? '3'
before_filter :authenticate_with_basic_auth
else
before_action :authenticate_with_basic_auth
end
def check
... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/spec_helper.rb | Ruby | mit | 219 | master | 1,508 | # frozen_string_literal: true
require 'rubygems'
require 'spork'
require 'sidekiq'
Spork.prefork do
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('dummy/config/environment.rb', __dir__)
require 'rspec/rails'
require 'database_cleaner'
require 'pry'
require 'timecop'
require 'mock_redis'
requi... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/dummy/db/schema.rb | Ruby | mit | 219 | master | 794 | # frozen_string_literal: true
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the auth... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/dummy/config/initializers/secret_token.rb | Ruby | mit | 219 | master | 566 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words ... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/dummy/config/initializers/backtrace_silencers.rb | Ruby | mit | 219 | master | 439 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your
# backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers ... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/dummy/config/environments/development.rb | Ruby | mit | 219 | master | 729 | # frozen_string_literal: true
Dummy::Application.configure do
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Print... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/dummy/config/environments/production.rb | Ruby | mit | 219 | master | 2,849 | # frozen_string_literal: true
Dummy::Application.configure do
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform bett... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/dummy/config/environments/test.rb | Ruby | mit | 219 | master | 791 | # frozen_string_literal: true
Dummy::Application.configure do
config.cache_classes = true
config.eager_load = true
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception t... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/support/shared_examples.rb | Ruby | mit | 219 | master | 474 | # frozen_string_literal: true
shared_examples 'expiring value in the redis' do
context 'when a value being set' do
let(:redis_key) { 'health:0.0.0.0' }
it 'removes this one in the future' do
subject.check!
expect(subject.send(:redis).with { |r| r.get(redis_key) }).to be_present
travel_to... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/support/providers.rb | Ruby | mit | 219 | master | 5,269 | # frozen_string_literal: true
require 'spec_helper'
require 'rspec/mocks'
module Providers
include RSpec::Mocks::ExampleMethods
extend self
def stub_cache_failure
allow(Rails.cache).to receive(:read).and_return(false)
end
def stub_database_failure(database = nil)
allow_any_instance_of(ActiveRecor... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/support/capybara.rb | Ruby | mit | 219 | master | 246 | # frozen_string_literal: true
require 'capybara/rspec'
require 'capybara/rails'
require 'capybara-screenshot/rspec'
Capybara.app = HealthMonitor::Engine
RSpec.configure do |config|
config.include HealthMonitor::Engine.routes.url_helpers
end |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/controllers/health_monitor/health_controller_spec.rb | Ruby | mit | 219 | master | 7,178 | # frozen_string_literal: true
require 'spec_helper'
require 'timecop'
require './app/controllers/health_monitor/health_controller'
describe HealthMonitor::HealthController, type: :controller do
routes { HealthMonitor::Engine.routes }
let(:time) { Time.local(1990) }
before do
Timecop.freeze(time)
end
... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/configuration_spec.rb | Ruby | mit | 219 | master | 2,540 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Configuration do
describe 'defaults' do
it do
expect(subject.providers.length).to be(1)
expect(subject.providers.first).to be_a(HealthMonitor::Providers::Database)
end
it { expect(subject.error_callback).to be_nil }... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/monitor_spec.rb | Ruby | mit | 219 | master | 9,548 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor do
let(:time) { Time.now.to_formatted_s(:rfc2822) }
let(:request) { test_request }
before do
described_class.configuration = HealthMonitor::Configuration.new
Timecop.freeze(time)
end
after do
Timecop.return
end
de... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/file_absence_spec.rb | Ruby | mit | 219 | master | 1,900 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::FileAbsence do
subject { described_class.new }
context 'with defaults' do
it { expect(subject.configuration.name).to eq('FileAbsence') }
it { expect(subject.configuration.filename).to eq(HealthMonitor::Providers::FileA... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/resque_spec.rb | Ruby | mit | 219 | master | 647 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::Resque do
subject { described_class.new }
describe '#name' do
it { expect(subject.name).to eq('Resque') }
end
describe '#check!' do
before { subject.request = test_request }
it 'succesfully checks' do
e... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/base_spec.rb | Ruby | mit | 219 | master | 696 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::Base do
subject { described_class.new }
describe '#initialize' do
it 'sets the configuration' do
expect(subject.configuration).to be_a(HealthMonitor::Providers::Base::Configuration)
end
end
describe '#name' ... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/sidekiq_spec.rb | Ruby | mit | 219 | master | 3,965 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::Sidekiq do
subject { described_class.new }
let(:default_queue_name) { HealthMonitor::Providers::Sidekiq::Configuration::DEFAULT_QUEUE_NAME }
context 'with defaults' do
let(:default_latency) { HealthMonitor::Providers::S... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/delayed_job_spec.rb | Ruby | mit | 219 | master | 1,338 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::DelayedJob do
subject { described_class.new }
describe 'defaults' do
it { expect(subject.configuration.name).to eq('DelayedJob') }
it { expect(subject.configuration.queue_size).to eq(HealthMonitor::Providers::DelayedJo... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/solr_spec.rb | Ruby | mit | 219 | master | 6,693 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::Solr do
subject { described_class.new }
context 'with defaults' do
it { expect(subject.configuration.name).to eq('Solr') }
it { expect(subject.configuration.url).to eq(HealthMonitor::Providers::Solr::Configuration::DEF... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/redis_spec.rb | Ruby | mit | 219 | master | 4,540 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::Redis do
subject { described_class.new }
context 'with defaults' do
it { expect(subject.configuration.name).to eq('Redis') }
it { expect(subject.configuration.url).to eq(HealthMonitor::Providers::Redis::Configuration::... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/cache_spec.rb | Ruby | mit | 219 | master | 1,184 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::Cache do
subject { described_class.new }
describe '#name' do
it { expect(subject.name).to eq('Cache') }
end
describe '#check!' do
subject { described_class.new }
before { subject.request = test_request }
... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/lib/health_monitor/providers/database_spec.rb | Ruby | mit | 219 | master | 2,199 | # frozen_string_literal: true
require 'spec_helper'
describe HealthMonitor::Providers::Database do
subject { described_class.new }
describe '#name' do
it { expect(subject.name).to eq('Database') }
end
describe '#check!' do
subject { described_class.new }
before { subject.request = test_request ... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | spec/features/health_monitor/health_monitor_spec.rb | Ruby | mit | 219 | master | 2,394 | # frozen_string_literal: true
require 'spec_helper'
describe 'Health Monitor' do
context 'when check is ok' do
it 'renders html' do
visit '/check'
expect(page).to have_css('h2', count: 1)
expect(page).to have_css('h2', text: 'Services')
expect(page).to have_css('.services dt.name', text:... |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | lib/health-monitor-rails.rb | Ruby | mit | 219 | master | 204 | # rubocop:disable Naming/FileName
# frozen_string_literal: true
require 'health_monitor/engine'
require 'health_monitor/configuration'
require 'health_monitor/monitor'
# rubocop:enable Naming/FileName |
github | lbeder/health-monitor-rails | https://github.com/lbeder/health-monitor-rails | lib/health_monitor/configuration.rb | Ruby | mit | 219 | master | 1,216 | # frozen_string_literal: true
module HealthMonitor
class Configuration
PROVIDERS = %i[cache database delayed_job file_absence redis resque sidekiq solr].freeze
attr_accessor :basic_auth_credentials,
:environment_variables,
:error_callback,
:hide_footer,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.