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 | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/api/alee.rb | Ruby | apache-2.0 | 95 | main | 505 | # frozen_string_literal: true
require 'aspera/api/aoc.rb'
module Aspera
module Api
# Aspera License Entitlement Engine API client
class Alee < Aspera::Rest
def initialize(entitlement_id, customer_id, api_domain: AoC::SAAS_DOMAIN_PROD, version: 'v1')
super(
base_url: "https://api.#{api... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/api/node.rb | Ruby | apache-2.0 | 95 | main | 29,196 | # frozen_string_literal: true
require 'aspera/transfer/spec'
require 'aspera/rest'
require 'aspera/oauth'
require 'aspera/log'
require 'aspera/assert'
require 'aspera/environment'
require 'base64'
require 'openssl'
require 'pathname'
require 'zlib'
require 'net/ssh/buffer'
module Aspera
module Api
# Aspera Node... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/api/cos_node.rb | Ruby | apache-2.0 | 95 | main | 4,348 | # frozen_string_literal: true
require 'aspera/log'
require 'aspera/assert'
require 'aspera/api/node'
require 'xmlsimple'
module Aspera
module Api
# Cloud Object Storage Node API Client
class CosNode < Node
IBM_CLOUD_TOKEN_URL = 'https://iam.cloud.ibm.com/identity'
TOKEN_FIELD = 'delegated_refres... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/oauth/base.rb | Ruby | apache-2.0 | 95 | main | 5,691 | # frozen_string_literal: true
require 'aspera/oauth/factory'
require 'aspera/log'
require 'aspera/assert'
require 'date'
module Aspera
module OAuth
# OAuth 2 client for the REST client
# Generate bearer token
# Bearer tokens are cached in memory and in a file cache for later re-use
# OAuth 2.0 Autho... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/oauth/url_json.rb | Ruby | apache-2.0 | 95 | main | 1,031 | # frozen_string_literal: true
require 'aspera/oauth/base'
module Aspera
module OAuth
# This class is used to create a token using a JSON body and a URL
class UrlJson < Base
# @param url [Hash] Query parameters to send
# @param json [Hash] Body parameters to send as JSON
# @param generic_p... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/oauth/generic.rb | Ruby | apache-2.0 | 95 | main | 886 | # frozen_string_literal: true
require 'aspera/oauth/base'
module Aspera
module OAuth
# Generic token creator
class Generic < Base
def initialize(
grant_type:,
response_type: nil,
apikey: nil,
receiver_client_ids: nil,
**base_params
)
super(**base_p... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/oauth/jwt.rb | Ruby | apache-2.0 | 95 | main | 2,858 | # frozen_string_literal: true
require 'aspera/oauth/base'
require 'aspera/assert'
require 'securerandom'
require 'openssl'
module Aspera
module OAuth
# remove 5 minutes to account for time offset between client and server (TODO: configurable?)
Factory.instance.parameters[:jwt_accepted_offset_sec] = 300
#... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/oauth/web.rb | Ruby | apache-2.0 | 95 | main | 2,155 | # frozen_string_literal: true
require 'aspera/oauth/base'
require 'aspera/environment'
require 'aspera/web_auth'
require 'aspera/assert'
module Aspera
module OAuth
# Authentication using Web browser
class Web < Base
class << self
attr_accessor :additional_info
end
# @param redirect_... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/oauth/factory.rb | Ruby | apache-2.0 | 95 | main | 6,563 | # frozen_string_literal: true
require 'aspera/id_generator'
require 'aspera/assert'
require 'singleton'
require 'base64'
module Aspera
module OAuth
# Factory to create tokens and manage their cache
class Factory
include Singleton
# a prefix for persistency of tokens (simplify garbage collect)
... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | spec/aspera-cli_spec.rb | Ruby | apache-2.0 | 95 | main | 11,498 | # frozen_string_literal: true
require 'rspec'
require 'spec_helper'
require 'aspera/log'
# Aspera::Log.instance.level = :debug
# Aspera::Log.instance.logger_type = :stderr
require 'aspera/coverage'
require 'aspera/transfer/uri'
require 'aspera/cli/main'
require 'aspera/ascmd'
require 'aspera/assert'
require 'aspera/ss... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | spec/spec_helper.rb | Ruby | apache-2.0 | 95 | main | 793 | # frozen_string_literal: true
require 'bundler/setup'
require 'yaml'
require_relative '../build/lib/test_env'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
config.expect_with(:rspec) do |c|
c.syntax = :expect
... |
github | kmrshntr/omniauth-slack | https://github.com/kmrshntr/omniauth-slack | omniauth-slack.gemspec | Ruby | mit | 95 | master | 969 | # coding: utf-8
require File.expand_path('../lib/omniauth-slack/version', __FILE__)
Gem::Specification.new do |spec|
spec.name = "omniauth-slack"
spec.version = Omniauth::Slack::VERSION
spec.authors = ["kimura"]
spec.email = ["kimura@enigmo.co.jp"]
spec.description = %q{OmniAut... |
github | kmrshntr/omniauth-slack | https://github.com/kmrshntr/omniauth-slack | test/test.rb | Ruby | mit | 95 | master | 3,905 | require "helper"
require "omniauth-slack"
class StrategyTest < StrategyTestCase
include OAuth2StrategyTests
end
class ClientTest < StrategyTestCase
test "has correct Slack site" do
assert_equal "https://slack.com", strategy.client.site
end
test "has correct authorize url" do
assert_equal "/oauth/auth... |
github | kmrshntr/omniauth-slack | https://github.com/kmrshntr/omniauth-slack | test/helper.rb | Ruby | mit | 95 | master | 1,518 | require "bundler/setup"
require "minitest/autorun"
require "mocha/setup"
require "omniauth/strategies/slack"
OmniAuth.config.test_mode = true
module BlockTestHelper
def test(name, &blk)
method_name = "test_#{name.gsub(/\s+/, "_")}"
raise "Method already defined: #{method_name}" if instance_methods.include?(... |
github | kmrshntr/omniauth-slack | https://github.com/kmrshntr/omniauth-slack | test/support/shared_examples.rb | Ruby | mit | 95 | master | 3,352 | # NOTE it would be useful if this lived in omniauth-oauth2 eventually
module OAuth2StrategyTests
def self.included(base)
base.class_eval do
include ClientTests
include AuthorizeParamsTests
include CSRFAuthorizeParamsTests
include TokenParamsTests
end
end
module ClientTests
ext... |
github | kmrshntr/omniauth-slack | https://github.com/kmrshntr/omniauth-slack | lib/omniauth/strategies/slack.rb | Ruby | mit | 95 | master | 2,880 | require 'omniauth/strategies/oauth2'
require 'uri'
require 'rack/utils'
module OmniAuth
module Strategies
class Slack < OmniAuth::Strategies::OAuth2
option :name, 'slack'
option :authorize_options, [:scope, :team]
option :client_options, {
site: 'https://slack.com',
token_url:... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | Vagrantfile | Ruby | bsd-3-clause | 95 | master | 1,004 | # -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "djangocore-box-1.1"
config.vm.box_url = "https://www.djangoproject.com/m/vms/djangocore-box-1.1.box"
config.vm.host_name = "djangocore"
config.ssh.forward_agent = true
# Shared folders
hosthome = "#{ENV['HOME']}/"
... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/memcached/metadata.rb | Ruby | bsd-3-clause | 95 | master | 1,096 | name "memcached"
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs memcached and provides a define to set up an instance of memcache via runit"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
vers... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/memcached/recipes/default.rb | Ruby | bsd-3-clause | 95 | master | 2,123 | #
# Cookbook Name:: memcached
# Recipe:: default
#
# Copyright 2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/memcached/definitions/memcached_instance.rb | Ruby | bsd-3-clause | 95 | master | 993 | #
# Cookbook Name:: memcached
# Definition:: memcached_instance
#
# Copyright 2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENS... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/git/metadata.rb | Ruby | bsd-3-clause | 95 | master | 698 | name "git"
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs git and/or sets up a Git server daemon"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.1.1"
recipe "gi... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/git/recipes/windows.rb | Ruby | bsd-3-clause | 95 | master | 1,017 | #
# Cookbook Name:: git
# Recipe:: windows
#
# Copyright 2008-2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/git/recipes/default.rb | Ruby | bsd-3-clause | 95 | master | 1,216 | #
# Cookbook Name:: git
# Recipe:: default
#
# Copyright 2008-2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/git/recipes/source.rb | Ruby | bsd-3-clause | 95 | master | 1,743 | #
# Cookbook Name:: git
# Recipe:: source
#
# Copyright 2012, Brian Flad, Fletcher Nichol
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/git/recipes/server.rb | Ruby | bsd-3-clause | 95 | master | 1,119 | #
# Cookbook Name:: git
# Recipe:: server
#
# Copyright 2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/git/attributes/default.rb | Ruby | bsd-3-clause | 95 | master | 1,862 | #
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
# Cookbook Name:: git
# Attributes:: default
#
# Copyright 2008-2012, Opscode, Inc.
#
# 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 at
#
# ... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/metadata.rb | Ruby | bsd-3-clause | 95 | master | 999 | name "postgresql"
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures postgresql for clients or servers"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "2.0.2"
reci... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/test/kitchen/cookbooks/postgresql_test/metadata.rb | Ruby | bsd-3-clause | 95 | master | 228 | maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "This cookbook is used with test-kitchen to test the parent, postgresql cookbook"
version "1.0.0" |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/test/kitchen/cookbooks/postgresql_test/recipes/default.rb | Ruby | bsd-3-clause | 95 | master | 675 | #
# Cookbook Name:: postgresql_test
# Recipe:: default
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/test/kitchen/cookbooks/postgresql_test/recipes/ruby.rb | Ruby | bsd-3-clause | 95 | master | 672 | #
# Cookbook Name:: postgresql_test
# Recipe:: default
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/test/kitchen/cookbooks/postgresql_test/recipes/server.rb | Ruby | bsd-3-clause | 95 | master | 794 | #
# Cookbook Name:: postgresql_test
# Recipe:: server
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/files/default/tests/minitest/ruby_test.rb | Ruby | bsd-3-clause | 95 | master | 881 | #
# Cookbook Name:: postgresql_test
# Recipe:: default
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/files/default/tests/minitest/server_test.rb | Ruby | bsd-3-clause | 95 | master | 1,393 | #
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/files/default/tests/minitest/default_test.rb | Ruby | bsd-3-clause | 95 | master | 870 | #
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/files/default/tests/minitest/support/helpers.rb | Ruby | bsd-3-clause | 95 | master | 797 | #
# Cookbook Name:: postgresql_test
# Recipe:: default
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/recipes/server_redhat.rb | Ruby | bsd-3-clause | 95 | master | 1,822 | #
# Cookbook Name:: postgresql
# Recipe:: server
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Lamont Granquist (<lamont@opscode.com>)
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/recipes/ppa_pitti_postgresql.rb | Ruby | bsd-3-clause | 95 | master | 249 | include_recipe 'apt'
apt_repository 'Pitti Postgresql PPA' do
uri 'http://ppa.launchpad.net/pitti/postgresql/ubuntu'
distribution node[:lsb][:codename]
components %w(main)
keyserver 'keyserver.ubuntu.com'
key '8683D8A2'
action :add
end |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/recipes/default.rb | Ruby | bsd-3-clause | 95 | master | 669 | #
# Cookbook Name:: postgresql
# Recipe:: default
#
# Copyright 2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/recipes/client.rb | Ruby | bsd-3-clause | 95 | master | 921 | #
# Cookbook Name:: postgresql
# Recipe:: client
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Lamont Granquist (<lamont@opscode.com>)
# Copyright 2009-2011 Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/recipes/ruby.rb | Ruby | bsd-3-clause | 95 | master | 3,021 | #
# Cookbook Name:: postgresql
# Recipe:: ruby
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Copyright 2012 Opscode, Inc.
#
# 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 at
#
# http... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/recipes/server.rb | Ruby | bsd-3-clause | 95 | master | 2,749 | #
# Cookbook Name:: postgresql
# Recipe:: server
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Lamont Granquist (<lamont@opscode.com>)
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/recipes/server_debian.rb | Ruby | bsd-3-clause | 95 | master | 1,038 | #
# Cookbook Name:: postgresql
# Recipe:: server
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Lamont Granquist (<lamont@opscode.com>)#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/postgresql/attributes/default.rb | Ruby | bsd-3-clause | 95 | master | 7,512 | #
# Cookbook Name:: postgresql
# Attributes:: postgresql
#
# Copyright 2008-2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/metadata.rb | Ruby | bsd-3-clause | 95 | master | 4,824 | name "mysql"
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures mysql for client or server"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "2.1.0"
recipe "mysql",... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/test/features/step_definitions/mysql_steps.rb | Ruby | bsd-3-clause | 95 | master | 1,133 | Given 'a new database server with some example data' do
end
When 'I delete a row from a database table' do
delete_chef 'Alison Holst'
end
When 'I query the database' do
select_tv_chefs
end
When 'I insert a new row into a database table' do
insert_chef 'Ainsley Harriott'
end
When 'I update a row in a database... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/test/features/support/mysql_helpers.rb | Ruby | bsd-3-clause | 95 | master | 1,066 | def query(sql)
cmd_prefix = test_client_host ? "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@#{test_client_host}" : ''
result = %x{echo "#{sql}" | #{cmd_prefix} mysql --host=#{test_server_host} --user=#{test_user} --password=#{test_password} --skip-column-names #{test_database}}
assert $?.... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/test/kitchen/cookbooks/mysql_test/metadata.rb | Ruby | bsd-3-clause | 95 | master | 303 | maintainer "Andrew Crump"
maintainer_email "andrew@kotirisoftware.com"
license "Apache 2.0"
description "Acceptance tests for mysql"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.0"
depends "database"
depends "yum" |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/test/kitchen/cookbooks/mysql_test/recipes/server.rb | Ruby | bsd-3-clause | 95 | master | 2,181 | #
# Cookbook Name:: mysql_test
# Recipe:: server
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/test/kitchen/cookbooks/mysql_test/recipes/setup.rb | Ruby | bsd-3-clause | 95 | master | 898 | #
# Cookbook Name:: mysql_test
# Recipe:: setup
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/test/kitchen/cookbooks/mysql_test/recipes/client.rb | Ruby | bsd-3-clause | 95 | master | 687 | #
# Cookbook Name:: mysql_test
# Recipe:: client
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/test/kitchen/cookbooks/mysql_test/attributes/default.rb | Ruby | bsd-3-clause | 95 | master | 961 | #
# Cookbook Name:: mysql_test
# Attributes:: default
#
# Copyright 2012, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/libraries/helpers.rb | Ruby | bsd-3-clause | 95 | master | 1,004 | #
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Copyright:: Copyright (c) 2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# 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 at
#
#... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/recipes/server.rb | Ruby | bsd-3-clause | 95 | master | 6,937 | #
# Cookbook Name:: mysql
# Recipe:: default
#
# Copyright 2008-2011, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/recipes/client.rb | Ruby | bsd-3-clause | 95 | master | 1,846 | #
# Cookbook Name:: mysql
# Recipe:: client
#
# Copyright 2008-2011, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/recipes/server_ec2.rb | Ruby | bsd-3-clause | 95 | master | 1,284 | #
# Cookbook Name:: mysql
# Recipe:: default
#
# Copyright 2008-2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/recipes/default.rb | Ruby | bsd-3-clause | 95 | master | 664 | #
# Cookbook Name:: mysql
# Recipe:: default
#
# Copyright 2008-2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/recipes/ruby.rb | Ruby | bsd-3-clause | 95 | master | 1,114 | #
# Cookbook Name:: mysql
# Recipe:: ruby
#
# Author:: Jesse Howarth (<him@jessehowarth.com>)
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
#
# Copyright 2008-2012, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/attributes/client.rb | Ruby | bsd-3-clause | 95 | master | 2,350 | #
# Cookbook Name:: mysql
# Attributes:: client
#
# Copyright 2008-2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/attributes/server.rb | Ruby | bsd-3-clause | 95 | master | 13,059 | #
# Cookbook Name:: mysql
# Attributes:: server
#
# Copyright 2008-2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/files/default/tests/minitest/server_test.rb | Ruby | bsd-3-clause | 95 | master | 1,071 | require File.expand_path('../support/helpers.rb', __FILE__)
describe 'mysql::server' do
include Helpers::Mysql
it 'has a secure operating system password' do
assert_secure_password(:debian)
end
it 'has a secure root password' do
assert_secure_password(:root)
end
it 'has a secure replication passw... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/mysql/files/default/tests/minitest/support/helpers.rb | Ruby | bsd-3-clause | 95 | master | 277 | module Helpers
module Mysql
include MiniTest::Chef::Assertions
include MiniTest::Chef::Context
include MiniTest::Chef::Resources
def assert_secure_password(type)
node["mysql"]["server_#{type}_password"].length.must_be_close_to(20, 8)
end
end
end |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/openssl/metadata.rb | Ruby | bsd-3-clause | 95 | master | 397 | name "openssl"
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Provides a library with a method for generating secure random passwords."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.0"... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/openssl/recipes/default.rb | Ruby | bsd-3-clause | 95 | master | 630 | #
# Cookbook Name:: openssl
# Recipe:: default
#
# Copyright 2009, Opscode, Inc.
#
# 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
github | jphalip/djangocore-box | https://github.com/jphalip/djangocore-box | provisioning/chef/openssl/libraries/secure_password.rb | Ruby | bsd-3-clause | 95 | master | 964 | #
# Cookbook Name:: openssl
# Library:: secure_password
# Author:: Joshua Timberman <joshua@opscode.com>
#
# Copyright 2009, Opscode, Inc.
#
# 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 at
#
# ... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | Gemfile | Ruby | mit | 95 | master | 1,325 | source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1', '>= 5.0.1'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cab... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | test/controllers/api/players_controller_test.rb | Ruby | mit | 95 | master | 663 | require 'test_helper'
class PlayersControllerTest < ActionDispatch::IntegrationTest
test "POST #create" do
assert_difference('Player.count', 1) do
post api_players_path, params: {
player: {
name: 'bob'
}
}
end
assert_response :success
end
test "POST #create twic... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | test/controllers/api/players_games_controller_test.rb | Ruby | mit | 95 | master | 618 | require 'test_helper'
module Api
class PlayersGamesControllerTest < ActionDispatch::IntegrationTest
test "POST #create" do
player = Player.create(name: 'bob')
game = Game.create
assert_nil game.left_player
assert_difference('PlayersGame.count', 1) do
post api_players_games_path, p... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | test/controllers/api/games_controller_test.rb | Ruby | mit | 95 | master | 373 | require 'test_helper'
module Api
class GamesControllerTest < ActionDispatch::IntegrationTest
test "GET #index" do
get api_games_path, :xhr => true
assert_response :success
end
test "POST #create" do
assert_difference('Game.count', 1) do
post api_games_path, :xhr => true
e... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | test/models/players_game_test.rb | Ruby | mit | 95 | master | 1,175 | require 'test_helper'
module Api
class PlayersGameTest < ActiveSupport::TestCase
def setup
@bob = Player.create(name: 'bob')
@alice = Player.create(name: 'alice')
@game = Game.create
end
test "should only have one left player" do
pg_left = PlayersGame.create(game_id: @game.id, ... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | test/models/game_test.rb | Ruby | mit | 95 | master | 780 | require 'test_helper'
class GameTest < ActionDispatch::IntegrationTest
def setup
@game = Game.create
bob = Player.create(name: 'bob')
alice = Player.create(name: 'alice')
@pg_left = PlayersGame.create(game_id: @game.id, player_id: bob.id, position: 'left')
@pg_right = PlayersGame.create(game_id: ... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | db/schema.rb | Ruby | mit | 95 | master | 1,178 | # 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 source for your
# dat... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | db/seeds.rb | Ruby | mit | 95 | master | 428 | # 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | db/migrate/20161229040917_create_players_games.rb | Ruby | mit | 95 | master | 344 | class CreatePlayersGames < ActiveRecord::Migration[5.0]
def change
create_table :players_games do |t|
t.integer :game_id
t.integer :player_id
t.integer :position
t.integer :score, :default => 0, :limit => 1
end
add_foreign_key :players_games, :players
add_foreign_key :players_... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/jobs/pong_job.rb | Ruby | mit | 95 | master | 347 | class PongJob < ApplicationJob
queue_as :default
def perform(game)
next_hit = nil
while game.playing?
b = Ball.new(game, next_hit)
b.serve
next_hit = b.next_hit
end
$redis.with do |conn|
conn.del("left:#{game.id}")
end
$redis.with do |conn|
conn.del("right:#{ga... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/models/stripe_wrapper.rb | Ruby | mit | 95 | master | 511 | module StripeWrapper
class Charge
attr_reader :response, :error_message
def initialize(response, error_message)
@response = response
@error_message = error_message
end
def self.create(options={})
begin
response = Stripe::Charge.create(options)
new(response, nil)
... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/models/game.rb | Ruby | mit | 95 | master | 1,041 | class Game < ApplicationRecord
enum status: [:waiting, :playing, :over]
has_many :players_games
has_many :players, through: :players_games
after_create :broadcast
after_commit :play
def left_player
player(:left)
end
def right_player
player(:right)
end
def score(position)
pg = player... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/models/ball.rb | Ruby | mit | 95 | master | 3,197 | class Ball
attr_reader :next_hit
TABLE_WIDTH = 650
TABLE_HEIGHT = 480
BALL_HEIGHT = 15
BALL_WIDTH = 15
PADDLE_HEIGHT = 80
VALID_SLOPES = [0, 0.0875, 0.2679, 0.5773, 1]
def initialize(game, next_hit=nil)
@game = game
@difficulty = 5
@x = 318
@y = 232
next_hit ||= 'left'
@next_hit... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/models/players_game.rb | Ruby | mit | 95 | master | 505 | class PlayersGame < ApplicationRecord
enum position: [:left, :right]
belongs_to :player
belongs_to :game
validates :game_id, uniqueness: {scope: [:position]}
validates :player_id, uniqueness: {scope: [:game_id]}
after_save :update_game
after_commit :broadcast_game
private
def update_game
if gam... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/controllers/api/players_controller.rb | Ruby | mit | 95 | master | 320 | module Api
class PlayersController < ApplicationController
def create
player = Player.find_or_create_by(name: params[:player][:name])
if player.valid?
render :json => player
else
render :json => {:errors => player.errors.full_messages}, :status => 422
end
end
end
end |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/controllers/api/games_controller.rb | Ruby | mit | 95 | master | 456 | module Api
class GamesController < ApplicationController
def index
render :json => Game.where("status != 2").order(id: :asc).limit(5).to_json({:methods => [:left_player, :right_player]})
end
def create
if Game.where("status != 2").count <= 5
render :json => Game.create
else
... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/controllers/api/donations_controller.rb | Ruby | mit | 95 | master | 478 | module Api
class DonationsController < ApplicationController
def create
charge = StripeWrapper::Charge.create(donation_params.to_h)
if charge.successful?
head :ok
else
render json: {error: charge.error_message}, status: :unprocessable_entity
end
end
private
de... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/controllers/api/leaders_controller.rb | Ruby | mit | 95 | master | 610 | module Api
class LeadersController < ApplicationController
def index
render :json => leader_board
end
private
def leader_board
Player.find_by_sql(%q{
SELECT p.name,
sum(pg.score) points,
count(pg.id) total_games,
sum(case when pg.score... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/controllers/api/players_games_controller.rb | Ruby | mit | 95 | master | 391 | module Api
class PlayersGamesController < ApplicationController
def create
players_game = PlayersGame.new(players_game_params)
players_game.save!
render :json => players_game
end
private
def players_game_params
params.require(:players_game).permit(
:game_id,
:... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/channels/right_paddle_channel.rb | Ruby | mit | 95 | master | 336 | class RightPaddleChannel < ApplicationCable::Channel
def subscribed
stream_from "right_paddle_channel_#{params[:game_id]}"
end
def receive(data)
$redis.with do |conn|
conn.set("right:#{params[:game_id]}", data["y"])
end
ActionCable.server.broadcast "left_paddle_channel_#{params[:game_id]}",... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/channels/left_paddle_channel.rb | Ruby | mit | 95 | master | 334 | class LeftPaddleChannel < ApplicationCable::Channel
def subscribed
stream_from "left_paddle_channel_#{params[:game_id]}"
end
def receive(data)
$redis.with do |conn|
conn.set("left:#{params[:game_id]}", data["y"])
end
ActionCable.server.broadcast "right_paddle_channel_#{params[:game_id]}", d... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | app/channels/application_cable/connection.rb | Ruby | mit | 95 | master | 203 | module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_player
def connect
self.current_player = Player.find_by(name: 'left')
end
end
end |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | config/routes.rb | Ruby | mit | 95 | master | 429 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
namespace :api, :defaults => {format: 'json'} do
resources :games, :except => [:show, :new, :edit]
resources :players, :only => [:create]
resources :players_games, :only =... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | config/puma.rb | Ruby | mit | 95 | master | 2,006 | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches ... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | config/application.rb | Ruby | mit | 95 | master | 1,196 | require_relative 'boot'
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 "action_cable/engine"
# require "sprockets/railti... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | config/environments/development.rb | Ruby | mit | 95 | master | 1,665 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.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 the web serv... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | config/environments/production.rb | Ruby | mit | 95 | master | 3,248 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | config/initializers/cors.rb | Ruby | mit | 95 | master | 583 | # Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
Rails.application.config.middleware.insert_before 0, Rac... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | config/initializers/redis.rb | Ruby | mit | 95 | master | 509 | require 'redis'
require 'connection_pool'
begin
if Rails.env.production?
uri = URI.parse(ENV["REDISTOGO_URL"])
$redis = ConnectionPool.new(:size => 6, :timeout => 3) do
Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end
else
$redis = ConnectionPool.new(:size => 6, ... |
github | rlafranchi/pong | https://github.com/rlafranchi/pong | config/initializers/new_framework_defaults.rb | Ruby | mit | 95 | master | 818 | # Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Read the Rails 5.0 release notes for more info on each option.
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupp... |
github | toddwschneider/nyc-subway-data | https://github.com/toddwschneider/nyc-subway-data | clock.rb | Ruby | mit | 95 | master | 273 | require './config/boot'
require './config/environment'
require 'clockwork'
include Clockwork
module Clockwork
configure do |config|
config[:tz] = "America/New_York"
end
end
every(1.minute, 'record observations') do
RealtimeFeed.record_observations_for_all
end |
github | toddwschneider/nyc-subway-data | https://github.com/toddwschneider/nyc-subway-data | Gemfile | Ruby | mit | 95 | master | 945 | source 'https://rubygems.org'
ruby '2.6.6'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'rails', '~> 6.1.7'
gem 'clockwork', '~> 2.0'
gem 'delayed_job_active_record', '~> 4.1'
gem 'foreman', '~> 0.63'
gem ... |
github | toddwschneider/nyc-subway-data | https://github.com/toddwschneider/nyc-subway-data | config/puma.rb | Ruby | mit | 95 | master | 324 | workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
ActiveRecord::Base.establish_connection
... |
github | toddwschneider/nyc-subway-data | https://github.com/toddwschneider/nyc-subway-data | config/application.rb | Ruby | mit | 95 | master | 591 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Gtfs
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails vers... |
github | toddwschneider/nyc-subway-data | https://github.com/toddwschneider/nyc-subway-data | config/environments/production.rb | Ruby | mit | 95 | master | 3,782 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | toddwschneider/nyc-subway-data | https://github.com/toddwschneider/nyc-subway-data | config/environments/development.rb | Ruby | mit | 95 | master | 2,007 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.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 the web serv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.