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
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
Rakefile
Ruby
mit
46
master
302
require "bundler/gem_tasks" require "rspec/core/rake_task" require_relative "spec/dummy/config/environment" require "appraisal" RSpec::Core::RakeTask.new(:spec) Rails.application.load_tasks task :default => :spec if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"] task :default => :appraisal end
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
lib/pundit/resource_controller.rb
Ruby
mit
46
master
1,381
module Pundit module ResourceController extend ActiveSupport::Concern included do include ActionController::Rescue include AbstractController::Callbacks after_action :enforce_policy_use JSONAPI.configure do |config| error = Pundit::NotAuthorizedError unless config.ex...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
lib/pundit/resource.rb
Ruby
mit
46
master
2,712
require "active_support/concern" module Pundit module Resource extend ActiveSupport::Concern included do define_jsonapi_resources_callbacks :policy_authorize before_save :authorize_create_or_update before_remove :authorize_destroy end module ClassMethods def records(options...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/spec_helper.rb
Ruby
mit
46
master
4,366
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'pundit/resources' # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` w...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/rails_helper.rb
Ruby
mit
46
master
1,904
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require_relative 'dummy/config/environment' # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? require 'spec_helper' r...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/resources/user_resource_spec.rb
Ruby
mit
46
master
367
require "rails_helper" RSpec.describe UserResource do let(:model) { User.new } let(:context) { Hash.new } let(:resource) { described_class.new(model, context) } subject { resource } describe "to-one relationships" do specify "can use non-ActiveRecord associations" do expect(subject.post._model.t...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/pundit/resource_controller_spec.rb
Ruby
mit
46
master
1,454
RSpec.describe Pundit::ResourceController do let(:controller_class) do Class.new do include Pundit::ResourceController def current_user end end end let(:controller) { controller_class.new } describe "#context" do it "provides the current_user" do user = Object.new all...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/index_spec.rb
Ruby
mit
46
master
931
require "rails_helper" RSpec.describe UsersController, type: :controller do describe "#index" do # Make sure there are multiple users in the database, # and select one at random that will feature in the random scope # returned by the policy. let!(:user) { 3.times.map { User.create! }.sample } be...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/destroy_relationship_spec.rb
Ruby
mit
46
master
1,546
require "rails_helper" RSpec.describe PostsController, type: :controller do describe "#destroy_relationship" do let(:params) {{ relationship: "user", post_id: post_id, data: { type: "users", id: user_id.to_s, }, }} def do_request delete :destroy_relationship...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/destroy_spec.rb
Ruby
mit
46
master
2,691
require "rails_helper" RSpec.describe UsersController, type: :controller do describe "#destroy" do def do_request delete :destroy, params_hash(id: id) end context "when the user does not exist" do let(:id) { next_id User } before { do_request } it "responds with 404 Not Found" ...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/enforced_policy_use_spec.rb
Ruby
mit
46
master
1,898
require "rails_helper" RSpec.describe UsersController, type: :controller do render_views def params_hash(inner_hash) if Rails.version < '5.0.0' inner_hash else { params: inner_hash } end end before do class << @controller include ActionController::Head # override #ind...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/show_spec.rb
Ruby
mit
46
master
1,775
require "rails_helper" RSpec.describe UsersController, type: :controller do describe "#show" do def do_request get :show, params_hash(id: id) end context "when the user does not exist" do let(:id) { next_id User } before { do_request } it "responds with 404 Not Found" do ...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/callbacks_spec.rb
Ruby
mit
46
master
1,856
require "rails_helper" RSpec.describe UsersController, type: :controller do def do_request delete :destroy, params_hash(id: User.create!.id) end def self.set_callback(klass, name, time, method) before do klass.set_callback(name, time, method) unless klass.method_defined?(method) allo...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/create_spec.rb
Ruby
mit
46
master
1,163
require "rails_helper" RSpec.describe UsersController, type: :controller do describe "#create" do def do_request post :create, params_hash(data: { type: :users }) end context "but Pundit says no" do before do expect_any_instance_of(UserPolicy). to receive(:create?).and_retu...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/show_relationship_spec.rb
Ruby
mit
46
master
1,476
require "rails_helper" RSpec.describe UsersController, type: :controller do describe "#show_relationship" do let(:params) {{ relationship: "posts", user_id: user_id, }} def do_request get :show_relationship, params_hash(params) end describe "when the user does not exist" do ...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/application_controller_spec.rb
Ruby
mit
46
master
200
require "rails_helper" RSpec.describe ApplicationController, type: :controller do it { is_expected.to be_a JSONAPI::ResourceController } it { is_expected.to be_a Pundit::ResourceController } end
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/update_spec.rb
Ruby
mit
46
master
2,966
require "rails_helper" RSpec.describe UsersController, type: :controller do describe "#update" do def do_request data = { id: id, type: "users", attributes: { "created-at": Time.now } } patch :update, params_hash(id: id, data: data) end context "when the user does not exist" do let(:id...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/get_related_resource_spec.rb
Ruby
mit
46
master
1,989
require "rails_helper" RSpec.describe UsersController, type: :controller do describe "#get_related_resource" do let(:params) {{ relationship: "user", source: "posts", post_id: post_id, }} def do_request get :get_related_resource, params_hash(params) end context "when th...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/update_relationship_spec.rb
Ruby
mit
46
master
1,539
require "rails_helper" RSpec.describe PostsController, type: :controller do describe "#update_relationship" do let(:params) {{ relationship: "user", post_id: post_id, data: { type: "users", id: user_id.to_s, }, }} def do_request patch :update_relationship, p...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/get_related_resources_spec.rb
Ruby
mit
46
master
1,507
require "rails_helper" RSpec.describe PostsController, type: :controller do describe "#get_related_resources" do let(:params) {{ source: "users", relationship: "posts", user_id: user_id, }} def do_request get :get_related_resources, params_hash(params) end describe "when...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/controllers/users/create_relationship_spec.rb
Ruby
mit
46
master
2,101
require "rails_helper" RSpec.describe UsersController, type: :controller do describe "#create_relationship" do let(:params) {{ user_id: user_id, relationship: "posts", data: [{ type: "posts", id: post_id }], }} let(:user) { User.create! } let(:_post) { Post.create! } let(:user...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/dummy/db/schema.rb
Ruby
mit
46
master
1,160
# 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
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/dummy/app/resources/user_resource.rb
Ruby
mit
46
master
280
class UserResource < ApplicationResource attribute :created_at # include relationship with and without relation_name: # to check both cases are handled has_one :x_post, class_name: "Post" has_one :post, relation_name: :x_post, class_name: "Post" has_many :posts end
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/dummy/app/policies/application_policy.rb
Ruby
mit
46
master
366
class ApplicationPolicy attr_reader :user, :record def initialize(user, record) @user = user @record = record end def scope Pundit.policy_scope!(user, record.class) end class Scope attr_reader :user, :scope def initialize(user, scope) @user = user @scope = scope end ...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/dummy/config/application.rb
Ruby
mit
46
master
740
require_relative 'boot' 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" Bundler.require(*Rails.groups) require "pundit/resources" module Dummy cl...
github
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/dummy/config/environments/development.rb
Ruby
mit
46
master
1,759
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
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/dummy/config/environments/production.rb
Ruby
mit
46
master
3,179
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
togglepro/pundit-resources
https://github.com/togglepro/pundit-resources
spec/support/types/controller.rb
Ruby
mit
46
master
470
RSpec.shared_context "controller specs", type: :controller do render_views let(:body) { JSON.parse(response.body, symbolize_names: true) } def params_hash(inner_hash) if Rails.version.split(?.).first.to_i < 5 inner_hash else { params: inner_hash } end end before do request.heade...
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
fast_git_deploy.gemspec
Ruby
mit
46
master
820
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fast_git_deploy/version' Gem::Specification.new do |gem| gem.name = "fast_git_deploy" gem.version = FastGitDeploy::VERSION::STRING gem.authors = ["Scott Taylo...
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
spec/Capfile
Ruby
mit
46
master
256
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir[File.dirname(__FILE__) + '/../**/recipes/*.rb'].each { |plugin| load(plugin) } load File.dirname(__FILE__) + '/config/deploy.rb' # remove this line to skip loading any of the default tasks
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
spec/spec_helper.rb
Ruby
mit
46
master
1,051
require 'capistrano/cli' require 'capistrano/configuration' # load File.expand_path(File.dirname(__FILE__) + "/../recipes/fast_git_deploy.rb") # load File.dirname(__FILE__) + '/config/deploy.rb' Spec::Runner.configure do |config| config.before :each do FileUtils.rm_rf(File.dirname(__FILE__) + "/deployments") ...
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
spec/deploy_spec.rb
Ruby
mit
46
master
873
require "spec_helper" describe "fast git deploy" do def cap_execute(command) commands = [ "--file", File.expand_path("#{File.dirname(__FILE__)}/Capfile"), "--quiet" ] commands.push command.split(" ") commands.flatten! Capistrano::CLI.parse(commands).execute! end it "should be ab...
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
spec/config/deploy.rb
Ruby
mit
46
master
657
def self.join(*args) current_path = File.dirname(__FILE__) File.expand_path(File.join(current_path, *args)) end set :application, "fast_git_deploy_test" set :repository, join("..", "..", ".git") set :deploy_to, join("..", "deployments") set :scm_command, `which git`.chomp set :user, `whoami`.chomp set :...
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
lib/fast_git_deploy.rb
Ruby
mit
46
master
518
if defined?(Capistrano) && Capistrano::Configuration.respond_to?(:instance) && instance = Capistrano::Configuration.instance require File.dirname(__FILE__) + "/fast_git_deploy/recipes/fast_git_deploy" require File.dirname(__FILE__) + "/fast_git_deploy/recipes/fast_git_deploy/rollback" require File.dirname(__...
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
lib/fast_git_deploy/recipes/fast_git_deploy.rb
Ruby
mit
46
master
6,319
module FastGitDeploy module Main def self.load_into(configuration) configuration.load do current_dir = File.expand_path(File.dirname(__FILE__)) set :scm, "git" set :scm_command, "git" set(:revision_log) { "#{deploy_to}/revisions.log" } set(:version_fi...
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
lib/fast_git_deploy/recipes/fast_git_deploy/rollback.rb
Ruby
mit
46
master
2,451
module FastGitDeploy module Rollback def self.load_into(configuration) configuration.load do namespace :deploy do namespace :rollback do desc "Rolls the app back one revision" task :code, :except => { :no_release => true } do current_revision = captur...
github
smtlaissezfaire/fast_git_deploy
https://github.com/smtlaissezfaire/fast_git_deploy
lib/fast_git_deploy/recipes/fast_git_deploy/setup.rb
Ruby
mit
46
master
3,594
module FastGitDeploy module Setup def self.load_into(configuration) configuration.load do namespace :deploy do namespace :fast_git_setup do task :cold do clone_repository finalize_clone create_revision_log deploy.update ...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
Gemfile
Ruby
apache-2.0
46
master
731
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
Dangerfile
Ruby
apache-2.0
46
master
562
# frozen_string_literal: true fail('Please rebase to get rid of the merge commits in this PR') if git.commits.any? { |c| c.message =~ /^Merge branch/ } updated_files = git.modified_files + git.added_files changed_files = updated_files + git.deleted_files has_app_changes = !changed_files.grep(/lib/).empty? has_test_ch...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
ios_icon_generator.gemspec
Ruby
apache-2.0
46
master
1,650
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'ios_icon_generator/version' Gem::Specification.new do |spec| spec.name = 'ios_icon_generator' spec.version = IOSIconGenerator::VERSION spec.authors = ['Stéphane Copin...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
spec/spec_helper.rb
Ruby
apache-2.0
46
master
1,779
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
spec/icon_generator_spec.rb
Ruby
apache-2.0
46
master
6,976
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
spec/support/aruba.rb
Ruby
apache-2.0
46
master
643
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator.rb
Ruby
apache-2.0
46
master
1,195
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/version.rb
Ruby
apache-2.0
46
master
714
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/cli/runner.rb
Ruby
apache-2.0
46
master
1,898
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/cli/commands/mask.rb
Ruby
apache-2.0
46
master
4,990
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/cli/commands/stub.rb
Ruby
apache-2.0
46
master
4,517
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/cli/commands/version.rb
Ruby
apache-2.0
46
master
953
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/cli/commands/generate.rb
Ruby
apache-2.0
46
master
2,481
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/helpers/which.rb
Ruby
apache-2.0
46
master
1,367
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/helpers/check_dependencies.rb
Ruby
apache-2.0
46
master
1,204
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/helpers/mask_icon.rb
Ruby
apache-2.0
46
master
7,537
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/helpers/generate_icon.rb
Ruby
apache-2.0
46
master
6,994
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
Fueled/ios-icon-generator
https://github.com/Fueled/ios-icon-generator
lib/ios_icon_generator/helpers/image_sets_definition.rb
Ruby
apache-2.0
46
master
1,978
# frozen_string_literal: true # Copyright (c) 2019 Fueled Digital Media, LLC # # 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 require...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/spec_helper.rb
Ruby
apache-2.0
46
master
450
require 'puppetlabs_spec_helper/module_spec_helper' require 'shared_examples' require 'puppet-openstack_spec_helper/facts' fixture_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_li...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/acceptance/basic_vswitch_spec.rb
Ruby
apache-2.0
46
master
4,287
require 'spec_helper_acceptance' describe 'basic vswitch' do context 'default parameters' do it 'should work with no errors' do pp= <<-EOS include openstack_integration include openstack_integration::repos include vswitch::ovs vs_bridge { 'br-ci1': ensure => present, ...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/type/vs_ssl_spec.rb
Ruby
apache-2.0
46
master
607
require 'spec_helper' describe Puppet::Type.type(:vs_ssl) do it "should support present as a value for ensure" do expect do described_class.new(:name => 'system', :ensure => :present) end.to_not raise_error end it "should accept key_file, cert_file, ca_file, bootstrap options" do expect do ...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/type/vs_port_spec.rb
Ruby
apache-2.0
46
master
576
require 'spec_helper' describe Puppet::Type.type(:vs_port) do it "should support only secure and standalone as a value for fail_mode" do expect do described_class.new(:name => 'foo', :ensure => :present, :fail_mode => 'secure') end.to_not raise_error expect do described_class.new(:name => 'f...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/type/vs_bridge_spec.rb
Ruby
apache-2.0
46
master
649
require 'spec_helper' describe Puppet::Type.type(:vs_bridge) do it "should support present as a value for ensure" do expect do described_class.new(:name => 'foo', :ensure => :present) end.to_not raise_error end it "should support a string value for external_ids" do expect do described_c...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/type/vs_config_spec.rb
Ruby
apache-2.0
46
master
2,627
require 'spec_helper' describe Puppet::Type.type(:vs_config) do it "should support present as a value for ensure" do expect do described_class.new(:name => 'foo', :ensure => :present) end.to_not raise_error end it "should support absent as a value for ensure" do expect do described_class...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/functions/range_to_mask_spec.rb
Ruby
apache-2.0
46
master
461
require 'spec_helper' require 'puppet' describe 'range_to_mask', :type => :puppet_function do # run with param it { is_expected.to run.with_params('0-7,16-23,9').and_return('ff02ff') } it { is_expected.to run.with_params('0,16,32,48,64').and_return('10001000100010001') } # run with empty param it { is_expect...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/provider/ovs_spec.rb
Ruby
apache-2.0
46
master
4,416
require 'puppet' require 'spec_helper' require 'puppet/provider/ovs' describe Puppet::Provider::Ovs do describe '#get_property' do it 'returns the property' do expect(described_class).to receive(:vsctl) .with('get', 'Port', 'testport', 'key') .and_return('value') expect(described_clas...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/provider/vs_bridge/ovs_spec.rb
Ruby
apache-2.0
46
master
3,911
require 'spec_helper' describe Puppet::Type.type(:vs_bridge).provider(:ovs) do let(:resource_attrs) do { :name => 'testbr' } end let(:resource) do Puppet::Type::Vs_bridge.new(resource_attrs) end let(:provider) do described_class.new(resource) end describe '#exists?' do conte...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/provider/vs_ssl/ovs_spec.rb
Ruby
apache-2.0
46
master
1,408
require 'spec_helper' describe Puppet::Type.type(:vs_ssl).provider(:ovs) do let :ssl_attrs do { :name => 'system', :ensure => 'present', } end let :resource do Puppet::Type::Vs_ssl.new(ssl_attrs) end let :provider do described_class.new(resource) end context 'when ...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/provider/vs_port/ovs_spec.rb
Ruby
apache-2.0
46
master
6,819
require 'spec_helper' describe Puppet::Type.type(:vs_port).provider(:ovs) do let(:resource_attrs) do { :name => 'testport', :bridge => 'testbr' } end let(:resource) do Puppet::Type::Vs_port.new(resource_attrs) end let(:provider) do described_class.new(resource) end descr...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/unit/provider/vs_config/ovs_spec.rb
Ruby
apache-2.0
46
master
3,184
require 'spec_helper' describe Puppet::Type.type(:vs_config).provider(:ovs) do it 'should have an instance method' do expect(described_class).to respond_to :instances end it 'should have a prefetch method' do expect(described_class).to respond_to :prefetch end context "Testing string values" do ...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/defines/vswitch_pki_cert_spec.rb
Ruby
apache-2.0
46
master
727
require 'spec_helper' describe 'vswitch::pki::cert' do let(:title) {'foo'} shared_examples_for 'vswitch::pki::cert' do it 'shoud generate a certificate' do is_expected.to contain_exec('ovs-req-and-sign-cert-foo').with( :command => ['ovs-pki', 'req+sign', 'foo'], :cwd => '/etc/openvs...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/classes/vswitch_ovs_spec.rb
Ruby
apache-2.0
46
master
3,739
require 'spec_helper' describe 'vswitch::ovs' do shared_examples_for 'vswitch::ovs' do context 'default parameters' do it 'contains the ovs class' do is_expected.to contain_class('vswitch::ovs') end it 'clears hw-offload option' do is_expected.to contain_vs_config('other_conf...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/classes/vswitch_dpdk_spec.rb
Ruby
apache-2.0
46
master
7,551
require 'spec_helper' describe 'vswitch::dpdk' do shared_examples_for 'vswitch::dpdk' do context 'when passing all empty params' do it 'configures dpdk options' do is_expected.to contain_vs_config('other_config:dpdk-init').with( :value => true, :wait => true, :restart => true, )...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
spec/classes/vswitch_pki_cacert_spec.rb
Ruby
apache-2.0
46
master
675
require 'spec_helper' describe 'vswitch::pki::cacert' do shared_examples_for 'vswitch::pki::cacert' do it 'shoud initialize ca authority' do is_expected.to contain_exec('ovs-pki-init-ca-authority').with( :command => ['ovs-pki', 'init', '--force'], :creates => '/var/lib/openvswitch/pki/swit...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppetx/redhat/ifcfg.rb
Ruby
apache-2.0
46
master
1,628
module IFCFG class OVS attr_reader :ifcfg def self.exists?(name) File.exist?(BASE + name) end def self.remove(name) File.delete(BASE + name) rescue Errno::ENOENT end def initialize(name, seed=nil) @name = name @ifcfg = {} set(seed) set_key('DEVICE', ...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/facter/pci_address.rb
Ruby
apache-2.0
46
master
878
require 'facter' if File.file?("/proc/bus/pci/devices") drivers_details=File.read("/proc/bus/pci/devices") drivers_lines=drivers_details.split("\n") else drivers_lines=Array.new end drivers=Hash.new drivers_lines.each do |line| line = line.gsub(/^\s+|\s+$/m, '').split(" ") if line.length == 18 pci_embed =...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/facter/ovs_uuid.rb
Ruby
apache-2.0
46
master
219
Facter.add("ovs_uuid") do confine :kernel => "Linux" setcode do if File.exist? '/usr/bin/ovs-vsctl' ovs_ver = Facter::Core::Execution.exec('/usr/bin/ovs-vsctl get Open_vSwitch . _uuid') end end end
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/facter/ovs.rb
Ruby
apache-2.0
46
master
261
Facter.add("ovs_version") do confine :kernel => "Linux" setcode do ovs_ver = Facter::Core::Execution.exec('/usr/bin/ovs-vsctl --version') if ovs_ver ovs_ver.gsub(/.*ovs-vsctl\s+\(Open\s+vSwitch\)\s+(\d+\.\d+\.\d+).*/, '\1') end end end
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/functions/range_to_mask.rb
Ruby
apache-2.0
46
master
598
# Converts the range to a mask Puppet::Functions.create_function(:'range_to_mask') do dispatch :empty_param do param 'Pattern[/^$/]', :range end dispatch :range_param do param 'Pattern[/^[0-9\-\,]/]', :range end dispatch :undef_param do param 'Undef', :range end def empty_param(range) ...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/provider/ovs.rb
Ruby
apache-2.0
46
master
1,039
require 'puppet' class Puppet::Provider::Ovs < Puppet::Provider initvars commands :vsctl => 'ovs-vsctl' protected def self.get_property(type, name, key) return vsctl('get', type, name, key).strip end def self.set_property(type, name, key, val=nil) if val.nil? or val.empty? vsctl('clear', ...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/provider/vs_bridge/ovs.rb
Ruby
apache-2.0
46
master
1,939
require File.join(File.dirname(__FILE__), '..','..','..', 'puppet/provider/ovs') Puppet::Type.type(:vs_bridge).provide( :ovs, :parent => Puppet::Provider::Ovs ) do commands :ip => 'ip' commands :vsctl => 'ovs-vsctl' def exists? vsctl("br-exists", @resource[:name]) return true rescue Puppet::Exe...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/provider/vs_ssl/ovs.rb
Ruby
apache-2.0
46
master
2,105
Puppet::Type.type(:vs_ssl).provide(:ovs) do commands :vsctl => 'ovs-vsctl' bootstrap_ca_cert = '/etc/openvswitch/cacert.pem' def singleton_check if not @resource[:name].eql? 'system' raise Puppet::Error, "OVS ssl provider only supports singleton instance with name 'system'" end end def parse_...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/provider/vs_port/ovs_redhat.rb
Ruby
apache-2.0
46
master
4,931
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'puppetx', 'redhat', 'ifcfg.rb')) require File.expand_path(File.join(File.dirname(__FILE__), '.','ovs.rb')) Puppet::Type.type(:vs_port).provide( :ovs_redhat, :parent => Puppet::Type.type(:vs_port).provider(:ovs) ) do BASE ||= '/etc/sys...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/provider/vs_port/ovs.rb
Ruby
apache-2.0
46
master
4,563
require File.join(File.dirname(__FILE__), '..','..','..', 'puppet/provider/ovs') Puppet::Type.type(:vs_port).provide( :ovs, :parent => Puppet::Provider::Ovs ) do UUID_RE ||= /[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/ commands :vsctl => 'ovs-vsctl' has_feature :bonding has_fe...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/provider/vs_config/ovs.rb
Ruby
apache-2.0
46
master
3,319
require 'puppet' Puppet::Type.type(:vs_config).provide(:ovs) do commands :vsctl => 'ovs-vsctl' def self.munge_array_value(value) "[#{value[1..-2].split(',').map(&:strip).sort.join(",")}]" end def self.parse_column_value(value) value = value.chomp if value[0] == '{' # hash case, like {syste...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/type/vs_bridge.rb
Ruby
apache-2.0
46
master
1,474
require 'puppet' Puppet::Type.newtype(:vs_bridge) do desc 'A Switch - For example "br-int" in OpenStack' ensurable newparam(:name, :namevar => true) do desc 'The bridge to configure' validate do |value| if !value.is_a?(String) raise ArgumentError, "Invalid name #{value}. Requires a Strin...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/type/vs_port.rb
Ruby
apache-2.0
46
master
5,383
require 'puppet' Puppet::Type.newtype(:vs_port) do desc 'A Virtual Switch Port' feature :bonding, "The provider supports bonded interfaces" feature :interface_type, "The provider supports interface types" feature :vlan, "The provider supports vlans" ensurable newparam(:port, :namevar => true) do des...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/type/vs_ssl.rb
Ruby
apache-2.0
46
master
964
Puppet::Type.newtype(:vs_ssl) do ensurable newparam(:name, :namevar => true) do desc "Name of SSL configuration" newvalues(/^\w+$/) end newparam(:key_file) do desc "Private key file path" validate do |value| if !value.is_a?(String) raise ArgumentError, "Key file path must be a s...
github
openstack/puppet-vswitch
https://github.com/openstack/puppet-vswitch
lib/puppet/type/vs_config.rb
Ruby
apache-2.0
46
master
1,745
require 'puppet' Puppet::Type.newtype(:vs_config) do desc 'Switch configurations' ensurable newparam(:name, :namevar => true) do desc 'Configuration parameter whose value need to be set' validate do |value| if !value.is_a?(String) raise ArgumentError, "Invalid name #{value}. Requires a S...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
Gemfile
Ruby
mit
46
main
2,725
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby File.read(".ruby-version").strip # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 7.1.0' gem 'pg' # Use Puma as the app server gem 'puma', '< 7' # Use SCSS for stylesheets gem 'sass-rai...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
lib/nyct-subway.pb.rb
Ruby
mit
46
main
1,309
require 'protobuf' require 'google/transit/gtfs-realtime.pb' module Transit_realtime # forward declarations class TripReplacementPeriod < ::Protobuf::Message; end class NyctFeedHeader < ::Protobuf::Message; end class NyctTripDescriptor < ::Protobuf::Message; end class NyctStopTimeUpdate < ::Protobuf::Messag...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
config/routes.rb
Ruby
mit
46
main
1,600
require "sidekiq/web" # require the web UI require "sidekiq/cron/web" # require cron tab UI Rails.application.routes.draw do Sidekiq::Web.use Rack::Auth::Basic do |username, password| # Protect against timing attacks: # - See https://codahale.com/a-lesson-in-timing-attacks/ # - See https://thisdata.com/b...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
config/application.rb
Ruby
mit
46
main
1,038
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 GoodserviceV2 class Application < Rails::Application # Initialize configuration defaults for originally generated R...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
config/initializers/new_framework_defaults_7_1.rb
Ruby
mit
46
main
12,119
# Be sure to restart your server when you modify this file. # # This file eases your Rails 7.1 framework defaults upgrade. # # Uncomment each configuration one by one to switch to the new default. # Once your application is ready to run with all new defaults, you can remove # this file and set the `config.load_defaults...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
config/initializers/redis.rb
Ruby
mit
46
main
322
require 'redis' require 'uri' if Rails.env == 'production' if ENV['REDIS_URL'] REDIS_CLIENT = Redis.new(url: ENV["REDIS_URL"], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }) else REDIS_CLIENT = Redis.new(url: ENV['REDISCLOUD_URL']) end else REDIS_CLIENT = Redis.new(url: ENV['REDIS_URL']) end
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
config/initializers/new_framework_defaults_6_1.rb
Ruby
mit
46
main
3,187
# Be sure to restart your server when you modify this file. # # This file contains migration options to ease your Rails 6.1 upgrade. # # Once upgraded flip defaults one by one to migrate to the new default. # # Read the Guide for Upgrading Ruby on Rails for more info on each option. # Support for inversing belongs_to ...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
config/initializers/sidekiq.rb
Ruby
mit
46
main
2,024
Sidekiq.configure_client do |config| config.redis = { url: ENV['REDIS_URL'], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE } } end Sidekiq.configure_server do |config| config.redis = { url: ENV['REDIS_URL'], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE } } end Sidekiq::Options[:cron_poll_interval] ...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
config/environments/development.rb
Ruby
mit
46
main
2,895
require "active_support/core_ext/integer/time" 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 any time # it changes. This slows down response time but is perfect for developme...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
config/environments/production.rb
Ruby
mit
46
main
5,503
require "active_support/core_ext/integer/time" 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 applica...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
app/helpers/twitter_helper.rb
Ruby
mit
46
main
1,938
module TwitterHelper TWITTER_MAX_CHARS = 280 - 10 ROUTE_CLIENT_MAPPING = (ENV['TWITTER_ROUTE_CLIENT_MAPPING'] || '').split(",").to_h { |str| array = str.split(":") [array.first, array.second] } ENABLE_ROUTE_CLIENTS = ENV['TWITTER_ENABLE_ROUTE_CLIENTS'] ? ActiveModel::Type::Boolean.new.cast(ENV['TWITTER_...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
app/workers/twitter_delays_notifier_worker.rb
Ruby
mit
46
main
9,033
class TwitterDelaysNotifierWorker include Sidekiq::Worker include TwitterHelper sidekiq_options retry: 1, queue: 'low' SKIPPED_ROUTES = ENV['DELAY_NOTIFICATION_EXCLUDED_ROUTES']&.split(',') || [] DELAY_NOTIFICATION_THRESHOLD = (ENV['DELAY_NOTIFICATION_THRESHOLD'] || 10.minutes).to_i DELAY_CLEARED_TIMEOUT_M...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
app/workers/heroku_autoscaler_worker.rb
Ruby
mit
46
main
1,989
require 'sidekiq/api' class HerokuAutoscalerWorker include Sidekiq::Worker sidekiq_options retry: false, queue: 'critical' MINIMUM_NUMBER_OF_DYNOS = ENV['AUTOSCALER_MIN_DYNOS']&.to_i || 1 MAXIMUM_NUMBER_OF_DYNOS = ENV['AUTOSCALER_MAX_DYNOS']&.to_i || 5 SCALEUP_DELAY = 2.minutes.to_i SCALE_DOWN_THRESHOLD =...
github
blahblahblah-/subwaynow-server
https://github.com/blahblahblah-/subwaynow-server
app/workers/feed_retriever_spawning_b1_worker.rb
Ruby
mit
46
main
388
class FeedRetrieverSpawningB1Worker < FeedRetrieverSpawningWorkerBase include Sidekiq::Worker sidekiq_options retry: false, queue: 'critical' FEEDS = ["-ace", "-bdfm", "-g"] def perform minutes = Time.current.min fraction_of_minute = Time.current.sec / 15 FEEDS.each do |id| FeedRetrieverWork...