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 | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/internal/type/converter.rb | Ruby | apache-2.0 | 19 | master | 11,068 | # frozen_string_literal: true
module Imagekitio
module Internal
module Type
# @api private
module Converter
extend Imagekitio::Internal::Util::SorbetRuntimeSupport
# rubocop:disable Lint/UnusedMethodArgument
# @api private
#
# @param value [Object]
#
... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/internal/type/unknown.rb | Ruby | apache-2.0 | 19 | master | 1,975 | # frozen_string_literal: true
module Imagekitio
module Internal
module Type
# @api private
#
# @abstract
#
# When we don't know what to expect for the value.
class Unknown
extend Imagekitio::Internal::Type::Converter
extend Imagekitio::Internal::Util::SorbetRun... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/internal/type/base_page.rb | Ruby | apache-2.0 | 19 | master | 1,397 | # frozen_string_literal: true
module Imagekitio
module Internal
module Type
# @api private
#
# @generic Elem
#
# This module provides a base implementation for paginated responses in the SDK.
module BasePage
# rubocop:disable Lint/UnusedMethodArgument
# @api p... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/internal/type/boolean.rb | Ruby | apache-2.0 | 19 | master | 2,030 | # frozen_string_literal: true
module Imagekitio
module Internal
module Type
# @api private
#
# @abstract
#
# Ruby has no Boolean class; this is something for models to refer to.
class Boolean
extend Imagekitio::Internal::Type::Converter
extend Imagekitio::Inter... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/internal/type/request_parameters.rb | Ruby | apache-2.0 | 19 | master | 1,261 | # frozen_string_literal: true
module Imagekitio
module Internal
module Type
# @api private
module RequestParameters
# @!attribute request_options
# Options to specify HTTP behaviour for this request.
#
# @return [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/internal/type/hash_of.rb | Ruby | apache-2.0 | 19 | master | 5,215 | # frozen_string_literal: true
module Imagekitio
module Internal
module Type
# @api private
#
# @abstract
#
# @generic Elem
#
# Hash of items of a given type.
class HashOf
include Imagekitio::Internal::Type::Converter
include Imagekitio::Internal::Ut... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/internal/transport/base_client.rb | Ruby | apache-2.0 | 19 | master | 20,077 | # frozen_string_literal: true
module Imagekitio
module Internal
module Transport
# @api private
#
# @abstract
class BaseClient
extend Imagekitio::Internal::Util::SorbetRuntimeSupport
# from whatwg fetch spec
MAX_REDIRECTS = 20
# rubocop:disable Style/Muta... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/internal/transport/pooled_net_requester.rb | Ruby | apache-2.0 | 19 | master | 7,179 | # frozen_string_literal: true
module Imagekitio
module Internal
module Transport
# @api private
class PooledNetRequester
extend Imagekitio::Internal::Util::SorbetRuntimeSupport
# from the golang stdlib
# https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b23... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/helpers/crypto_utils.rb | Ruby | apache-2.0 | 19 | master | 748 | # frozen_string_literal: true
require "openssl"
require "digest"
module Imagekitio
# @api private
# Crypto utilities for ImageKit SDK
# Provides HMAC-SHA1 functionality for URL signing and authentication
module CryptoUtils
class << self
# Creates an HMAC-SHA1 hash
#
# @param key [String]... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/helpers/transformation_utils.rb | Ruby | apache-2.0 | 19 | master | 4,891 | # frozen_string_literal: true
module Imagekitio
# @api private
# Transformation utilities for building ImageKit URLs
# Ported from the Node.js SDK
module TransformationUtils
# Constants for transformation parsing
QUERY_TRANSFORMATION_POSITION = :query
PATH_TRANSFORMATION_POSITION = :path
CHAIN_... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/helpers/helper.rb | Ruby | apache-2.0 | 19 | master | 24,852 | # frozen_string_literal: true
require_relative "transformation_utils"
require_relative "crypto_utils"
require_relative "uuid_utils"
module Imagekitio
class Helper
TRANSFORMATION_PARAMETER = "tr"
SIGNATURE_PARAMETER = "ik-s"
TIMESTAMP_PARAMETER = "ik-t"
DEFAULT_TIMESTAMP = 9_999_999_999
SIMPLE_OV... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/helpers/uuid_utils.rb | Ruby | apache-2.0 | 19 | master | 318 | # frozen_string_literal: true
require "securerandom"
module Imagekitio
# @api private
# UUID utilities for ImageKit SDK
module UuidUtils
class << self
# Generates a UUID v4 string
#
# @return [String] A UUID v4 string
def uuid4
SecureRandom.uuid
end
end
end
end |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/webhooks.rb | Ruby | apache-2.0 | 19 | master | 2,468 | # frozen_string_literal: true
module Imagekitio
module Resources
class Webhooks
# @param payload [String] The raw webhook payload as a string
#
# @return [Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransforma... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/saved_extensions.rb | Ruby | apache-2.0 | 19 | master | 5,628 | # frozen_string_literal: true
module Imagekitio
module Resources
class SavedExtensions
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::SavedExtensionCreateParams} for more details.
#
# This API creates a new saved extension. Saved extensions allow you to sav... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/assets.rb | Ruby | apache-2.0 | 19 | master | 2,371 | # frozen_string_literal: true
module Imagekitio
module Resources
class Assets
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::AssetListParams} for more details.
#
# This API can list all the uploaded files and folders in your ImageKit.io media
# librar... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/files.rb | Ruby | apache-2.0 | 19 | master | 13,874 | # frozen_string_literal: true
module Imagekitio
module Resources
class Files
# @return [Imagekitio::Resources::Files::Bulk]
attr_reader :bulk
# @return [Imagekitio::Resources::Files::Versions]
attr_reader :versions
# @return [Imagekitio::Resources::Files::Metadata]
attr_read... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/accounts.rb | Ruby | apache-2.0 | 19 | master | 757 | # frozen_string_literal: true
module Imagekitio
module Resources
class Accounts
# @return [Imagekitio::Resources::Accounts::Usage]
attr_reader :usage
# @return [Imagekitio::Resources::Accounts::Origins]
attr_reader :origins
# @return [Imagekitio::Resources::Accounts::URLEndpoints]... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/cache.rb | Ruby | apache-2.0 | 19 | master | 420 | # frozen_string_literal: true
module Imagekitio
module Resources
class Cache
# @return [Imagekitio::Resources::Cache::Invalidation]
attr_reader :invalidation
# @api private
#
# @param client [Imagekitio::Client]
def initialize(client:)
@client = client
@invali... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/folders.rb | Ruby | apache-2.0 | 19 | master | 6,668 | # frozen_string_literal: true
module Imagekitio
module Resources
class Folders
# @return [Imagekitio::Resources::Folders::Job]
attr_reader :job
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::FolderCreateParams} for more details.
#
# This will c... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/custom_metadata_fields.rb | Ruby | apache-2.0 | 19 | master | 5,723 | # frozen_string_literal: true
module Imagekitio
module Resources
class CustomMetadataFields
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::CustomMetadataFieldCreateParams} for more details.
#
# This API creates a new custom metadata field. Once a custom met... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/beta.rb | Ruby | apache-2.0 | 19 | master | 377 | # frozen_string_literal: true
module Imagekitio
module Resources
class Beta
# @return [Imagekitio::Resources::Beta::V2]
attr_reader :v2
# @api private
#
# @param client [Imagekitio::Client]
def initialize(client:)
@client = client
@v2 = Imagekitio::Resources::... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/accounts/url_endpoints.rb | Ruby | apache-2.0 | 19 | master | 6,595 | # frozen_string_literal: true
module Imagekitio
module Resources
class Accounts
class URLEndpoints
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Accounts::URLEndpointCreateParams} for more details.
#
# **Note:** This API is currently in beta.... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/accounts/usage.rb | Ruby | apache-2.0 | 19 | master | 1,804 | # frozen_string_literal: true
module Imagekitio
module Resources
class Accounts
class Usage
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Accounts::UsageGetParams} for more details.
#
# Get the account usage information between two dates. Not... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/accounts/origins.rb | Ruby | apache-2.0 | 19 | master | 7,535 | # frozen_string_literal: true
module Imagekitio
module Resources
class Accounts
class Origins
# **Note:** This API is currently in beta.
# Creates a new origin and returns the origin object.
#
# @overload create(origin_request:, request_options: {})
#
# @para... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/files/metadata.rb | Ruby | apache-2.0 | 19 | master | 2,499 | # frozen_string_literal: true
module Imagekitio
module Resources
class Files
class Metadata
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Files::MetadataGetParams} for more details.
#
# You can programmatically get image EXIF, pHash, and othe... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/files/versions.rb | Ruby | apache-2.0 | 19 | master | 5,245 | # frozen_string_literal: true
module Imagekitio
module Resources
class Files
class Versions
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Files::VersionListParams} for more details.
#
# This API returns details of all versions of a file.
... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/files/bulk.rb | Ruby | apache-2.0 | 19 | master | 5,132 | # frozen_string_literal: true
module Imagekitio
module Resources
class Files
class Bulk
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Files::BulkDeleteParams} for more details.
#
# This API deletes multiple files and all their file versions p... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/beta/v2.rb | Ruby | apache-2.0 | 19 | master | 440 | # frozen_string_literal: true
module Imagekitio
module Resources
class Beta
class V2
# @return [Imagekitio::Resources::Beta::V2::Files]
attr_reader :files
# @api private
#
# @param client [Imagekitio::Client]
def initialize(client:)
@client = clien... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/beta/v2/files.rb | Ruby | apache-2.0 | 19 | master | 6,206 | # frozen_string_literal: true
module Imagekitio
module Resources
class Beta
class V2
class Files
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Beta::V2::FileUploadParams} for more details.
#
# The V2 API enhances security by v... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/folders/job.rb | Ruby | apache-2.0 | 19 | master | 1,215 | # frozen_string_literal: true
module Imagekitio
module Resources
class Folders
class Job
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Folders::JobGetParams} for more details.
#
# This API returns the status of a bulk job like copy and move f... |
github | imagekit-developer/imagekit-ruby | https://github.com/imagekit-developer/imagekit-ruby | lib/imagekitio/resources/cache/invalidation.rb | Ruby | apache-2.0 | 19 | master | 2,314 | # frozen_string_literal: true
module Imagekitio
module Resources
class Cache
class Invalidation
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Cache::InvalidationCreateParams} for more details.
#
# This API will purge CDN cache and ImageKit.io... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | poto.gemspec | Ruby | mit | 19 | master | 1,721 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'poto/version'
Gem::Specification.new do |spec|
spec.name = "poto"
spec.version = Poto::VERSION
spec.authors = ["James Moriarty"]
spec.email = ["jamespaulmoria... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto.rb | Ruby | mit | 19 | master | 269 | $LOAD_PATH.unshift File.dirname(__FILE__)
require 'active_support'
require 'active_support/core_ext/object/to_param'
require 'active_support/core_ext/object/try'
require 'poto/version'
require 'poto/api'
require 'poto/image_proxy'
require 'poto/app'
module Poto; end |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/api.rb | Ruby | mit | 19 | master | 1,388 | require 'base64'
require 'grape'
require 'grape/roar'
require 'poto/file_repository/proxy'
require 'poto/representers/file_representer'
require 'poto/representers/file_collection_representer'
module Poto
class API < Grape::API
content_type :json, 'application/hal+json'
format :json
formatter :js... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/image_proxy.rb | Ruby | mit | 19 | master | 1,021 | require 'sinatra'
require 'tmpdir'
require 'poto/services/download'
require 'poto/services/file_cache'
require 'poto/services/resize'
module Poto
class ImageProxy < Sinatra::Base
set :cache_path, Dir.tmpdir
helpers do
def src
URI(params['src'].gsub(%r{\A\/\/}, 'http://'))
end
def... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/app.rb | Ruby | mit | 19 | master | 225 | require 'sinatra'
module Poto
class App < Sinatra::Base
set :public_folder, File.join(File.dirname(__FILE__), '..', '..', 'public')
get('/') do
File.read(File.join('public', 'index.html'))
end
end
end |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/services/resize.rb | Ruby | mit | 19 | master | 454 | require 'mini_magick'
module Poto
module Services
class Resize
attr_reader :path, :width, :height
def initialize(path:, width:, height:)
@path = path
@width = width
@height = height
end
def call
image = MiniMagick::Image.open(path)
image.resize([w... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/services/file_cache.rb | Ruby | mit | 19 | master | 494 | require 'digest'
module Poto
module Services
class FileCache
attr_reader :path
def initialize(path:)
@path = path
end
def cache(key)
File.join(path, filename(key)).tap do |cache_path|
unless File.exist?(cache_path)
file_path = yield
File... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/services/download.rb | Ruby | mit | 19 | master | 364 | require 'open-uri'
require 'poto/ext/open_uri'
module Poto
module Services
class Download
attr_reader :file, :uri
def initialize(file:, uri:)
@file = file
@uri = uri
end
def call
open(uri) do |src|
file.write(src.read)
end
file.close
... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/file_repository/proxy.rb | Ruby | mit | 19 | master | 391 | require 'poto/file_repository/dsl'
module Poto
module FileRepository
class Proxy
include DSL
option :per_page
option :page
option :prefix
attr_reader :backend
def initialize(backend)
@backend = backend
end
def url(id)
backend.url(id)
end
... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/file_repository/dsl.rb | Ruby | mit | 19 | master | 456 | module Poto
module FileRepository
class Proxy
module DSL
module ClassMethods
def option(name)
define_method(name) do |value|
tap do
options[name] = value
end
end
end
end
def self.included(base)
... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/file_repository/google/cloud/storage.rb | Ruby | mit | 19 | master | 697 | require 'base64'
require 'google/cloud/storage'
require 'poto/file_repository/google/cloud/storage/file_collection_mapper'
module Poto
module FileRepository
module Google
module Cloud
class Storage
attr_reader :client
def initialize(client:)
@client = client
... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/file_repository/aws/s3.rb | Ruby | mit | 19 | master | 683 | require 'base64'
require 'poto/file_repository/aws/s3/client'
require 'poto/file_repository/aws/s3/file_collection_mapper'
module Poto
module FileRepository
module AWS
class S3
attr_reader :bucket, :client
def initialize(bucket:, client: Client.new(bucket))
@bucket = bucket
... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/file_repository/aws/s3/file_mapper.rb | Ruby | mit | 19 | master | 553 | require 'base64'
require 'poto/file_repository/file'
module Poto
module FileRepository
module AWS
class S3
class FileMapper
attr_reader :object
def initialize(object)
@object = object
end
def call
File.new(id, name, size)
... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/file_repository/aws/s3/client.rb | Ruby | mit | 19 | master | 667 | require 'aws-sdk'
module Poto
module FileRepository
module AWS
class S3
class Client
attr_reader :bucket
def initialize(bucket)
@bucket = bucket
end
def objects(prefix:, page:, per_page:)
Aws::S3::Client.new.list_objects(
... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/file_repository/aws/s3/file_collection_mapper.rb | Ruby | mit | 19 | master | 701 | require 'poto/file_repository/aws/s3/file_mapper'
require 'poto/file_repository/file_collection'
module Poto
module FileRepository
module AWS
class S3
class FileCollectionMapper
attr_reader :objects
def initialize(objects)
@objects = objects
end
... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/representers/file_collection_representer.rb | Ruby | mit | 19 | master | 628 | require 'roar/representer'
require 'roar/json'
require 'roar/json/hal'
require 'poto/representers/file_representer'
module Poto
module FileCollectionRepresenter
include Roar::JSON::HAL
include Roar::Hypermedia
include Grape::Roar::Representer
collection :files, extend: FileRepresenter, embedded: tru... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | lib/poto/representers/file_representer.rb | Ruby | mit | 19 | master | 409 | require 'base64'
require 'roar/representer'
require 'roar/json'
require 'roar/json/hal'
module Poto
module FileRepresenter
include Roar::JSON::HAL
include Roar::Hypermedia
include Grape::Roar::Representer
property :name
property :size
link :file do |opts, helpers = opts[:env]['api.endpoint'... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | spec/api_spec.rb | Ruby | mit | 19 | master | 893 | require 'spec_helper'
require 'poto/file_repository/aws/s3'
describe Poto::API do
let(:bucket) { 'abc' }
let(:key) { 'example.png' }
let(:client) do
instance_double('Client',
objects: OpenStruct.new(contents: [OpenStruct.new(key: key, size: 0)]),
url: 'http:... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | spec/image_proxy_spec.rb | Ruby | mit | 19 | master | 809 | require 'spec_helper'
describe Poto::ImageProxy do
describe 'GET /' do
let(:fixtures_path) { File.expand_path('fixtures', File.dirname(__FILE__)) }
let(:port) { 3000 + rand(1000) }
let(:width) { 500 }
let(:height) { 500 }
let(:src) { "http://localhost:#{port}/exa... |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | spec/support/http_server.rb | Ruby | mit | 19 | master | 256 | require 'webrick'
def http_server(port, root_path)
server = WEBrick::HTTPServer.new(Port: port)
server.mount('/', WEBrick::HTTPServlet::FileHandler, root_path)
thread = Thread.new { server.start }
yield(server)
server.shutdown
thread.exit
end |
github | jamesmoriarty/poto | https://github.com/jamesmoriarty/poto | spec/support/customer_matchers.rb | Ruby | mit | 19 | master | 340 | RSpec::Matchers.define :be_json_of_files do |expected|
match do |actual|
expect(actual[:_embedded][:files].size).to eq expected.size
expect(actual[:_links][:self]).to eq(href: 'http://example.org:80/files?page=')
expect(actual[:_links][:next]).to eq(href: 'http://example.org:80/files?page=example.png&per_... |
github | franckverrot/rb_import | https://github.com/franckverrot/rb_import | rb_import.gemspec | Ruby | mit | 19 | master | 1,052 | # coding: utf-8
$:<< 'lib'
Gem::Specification.new do |spec|
spec.name = "rb_import"
spec.version = "0.2.0"
spec.authors = ["Franck Verrot"]
spec.email = ["franck@verrot.fr"]
spec.summary = %q{Add an import method to your Ruby VM}
spec.description = spec.summary
spec.h... |
github | franckverrot/rb_import | https://github.com/franckverrot/rb_import | Rakefile | Ruby | mit | 19 | master | 1,973 | require 'rubygems'
require 'rubygems/specification'
require 'bundler'
Bundler::GemHelper.install_tasks
$:<< 'lib'
$stdout.puts """
rb_import Copyright (C) 2014 Franck Verrot <franck@verrot.fr>
This program comes with ABSOLUTELY NO WARRANTY; for details type `rake license'.
This is free software, and you are welcome ... |
github | franckverrot/rb_import | https://github.com/franckverrot/rb_import | test/test_helper.rb | Ruby | mit | 19 | master | 777 | # rb_import
# Copyright (C) 2014 Franck Verrot <franck@verrot.fr>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Th... |
github | franckverrot/rb_import | https://github.com/franckverrot/rb_import | test/basic_test.rb | Ruby | mit | 19 | master | 382 | require 'test_helper'
require 'minitest/autorun'
class BasicTest < Minitest::Test
def test_basic
f = import("./test/fixtures/foo.rb")
assert_equal "foo bar", f.new.to_s
end
def test_missing_file
error_occured = false
begin
import("unknown_file.rb")
rescue LoadError => error
erro... |
github | matthewrudy/rcov_rails | https://github.com/matthewrudy/rcov_rails | Rakefile | Ruby | mit | 19 | master | 1,735 | require "rubygems"
require "rubygems/package_task"
task :default => :package do
puts "Don't forget to write some tests!"
end
# This builds the actual gem. For details of what all these options
# mean, and other ones you can add, check the documentation here:
#
# http://rubygems.org/read/chapter/20
#
spec = Gem::S... |
github | matthewrudy/rcov_rails | https://github.com/matthewrudy/rcov_rails | rcov_rails.gemspec | Ruby | mit | 19 | master | 1,123 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{rcov_rails}
s.version = "0.3.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Matthew Rudy Jacobs"]
s.date = %q{2011-06-01}
s.description = %q{One Rake task to give y... |
github | matthewrudy/rcov_rails | https://github.com/matthewrudy/rcov_rails | lib/rcov_rails/rcovtask.rb | Ruby | mit | 19 | master | 4,765 | #!/usr/bin/env ruby
# Define a task library for performing code coverage analysis of unit tests
# using rcov.
require 'rake'
require 'rake/tasklib'
module RcovRails
# A variant of Rcov::RcovTask
# which lets me switch off descriptions on auto-generated tasks
#
# Example:
#
# require 'rcov_rails/rcovta... |
github | matthewrudy/rcov_rails | https://github.com/matthewrudy/rcov_rails | lib/tasks/coverage.rake | Ruby | mit | 19 | master | 3,141 | # this is what a Rails test looks like
# copy it;
#
# Rake::TestTask.new(:units => "db:test:prepare") do |t|
# t.libs << "test"
# t.pattern = 'test/unit/**/*_test.rb'
# t.verbose = true
# end
# Rake::Task['test:units'].comment = "Run the unit tests in test/unit"
#
begin
require File.expand_path(File.join(File... |
github | xiongchiamiov/osx-useradd | https://github.com/xiongchiamiov/osx-useradd | osx-useradd.gemspec | Ruby | mit | 19 | master | 672 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'osx-useradd'
s.version = '0.1.0'
s.date = Time.now.strftime('%Y-%m-%d')
s.authors = ['xiongchiamiov']
s.email = ['xiong.chiamiov@gmail.com']
s.files = %w( COPYING Rakefile README.md )
s.files += Dir.glob 'bin/*'
s.executables = 'u... |
github | kostya/pg_reindex | https://github.com/kostya/pg_reindex | pg_reindex.gemspec | Ruby | mit | 19 | master | 910 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{pg_reindex}
s.version = "0.1.5"
s.authors = ["Makarchev Konstantin"]
s.description = %q{Console utility for gracefully rebuild indexes/pkeys for PostgreSQL, with minimal locking in semi-auto mode.}
s.summary = %q{Console utility for grace... |
github | kostya/pg_reindex | https://github.com/kostya/pg_reindex | lib/pg-reindex.rb | Ruby | mit | 19 | master | 6,017 | require 'pg'
class PgReindex
MIN_SIZE = 50 # megabyte min, total table size
def initialize(conf)
@cfg = {:host => conf['host'] || '127.0.0.1', :dbname => conf['database'],
:user => conf['username'] || `whoami`.chop, :password => conf['password'] || 'password', :port => conf['port'].to_s}
@con... |
github | kostya/pg_reindex | https://github.com/kostya/pg_reindex | spec/reindex_spec.rb | Ruby | mit | 19 | master | 5,260 | require File.dirname(__FILE__) + '/spec_helper'
describe PgReindex do
before :each do
@pgre = PgReindex.new($cfg)
end
def row(name)
@pgre.filter_relations(name).first
end
def drop_swap_for_reindex
@pgre.exec("drop FUNCTION swap_for_pkey(text, text, text)") rescue nil
end
it "get_raw_re... |
github | kostya/pg_reindex | https://github.com/kostya/pg_reindex | spec/spec_helper.rb | Ruby | mit | 19 | master | 225 | require 'rubygems'
require "bundler"
Bundler.setup
ENV['RAILS_ENV'] ||= 'test'
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'pg-reindex'
require 'active_record'
require File.dirname(__FILE__) + '/spec_support.rb' |
github | kostya/pg_reindex | https://github.com/kostya/pg_reindex | spec/spec_support.rb | Ruby | mit | 19 | master | 631 | $cfg = {'adapter' => 'postgresql', 'database' => 'pgre_test'}
ActiveRecord::Base.establish_connection $cfg
class Test < ActiveRecord::Base
self.table_name = 'tests'
end
def pg_create_schema
ActiveRecord::Migration.create_table :tests do |t|
t.integer :a
t.integer :b
t.integer :c
end
ActiveRecor... |
github | hbin/mina-nginx | https://github.com/hbin/mina-nginx | mina-nginx.gemspec | Ruby | mit | 19 | master | 943 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'mina/nginx/version'
Gem::Specification.new do |spec|
spec.name = 'mina-nginx'
spec.version = Mina::Nginx::VERSION
spec.authors = ['hbin', 'anulman']
spec.email ... |
github | hbin/mina-nginx | https://github.com/hbin/mina-nginx | lib/mina/nginx.rb | Ruby | mit | 19 | master | 2,091 | require 'mina/nginx/version'
namespace :nginx do
application = fetch :application, 'application'
set :nginx_user, 'www-data'
set :nginx_group, 'www-data'
set :nginx_path, '/etc/nginx'
set :nginx_config, -> { "#{fetch(:shared_path)}/config/nginx.conf" }
set :nginx_config_e, -> {... |
github | planas/sequel_enum | https://github.com/planas/sequel_enum | sequel_enum.gemspec | Ruby | mit | 19 | master | 1,065 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sequel_enum/version'
Gem::Specification.new do |spec|
spec.name = "sequel_enum"
spec.version = SequelEnum::VERSION
spec.authors = ["Adrià Planas"]
spec.email ... |
github | planas/sequel_enum | https://github.com/planas/sequel_enum | spec/spec_helper.rb | Ruby | mit | 19 | master | 673 | require 'sequel'
require 'sqlite3'
require 'sequel_enum'
DB = Sequel.connect('sqlite://test.db')
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.order = 'random'
config.before(:suite) do
AbstractModel = Class.new(Sequel::Model)
AbstractModel.require_valid_table = false... |
github | planas/sequel_enum | https://github.com/planas/sequel_enum | spec/sequel_enum_spec.rb | Ruby | mit | 19 | master | 3,276 | require 'spec_helper'
RSpec.describe "sequel_enum" do
let(:item) { Item.new }
specify "class should provide reflection" do
Item.enum :condition, [:mint, :very_good, :fair]
expect(Item.enums).to eq({ condition: { :mint => 0, :very_good => 1, :fair => 2}})
end
specify "inheriting from abstract model sh... |
github | planas/sequel_enum | https://github.com/planas/sequel_enum | lib/sequel_enum.rb | Ruby | mit | 19 | master | 1,310 | module Sequel
module Plugins
module Enum
def self.apply(model, opts = OPTS)
end
module ClassMethods
def enums
@enums ||= {}
end
def enum(column, values)
if values.is_a? Hash
values.each do |key,val|
raise ArgumentError, "in... |
github | toyokazu/fluent-plugin-mqtt-io | https://github.com/toyokazu/fluent-plugin-mqtt-io | fluent-plugin-mqtt-io.gemspec | Ruby | apache-2.0 | 19 | master | 1,220 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = "fluent-plugin-mqtt-io"
spec.version = "0.5.0"
spec.authors = ["Toyokazu Akiyama"]
spec.email = ["toyokazu@gmail.com"]
... |
github | toyokazu/fluent-plugin-mqtt-io | https://github.com/toyokazu/fluent-plugin-mqtt-io | lib/fluent/plugin/out_mqtt.rb | Ruby | apache-2.0 | 19 | master | 5,103 | require 'fluent/plugin/output'
require 'fluent/event'
require 'fluent/time'
require 'fluent/plugin/mqtt_proxy'
module Fluent::Plugin
class MqttOutput < Output
include MqttProxy
include Fluent::TimeMixin::Formatter
Fluent::Plugin.register_output('mqtt', self)
helpers :compat_parameters, :formatter, ... |
github | toyokazu/fluent-plugin-mqtt-io | https://github.com/toyokazu/fluent-plugin-mqtt-io | lib/fluent/plugin/mqtt_proxy.rb | Ruby | apache-2.0 | 19 | master | 6,348 | require 'mqtt'
module Fluent::Plugin
module MqttProxy
MQTT_PORT = 1883
def self.included(base)
base.helpers :timer, :thread
base.desc 'The address to connect to.'
base.config_param :host, :string, default: '127.0.0.1'
base.desc 'The port to connect to.'
base.config_param :port,... |
github | toyokazu/fluent-plugin-mqtt-io | https://github.com/toyokazu/fluent-plugin-mqtt-io | lib/fluent/plugin/in_mqtt.rb | Ruby | apache-2.0 | 19 | master | 3,570 | require 'fluent/plugin/input'
require 'fluent/event'
require 'fluent/time'
require 'fluent/plugin/mqtt_proxy'
module Fluent::Plugin
class MqttInput < Input
include MqttProxy
include Fluent::TimeMixin::Formatter
Fluent::Plugin.register_input('mqtt', self)
helpers :compat_parameters, :parser
des... |
github | toyokazu/fluent-plugin-mqtt-io | https://github.com/toyokazu/fluent-plugin-mqtt-io | test/plugin/test_in_mqtt.rb | Ruby | apache-2.0 | 19 | master | 1,371 | require_relative '../helper'
require 'fluent/test/driver/input'
require 'fluent/plugin/in_mqtt'
class MqttInputTest < Test::Unit::TestCase
def setup
Fluent::Test.setup
end
CONFIG = %[
]
def create_driver(conf = CONFIG, opts = {})
Fluent::Test::Driver::Input.new(Fluent::Plugin::MqttInput, opts: opt... |
github | toyokazu/fluent-plugin-mqtt-io | https://github.com/toyokazu/fluent-plugin-mqtt-io | test/plugin/test_out_mqtt.rb | Ruby | apache-2.0 | 19 | master | 1,566 | require_relative '../helper'
require 'fluent/test/driver/output'
require 'fluent/plugin/out_mqtt'
class MqttOutputTest < Test::Unit::TestCase
def setup
Fluent::Test.setup
end
CONFIG = %[
]
def create_driver(conf = CONFIG, opts = {})
Fluent::Test::Driver::Output.new(Fluent::Plugin::MqttOutput, opts... |
github | influitive/apartment-activejob | https://github.com/influitive/apartment-activejob | apartment-activejob.gemspec | Ruby | mit | 19 | master | 1,033 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'apartment/active_job/version'
Gem::Specification.new do |spec|
spec.name = "apartment-activejob"
spec.version = Apartment::ActiveJob::VERSION
spec.authors = ["Zulfiqar ... |
github | influitive/apartment-activejob | https://github.com/influitive/apartment-activejob | lib/apartment/active_job.rb | Ruby | mit | 19 | master | 316 | module Apartment
module ActiveJob
extend ActiveSupport::Concern
class_methods do
def execute(job_data)
Apartment::Tenant.switch(job_data['tenant']) do
super
end
end
end
def serialize
super.merge('tenant' => Apartment::Tenant.current)
end
end
end |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | Gemfile | Ruby | mit | 19 | master | 225 | # frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "gosu", "~> 1.2"
gem "yaml", "~> 0.1.1"
gem "open-uri", "~> 0.2"
gem "json", "~> 2.6" |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus.rb | Ruby | mit | 19 | master | 14,531 | VERSION = "1.6.0"
ROOT_PATH = File.expand_path(".", __dir__)
REPO_URL = "https://github.com/Flaptus/Flaptus"
VOLUME = 0.75
WIDTH = 833
HEIGHT = 511
THEME_COLOUR = 0xff_2d832d
TEXT_COLOUR = 0xff_eeffee
# builds: replace this with the secret value
SECRET = ENV["SECRET"]
if !SECRET
puts "No secret env... |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/buttons.rb | Ruby | mit | 19 | master | 6,325 | BUTTON_TEXT_COLOUR = 0xff_eeffee
BUTTON_LIFT_COLOUR = 0xff_2d832d
BUTTON_SCIM_COLOUR = 0x22_2d832d
class Button
attr_reader :width, :height
#attr_writer :width, :height
def initialize(base_image, hover_image=base_image)
@base_image, @hover_image = base_image, hover_image
@x = @y = 0.0
@hover = false
@wid... |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/player.rb | Ruby | mit | 19 | master | 3,117 | class Player
attr_reader :x, :y, :width, :height, :score, :average_score, :high_score, :username, :token
def initialize
@die = Gosu::Sample.new("#{ROOT_PATH}/assets/audio/die.wav")
@flap = Gosu::Sample.new("#{ROOT_PATH}/assets/audio/flap.wav")
@image = Gosu::Image.new("#{ROOT_PATH}/assets/ima... |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/textbox.rb | Ruby | mit | 19 | master | 3,052 | class TextBox < Gosu::TextInput
WIDTH = 240
PADDING = 4
CARET_COLOUR = 0xffffffff
ACTIVE_COLOUR = 0xff_2d832d
INACTIVE_COLOUR = 0x22_2d832d
SELECTION_COLOUR = 0xcc_0022dd
ACTIVE_TEXT_COLOUR = 0xff_eeffee
INACTIVE_TEXT_COLOUR = 0xff_2d832d
attr_reader :x, :... |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/scrim.rb | Ruby | mit | 19 | master | 218 | SCRIM_COLOUR = 0x77_444444
class Scrim
def initialize
@width = WIDTH
@height = HEIGHT
end
def draw
Gosu::draw_rect(
0, 0,
@width, @height,
Gosu::Color.argb(SCRIM_COLOUR),
ZOrder::UI
)
end
end |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/update_container.rb | Ruby | mit | 19 | master | 1,096 | class UpdateContainer
attr_reader :width, :height, :x, :y
def initialize(current, new)
@current, @new = current, new
@background = Gosu::Image.new("#{ROOT_PATH}/assets/images/update_prompt_container.png")
@x = @y = 0.0
@width = @background.width
@height = @background.height
@big_text = Gosu::Font.... |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/foreground.rb | Ruby | mit | 19 | master | 270 | class Foreground
def initialize
@image = Gosu::Image.new("#{ROOT_PATH}/assets/images/foreground.png")
@x = 0
end
def move(speed)
@x -= speed * 0.5
if @x < WIDTH - @image.width
@x = 0
end
end
def draw
@image.draw(@x, 0, ZOrder::FOREGROUND)
end
end |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/rock.rb | Ruby | mit | 19 | master | 831 | class Rock
attr_reader :image, :x, :width
attr_accessor :passed_player
def initialize(direction)
@image = Gosu::Image.new("#{ROOT_PATH}/assets/images/rock_#{direction}.png")
@x = @y = 0.0
@height = @image.height
@width = @image.width
@passed_player = false
end
def warp(x, y)
@x, @y = x, y
end
def ... |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/background.rb | Ruby | mit | 19 | master | 271 | class Background
def initialize
@image = Gosu::Image.new("#{ROOT_PATH}/assets/images/backgroundp.png")
@x = 0
end
def move(speed)
@x -= speed * 0.1
if @x < WIDTH - @image.width
@x = 0
end
end
def draw
@image.draw(@x, 0, ZOrder::BACKGROUND)
end
end |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/leaderboard.rb | Ruby | mit | 19 | master | 3,244 | class Leaderboard
PAGE_LENGTH = 10
COLUMN_WIDTH = 150
attr_reader :width, :height, :x, :y, :page
def initialize
@background = Gosu::Image.new("#{ROOT_PATH}/assets/images/leaderboard.png")
@flaptus_down = Gosu::Image.new("#{ROOT_PATH}/assets/images/flaptus.png")
@flaptus_flap = Gosu::Image.new("#{ROOT_PATH}... |
github | Flaptus/Flaptus | https://github.com/Flaptus/Flaptus | flaptus/floor.rb | Ruby | mit | 19 | master | 316 | class Floor
attr_reader :y, :image
def initialize
@image = Gosu::Image.new("#{ROOT_PATH}/assets/images/floor.png")
@x = @y = 0.0
end
def warp(x, y)
@x, @y = x, y
end
def move(speed)
@x -= 2 * speed
@x = 0 if @x + @image.width / 2 <= 0
end
def draw
@image.draw(@x, @y, ZOrder::FLOOR)
end
end |
github | ProGM/rails-google-amp-example | https://github.com/ProGM/rails-google-amp-example | Gemfile | Ruby | mit | 19 | master | 1,568 | source 'https://rubygems.org'
ruby '2.2.4'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
#... |
github | ProGM/rails-google-amp-example | https://github.com/ProGM/rails-google-amp-example | app/scrubbers/amp_scrubber.rb | Ruby | mit | 19 | master | 1,387 | class AmpScrubber < Rails::Html::PermitScrubber
TAG_MAPPINGS = {
'img' => lambda { |node|
if node['width'] && node['height']
node.name = 'amp-img'
node['layout'] = 'responsive'
node['srcset'] = node['src']
else
node.remove
end
},
'iframe' => lambda { |node... |
github | ProGM/rails-google-amp-example | https://github.com/ProGM/rails-google-amp-example | db/seeds.rb | Ruby | mit | 19 | master | 1,611 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
github | ProGM/rails-google-amp-example | https://github.com/ProGM/rails-google-amp-example | db/schema.rb | Ruby | mit | 19 | master | 1,133 | # 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 | ProGM/rails-google-amp-example | https://github.com/ProGM/rails-google-amp-example | db/migrate/20160419185759_create_articles.rb | Ruby | mit | 19 | master | 213 | class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title, null: false
t.text :content, null: false
t.timestamps null: false
end
end
end |
github | ProGM/rails-google-amp-example | https://github.com/ProGM/rails-google-amp-example | config/application.rb | Ruby | mit | 19 | master | 1,453 | require File.expand_path('../boot', __FILE__)
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# requi... |
github | taikii/redmine_custom_auto_complete | https://github.com/taikii/redmine_custom_auto_complete | init.rb | Ruby | mit | 19 | master | 543 | require File.expand_path('lib/custom_auto_complete_hook', __dir__)
Redmine::Plugin.register :redmine_custom_auto_complete do
name 'Redmine Custom Auto-Complete plugin'
author 'taikii'
description 'This plugin adds auto-complete to the custom fields.'
version '1.1.2'
url 'https://github.com/taikii/redmine_cus... |
github | taikii/redmine_custom_auto_complete | https://github.com/taikii/redmine_custom_auto_complete | app/controllers/custom_auto_complete_controller.rb | Ruby | mit | 19 | master | 689 | class CustomAutoCompleteController < ApplicationController
unloadable
before_action :find_project, :authorize
def search
@issues = Issue.find_by_sql(["select max(issues.id) as id, custom_values.value as value, count(*) as count from custom_values, issues where custom_values.customized_id = issues.id and cus... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.