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 | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/folder.rb | Ruby | apache-2.0 | 249 | main | 1,307 | module Viewpoint::EWS::Types
class Folder
include Viewpoint::EWS
include Viewpoint::EWS::Types
include Viewpoint::EWS::Types::GenericFolder
FOLDER_KEY_PATHS = {
:unread_count => [:unread_count, :text],
}
FOLDER_KEY_TYPES = {
:unread_count => ->(str){str.to_i},
}
... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/file_attachment.rb | Ruby | apache-2.0 | 249 | main | 1,713 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/item.rb | Ruby | apache-2.0 | 249 | main | 14,321 | module Viewpoint::EWS::Types
module Item
include Viewpoint::EWS
include Viewpoint::EWS::Types
include ItemFieldUriMap
def self.included(klass)
klass.extend ClassMethods
end
module ClassMethods
def init_simple_item(ews, id, change_key = nil, parent = nil)
ews_item = {item_... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/item_field_uri_map.rb | Ruby | apache-2.0 | 249 | main | 16,020 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/copied_event.rb | Ruby | apache-2.0 | 249 | main | 1,309 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/generic_folder.rb | Ruby | apache-2.0 | 249 | main | 13,993 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/task.rb | Ruby | apache-2.0 | 249 | main | 1,040 | module Viewpoint::EWS::Types
class Task
include Viewpoint::EWS
include Viewpoint::EWS::Types
include Viewpoint::EWS::Types::Item
TASK_KEY_PATHS = {
complete?: [:is_complete, :text],
recurring?: [:is_recurring, :text],
start_date: [:start_date, :text],
... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/event.rb | Ruby | apache-2.0 | 249 | main | 1,512 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/export_items_response_message.rb | Ruby | apache-2.0 | 249 | main | 897 | module Viewpoint::EWS::Types
class ExportItemsResponseMessage
include Viewpoint::EWS
include Viewpoint::EWS::Types
include Viewpoint::EWS::Types::Item
BULK_KEY_PATHS = {
:id => [:item_id, :attribs, :id],
:change_key => [:item_id, :attribs, :change_key],
:data => ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/new_mail_event.rb | Ruby | apache-2.0 | 249 | main | 765 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/free_busy_changed_event.rb | Ruby | apache-2.0 | 249 | main | 773 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/created_event.rb | Ruby | apache-2.0 | 249 | main | 765 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/types/moved_event.rb | Ruby | apache-2.0 | 249 | main | 1,302 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/templates/reply_to_item.rb | Ruby | apache-2.0 | 249 | main | 582 | module Viewpoint::EWS
module Template
class ReplyToItem < Message
# Format this object for EWS backend consumption.
def to_ews
ews_opts, msg = to_ews_basic
msg[:reference_item_id] = reference_item_id
msg[:new_body_content] = {text: new_body_content, body_type: new_body_type}
... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/templates/message.rb | Ruby | apache-2.0 | 249 | main | 2,103 | module Viewpoint::EWS
module Template
class Message < OpenStruct
def initialize(opts = {})
super opts.clone
init_defaults!
end
# Format this object for EWS backend consumption.
def to_ews
ews_opts, msg = to_ews_basic
ews_opts.merge({items: [{message: msg}]... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/templates/task.rb | Ruby | apache-2.0 | 249 | main | 2,710 | module Viewpoint::EWS
module Template
# Template for creating Tasks
# @see http://msdn.microsoft.com/en-us/library/exchange/aa564765.aspx
class Task < OpenStruct
# Available parameters with the required ordering
PARAMETERS = %w{mime_content item_id parent_folder_id item_class subject sensitivity bo... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/templates/forward_item.rb | Ruby | apache-2.0 | 249 | main | 545 | module Viewpoint::EWS
module Template
class ForwardItem < Message
# Format this object for EWS backend consumption.
def to_ews
ews_opts, msg = to_ews_basic
msg[:reference_item_id] = reference_item_id
msg[:new_body_content] = {text: new_body_content, body_type: new_body_type}
... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/ews/templates/calendar_item.rb | Ruby | apache-2.0 | 249 | main | 3,344 | module Viewpoint::EWS
module Template
# Template for creating CalendarItems
# @see http://msdn.microsoft.com/en-us/library/exchange/aa564765.aspx
class CalendarItem < OpenStruct
# Available parameters with the required ordering
PARAMETERS = %w{mime_content item_id parent_folder_id item_class subjec... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/viewpoint/string_utils.rb | Ruby | apache-2.0 | 249 | main | 2,447 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/viewpoint/logging.rb | Ruby | apache-2.0 | 249 | main | 825 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | WinRb/Viewpoint | https://github.com/WinRb/Viewpoint | lib/viewpoint/logging/config.rb | Ruby | apache-2.0 | 249 | main | 841 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License ... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | Gemfile | Ruby | mit | 248 | master | 283 | source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'sqlite3'
# asset pipeline
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# gems for omniauth and devise
gem 'devise'
gem 'omniauth' |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | Rakefile | Ruby | mit | 248 | master | 277 | # Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
OauthProviderDemo::Application.load_tasks |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | db/seeds.rb | Ruby | mit | 248 | master | 335 | ClientApplication.delete_all
User.delete_all
ClientApplication.create(
:name => "secret",
:app_id => "demo_id",
:app_secret => "demo_secret"
)
User.create(
:username => "demo",
:password_hash => User.hash_password("password", "salt"),
:password_salt => "salt",
:status => "Active",
:expiration_date => ... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | db/schema.rb | Ruby | mit | 248 | master | 2,472 | # 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 | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | db/migrate/20110203105441_create_client.rb | Ruby | mit | 248 | master | 248 | class CreateClient < ActiveRecord::Migration
def self.up
create_table :clients do |t|
t.string :name
t.string :app_id
t.string :app_secret
t.timestamps
end
end
def self.down
drop_table :clients
end
end |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | db/migrate/20101007181515_create_users.rb | Ruby | mit | 248 | master | 1,117 | class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | db/migrate/20110202133040_create_authentications.rb | Ruby | mit | 248 | master | 272 | class CreateAuthentications < ActiveRecord::Migration
def self.up
create_table :authentications do |t|
t.integer :user_id
t.string :provider
t.string :uid
t.timestamps
end
end
def self.down
drop_table :authentications
end
end |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | db/migrate/20101007181933_create_access_grants.rb | Ruby | mit | 248 | master | 369 | class CreateAccessGrants < ActiveRecord::Migration
def self.up
create_table :access_grants do |t|
t.string :code
t.string :access_token
t.string :refresh_token
t.datetime :access_token_expires_at
t.integer :user_id
t.integer :client_id
t.timestamps
end
end
def s... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | app/models/user.rb | Ruby | mit | 248 | master | 1,026 | class User < ActiveRecord::Base
has_many :authentications, :dependent => :delete_all
has_many :access_grants, :dependent => :delete_all
before_validation :initialize_fields, :on => :create
devise :database_authenticatable, :registerable, :token_authenticatable,
:recoverable, :timeoutable, :trackable,... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | app/models/access_grant.rb | Ruby | mit | 248 | master | 922 | class AccessGrant < ActiveRecord::Base
belongs_to :user
belongs_to :client
before_create :generate_tokens
def self.prune!
delete_all(["created_at < ?", 3.days.ago])
end
def self.authenticate(code, application_id)
AccessGrant.where("code = ? AND client_id = ?", code, application_id).first
end
... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | app/controllers/authentications_controller.rb | Ruby | mit | 248 | master | 2,697 | class AuthenticationsController < ApplicationController
before_filter :authenticate_user!, :except => [:create, :link, :add]
def index
@authentications = current_user.authentications.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @authentications }
end... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | app/controllers/auth_controller.rb | Ruby | mit | 248 | master | 2,029 | class AuthController < ApplicationController
before_filter :authenticate_user!, :except => [:access_token]
skip_before_filter :verify_authenticity_token, :only => [:access_token]
def welcome
render :text => "Hiya! #{current_user.first_name} #{current_user.last_name}"
end
def authorize
AccessGrant.pr... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | app/controllers/registrations_controller.rb | Ruby | mit | 248 | master | 1,100 | class RegistrationsController < Devise::RegistrationsController
def new
# Building the resource with information that MAY BE available from omniauth!
build_resource(:first_name => session[:omniauth] && session[:omniauth]['user_info'] && session[:omniauth]['user_info']['first_name'],
:last_name => s... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | config/application.rb | Ruby | mit | 248 | master | 2,179 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
if defined?(Bundler)
Bundler.require(*Rails.groups(:assets =... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | config/routes.rb | Ruby | mit | 248 | master | 789 | OauthProviderDemo::Application.routes.draw do
devise_for :users, :controllers => { :registrations => 'registrations',
:sessions => 'sessions'}
# omniauth client stuff
match '/auth/:provider/callback', :to => 'authentications#create'
match '/auth/failure', :to => 'authentic... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | config/environments/test.rb | Ruby | mit | 248 | master | 1,613 | OauthProviderDemo::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# 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... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | config/environments/production.rb | Ruby | mit | 248 | master | 1,735 | OauthProviderDemo::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | config/environments/development.rb | Ruby | mit | 248 | master | 1,011 | OauthProviderDemo::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | config/initializers/session_store.rb | Ruby | mit | 248 | master | 439 | # Be sure to restart your server when you modify this file.
OauthProviderDemo::Application.config.session_store :cookie_store, :key => '_oauth-provider-demo_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the se... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | config/initializers/devise.rb | Ruby | mit | 248 | master | 8,125 | # Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = "please-change-me@con... |
github | joshsoftware/sso-devise-omniauth-provider | https://github.com/joshsoftware/sso-devise-omniauth-provider | config/initializers/secret_token.rb | Ruby | mit | 248 | master | 508 | # Be sure to restart your server when you modify this file.
# Your secret key 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 dictionary attac... |
github | chadrem/workers | https://github.com/chadrem/workers | workers.gemspec | Ruby | mit | 247 | master | 901 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'workers/version'
Gem::Specification.new do |spec|
spec.name = "workers"
spec.version = Workers::VERSION
spec.authors = ["Chad Remesch"]
spec.email = ["chad@re... |
github | chadrem/workers | https://github.com/chadrem/workers | test/workers_test.rb | Ruby | mit | 247 | master | 363 | require 'test_helper'
class WorkersTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Workers::VERSION
end
def test_parallel_map
result = Workers.map([1, 2, 3, 4, 5], :max_tries => 100) do |i|
if rand <= 0.5
raise 'sad face'
end
i * i
end
assert_... |
github | chadrem/workers | https://github.com/chadrem/workers | test/timer_test.rb | Ruby | mit | 247 | master | 630 | require 'test_helper'
class TimerTest < Minitest::Test
def test_basic_usage_with_default_scheduler
perform_basic_test(Workers.scheduler)
end
def test_basic_usage_with_bucket_scheduler
scheduler = Workers::BucketScheduler.new
perform_basic_test(scheduler)
ensure
scheduler.dispose
end
priva... |
github | chadrem/workers | https://github.com/chadrem/workers | test/task_test.rb | Ruby | mit | 247 | master | 1,032 | require 'test_helper'
class TaskTest < Minitest::Test
def test_basic_usage
counter = 0
perform_success = false
finished_success = false
task = Workers::Task.new(
:input => [1, 2, 3],
:on_perform => proc { |input|
counter += 1
raise 'uh oh' if counter < 3
perform_s... |
github | chadrem/workers | https://github.com/chadrem/workers | test/worker_test.rb | Ruby | mit | 247 | master | 582 | require 'test_helper'
class WorkerTest < Minitest::Test
def test_basic_usage
worker = Workers::Worker.new
success = false
worker.perform { success = true }
assert(worker.dispose(5))
assert(success)
assert_equal(false, worker.alive?)
end
def test_exception_during_perform
worker = Wo... |
github | chadrem/workers | https://github.com/chadrem/workers | test/task_group_test.rb | Ruby | mit | 247 | master | 661 | require 'test_helper'
class TaskGroupTest < Minitest::Test
def test_basic_usage
group = Workers::TaskGroup.new
10.times do |i|
10.times do |j|
group.add do
group.synchronize do
i * j
end
end
end
end
group.run
assert_equal(100, group.s... |
github | chadrem/workers | https://github.com/chadrem/workers | test/periodic_timer_test.rb | Ruby | mit | 247 | master | 666 | require 'test_helper'
class PeriodicTimerTest < Minitest::Test
def test_basic_usage_with_default_scheduler
perform_basic_test(Workers.scheduler)
end
def test_basic_usage_with_bucket_scheduler
scheduler = Workers::BucketScheduler.new
perform_basic_test(scheduler)
ensure
scheduler.dispose
end
... |
github | chadrem/workers | https://github.com/chadrem/workers | test/pool_test.rb | Ruby | mit | 247 | master | 1,149 | require 'test_helper'
class PoolTest < Minitest::Test
def test_basic_usage
pool = Workers::Pool.new
successes = []
pool.size.times do
pool.perform { successes << true }
end
assert(pool.dispose(5))
assert(Array.new(pool.size, true), successes)
end
def test_exception_during_perform... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers.rb | Ruby | mit | 247 | master | 1,087 | require 'thread'
require 'monitor'
require 'set'
require 'workers/version'
require 'workers/exceptions'
require 'workers/helpers'
require 'workers/worker'
require 'workers/pool'
require 'workers/event'
require 'workers/log_proxy'
require 'workers/scheduler'
require 'workers/bucket_scheduler'
require 'workers/timer'
re... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/pool.rb | Ruby | mit | 247 | master | 2,313 | module Workers
class Pool
include Workers::Helpers
DEFAULT_POOL_SIZE = 20
attr_accessor :on_exception
def initialize(options = {})
@logger = Workers::LogProxy.new(options[:logger])
@worker_class = options[:worker_class] || Workers::Worker
@input_queue = Queue.new
@lock = Mon... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/exceptions.rb | Ruby | mit | 247 | master | 366 | module Workers
class WorkersError < RuntimeError; end
class UnknownEventError < WorkersError; end
class JoinError < WorkersError; end
class FailedTaskError < WorkersError; end
class InvalidStateError < WorkersError; end
class MaxTriesError < WorkersError; end
class MissingCallbackError < WorkersError; end... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/log_proxy.rb | Ruby | mit | 247 | master | 484 | module Workers
class LogProxy
attr_accessor :logger
def initialize(logger)
@logger = logger.is_a?(Workers::LogProxy) ? logger.logger : logger
nil
end
def debug(msg)
@logger.debug(msg) if @logger
nil
end
def info(msg)
@logger.info(msg) if @logger
nil
... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/task.rb | Ruby | mit | 247 | master | 1,285 | module Workers
class Task
include Workers::Helpers
attr_reader :input
attr_reader :result
attr_reader :exception
attr_reader :state
attr_reader :max_tries
attr_reader :tries
def initialize(options = {})
@logger = Workers::LogProxy.new(options[:logger])
@input = options[:i... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/helpers.rb | Ruby | mit | 247 | master | 530 | module Workers
module Helpers
def log_debug(msg, e = nil)
(@_logger || @logger).debug(concat_e(msg, e))
end
def log_info(msg, e = nil)
(@_logger || @logger).info(concat_e(msg, e))
end
def log_warn(msg, e = nil)
(@_logger || @logger).warn(concat_e(msg, e))
end
def log_e... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/worker.rb | Ruby | mit | 247 | master | 2,341 | module Workers
class Worker
include Workers::Helpers
attr_accessor :exception
attr_accessor :on_exception
def initialize(options = {})
@logger = Workers::LogProxy.new(options[:logger])
@input_queue = options[:input_queue] || Queue.new
@on_exception = options[:on_exception]
@r... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/bucket_scheduler.rb | Ruby | mit | 247 | master | 889 | module Workers
class BucketScheduler
DEFAULT_BUCKET_SIZE = 100
DEFAULT_POOL_SIZE = 1
def initialize(options = {})
options[:bucket_size] ||= DEFAULT_BUCKET_SIZE
options[:pool_size] ||= DEFAULT_POOL_SIZE
@logger = Workers::LogProxy.new(options[:logger])
@options = options
@... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/task_group.rb | Ruby | mit | 247 | master | 2,717 | module Workers
class TaskGroup
include Workers::Helpers
attr_reader :state
attr_reader :tasks
def initialize(options = {})
@logger = Workers::LogProxy.new(options[:logger])
@pool = options[:pool] || Workers.pool
@state = :initialized
@tasks = []
@internal_lock = Mutex.n... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/timer.rb | Ruby | mit | 247 | master | 1,039 | module Workers
class Timer
include Workers::Helpers
attr_reader :delay
attr_reader :repeat
def initialize(delay, options = {}, &block)
@logger = Workers::LogProxy.new(options[:logger])
@delay = delay
@callback = options[:callback] || block
@repeat = options[:repeat] || false
... |
github | chadrem/workers | https://github.com/chadrem/workers | lib/workers/scheduler.rb | Ruby | mit | 247 | master | 1,511 | module Workers
class Scheduler
include Workers::Helpers
def initialize(options = {})
@logger = Workers::LogProxy.new(options[:logger])
@pool = options[:pool] || Workers::Pool.new
@schedule = SortedSet.new
@mutex = Mutex.new
@thread = Thread.new { start_loop }
nil
end
... |
github | radeno/nanoid.rb | https://github.com/radeno/nanoid.rb | nanoid.gemspec | Ruby | mit | 247 | master | 851 | require File.expand_path('../lib/nanoid/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'nanoid'
s.version = Gem::Version.new(NanoId::VERSION)
s.authors = ['Radovan Smitala']
s.license = 'MIT'
s.homepage = 'https://github.com/radeno/nanoid.rb'
s.summary = 'R... |
github | radeno/nanoid.rb | https://github.com/radeno/nanoid.rb | lib/nanoid.rb | Ruby | mit | 247 | master | 1,347 | require 'securerandom'
module Nanoid
SAFE_ALPHABET = '_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.freeze
def self.generate(size: 21, alphabet: SAFE_ALPHABET, non_secure: false)
return non_secure_generate(size: size, alphabet: alphabet) if non_secure
return simple_generate(size: size... |
github | radeno/nanoid.rb | https://github.com/radeno/nanoid.rb | test/nanoid_test.rb | Ruby | mit | 247 | master | 1,457 | # frozen_string_literal: true
require_relative 'test_helper'
describe Nanoid do
it 'has correct size' do
count = 100
count.times do
id = Nanoid.generate
assert_equal(id.size, 21)
end
end
it 'generates URL-friendly IDs' do
count = 100
count.times do
id = Nanoid.generate
... |
github | radeno/nanoid.rb | https://github.com/radeno/nanoid.rb | test/generate_benchmark.rb | Ruby | mit | 247 | master | 375 | require 'benchmark/ips'
require_relative '../lib/nanoid'
Benchmark.ips do |x|
# Configure the number of seconds used during
# the warmup phase (default 2) and calculation phase (default 5)
x.config(time: 5, warmup: 2)
x.report("secure") do
Nanoid.generate
end
x.report("non-secure") do |times|
Nan... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | Rakefile | Ruby | mit | 247 | master | 315 | require 'rake'
require 'fileutils'
Dir.chdir File.dirname(__FILE__)
load 'rake/common.rb'
Dir['rake/*.rb'].each { |f| load f unless f =~ %r{/common.rb} }
task gem: ['gem:build', 'gem:tag', 'gem:push']
task rubocop: 'rubocop:all'
task style: :rubocop
task spec: 'spec:all'
task test: :spec
task default: :spec |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | octocatalog-diff.gemspec | Ruby | mit | 247 | master | 2,426 | require 'json'
DEFAULT_PUPPET_VERSION = '7.32.1'.freeze
Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.6.0'
puppet_version = ENV['PUPPET_VERSION'] || DEFAULT_PUPPET_VERSION
s.name = 'octocatalog-diff'
s.version = ENV['OCTOCATALOG_DIFF_VERSION'] || File.read(File.join(File.dirname(__... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | examples/octocatalog-diff.cfg.rb | Ruby | mit | 247 | master | 15,813 | # This is a configuration file for octocatalog-diff (https://github.com/github/octocatalog-diff).
#
# When octocatalog-diff runs, it will look for configuration files in the following locations:
# - As specified by the environment variable OCTOCATALOG_DIFF_CONFIG_FILE
# - Your current working directory: `$PWD/.octocata... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | examples/api/v1/catalog-diff-local-files.rb | Ruby | mit | 247 | master | 3,707 | #!/usr/bin/env ruby
# ------------------------------------------------------------------------------------
# This is a script that demonstrates the use of the OctocatalogDiff::API::V1.catalog_diff
# method to compare two catalogs.
#
# Run this with:
# bundle exec examples/api/v1/catalog-diff-local-files.rb
#
# In th... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | examples/api/v1/catalog-diff-git-repo.rb | Ruby | mit | 247 | master | 3,969 | #!/usr/bin/env ruby
# ------------------------------------------------------------------------------------
# This is a script that demonstrates the use of the OctocatalogDiff::API::V1.catalog_diff
# method to compare two catalogs.
#
# Run this with:
# bundle exec examples/api/v1/catalog-diff-local-files.rb
#
# In th... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | examples/api/v1/catalog-builder-local-files.rb | Ruby | mit | 247 | master | 3,964 | #!/usr/bin/env ruby
# ------------------------------------------------------------------------------------
# This is a script that demonstrates the use of the OctocatalogDiff::API::V1.catalog
# method to build a catalog.
#
# Run this with:
# bundle exec examples/api/v1/catalog-builder-local-files.rb
# --------------... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | examples/ci/puppet_catalog_diff_spec.rb | Ruby | mit | 247 | master | 1,493 | # Spec file that computes catalog differences for specified hosts.
require 'open3'
require 'shellwords'
require 'tempfile'
# This rspec job assumes you have passed in a list of hosts in an environment variable called HOST_LIST.
# Adjust as necessary.
hosts = ENV['HOST_LIST']
raise ArgumentError, 'Must pass a HOST_LIS... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | examples/ci/puppet_catalogs_spec.rb | Ruby | mit | 247 | master | 1,587 | # Spec file that compiles a number of catalogs for representative hosts, to make sure
# all of the catalogs compile correctly.
require 'open3'
require 'rspec'
require 'shellwords'
# This rspec job assumes you have passed in a list of hosts in an environment variable called HOST_LIST.
# Adjust as necessary.
hosts = EN... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff.rb | Ruby | mit | 247 | master | 267 | # These are all the classes we believe people might want to call directly, so load
# them in response to a 'require octocatalog-diff'.
loads = %w(api/v1 bootstrap catalog cli errors facts puppetdb version)
loads.each { |f| require_relative "octocatalog-diff/#{f}" } |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/catalog.rb | Ruby | mit | 247 | master | 14,972 | # frozen_string_literal: true
require 'json'
require 'stringio'
require_relative 'catalog/computed'
require_relative 'catalog/json'
require_relative 'catalog/noop'
require_relative 'catalog/puppetdb'
require_relative 'catalog/puppetmaster'
require_relative 'catalog-util/fileresources'
require_relative 'errors'
modul... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/errors.rb | Ruby | mit | 247 | master | 1,069 | # frozen_string_literal: true
module OctocatalogDiff
# Contains error classes raised by this gem
class Errors
# Error classes for handled configuration file errors
class ConfigurationFileNotFoundError < RuntimeError; end
class ConfigurationFileContentError < RuntimeError; end
# Error classes for b... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli.rb | Ruby | mit | 247 | master | 9,395 | # frozen_string_literal: true
require_relative 'api/v1'
require_relative 'catalog-util/cached_master_directory'
require_relative 'cli/diffs'
require_relative 'cli/options'
require_relative 'cli/printer'
require_relative 'errors'
require_relative 'util/catalogs'
require_relative 'util/util'
require_relative 'version'
... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/puppetdb.rb | Ruby | mit | 247 | master | 8,054 | # frozen_string_literal: true
require_relative 'errors'
require_relative 'util/httparty'
require 'uri'
module OctocatalogDiff
# A standard way to connect to PuppetDB from the various scripts in this repository.
class PuppetDB
DEFAULT_HTTPS_PORT = 8081
DEFAULT_HTTP_PORT = 8080
# Allow connections to ... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/facts.rb | Ruby | mit | 247 | master | 4,766 | # frozen_string_literal: true
require_relative 'errors'
require_relative 'facts/json'
require_relative 'facts/yaml'
require_relative 'facts/puppetdb'
require_relative 'util/util'
require_relative 'external/pson/pure'
module OctocatalogDiff
# Deal with facts in all forms, including:
# - In existing YAML files
# ... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/version.rb | Ruby | mit | 247 | master | 255 | # frozen_string_literal: true
module OctocatalogDiff
# Determine the version of octocatalog-diff
class Version
version_file = File.expand_path('../../.version', File.dirname(__FILE__))
VERSION = File.read(version_file).strip.freeze
end
end |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/bootstrap.rb | Ruby | mit | 247 | master | 2,371 | # frozen_string_literal: true
require 'open3'
require 'shellwords'
module OctocatalogDiff
# Contains bootstrap function to bootstrap a checked-out Puppet environment.
class Bootstrap
# Bootstrap a checked-out Puppet environment
# @param options [Hash] Options hash:
# :path [String] => Directory... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/util/puppetversion.rb | Ruby | mit | 247 | master | 1,426 | # frozen_string_literal: true
# Helper to determine the version of Puppet
require_relative 'scriptrunner'
module OctocatalogDiff
module Util
# This is a utility class to determine the version of Puppet.
class PuppetVersion
# Determine the version of Puppet.
# @param puppet [String] Path to Pupp... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/util/colored.rb | Ruby | mit | 247 | master | 499 | # frozen_string_literal: true
# Create colorizing methods in the 'String' class, but only if 'colors_enabled'
# has been set.
class String
COLORS = {
'red' => 31,
'green' => 32,
'yellow' => 33,
'cyan' => 36
}.freeze
COLORS.each do |color, _value|
define_method(color) do
@@colors_... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/util/parallel.rb | Ruby | mit | 247 | master | 10,482 | # frozen_string_literal: true
# A class to parallelize process executation.
# This is a utility class to execute tasks in parallel, with our own forking implementation
# that passes through logs and reliably handles errors. If parallel processing has been disabled,
# this instead executes the tasks serially, but provi... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/util/httparty.rb | Ruby | mit | 247 | master | 7,702 | # frozen_string_literal: true
require 'httparty'
require 'json'
require_relative '../external/pson/pure'
module OctocatalogDiff
module Util
# This is a wrapper around some common actions that octocatalog-diff does when preparing to talk
# to a web server using 'httparty'.
class HTTParty
# Wrap the... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/util/util.rb | Ruby | mit | 247 | master | 3,666 | # frozen_string_literal: true
# Handy methods that are not tied to one particular class
require 'fileutils'
module OctocatalogDiff
module Util
# Helper class to construct catalogs, performing all necessary steps such as
# bootstrapping directories, installing facts, and running puppet.
class Util
... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/util/scriptrunner.rb | Ruby | mit | 247 | master | 5,898 | # frozen_string_literal: true
# Execute a built-in script (which can also be overridden with a user-supplied script)
require 'fileutils'
require 'open3'
require 'shellwords'
require_relative 'util'
module OctocatalogDiff
module Util
# This is a utility class to execute a built-in script.
class ScriptRunne... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/util/catalogs.rb | Ruby | mit | 247 | master | 12,952 | # frozen_string_literal: true
require 'json'
require 'open3'
require 'yaml'
require_relative '../catalog'
require_relative '../errors'
require_relative 'parallel'
module OctocatalogDiff
module Util
# Helper class to construct catalogs, performing all necessary steps such as
# bootstrapping directories, inst... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/printer.rb | Ruby | mit | 247 | master | 2,164 | # frozen_string_literal: true
require_relative '../catalog-diff/display'
require_relative '../errors'
module OctocatalogDiff
class Cli
# Wrapper around OctocatalogDiff::CatalogDiff::Display to set the options and
# output to a file or the screen depending on selection.
class Printer
# Constructor
... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options.rb | Ruby | mit | 247 | master | 11,314 | # frozen_string_literal: true
require_relative '../cli'
require_relative '../facts'
require_relative '../version'
require 'optparse'
module OctocatalogDiff
class Cli
# This class contains the option parser. 'parse_options' is the external entry point.
class Options
# The usage banner.
BANNER = ... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/diffs.rb | Ruby | mit | 247 | master | 1,547 | # frozen_string_literal: true
require_relative '../catalog-diff/differ'
module OctocatalogDiff
class Cli
# Wrapper around OctocatalogDiff::CatalogDiff::Differ to provide the logger object, set up
# ignores, and add additional ignores for items dependent upon the compilation directory.
class Diffs
... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/pass_env_vars.rb | Ruby | mit | 247 | master | 972 | # frozen_string_literal: true
# One or more environment variables that should be made available to the Puppet binary when parsing
# the catalog. For example, --pass-env-vars FOO,BAR will make the FOO and BAR environment variables
# available. Setting these variables is your responsibility outside of octocatalog-diff.
... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/validate_references.rb | Ruby | mit | 247 | master | 1,023 | # frozen_string_literal: true
# Confirm that each `before`, `require`, `subscribe`, and/or `notify` points to a valid
# resource in the catalog. This value should be specified as an array of which of these
# parameters are to be checked.
# @param parser [OptionParser object] The OptionParser argument
# @param options ... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/bootstrap_script.rb | Ruby | mit | 247 | master | 692 | # frozen_string_literal: true
# Allow specification of a bootstrap script. This runs after checking out the directory, and before running
# puppet there. Good for running librarian to install modules, and anything else site-specific that needs
# to be done.
# @param parser [OptionParser object] The OptionParser argume... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/puppet_binary.rb | Ruby | mit | 247 | master | 599 | # frozen_string_literal: true
# Set --puppet-binary, --to-puppet-binary, --from-puppet-binary
# @param parser [OptionParser object] The OptionParser argument
# @param options [Hash] Options hash being constructed; this is modified in this method.
OctocatalogDiff::Cli::Options::Option.newoption(:puppet_binary) do
has... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/pe_enc_url.rb | Ruby | mit | 247 | master | 860 | # frozen_string_literal: true
require 'uri'
# Specify the URL to the Puppet Enterprise ENC API. By default, the node classifier service
# listens on port 4433 and all endpoints are relative to the /classifier-api/ path. That means
# the likely value for this option will be something like:
# https://your-pe-console-se... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/hiera_config.rb | Ruby | mit | 247 | master | 1,053 | # frozen_string_literal: true
# Specify a relative path to the Hiera yaml file
# @param parser [OptionParser object] The OptionParser argument
# @param options [Hash] Options hash being constructed; this is modified in this method.
OctocatalogDiff::Cli::Options::Option.newoption(:hiera_config) do
has_weight 180
d... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/from_puppetdb.rb | Ruby | mit | 247 | master | 554 | # frozen_string_literal: true
# Set --from-puppetdb to pull most recent catalog from PuppetDB instead of compiling
# @param parser [OptionParser object] The OptionParser argument
# @param options [Hash] Options hash being constructed; this is modified in this method.
OctocatalogDiff::Cli::Options::Option.newoption(:fr... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/override_script_path.rb | Ruby | mit | 247 | master | 833 | # frozen_string_literal: true
# Provide an optional directory to override default built-in scripts such as git checkout
# and puppet version determination.
# @param parser [OptionParser object] The OptionParser argument
# @param options [Hash] Options hash being constructed; this is modified in this method.
Octocatalo... |
github | github/octocatalog-diff | https://github.com/github/octocatalog-diff | lib/octocatalog-diff/cli/options/puppet_master_update_facts.rb | Ruby | mit | 247 | master | 747 | # frozen_string_literal: true
# Specify if, when using the Puppetserver v4 catalog API, the Puppetserver should
# update the facts in PuppetDB.
# @param parser [OptionParser object] The OptionParser argument
# @param options [Hash] Options hash being constructed; this is modified in this method.
OctocatalogDiff::Cli::... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.