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 | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/helpers/avatar_helper.rb | Ruby | mit | 95 | main | 662 | module AvatarHelper
def avatar_path(object, options = {})
size = options[:size] || 180
default_image = options[:default] || "mp"
base_url = "https://secure.gravatar.com/avatar"
base_url_params = "?s=#{size}&d=#{default_image}"
if object.respond_to?(:avatar) && object.avatar.attached? && object.av... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/helpers/votes_helper.rb | Ruby | mit | 95 | main | 276 | module VotesHelper
def vote_choice(vote)
case vote.choice
when "yes"
tag.span "Yes", class: "badge bg-danger"
when "no"
tag.span "No", class: "badge bg-success"
when "abstain"
tag.span "Abstain", class: "badge bg-warning"
end
end
end |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/controllers/politicians_controller.rb | Ruby | mit | 95 | main | 2,176 | class PoliticiansController < ApplicationController
before_action :require_sign_in, except: %i[index show]
before_action :set_politician, only: %i[show edit update destroy]
# GET /politicians or /politicians.json
def index
@politicians = Politician.all
end
# GET /politicians/1 or /politicians/1.json
... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/controllers/votes_controller.rb | Ruby | mit | 95 | main | 2,171 | class VotesController < ApplicationController
before_action :set_vote, only: %i[show edit update destroy]
before_action :authenticate_user!, only: %i[new create edit update destroy]
before_action :set_legislation, only: %i[new create]
# GET /votes or /votes.json
def index
@votes = Vote.all
end
# GET... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/controllers/businesses_controller.rb | Ruby | mit | 95 | main | 2,188 | class BusinessesController < ApplicationController
before_action :require_sign_in, except: %i[index show]
before_action :set_business, only: %i[show edit update destroy]
# GET /businesses or /businesses.json
def index
@businesses = Business.all
end
# GET /businesses/1 or /businesses/1.json
def show
... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/controllers/announcements_controller.rb | Ruby | mit | 95 | main | 294 | class AnnouncementsController < ApplicationController
before_action :mark_as_read, if: :user_signed_in?
def index
@announcements = Announcement.order(published_at: :desc)
end
private
def mark_as_read
current_user.update(announcements_last_read_at: Time.zone.now)
end
end |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/controllers/legislations_controller.rb | Ruby | mit | 95 | main | 2,384 | class LegislationsController < ApplicationController
before_action :set_legislation, only: %i[show edit update destroy]
before_action :authenticate_user!, only: %i[new create edit update destroy]
# GET /legislations or /legislations.json
def index
@legislations = Legislation.all
end
# GET /legislation... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/controllers/application_controller.rb | Ruby | mit | 95 | main | 569 | class ApplicationController < ActionController::Base
impersonates :user
include Pundit::Authorization
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, ... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/controllers/users/omniauth_callbacks_controller.rb | Ruby | mit | 95 | main | 2,124 | module Users
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
before_action :set_user, except: [:failure]
before_action :set_service, except: [:failure]
attr_reader :service, :user
def failure
redirect_to root_path, alert: "Something went wrong"
end
def facebook... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/controllers/madmin/impersonates_controller.rb | Ruby | mit | 95 | main | 292 | class Madmin::ImpersonatesController < Madmin::ApplicationController
impersonates :user
def impersonate
user = User.find(params[:id])
impersonate_user(user)
redirect_to root_path
end
def stop_impersonating
stop_impersonating_user
redirect_to root_path
end
end |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/models/user.rb | Ruby | mit | 95 | main | 599 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable, :omniauthable
has_one_attached :avatar
has_person_name
has_many :noti... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/models/announcement.rb | Ruby | mit | 95 | main | 354 | class Announcement < ApplicationRecord
TYPES = %w[new fix update]
after_initialize :set_defaults
validates :announcement_type, :description, :name, :published_at, presence: true
validates :announcement_type, inclusion: {in: TYPES}
def set_defaults
self.published_at ||= Time.zone.now
self.announceme... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/models/politician.rb | Ruby | mit | 95 | main | 300 | class Politician < ApplicationRecord
belongs_to :user
has_many :businesses, dependent: :destroy
has_many :votes, dependent: :destroy
validates :name, presence: true
validates :position, presence: true
validates :jurisdiction, presence: true
def to_combobox_display
name
end
end |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/models/service.rb | Ruby | mit | 95 | main | 745 | class Service < ApplicationRecord
belongs_to :user
Devise.omniauth_configs.keys.each do |provider|
scope provider, -> { where(provider: provider) }
end
def client
send(:"#{provider}_client")
end
def expired?
expires_at? && expires_at <= Time.zone.now
end
def access_token
send(:"#{pro... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/models/legislation.rb | Ruby | mit | 95 | main | 429 | class Legislation < ApplicationRecord
belongs_to :user
has_many :votes, dependent: :destroy
has_many :politicians, through: :votes
validates :title, presence: true
enum status: {proposed: "proposed", passed: "passed", failed: "failed"}
def total_votes
votes.count
end
def yes_votes
votes.yes... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/models/vote.rb | Ruby | mit | 95 | main | 312 | class Vote < ApplicationRecord
belongs_to :politician
belongs_to :legislation
belongs_to :user
validates :politician_id, uniqueness: {scope: :legislation_id, message: "already voted on this legislation"}
validates :choice, presence: true
enum choice: {yes: "yes", no: "no", abstain: "abstain"}
end |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/service_resource.rb | Ruby | mit | 95 | main | 699 | class ServiceResource < Madmin::Resource
# Attributes
attribute :id, form: false
attribute :provider
attribute :uid
attribute :access_token
attribute :access_token_secret
attribute :refresh_token
attribute :expires_at
attribute :auth
attribute :created_at, form: false
attribute :updated_at, form: ... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/vote_resource.rb | Ruby | mit | 95 | main | 567 | class VoteResource < Madmin::Resource
attribute :id, form: false
attribute :choice
attribute :politician
attribute :legislation
attribute :user
attribute :created_at, form: false
attribute :updated_at, form: false
# Uncomment this to customize the display name of records in the admin area.
# def se... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/user_resource.rb | Ruby | mit | 95 | main | 851 | class UserResource < Madmin::Resource
attribute :id, form: false
attribute :email
attribute :first_name
attribute :last_name
attribute :admin
attribute :avatar, index: false
attribute :encrypted_password
attribute :reset_password_token
attribute :reset_password_sent_at
attribute :remember_created_at... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/business_resource.rb | Ruby | mit | 95 | main | 695 | class BusinessResource < Madmin::Resource
# Attributes
attribute :id, form: false
attribute :name
attribute :address
attribute :industry
attribute :business_phone
attribute :business_email
attribute :website
attribute :created_at, form: false
attribute :updated_at, form: false
# Associations
at... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/legislation_resource.rb | Ruby | mit | 95 | main | 639 | class LegislationResource < Madmin::Resource
# Attributes
attribute :id, form: false
attribute :title
attribute :description
attribute :status
attribute :created_at, form: false
attribute :updated_at, form: false
# Associations
attribute :user
attribute :votes
attribute :politicians
# Uncommen... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/politician_resource.rb | Ruby | mit | 95 | main | 709 | class PoliticianResource < Madmin::Resource
attribute :id, form: false
attribute :name
attribute :office_phone
attribute :office_email
attribute :position
attribute :jurisdiction
attribute :political_party
attribute :website
attribute :user
attribute :businesses
attribute :votes
attribute :cre... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/announcement_resource.rb | Ruby | mit | 95 | main | 619 | class AnnouncementResource < Madmin::Resource
# Attributes
attribute :id, form: false
attribute :published_at
attribute :announcement_type
attribute :name
attribute :description
attribute :created_at, form: false
attribute :updated_at, form: false
# Associations
# Uncomment this to customize the d... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/noticed/event_resource.rb | Ruby | mit | 95 | main | 652 | class Noticed::EventResource < Madmin::Resource
# Attributes
attribute :id, form: false
attribute :type
attribute :params
attribute :created_at, form: false
attribute :updated_at, form: false
attribute :notifications_count, form: false
# Associations
attribute :record
attribute :notifications
# ... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/noticed/notification_resource.rb | Ruby | mit | 95 | main | 630 | class Noticed::NotificationResource < Madmin::Resource
# Attributes
attribute :id, form: false
attribute :type
attribute :read_at
attribute :seen_at
attribute :created_at, form: false
attribute :updated_at, form: false
# Associations
attribute :event
attribute :recipient
# Uncomment this to cust... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/active_storage/blob_resource.rb | Ruby | mit | 95 | main | 788 | class ActiveStorage::BlobResource < Madmin::Resource
# Attributes
attribute :id, form: false
attribute :key
attribute :filename
attribute :content_type
attribute :service_name
attribute :byte_size
attribute :checksum
attribute :created_at, form: false
attribute :analyzed
attribute :identified
at... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/madmin/resources/active_storage/variant_record_resource.rb | Ruby | mit | 95 | main | 625 | class ActiveStorage::VariantRecordResource < Madmin::Resource
# Attributes
attribute :id, form: false
attribute :variation, index: false, show: false
attribute :variation_confirmation, index: false, show: false
attribute :image, index: false
# Associations
attribute :blob
# Uncomment this to customize... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | app/channels/application_cable/connection.rb | Ruby | mit | 95 | main | 462 | module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user, :true_user
impersonates :user
def connect
self.current_user = find_verified_user
logger.add_tags "ActionCable", "User #{current_user.id}"
end
protected
def find_verified_user
... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/schema.rb | Ruby | mit | 95 | main | 7,047 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240613165501_create_businesses.rb | Ruby | mit | 95 | main | 353 | class CreateBusinesses < ActiveRecord::Migration[7.1]
def change
create_table :businesses do |t|
t.string :name
t.string :address
t.string :industry
t.string :business_phone
t.string :business_email
t.string :website
t.timestamps
end
add_reference :businesses, :u... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240618110019_create_votes.rb | Ruby | mit | 95 | main | 336 | class CreateVotes < ActiveRecord::Migration[7.1]
def change
create_table :votes do |t|
t.string :type
t.references :politician, null: false, foreign_key: true
t.references :legislation, null: false, foreign_key: true
t.references :user, null: false, foreign_key: true
t.timestamps
... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240613143448_create_announcements.rb | Ruby | mit | 95 | main | 259 | class CreateAnnouncements < ActiveRecord::Migration[7.1]
def change
create_table :announcements do |t|
t.datetime :published_at
t.string :announcement_type
t.string :name
t.text :description
t.timestamps
end
end
end |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240618105806_create_legislations.rb | Ruby | mit | 95 | main | 294 | class CreateLegislations < ActiveRecord::Migration[7.1]
def change
create_table :legislations do |t|
t.string :title
t.text :description
t.string :status, default: "proposed"
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240613143506_create_active_storage_tables.active_storage.rb | Ruby | mit | 95 | main | 2,130 | # This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
def change
# Use Active Record's configured type for primary and foreign keys
primary_key_type, foreign_key_type = primary_and_foreign_key_types
create_table :active_stora... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240613143438_devise_create_users.rb | Ruby | mit | 95 | main | 1,508 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[7.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_pas... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240613143451_create_services.rb | Ruby | mit | 95 | main | 382 | class CreateServices < ActiveRecord::Migration[7.1]
def change
create_table :services do |t|
t.references :user, null: false, foreign_key: true
t.string :provider
t.string :uid
t.string :access_token
t.string :access_token_secret
t.string :refresh_token
t.datetime :expire... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240613143452_create_friendly_id_slugs.rb | Ruby | mit | 95 | main | 793 | MIGRATION_CLASS =
if ActiveRecord::VERSION::MAJOR >= 5
ActiveRecord::Migration[5.2]["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"]
else
ActiveRecord::Migration[5.2]
end
class CreateFriendlyIdSlugs < MIGRATION_CLASS
def change
create_table :friendly_id_slugs do |t|
t.string... |
github | kaka-ruto/carpitan | https://github.com/kaka-ruto/carpitan | db/migrate/20240613170139_create_politicians.rb | Ruby | mit | 95 | main | 452 | class CreatePoliticians < ActiveRecord::Migration[7.1]
def change
create_table :politicians do |t|
t.string :name
t.string :office_phone
t.string :office_email
t.string :position
t.string :jurisdiction
t.string :political_party
t.string :website
t.timestamps
... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | Rakefile | Ruby | mit | 95 | master | 2,179 | require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rubygems'
require 'bundler'
require 'jeweler'
desc 'Default: run unit tests.'
task :default => "test:units"
task :test => "test:functionals"
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | Gemfile | Ruby | mit | 95 | master | 331 | source "http://rubygems.org"
gem "rake"
gem "bundler", "~> 1.0.0"
gem "mongo"
gem "bson_ext"
group :development do
# adds Bundler support for gemspec generation
gem "jeweler", "~> 1.5.0.pre5"
gem "shoulda"
gem "i18n"
gem "activesupport"
gem "mocha"
gem (RUBY_VERSION =~ /^1\.9/ ? "ruby-debug19" : "ruby-d... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | central_logger.gemspec | Ruby | mit | 95 | master | 3,747 | # 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 = %q{central_logger}
s.version = "0.3.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | lib/central_logger/replica_set_helper.rb | Ruby | mit | 95 | master | 502 | module CentralLogger
module ReplicaSetHelper
# Use retry alg from mongodb to gobble up connection failures during replica set master vote
# Defaults to a 10 second wait
def rescue_connection_failure(max_retries=40)
success = false
retries = 0
while !success
begin
yield
... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | lib/central_logger/server.rb | Ruby | mit | 95 | master | 2,316 | require 'sinatra/base'
require 'erb'
require 'mongo'
require 'yaml'
module CentralLogger
class Server < Sinatra::Base
dir = File.dirname(File.expand_path(__FILE__))
set :views, "#{dir}/server/views"
set :public, "#{dir}/server/public"
set :static, true
helpers do
include Rack::Utils
... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | lib/central_logger/initializer_mixin.rb | Ruby | mit | 95 | master | 1,184 | module CentralLogger
module InitializerMixin
# initialization common to Rails 2.3.8 and 3.0
def create_logger(config, path)
level = ActiveSupport::BufferedLogger.const_get(config.log_level.to_s.upcase)
logger = MongoLogger.new(:path => path, :level => level)
logger.auto_flushing = false if R... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | lib/central_logger/initializer.rb | Ruby | mit | 95 | master | 462 | if Rails::VERSION::MAJOR == 2
require 'central_logger/initializer_mixin'
module CentralLogger
class Initializer
extend CentralLogger::InitializerMixin
# mirrors code in Rails 2 initializer.rb#initialize_logger
def self.initialize_deprecated_logger(config)
logger = config.logger = cre... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | lib/central_logger/railtie.rb | Ruby | mit | 95 | master | 612 | if Rails::VERSION::MAJOR == 3
require 'central_logger/initializer_mixin'
class Railtie < Rails::Railtie
include CentralLogger::InitializerMixin
# load earlier than bootstrap.rb initializer loads the default logger. bootstrap
# initializer will then skip its own initialization once Rails.logger is def... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | lib/central_logger/mongo_logger.rb | Ruby | mit | 95 | master | 5,649 | require 'erb'
require 'mongo'
require 'active_support'
require 'active_support/core_ext'
require 'central_logger/replica_set_helper'
module CentralLogger
class MongoLogger < ActiveSupport::BufferedLogger
include ReplicaSetHelper
PRODUCTION_COLLECTION_SIZE = 250.megabytes
DEFAULT_COLLECTION_SIZE = 100.me... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | lib/central_logger/filter.rb | Ruby | mit | 95 | master | 942 | module CentralLogger
module Filter
def self.included(base)
base.class_eval { around_filter :enable_central_logger }
end
def enable_central_logger
return yield unless Rails.logger.respond_to?(:mongoize)
# make sure the controller knows how to filter its parameters (Rails 3, 2, respectiv... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/test_helper.rb | Ruby | mit | 95 | master | 1,952 | require 'test/unit'
require 'shoulda'
require 'mocha'
# mock rails class
require 'pathname'
require 'rails'
require 'fileutils'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
Shoulda.autoload_macros("#{File.dirname(__FILE__)}/..")
class Test::Unit::TestC... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/common/app/controllers/order_controller.rb | Ruby | mit | 95 | master | 307 | class OrderController < ApplicationController
LOG_MESSAGE = "FOO"
def index
logger.debug LOG_MESSAGE
logger.add_metadata(:application_name_again => Rails.root.basename.to_s)
render :text => "nothing"
end
def blow_up
raise OrderController::LOG_MESSAGE
end
def create
end
end |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/common/test/test_helper.rb | Ruby | mit | 95 | master | 344 | ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
if Rails::VERSION::MAJOR == 3
require 'rails/test_help'
else
require 'test_help'
end
class ActiveSupport::TestCase
def common_setup
@con = @central_logger.mongo_connection
@collection = @con[@central_logger.mongo_col... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/common/test/functional/order_controller_test.rb | Ruby | mit | 95 | master | 1,846 | require 'test_helper'
class OrderControllerTest < ActionController::TestCase
def setup
@central_logger = Rails.logger
@central_logger.reset_collection
common_setup
end
def rails3?
Rails.root.to_s.index('3')
end
test "should have log level set" do
assert_equal ActiveSupport::BufferedLogg... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/2/Gemfile | Ruby | mit | 95 | master | 247 | # A sample Gemfile
source "http://rubygems.org"
gem 'sqlite3-ruby', :require => 'sqlite3'
gem "rails", "2.3.8"
gem "central_logger", :require => "central_logger", :path => "../../.."
gem (RUBY_VERSION =~ /^1\.9/ ? "ruby-debug19" : "ruby-debug") |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/2/db/seeds.rb | Ruby | mit | 95 | master | 356 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Major.create(:name... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/2/db/schema.rb | Ruby | mit | 95 | master | 767 | # 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 data... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/2/app/controllers/application_controller.rb | Ruby | mit | 95 | master | 460 | # Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
include CentralLogger::Filter
helper :all # include all helpers, all the time
protect_from_forgery # See Ac... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/2/config/preinitializer.rb | Ruby | mit | 95 | master | 602 | begin
require "rubygems"
require "bundler"
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."
end
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
"Run `gem install bundler`... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/2/config/environment.rb | Ruby | mit | 95 | master | 2,069 | # Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/2/config/initializers/session_store.rb | Ruby | mit | 95 | master | 810 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Act... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/2/config/initializers/cookie_verification_secret.rb | Ruby | mit | 95 | master | 505 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary atta... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/Gemfile | Ruby | mit | 95 | master | 737 | source 'http://rubygems.org'
gem 'rails', '3.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', :require => 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
gem "central_logger", :require => "central_logger", :path => "../../.."
# Deploy with Ca... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/Rakefile | Ruby | mit | 95 | master | 275 | # Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
LoggerAndRails3::Application.load_tasks |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/db/schema.rb | Ruby | mit | 95 | master | 768 | # 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 | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/config/routes.rb | Ruby | mit | 95 | master | 1,855 | LoggerAndRails3::Application.routes.draw do
#resources :order
#match 'blow_up' => 'order#blow_up'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :co... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/config/application.rb | Ruby | mit | 95 | master | 1,933 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module LoggerAndRails3
class Application < Rails::Applicati... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/config/environments/test.rb | Ruby | mit | 95 | master | 1,519 | LoggerAndRails3::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for t... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/config/environments/production.rb | Ruby | mit | 95 | master | 1,764 | LoggerAndRails3::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is t... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/config/environments/development.rb | Ruby | mit | 95 | master | 995 | LoggerAndRails3::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart t... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/config/initializers/secret_token.rb | Ruby | mit | 95 | master | 506 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/rails/3/config/initializers/session_store.rb | Ruby | mit | 95 | master | 433 | # Be sure to restart your server when you modify this file.
LoggerAndRails3::Application.config.session_store :cookie_store, :key => '_logger_and_rails3_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the sessio... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/shoulda_macros/log_macros.rb | Ruby | mit | 95 | master | 371 | module LogMacros
def should_contain_one_log_record
should "contain a log record" do
assert_equal 1, @con[@central_logger.mongo_collection_name].count
end
end
def should_use_database_name_in_config
should "use the database name in the config file" do
assert_equal "system_log", @central_log... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/unit/central_logger_test.rb | Ruby | mit | 95 | master | 5,742 | require 'test_helper'
require 'central_logger/mongo_logger'
# test the basic stuff
class CentralLogger::MongoLoggerTest < Test::Unit::TestCase
extend LogMacros
EXCEPTION_MSG = "Foo"
context "A CentralLogger::MongoLogger" do
setup do
# Can use different configs, but most tests use database.yml
F... |
github | peburrows/mongo_db_logger | https://github.com/peburrows/mongo_db_logger | test/unit/central_logger_replica_test.rb | Ruby | mit | 95 | master | 1,317 | require 'test_helper'
require 'central_logger/mongo_logger'
# test the basic stuff
class CentralLogger::MongoLoggerReplicaTest < Test::Unit::TestCase
extend LogMacros
context "A CentralLogger::MongoLogger" do
setup do
# Can use different configs, but most tests use database.yml
cp_config(REPLICA_S... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | aspera-cli.gemspec | Ruby | apache-2.0 | 95 | main | 3,426 | # frozen_string_literal: true
require_relative 'lib/aspera/cli/version'
require_relative 'lib/aspera/cli/info'
# expected extension of gemspec file
GEMSPEC_EXT = '.gemspec'
Gem::Specification.new do |spec|
# get location of this file (shall be in project root)
gemspec_file = File.expand_path(__FILE__)
raise "Er... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | Rakefile | Ruby | apache-2.0 | 95 | main | 1,443 | # frozen_string_literal: true
# Adds the following tasks:
# See: https://bundler.io/guides/creating_gem.html
# build # Build aspera-cli-x.y.z.gem into the pkg directory
# build:checksum # Generate SHA512 checksum of aspera-cli-x.y.z.gem into the checksums directory
# clean # Remove any temporar... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | Gemfile | Ruby | apache-2.0 | 95 | main | 1,802 | # frozen_string_literal: true
source 'https://rubygems.org'
# Gem's dependencies are in file <gem name>.gemspec
gemspec
# Used for development
group :build do
gem('rake', '~> 13.0')
end
# Used only for development
group :development do
gem('debug', '~> 1.11') unless defined?(JRUBY_VERSION)
gem('grpc-tools', '... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/release.rake | Ruby | apache-2.0 | 95 | main | 7,149 | # frozen_string_literal: true
require 'pathname'
require 'tmpdir'
require 'aspera/markdown'
require 'aspera/environment'
require_relative '../build/lib/paths'
require_relative '../build/lib/build_tools'
include BuildTools
namespace :release do
# Pre-release
PRE_SUFFIX = '.pre'
DATE_PLACE_HOLDER = 'Released: [Pl... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/windowszip.rake | Ruby | apache-2.0 | 95 | main | 3,600 | # Rakefile
# frozen_string_literal: true
require 'rake'
require 'zip'
require 'erb'
require 'aspera/rest'
require 'aspera/colors'
require 'aspera/environment'
require 'aspera/cli/info'
require 'aspera/cli/version'
require 'fileutils'
require 'aspera/cli/transfer_progress'
require 'aspera/ascp/installation'
require_re... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/certs.rake | Ruby | apache-2.0 | 95 | main | 2,213 | # Rakefile
# frozen_string_literal: true
require 'rake'
require 'openssl'
require 'pathname'
require 'singleton'
require_relative '../build/lib/build_tools'
include BuildTools
class Signer
include Singleton
def private_key_path
raise 'SIGNING_KEY env var required' unless ENV.key?('SIGNING_KEY')
key_path... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/mkdocs.rake | Ruby | apache-2.0 | 95 | main | 1,315 | # frozen_string_literal: true
require 'fileutils'
require_relative '../build/lib/build_tools'
include BuildTools
PATH_TMP_MKDOCS = Paths::TMP / 'mkdocs'
VENV_DIR = Paths::TMP / '.venv_mkdocs'
VENV_FLAG = VENV_DIR / 'bin/activate'
def run_venv(*args)
nenwenv = {
'PATH' => [VENV_DIR / 'bin', ENV['PATH']]... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/tools.rake | Ruby | apache-2.0 | 95 | main | 2,316 | # frozen_string_literal: true
require_relative '../build/lib/build_tools'
include BuildTools
include Paths
namespace :tools do
desc 'Show changes since latest tag'
task changes: [] do
latest_tag = run(*%w[git describe --tags --abbrev=0], mode: :capture).first.chomp
log.info("Changes since #{latest_tag}")
... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/appimage.rake | Ruby | apache-2.0 | 95 | main | 4,687 | # Rakefile
# frozen_string_literal: true
require 'rake'
require 'fileutils'
require 'pathname'
require 'tmpdir'
require 'aspera/assert'
require 'aspera/environment'
require 'aspera/cli/info'
require 'aspera/cli/version'
require_relative '../build/lib/build_tools'
include BuildTools
# AppImage build configuration
APP... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/chocolatey.rake | Ruby | apache-2.0 | 95 | main | 2,901 | # Rakefile
# frozen_string_literal: true
require 'rake'
require 'erb'
require 'fileutils'
require 'aspera/cli/info'
require 'aspera/cli/version'
require_relative '../build/lib/build_tools'
require_relative '../build/lib/paths'
include BuildTools
# Path to Chocolatey templates
CHOCOLATEY_SRC = Paths::BUILD / 'chocola... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/test.rake | Ruby | apache-2.0 | 95 | main | 14,869 | # frozen_string_literal: true
require 'aspera/environment'
require 'aspera/rest'
require 'aspera/log'
require 'aspera/hash_ext'
require 'rake'
require 'uri'
require 'zlib'
require 'etc'
require 'set'
require 'fileutils'
require 'securerandom'
require 'yaml'
require_relative '../build/lib/build_tools'
require_relative ... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/doc.rake | Ruby | apache-2.0 | 95 | main | 3,787 | # frozen_string_literal: true
require 'aspera/cli/info'
require 'digest'
require_relative '../build/lib/build_tools'
require_relative '../build/lib/pandoc'
require_relative '../build/lib/doc_helper'
require_relative '../build/lib/test_env'
require_relative '../build/lib/asperaconf'
include BuildTools
PATH_TMP_DOT = P... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/container.rake | Ruby | apache-2.0 | 95 | main | 2,408 | # Rakefile
# frozen_string_literal: true
require 'rake'
require 'erb'
require 'fileutils'
require 'aspera/assert'
require 'aspera/cli/info'
require 'aspera/cli/version'
require_relative '../build/lib/build_tools'
include BuildTools
CONTAINER_TOOL = ENV['CONTAINER_TOOL'] || 'podman'
# Extract optional gems
def option... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | rakelib/binary.rake | Ruby | apache-2.0 | 95 | main | 3,748 | # Rakefile
# frozen_string_literal: true
require 'rake'
require 'fileutils'
require 'pathname'
require 'bundler'
require 'aspera/assert'
require 'aspera/environment'
require 'aspera/cli/info'
require 'aspera/cli/version'
require_relative '../build/lib/build_tools'
include BuildTools
TEBAKO_VERSION = '0.13.4'
TEBAKO_... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | build/lib/pandoc.rb | Ruby | apache-2.0 | 95 | main | 6,252 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'pathname'
require_relative 'paths'
require_relative 'build_tools'
include BuildTools
include Paths
# Path to pandoc root directory
PATH_PANDOC_ROOT = ENV.key?('DIR_PANDOC') ? Pathname.new(ENV['DIR_PANDOC']) : Paths::PANDOC
# List of pandoc dependencies files... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | build/lib/paths.rb | Ruby | apache-2.0 | 95 | main | 1,810 | # frozen_string_literal: true
require 'pathname'
require 'aspera/cli/info'
require 'aspera/cli/version'
# Path constants for the project layout (build scripts, docs, tests).
# All paths are relative to the repository root.
module Paths
# Project (repository) root directory.
TOP = Pathname.new(__dir__).parent.pare... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | build/lib/doc_helper.rb | Ruby | apache-2.0 | 95 | main | 15,596 | # frozen_string_literal: true
# cspell:ignore INCMAN geminstadd transferspec passcode emea
# Tools used in README.erb.md
# get transfer spec parameter description
require 'aspera/environment'
require 'aspera/cli/info'
require 'aspera/agent/factory'
require 'aspera/cli/plugins/factory'
require 'aspera/cli/plugins/con... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | build/lib/test_env.rb | Ruby | apache-2.0 | 95 | main | 3,195 | # frozen_string_literal: true
require 'aspera/log'
require 'aspera/assert'
require 'aspera/uri_reader'
require 'aspera/yaml'
require_relative 'paths'
# Test environment configuration and test definition management
# Provides utilities to load test configuration (servers, credentials) and parse test definitions
module... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | build/lib/asperaconf.rb | Ruby | apache-2.0 | 95 | main | 21,676 | #!/usr/bin/env ruby
# frozen_string_literal: true
module Aspera
module Conf
# ═════════════════════════════════════════════════════════════════════════════
# CommentParser
#
# Parses the structured comments that aspera.conf places after each element.
#
# Comment anatomy in aspera.conf:
#
... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | build/lib/build_tools.rb | Ruby | apache-2.0 | 95 | main | 5,013 | # frozen_string_literal: true
require 'bundler'
require 'yaml'
require 'aspera/log'
require 'aspera/secret_hider'
require 'aspera/environment'
require 'aspera/cli/version'
require 'aspera/cli/manager'
require_relative 'paths'
module BuildTools
# @see Aspera::Log#logger
def log(*args, **kwargs, &block)
Aspera:... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | tests/warning_exit_wrapper.rb | Ruby | apache-2.0 | 95 | main | 383 | # frozen_string_literal: true
# First warning displayed will stop the execution
module Warning
class << self
def warn(message)
# Stop on first warning if in this gem's code, not other gems
raise message.to_s if message.to_s.include?('/aspera/')
# ignore other gems code (do not call `super`)
... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/transferd_pb.rb | Ruby | apache-2.0 | 95 | main | 35,466 | # frozen_string_literal: true
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: transferd.proto
require 'google/protobuf'
descriptor_data = "\n\x0ftransferd.proto\x12\rtransferd.api\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"\x13\n\x11\x... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/transferd_services_pb.rb | Ruby | apache-2.0 | 95 | main | 4,953 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: transferd.proto for package 'transferd.api'
require 'grpc'
require 'transferd_pb'
module Transferd
module Api
module TransferService
#
# Transfer service definition. This service enables users to start, manage and monitor transfers... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/line_logger.rb | Ruby | apache-2.0 | 95 | main | 436 | # frozen_string_literal: true
require 'aspera/log'
module Aspera
# used for logging http
class LineLogger
def initialize(level)
@level = level
@buffer = []
end
def <<(string)
return if string.nil? || string.empty?
if !string.end_with?("\n")
@buffer.push(string)
... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/web_auth.rb | Ruby | apache-2.0 | 95 | main | 9,089 | # frozen_string_literal: true
require 'aspera/web_server_simple'
require 'aspera/assert'
module Aspera
# servlet called on callback: it records the callback request
class WebAuthServlet < WEBrick::HTTPServlet::AbstractServlet
# @param server [WEBrick::HTTPServer]
# @param web_auth [WebAuth]
def initia... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/temp_file_manager.rb | Ruby | apache-2.0 | 95 | main | 2,498 | # frozen_string_literal: true
require 'singleton'
require 'fileutils'
require 'etc'
module Aspera
# create a temp file name for a given folder
# files can be deleted on process exit by calling cleanup
class TempFileManager
include Singleton
SEC_IN_DAY = 86_400
# assume no transfer last longer than ... |
github | IBM/aspera-cli | https://github.com/IBM/aspera-cli | lib/aspera/faspex_postproc.rb | Ruby | apache-2.0 | 95 | main | 3,605 | # frozen_string_literal: true
require 'json'
require 'timeout'
require 'English'
require 'webrick'
require 'aspera/log'
require 'aspera/assert'
module Aspera
# Start a Faspex-4 style post-processing script using Faspex-5 webhook
class Faspex4PostProcServlet < WEBrick::HTTPServlet::AbstractServlet
ALLOWED_PARA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.