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 | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/device_managers.rb | Ruby | mit | 19 | develop | 707 | module OSTSdk
module Saas
class DeviceManagers < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/devices.rb | Ruby | mit | 19 | develop | 1,182 | module OSTSdk
module Saas
class Devices < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/redeemable_skus.rb | Ruby | mit | 19 | develop | 888 | module OSTSdk
module Saas
class RedeemableSkus < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/tokens.rb | Ruby | mit | 19 | develop | 564 | module OSTSdk
module Saas
class Tokens < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/recovery_owners.rb | Ruby | mit | 19 | develop | 688 | module OSTSdk
module Saas
class RecoveryOwners < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/chains.rb | Ruby | mit | 19 | develop | 636 | module OSTSdk
module Saas
class Chains < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/redemptions.rb | Ruby | mit | 19 | develop | 981 | module OSTSdk
module Saas
class Redemptions < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(pa... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/users.rb | Ruby | mit | 19 | develop | 958 | module OSTSdk
module Saas
class Users < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/balance.rb | Ruby | mit | 19 | develop | 634 | module OSTSdk
module Saas
class Balance < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/webhooks.rb | Ruby | mit | 19 | develop | 2,076 | module OSTSdk
module Saas
class Webhooks < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/base_tokens.rb | Ruby | mit | 19 | develop | 573 | module OSTSdk
module Saas
class BaseTokens < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/transactions.rb | Ruby | mit | 19 | develop | 1,250 | module OSTSdk
module Saas
class Transactions < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(p... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/base.rb | Ruby | mit | 19 | develop | 4,325 | module OSTSdk
module Saas
class Base
include OSTSdk::Util::ServicesHelper
attr_reader :http_helper
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
#
def initialize(p... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/manifest.rb | Ruby | mit | 19 | develop | 1,404 | module OSTSdk
module Saas
class Manifest
attr_reader :balance, :chains, :device_managers, :devices, :price_points, :recovery_owners, :redemptions,
:redeemable_skus, :rules, :sessions, :tokens, :transactions, :users, :base_tokens, :webhooks
# Initialize
#
# Arguments:
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/webhooks_test.rb | Ruby | mit | 19 | develop | 2,693 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class UsersTest < Test::Unit::TestCase
def webhooks_service
@webhooks_service ||= Config::OST_SDK.services.webhooks
end
def test_webhooks_create
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/balance_test.rb | Ruby | mit | 19 | develop | 486 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class BalanceTest < Test::Unit::TestCase
def balance_service
@balance_service ||= Config::OST_SDK.services.balance
end
def test_balance_get
resu... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/device_managers_test.rb | Ruby | mit | 19 | develop | 533 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class DeviceManagersTest < Test::Unit::TestCase
def device_managers_service
@device_managers_service ||= Config::OST_SDK.services.device_managers
end
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/transactions_test.rb | Ruby | mit | 19 | develop | 1,601 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class TransactionsTest < Test::Unit::TestCase
def transactions_service
@transactions_service ||= Config::OST_SDK.services.transactions
end
def test_... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/users_test.rb | Ruby | mit | 19 | develop | 874 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class UsersTest < Test::Unit::TestCase
def users_service
@users_service ||= Config::OST_SDK.services.users
end
def test_users_create
result = us... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/chains_test.rb | Ruby | mit | 19 | develop | 486 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class ChainsTest < Test::Unit::TestCase
def chains_service
@chains_service ||= Config::OST_SDK.services.chains
end
def test_chains_get
result = ... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/base_tokens_test.rb | Ruby | mit | 19 | develop | 477 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class BaseTokensTest < Test::Unit::TestCase
def base_tokens_service
@base_tokens_service ||= Config::OST_SDK.services.base_tokens
end
def test_base_... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/redeemable_skus_test.rb | Ruby | mit | 19 | develop | 740 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class RedeemableSkusTest < Test::Unit::TestCase
def redeemable_skus_service
@redeemable_skus_service ||= Config::OST_SDK.services.redeemable_skus
end
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/rules_test.rb | Ruby | mit | 19 | develop | 452 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class RulesTest < Test::Unit::TestCase
def rules_service
@rules_service ||= Config::OST_SDK.services.rules
end
def test_rules_get_list
result = ... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/signature_generation_test.rb | Ruby | mit | 19 | develop | 1,027 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class SignatureGenerationTest < Test::Unit::TestCase
def signature_test_obj
params = {
api_secret: "a0431203671f42c079b2154066fd04ba"
}
@... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/redemptions_test.rb | Ruby | mit | 19 | develop | 769 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class RedemptionsTest < Test::Unit::TestCase
def redemptions_service
@redemptions_service ||= Config::OST_SDK.services.redemptions
end
def test_rede... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/devices_test.rb | Ruby | mit | 19 | develop | 1,400 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class DevicesTest < Test::Unit::TestCase
def devices_service
@devices_service ||= Config::OST_SDK.services.devices
end
def test_devices_create
r... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/price_points_test.rb | Ruby | mit | 19 | develop | 521 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class PricePointsTest < Test::Unit::TestCase
def price_points_service
@price_points_service ||= Config::OST_SDK.services.price_points
end
def test_p... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/sessions_test.rb | Ruby | mit | 19 | develop | 877 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class SessionsTest < Test::Unit::TestCase
def sessions_service
@sessions_service ||= Config::OST_SDK.services.sessions
end
def test_sessions_get
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/recovery_owners_test.rb | Ruby | mit | 19 | develop | 732 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class RecoveryOwnersTest < Test::Unit::TestCase
def recovery_owners_service
@recovery_owners_service ||= Config::OST_SDK.services.recovery_owners
end
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/test/tokens_test.rb | Ruby | mit | 19 | develop | 448 | require_relative "../../../lib/ost-sdk-ruby/util"
require_relative "../../../lib/ost-sdk-ruby/saas"
require "test/unit"
require_relative "../../../lib/config"
class TokensTest < Test::Unit::TestCase
def tokens_service
@tokens_service ||= Config::OST_SDK.services.tokens
end
def test_tokens_get
result = ... |
github | alexkpek/rails-angular-material | https://github.com/alexkpek/rails-angular-material | rails-angular-material.gemspec | Ruby | mit | 19 | master | 671 | # -*- encoding: utf-8 -*-
require File.expand_path("../lib/rails-angular-material/version", __FILE__)
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "rails-angular-material"
s.version = AngularMaterialRails::VERSION
s.date = Time.new.strftime("%Y-%m-%d")
s.su... |
github | alexkpek/rails-angular-material | https://github.com/alexkpek/rails-angular-material | lib/rails-angular-material.rb | Ruby | mit | 19 | master | 238 | require "rails-angular-material/version"
module RailsAngularMaterial
if defined? ::Rails::Engine
require "rails-angular-material/engine"
else
puts "You should use Rails 3.1+ and higher with rails-angular-material!"
end
end |
github | xfalcox/discourse-backups-to-dropbox | https://github.com/xfalcox/discourse-backups-to-dropbox | plugin.rb | Ruby | mit | 19 | master | 970 | # name: discourse-backups-to-dropbox
# about: Backups discourse backups in dropbox
# version: 0.0.2
# authors: Rafael dos Santos Silva <xfalcox@gmail.com>
# url: https://github.com/xfalcox/discourse-backups-to-dropbox
gem 'public_suffix', '2.0.5', {require: false }
gem 'domain_name', '0.5.20170404', {require: false }
... |
github | xfalcox/discourse-backups-to-dropbox | https://github.com/xfalcox/discourse-backups-to-dropbox | lib/dropbox_synchronizer.rb | Ruby | mit | 19 | master | 1,638 | module DiscourseBackupToDropbox
class DropboxSynchronizer
CHUNK_SIZE = 25600000
UPLOAD_MAX_SIZE = CHUNK_SIZE * 4
def self.sync
dbx = Dropbox::Client.new(SiteSetting.discourse_backups_to_dropbox_api_key)
folder_name = Discourse.current_hostname
begin
dbx.create_folder("/#{folde... |
github | xfalcox/discourse-backups-to-dropbox | https://github.com/xfalcox/discourse-backups-to-dropbox | app/jobs/regular/sync_backups_to_dropbox.rb | Ruby | mit | 19 | master | 242 | module Jobs
class SyncBackupsToDropbox < ::Jobs::Base
sidekiq_options queue: 'low'
def execute(args)
::DiscourseBackupToDropbox::DropboxSynchronizer.sync if SiteSetting.discourse_backups_to_dropbox_enabled
end
end
end |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | Rakefile | Ruby | mit | 19 | master | 1,575 | require 'rubygems'
require 'rake/gempackagetask'
require 'rubygems/specification'
require File.join(File.dirname(__FILE__), 'lib', 'sous-chef')
##############################################################################
# Package && release
###########################################################################... |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/sous-chef.rb | Ruby | mit | 19 | master | 633 | require 'rubygems'
gem 'templater', '>= 0.5.0'
require 'templater'
module SousChef
VERSION = '0.0.1'
autoload :ApplicationTask, File.join(File.dirname(__FILE__), 'sous-chef', 'application_task')
autoload :NodeTask, File.join(File.dirname(__FILE__), 'sous-chef', 'node_task')
end
path = File.join(File.d... |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/application.rb | Ruby | mit | 19 | master | 1,421 | module SousChef
module Generators
class ApplicationGenerator < Generator
desc <<-DESC
Generate cookbooks, nodes, and recipes for your chef scripts.
DESC
def destination_root
File.join(@destination_root, name)
end
first_argument :name, :required => true, :desc => "A... |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/template.rb | Ruby | mit | 19 | master | 863 | module SousChef
module Generators
class TemplateGenerator < CookbookBasedGenerator
desc <<-DESC
Generate new template for a cookbook recipe.
DESC
option :cookbook, :required => true, :desc => "Cookbook Name"
option :recipe, :default => :default, :desc => "Recipe Name"
firs... |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/file.rb | Ruby | mit | 19 | master | 828 | module SousChef
module Generators
class FileGenerator < CookbookBasedGenerator
desc <<-DESC
Generate new files for a cookbook recipe.
DESC
option :cookbook, :required => true, :desc => "Cookbook Name"
option :recipe, :default => :default, :desc => "Recipe Name"
first_argum... |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/node.rb | Ruby | mit | 19 | master | 1,325 | module SousChef
module Generators
class NodeGenerator < Generator
desc <<-DESC
The name of the new node.
DESC
first_argument :node, :required => true, :desc => "Node Name"
desc <<-DESC
The Target plateform the application for deployment.
DESC
option :platform, :... |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/cookbook.rb | Ruby | mit | 19 | master | 993 | module SousChef
module Generators
class CookbookGenerator < CookbookBasedGenerator
desc <<-DESC
Generates a new cookbook.
DESC
first_argument :cookbook, :required => true, :desc => "Cookbook Name"
option :recipe, :default => :default, :desc => "Recipe Name"
option :file, :d... |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/templates/nodes/ec2/attributes/c1.medium.rb | Ruby | mit | 19 | master | 226 | require 'open-uri'
instance_type(open('http://169.254.169.254/latest/meta-data/instance-type').gets) unless attribute?('instance_type')
if instance_type == 'c1.medium'
#Add attributes specific to c1.medium instance here
end |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/templates/nodes/ec2/attributes/m1.small.rb | Ruby | mit | 19 | master | 226 | require 'open-uri'
instance_type(open('http://169.254.169.254/latest/meta-data/instance-type').gets) unless attribute?('instance_type')
if instance_type == 'm1.small'
#Add attributes specific to a m1.small instance here
end |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/templates/nodes/ec2/attributes/m1.large.rb | Ruby | mit | 19 | master | 226 | require 'open-uri'
instance_type(open('http://169.254.169.254/latest/meta-data/instance-type').gets) unless attribute?('instance_type')
if instance_type == 'm1.large'
#Add attributes specific to a m1.large instance here
end |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/templates/nodes/ec2/attributes/c1.xlarge.rb | Ruby | mit | 19 | master | 228 | require 'open-uri'
instance_type(open('http://169.254.169.254/latest/meta-data/instance-type').gets) unless attribute?('instance_type')
if instance_type == 'c1.xlarge'
#Add attributes specific to a c1.xlarge instance here
end |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/generators/templates/nodes/ec2/attributes/m1.xlarge.rb | Ruby | mit | 19 | master | 228 | require 'open-uri'
instance_type(open('http://169.254.169.254/latest/meta-data/instance-type').gets) unless attribute?('instance_type')
if instance_type == 'm1.xlarge'
#Add attributes specific to a m1.xlarge instance here
end |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/sous-chef/generator.rb | Ruby | mit | 19 | master | 644 | module SousChef
module Generators
extend Templater::Manifold
desc <<-DESC
Generate cookbooks, nodes, and recipes for your chef scripts.
DESC
class Generator < ::Templater::Generator
def self.source_root
File.join(File.dirname(__FILE__), '..', 'generators', 'templates')
end
... |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/sous-chef/application_task.rb | Ruby | mit | 19 | master | 288 | require 'rake'
require 'rake/tasklib'
module SousChef
class ApplicationTask < ::Rake::TaskLib
def initialize(dir)
@nodes = Dir[File.join(dir, 'nodes', '*')].map {|f| File.basename(f).gsub(/\.rb$/, '')}
@nodes.each {|n| SousChef::NodeTask.new(n, dir)}
end
end
end |
github | benburkert/sous-chef | https://github.com/benburkert/sous-chef | lib/sous-chef/node_task.rb | Ruby | mit | 19 | master | 2,474 | require 'rake'
require 'rake/tasklib'
require 'ey'
module SousChef
class NodeTask < ::Rake::TaskLib
def initialize(name, dir)
@name, @dir = name, dir
@path = "#{dir}/nodes/#{name}"
@cookbook_dir = "cookbooks"
@node_dir = "nodes/#{@name}/cookbooks"
@base_dir = "p... |
github | PatrickTulskie/redis-lock | https://github.com/PatrickTulskie/redis-lock | redis-lock.gemspec | Ruby | mit | 19 | master | 872 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'redis-lock/version'
Gem::Specification.new do |gem|
gem.name = "redis-lock"
gem.version = Redis::Lock::VERSION
gem.authors = ["Patrick Tulskie"]
gem.email ... |
github | PatrickTulskie/redis-lock | https://github.com/PatrickTulskie/redis-lock | lib/redis/lock.rb | Ruby | mit | 19 | master | 2,342 | require 'redis'
class Redis
module Lock
# Lock a given key for updating
#
# Example:
#
# $redis = Redis.new
# lock_for_update('beers_on_the_wall', 20, 1000) do
# $redis.decr('beers_on_the_wall')
# end
def lock_for_update(key, timeout = 60, max_attempts = 100)
if ... |
github | PatrickTulskie/redis-lock | https://github.com/PatrickTulskie/redis-lock | spec/redis_spec.rb | Ruby | mit | 19 | master | 1,740 | require 'spec_helper'
require 'redis-lock'
require 'logger'
require 'date'
describe 'redis' do
before(:all) do
@redis = Redis.new
end
before(:each) do
@redis.flushdb
end
after(:each) do
@redis.flushdb
end
after(:all) do
@redis.quit
end
it "should respond to lock" do
@red... |
github | junegunn/tabularize | https://github.com/junegunn/tabularize | tabularize.gemspec | Ruby | mit | 19 | master | 851 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'tabularize/version'
Gem::Specification.new do |s|
s.name = 'tabularize'
s.version = Tabularize::VERSION
s.authors = ['Junegunn Choi']
s.email = ['junegunn.c@gmail.com']
s.homepage = 'https://g... |
github | junegunn/tabularize | https://github.com/junegunn/tabularize | lib/tabularize.rb | Ruby | mit | 19 | master | 9,051 | # encoding: utf-8
# frozen_string_literal: true
# rubocop:disable Style/HashSyntax
require 'tabularize/version'
require 'stringio'
require 'unicode/display_width'
require 'English'
class Tabularize
DEFAULT_OPTIONS = {
:align => :left,
:valign => :top,
:pad => ' ',
:pad_left ... |
github | junegunn/tabularize | https://github.com/junegunn/tabularize | test/readme.rb | Ruby | mit | 19 | master | 928 | #!/usr/bin/env ruby
# encoding: utf-8
require 'rubygems'
require 'ansi'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'tabularize'
table = Tabularize.new
table = Tabularize.new :pad => '.', :pad_left => 2, :pad_right => 0,
:border_style => :unicode,
... |
github | junegunn/tabularize | https://github.com/junegunn/tabularize | test/test_tabularize.rb | Ruby | mit | 19 | master | 13,489 | # encoding: utf-8
# frozen_string_literal: true
require 'rubygems'
require 'bundler/setup'
require 'minitest/autorun'
require 'tabularize'
require 'csv'
require 'English'
class TestTabularize < Minitest::Test
DATA0 = %w[a aa aaa aaaa aaaaa].freeze
DATA1 =
[
%w[a aa aaa aaaa],
%w[bbbb bbb bb b]
... |
github | alexpeachey/response_state | https://github.com/alexpeachey/response_state | response_state.gemspec | Ruby | mit | 19 | master | 994 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'response_state/version'
Gem::Specification.new do |spec|
spec.name = 'response_state'
spec.version = ResponseState::VERSION
spec.authors = ['alexpeachey']
spec.email ... |
github | alexpeachey/response_state | https://github.com/alexpeachey/response_state | Rakefile | Ruby | mit | 19 | master | 234 | require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
task :console do
require 'irb'
require 'irb/completion'
require 'response_state'
ARGV.clear
IRB.start
end |
github | alexpeachey/response_state | https://github.com/alexpeachey/response_state | lib/response_state/response.rb | Ruby | mit | 19 | master | 1,140 | module ResponseState
class Response
attr_reader :state, :message, :context, :valid_states, :called_states
def initialize(state, message=nil, context=nil, valid_states=nil)
@valid_states = Array(valid_states || self.class.class_valid_states)
raise "Invalid state of response: #{state}" unless @val... |
github | alexpeachey/response_state | https://github.com/alexpeachey/response_state | lib/response_state/service.rb | Ruby | mit | 19 | master | 665 | module ResponseState
class Service
def self.response_states(*states)
@valid_states = Array(states)
end
def self.valid_states
@valid_states || [:success, :failure]
end
def self.call(*args, &block)
self.new(*args).call(&block)
end
def call(&block)
fail NotImplemen... |
github | alexpeachey/response_state | https://github.com/alexpeachey/response_state | spec/spec_helper.rb | Ruby | mit | 19 | master | 525 | require 'coveralls'
Coveralls.wear!
require 'rspec'
require 'response_state'
RSpec.configure do |config|
config.mock_with :rspec
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus
# Run specs in random order to surface order... |
github | alexpeachey/response_state | https://github.com/alexpeachey/response_state | spec/features/full_example_spec.rb | Ruby | mit | 19 | master | 1,320 | require 'spec_helper'
require 'ostruct'
class MyService < ResponseState::Service
attr_reader :object, :pass
def initialize(object, pass)
@object = object
@pass = pass
end
def call
yield (success_response or failure_response)
end
private
def success_response
return unless pass
send... |
github | alexpeachey/response_state | https://github.com/alexpeachey/response_state | spec/lib/response_state/service_spec.rb | Ruby | mit | 19 | master | 2,957 | require 'spec_helper'
require 'ostruct'
module ResponseState
describe Service do
subject(:service) { Service.new }
before do
Response.instance_variable_set :@class_valid_states, nil
Service.instance_variable_set :@valid_states, nil
end
describe '.call' do
it 'news up an instance an... |
github | alexpeachey/response_state | https://github.com/alexpeachey/response_state | spec/lib/response_state/response_spec.rb | Ruby | mit | 19 | master | 3,846 | require 'spec_helper'
module ResponseState
describe Response do
subject(:response) { Response.new(state, message, context, valid_states) }
let(:state) { :success }
let(:message) { nil }
let(:context) { nil }
let(:valid_states) { [:success, :failure] }
before { Response.instance_variable_set :... |
github | durran/injectable | https://github.com/durran/injectable | Gemfile | Ruby | mit | 19 | master | 206 | source "https://rubygems.org"
gemspec
gem "rake"
group :test do
gem "rspec", "~> 2.13"
if ENV["CI"]
gem "coveralls", :require => false
else
gem "guard-rspec"
gem "rb-fsevent"
end
end |
github | durran/injectable | https://github.com/durran/injectable | Rakefile | Ruby | mit | 19 | master | 704 | require "bundler"
Bundler.setup
require "rake"
require "rspec/core/rake_task"
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "injectable/version"
task :gem => :build
task :build do
system "gem build injectable.gemspec"
end
task :install => :build do
system "sudo gem install injectable-#{Injecta... |
github | durran/injectable | https://github.com/durran/injectable | injectable.gemspec | Ruby | mit | 19 | master | 461 | # encoding: utf-8
require "./lib/injectable/version"
Gem::Specification.new do |s|
s.name = "injectable"
s.version = Injectable::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Durran Jordan"]
s.email = ["durran@gmail.com"]
s.summary = "Dead simple Ruby dependency i... |
github | durran/injectable | https://github.com/durran/injectable | spec/spec_helper.rb | Ruby | mit | 19 | master | 315 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
if ENV["CI"]
require "simplecov"
require "coveralls"
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.start do
add_filter "spec"
end
end
require "injectable"
require "rspec" |
github | durran/injectable | https://github.com/durran/injectable | spec/injectable_spec.rb | Ruby | mit | 19 | master | 1,191 | require "spec_helper"
describe Injectable do
describe ".configure" do
before(:all) do
class Admin; end
end
after(:all) do
Object.__send__(:remove_const, :Admin)
end
context "when provided a block" do
before do
described_class.configure do |registry|
regist... |
github | durran/injectable | https://github.com/durran/injectable | spec/injectable/registerable_spec.rb | Ruby | mit | 19 | master | 1,242 | require "spec_helper"
describe Injectable::Registerable do
describe ".included" do
before(:all) do
class Register
include Injectable::Registerable
end
class User; end
class SuperUser; end
end
after(:all) do
Object.__send__(:remove_const, :Register)
Object.__... |
github | durran/injectable | https://github.com/durran/injectable | spec/injectable/container_spec.rb | Ruby | mit | 19 | master | 9,124 | require "spec_helper"
describe Injectable::Container do
describe "#get" do
before(:all) do
class User
include Injectable
end
class UserFinder
include Injectable
end
class UserService
include Injectable
dependencies :user, :user_finder
end
... |
github | durran/injectable | https://github.com/durran/injectable | spec/injectable/inflector_spec.rb | Ruby | mit | 19 | master | 663 | require "spec_helper"
describe Injectable::Inflector do
describe ".underscore" do
context "when provided a non namespaced name" do
context "when the name is one word" do
let(:inflected) do
described_class.underscore("Band")
end
it "returns the name as lowercase" do
... |
github | durran/injectable | https://github.com/durran/injectable | spec/injectable/macros_spec.rb | Ruby | mit | 19 | master | 1,912 | require "spec_helper"
describe Injectable::Macros do
describe ".dependencies" do
before(:all) do
class User; end
class UserFinder; end
end
after(:all) do
Object.__send__(:remove_const, :User)
Object.__send__(:remove_const, :UserFinder)
end
context "when providing a sin... |
github | durran/injectable | https://github.com/durran/injectable | spec/injectable/registry_spec.rb | Ruby | mit | 19 | master | 1,986 | require "spec_helper"
describe Injectable::Registry do
describe "#implementation" do
before(:all) do
class User; end
end
after(:all) do
Object.__send__(:remove_const, :User)
end
context "when the implementation is registered" do
let(:implementation) do
described_cla... |
github | durran/injectable | https://github.com/durran/injectable | lib/injectable.rb | Ruby | mit | 19 | master | 1,378 | # encoding: utf-8
require "injectable/container"
require "injectable/inflector"
require "injectable/macros"
require "injectable/registry"
# Objects that include Injectable can have their dependencies satisfied by the
# container, and removes some basic boilerplate code of creating basic
# constructors that set instanc... |
github | durran/injectable | https://github.com/durran/injectable | lib/injectable/container.rb | Ruby | mit | 19 | master | 3,395 | # encoding: utf-8
require "injectable/registerable"
module Injectable
# A simple container that can resolve dependencies.
#
# @since 0.0.0
class Container
include Registerable
# Get an instance of an object from the container with the provided class.
#
# @example Get an instance of an object ... |
github | durran/injectable | https://github.com/durran/injectable | lib/injectable/inflector.rb | Ruby | mit | 19 | master | 767 | # encoding: utf-8
module Injectable
# Used so we don't need active support around to perform inflections.
#
# @since 0.0.4
module Inflector
class << self
# Underscore a string. This is partially taken from Active Support, but
# dumbed down for our purposes - we don't handle namespacing.
... |
github | durran/injectable | https://github.com/durran/injectable | lib/injectable/macros.rb | Ruby | mit | 19 | master | 1,562 | # encoding: utf-8
module Injectable
# Provides class level macros for setting up dependencies.
#
# @since 0.0.0
module Macros
# Sets up the dependencies for the class.
#
# @example Define a UserService that has two dependencies.
# class User; end
# class UserFinder; end
#
# c... |
github | durran/injectable | https://github.com/durran/injectable | lib/injectable/registry.rb | Ruby | mit | 19 | master | 2,324 | # encoding: utf-8
require "injectable/registerable"
module Injectable
# The registry keeps track of all objects and their dependencies that need
# to be injected at construction.
#
# @since 0.0.0
module Registry
include Registerable
extend self
# Get an implementation for the provided name.
... |
github | durran/injectable | https://github.com/durran/injectable | lib/injectable/registerable.rb | Ruby | mit | 19 | master | 701 | # encoding: utf-8
module Injectable
module Registerable
# Register that instances of klass will perform the given role in this
# container context.
#
# @example Register that the user_finder role will be performed by
# instances of DatabaseUserFinder
# container.register_implementation(:u... |
github | herval/render_static | https://github.com/herval/render_static | Gemfile | Ruby | mit | 19 | master | 203 | source "http://rubygems.org"
gem "selenium-webdriver"
gem "headless"
group :development do
gem "rspec"
gem "shoulda", ">= 0"
gem "rdoc", "~> 3.12"
gem "bundler"
gem "jeweler", "~> 1.8.4"
end |
github | herval/render_static | https://github.com/herval/render_static | render_static.gemspec | Ruby | mit | 19 | master | 2,679 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "render_static"
s.version = "0.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_ru... |
github | herval/render_static | https://github.com/herval/render_static | Rakefile | Ruby | mit | 19 | master | 1,459 | # encoding: utf-8
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is... |
github | herval/render_static | https://github.com/herval/render_static | spec/middleware_spec.rb | Ruby | mit | 19 | master | 2,126 | require "render_static/middleware"
describe RenderStatic::Middleware do
let(:app) { stub }
let(:middleware) { RenderStatic::Middleware.new(app) }
let(:request) {
{
"PATH_INFO" => "/somewhere/",
"REQUEST_METHOD" => "GET"
}
}
before do
RenderStatic::Middleware.base_path = "/somewhe... |
github | herval/render_static | https://github.com/herval/render_static | spec/renderer_spec.rb | Ruby | mit | 19 | master | 739 | require "render_static/renderer"
describe RenderStatic::Renderer do
class Headless
def self.ly &block
yield
end
end
describe ".render" do
it "requests the content" do
env = { "HTTP_HOST" => "localhost:3000", "REQUEST_PATH" => "/abc", "rack.url_scheme" => "https" }
navigate = stub
... |
github | herval/render_static | https://github.com/herval/render_static | lib/render_static/middleware.rb | Ruby | mit | 19 | master | 1,153 | require 'render_static/rails/railtie' if defined?(Rails)
require 'render_static/renderer'
module RenderStatic
class NotSeoFriendly < Exception
end
class Middleware
class << self
attr_accessor :base_path
end
def initialize(app)
@app = app
end
def call(env)
if will_render?(... |
github | herval/render_static | https://github.com/herval/render_static | lib/render_static/renderer.rb | Ruby | mit | 19 | master | 450 | require 'selenium-webdriver'
require 'headless'
module RenderStatic
class Renderer
def self.render(env)
Headless.ly do
browser = Selenium::WebDriver.for(:firefox)
path = "#{env["rack.url_scheme"]}://#{env["HTTP_HOST"]}#{env["REQUEST_PATH"]}"
browser.navigate.to(path)
[200, ... |
github | herval/render_static | https://github.com/herval/render_static | lib/render_static/rails/railtie.rb | Ruby | mit | 19 | master | 204 | require 'rails'
module RenderStatic
class Railtie < Rails::Railtie
initializer "render_static.insert_middleware" do |app|
app.config.middleware.use RenderStatic::Middleware
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | omnom.gemspec | Ruby | mit | 19 | master | 1,323 | $:.push File.expand_path('../lib', __FILE__)
require 'omnom/version'
Gem::Specification.new do |s|
s.name = 'omnom'
s.version = Omnom::VERSION
s.authors = ['Tom Benner']
s.email = ['tombenner@gmail.com']
s.homepage = 'https://github.com/tombenner/omnom'
s.summary = s.description = '... |
github | tombenner/omnom | https://github.com/tombenner/omnom | Rakefile | Ruby | mit | 19 | master | 700 | #!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.r... |
github | tombenner/omnom | https://github.com/tombenner/omnom | app/controllers/omnom/feeds_controller.rb | Ruby | mit | 19 | master | 637 | module Omnom
class FeedsController < Omnom::ApplicationController
def index
feeds = Omnom.feeds
@feed_key = feeds.keys.first
show
render template: 'omnom/feeds/show'
end
def show
@feed_key ||= params[:id]
@feed = Omnom.feeds[@feed_key]
render_404 and return if @f... |
github | tombenner/omnom | https://github.com/tombenner/omnom | app/controllers/omnom/application_controller.rb | Ruby | mit | 19 | master | 256 | module Omnom
class ApplicationController < ::ApplicationController
helper Rails.application.routes.url_helpers
helper PostsHelper
layout 'omnom/layouts/application'
def render_404
render :status => 404 and return
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | app/controllers/omnom/posts_controller.rb | Ruby | mit | 19 | master | 278 | module Omnom
class PostsController < Omnom::ApplicationController
def update_all
if Post.where(id: params[:ids]).update_all(params[:post])
render json: {success: true}
else
render json: {success: false}, status: 500
end
end
end
end |
github | tombenner/omnom | https://github.com/tombenner/omnom | app/models/omnom/post.rb | Ruby | mit | 19 | master | 1,439 | module Omnom
class Post < ActiveRecord::Base
attr_accessible :author_name, :author_url, :comments_count, :comments_url, :description,
:guid, :guid_namespace, :is_read, :other, :published_at, :subtitle, :tags,
:thumbnail_height, :thumbnail_url, :thumbnail_width, :title, :url
has_many :posts_origin... |
github | tombenner/omnom | https://github.com/tombenner/omnom | app/models/omnom/posts_origin.rb | Ruby | mit | 19 | master | 368 | module Omnom
class PostsOrigin < ActiveRecord::Base
attr_accessible :post_id, :feed_key, :source_key, :source_id
belongs_to :post
validates_presence_of :post_id, :feed_key, :source_key, :source_id
def feed
Omnom.feeds[feed_key]
end
def source
return nil unless feed
feed.s... |
github | tombenner/omnom | https://github.com/tombenner/omnom | app/helpers/omnom/posts_helper.rb | Ruby | mit | 19 | master | 384 | module Omnom
module PostsHelper
def post_timeago(post)
content_tag :abbr, post.published_at.utc, title: post.published_at.iso8601, class: 'timeago'
end
def post_source_icon(post)
return nil if post.source.blank? || post.source.settings[:icon].blank?
content_tag :div, image_tag(post.sour... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/spec_helper.rb | Ruby | mit | 19 | master | 1,484 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../dummy/config/environment', __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'helpers/source_helpers'
# Requires supporting ruby files with custom matchers and macros, etc,... |
github | tombenner/omnom | https://github.com/tombenner/omnom | spec/dummy/db/schema.rb | Ruby | mit | 19 | master | 2,764 | # 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 | tombenner/omnom | https://github.com/tombenner/omnom | spec/dummy/db/migrate/20130424222539_create_omnom_posts_origins.rb | Ruby | mit | 19 | master | 454 | class CreateOmnomPostsOrigins < ActiveRecord::Migration
def change
create_table :omnom_posts_origins do |t|
t.belongs_to :post
t.string :feed_key
t.string :source_key
t.string :source_id
t.timestamps
end
add_index :omnom_posts_origins, :post_id
add_index :omnom_posts_or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.