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 | scirate/scirate | https://github.com/scirate/scirate | app/models/comment.rb | Ruby | mit | 181 | main | 4,092 | # == Schema Information
#
# Table name: comments
#
# id :integer not null, primary key
# user_id :integer not null
# score :integer default(0), not null
# cached_votes_up :integer default(0), not null
# cached_votes_down :integer ... |
github | scirate/scirate | https://github.com/scirate/scirate | app/models/comment_report.rb | Ruby | mit | 181 | main | 692 | # == Schema Information
#
# Table name: comment_reports
#
# id :integer not null, primary key
# user_id :integer
# comment_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class CommentReport < ActiveRecord::Base
belongs_to :user
belongs_to :com... |
github | scirate/scirate | https://github.com/scirate/scirate | app/models/system.rb | Ruby | mit | 181 | main | 766 | # == Schema Information
#
# Table name: system
#
# id :integer not null, primary key
# alert :text default(""), not null
# created_at :datetime
# updated_at :datetime
# arxiv_sync_dt :datetime default(2014-09-08 00:00:00 UTC),... |
github | scirate/scirate | https://github.com/scirate/scirate | app/models/version.rb | Ruby | mit | 181 | main | 612 | # == Schema Information
#
# Table name: versions
#
# id :integer not null, primary key
# position :integer not null
# date :datetime not null
# size :text
# paper_uid :text not null
#
class Version < ActiveRecord::Base
validates :paper_uid, presence: true
... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/password_resets_controller.rb | Ruby | mit | 181 | main | 1,163 | class PasswordResetsController < ApplicationController
def create
# this should be case insensitive
user = User.find_by_email(params[:email])
if user
user.send_password_reset
flash[:success] = "Email sent with password reset instructions."
redirect_to root_url
else
flash[:erro... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/sessions_controller.rb | Ruby | mit | 181 | main | 4,673 | class SessionsController < ApplicationController
def new
end
def create
session[:return_to] = params[:return_to] if params[:return_to]
user = User.find_by_email(params[:email_or_username]) ||
User.find_by_username(params[:email_or_username])
if user && user.authenticate(params[:password]... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/feeds_controller.rb | Ruby | mit | 181 | main | 7,679 | require 'data_helpers'
class FeedsController < ApplicationController
before_action :parse_params
# No user, and no feed specified: show all papers
def index_nouser
if @date.nil?
@date = Feed.order("last_paper_date DESC").where("last_paper_date is not null").limit(1).pluck(:last_paper_date).first
e... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/comments_controller.rb | Ruby | mit | 181 | main | 4,282 | class CommentsController < ApplicationController
before_action :find_comment, only: [:edit, :delete, :restore, :upvote, :unvote, :report, :unreport, :reply, :history]
before_action :check_moderation_permission, only: [:edit, :delete, :restore]
def index
@page = [1, params.fetch(:page, 1).to_s.to_i].max
... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/papers_controller.rb | Ruby | mit | 181 | main | 5,268 | require 'arxiv_import'
class PapersController < ApplicationController
include PapersHelper
def show
@paper = Paper.where(uid: Arxiv.strip_version(params[:paper_uid]))
.select('id', 'uid', 'title', 'abstract', 'scites_count', 'abs_url', 'pdf_url', 'update_date', 'submit_date', 'pubdate', 'author_comments... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/users_controller.rb | Ruby | mit | 181 | main | 5,927 | require 'open-uri'
require 'data_helpers'
class UsersController < ApplicationController
before_action :signed_in_user,
only: [:feeds, :edit, :update, :destroy, :settings, :settings_password]
before_action :correct_user, only: [:edit, :update, :destroy]
before_action :profile_data, only: [:activity, ... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/static_pages_controller.rb | Ruby | mit | 181 | main | 935 | require 'jwt'
class StaticPagesController < ApplicationController
# Only send a confirmation email if it hasn't been sent yet.
def job_success
jobId = params[:jobId]
query = """
query MyQuery {
jobs(where: {id: {_eq: #{jobId}}, emailedConfirmation: {_eq: false}}) {
contactEmail
contactName
to... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/application_controller.rb | Ruby | mit | 181 | main | 1,379 | require 'net/https'
class ApplicationController < ActionController::Base
protect_from_forgery
RECAPTCHA_MINIMUM_SCORE = 0.5
include SessionsHelper
include ApplicationHelper
before_action :block_bad_requests
before_action :redirect_https
before_action :set_token
def set_token
@token = mk_jwt_toke... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/api_controller.rb | Ruby | mit | 181 | main | 2,646 | Stripe.api_key = Settings::STRIPE_API_SECRET_KEY
require 'erb'
class ApiController < ApplicationController
before_action :authorize
before_action :needs_moderator, only: [:hide_from_recent]
skip_before_action :authorize, only: [:create_stripe_checkout]
def create_stripe_checkout
session = Stripe::Check... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/admin/base_controller.rb | Ruby | mit | 181 | main | 1,571 | require 'data_helpers'
class Admin::BaseController < ApplicationController
before_action :signed_in_user, :require_admin
def require_admin
unless current_user.can_admin?
flash[:error] = "You don't have permission to do that!"
redirect_to root_url
end
end
def _site_data(from, to)
data ... |
github | scirate/scirate | https://github.com/scirate/scirate | app/controllers/admin/users_controller.rb | Ruby | mit | 181 | main | 921 | module Admin
class UsersController < BaseController
before_action :load_user
def edit
end
def become
sign_in @user
flash[:success] = "You are now signed in as #{@user.username}"
redirect_to root_path
end
def update
old = @user.attributes.dup
user_params = para... |
github | scirate/scirate | https://github.com/scirate/scirate | app/lib/search.rb | Ruby | mit | 181 | main | 16,696 | require 'data_helpers'
require 'elasticsearch'
module Search
class << self
attr_reader :index_name
end
def self.es
host = Settings::ELASTIC_SEARCH_HOST
@es ||= Elasticsearch::Client.new url: "http://#{host}:9200", log: false
end
# http://stackoverflow.com/questions/16205341/symbols-in-query-str... |
github | scirate/scirate | https://github.com/scirate/scirate | app/lib/exception_notification.rb | Ruby | mit | 181 | main | 297 | class Exception
# From http://stackoverflow.com/questions/2823748/how-do-i-add-information-to-an-exception-message-without-changing-its-class-in-r
def with_details(extra)
begin
raise self, "#{message} - #{extra}", backtrace
rescue Exception => e
return e
end
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | app/mailers/job_mailer.rb | Ruby | mit | 181 | main | 403 | class JobMailer < ActionMailer::Base
default from: "SciRate Jobs <notifications@#{Settings::HOST}>"
def mail(*args)
super
end
def job_notification(contact_email, contact_name, job_token)
@contact_name = contact_name
@url = Settings::HOST + "/jobs/submit?i=" + job_token
mail to: contact_email, ... |
github | scirate/scirate | https://github.com/scirate/scirate | app/mailers/user_mailer.rb | Ruby | mit | 181 | main | 906 | class UserMailer < ActionMailer::Base
default from: "SciRate <notifications@#{Settings::HOST}>"
def mail(*args)
super
end
def signup_confirmation(user)
@user = user
mail to: user.email, subject: "Welcome to SciRate!"
end
def password_reset(user)
@user = user
mail :to => user.email, :s... |
github | scirate/scirate | https://github.com/scirate/scirate | app/helpers/users_helper.rb | Ruby | mit | 181 | main | 443 | module UsersHelper
# Returns the Gravatar (http://gravatar.com/) for the given user.
def gravatar_url(user, options = { size: 50 })
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
size = options[:size]
"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=#{size}"
end
def gravatar_for... |
github | scirate/scirate | https://github.com/scirate/scirate | app/helpers/sessions_helper.rb | Ruby | mit | 181 | main | 997 | module SessionsHelper
def sign_in(user, options = {})
session[:remember_token] = user.remember_token
self.current_user = user
end
def signed_in?
!current_user.nil?
end
def current_user=(user)
@current_user = user
end
def current_user
@current_user ||= user_from_remember_token
end... |
github | scirate/scirate | https://github.com/scirate/scirate | app/helpers/papers_helper.rb | Ruby | mit | 181 | main | 661 | module PapersHelper
def last_date(papers)
last = papers.find(:first, order: "submit_date DESC")
last.nil? ? Time.now.utc.to_date : last.submit_date
end
def next_date(papers, date)
next_paper = papers.find(:last,
order: "submit_date DESC",
condit... |
github | scirate/scirate | https://github.com/scirate/scirate | app/helpers/application_helper.rb | Ruby | mit | 181 | main | 1,598 | require 'jwt'
require 'net/http'
require 'json'
module ApplicationHelper
def status_warning
raw "<span class=\"warning\">#{current_user.account_status}:</span>"
end
def timeago(dt)
dt = Time.parse(dt) if dt.is_a? String
raw "<abbr class=\"timeago\" title=\"#{dt.iso8601}\">#{dt.strftime("%b %d %Y %R ... |
github | scirate/scirate | https://github.com/scirate/scirate | app/helpers/authors_helper.rb | Ruby | mit | 181 | main | 307 | module AuthorsHelper
def author_link_to(author, paper)
if paper.nil?
link_to(author.fullname.html_safe, "/search?q=au:#{author.searchterm}")
else
link_to(author.fullname.html_safe, "/search?q=au:#{author.searchterm}+in:#{paper.categories[0].feed_uid.split('.')[0]}")
end
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | config/routes.rb | Ruby | mit | 181 | main | 4,210 | require 'sessions_helper'
SciRate::Application.routes.draw do
root 'feeds#index'
get '/search', to: 'papers#search', as: 'papers_search'
post '/api/scite/:paper_uid', to: 'api#scite',
as: :scite, paper_uid: /.+/
post '/api/unscite/:paper_uid', to: 'api#unscite',
as: :unscite, paper_uid: /.+/
... |
github | scirate/scirate | https://github.com/scirate/scirate | config/puma.rb | Ruby | mit | 181 | main | 206 | # config/puma.rb
environment "production"
port 8000
threads 8,32
workers 3
preload_app!
on_worker_boot do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.establish_connection
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | config/application.rb | Ruby | mit | 181 | main | 2,024 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'net/http'
require 'font-awesome-rails'
require "sprockets/railtie"
if defined?(Bundler)
ActiveSupport::Deprecation.silence do
Bundler.require(:default, Rails.env)
end
end
module SciRate
class Application < Rails::Application
c... |
github | scirate/scirate | https://github.com/scirate/scirate | config/initializers/assets.rb | Ruby | mit | 181 | main | 746 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional ... |
github | scirate/scirate | https://github.com/scirate/scirate | config/initializers/action_mailer.rb | Ruby | mit | 181 | main | 560 | if Rails.env.production?
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
:address => "smtp.mailersend.net",
:port => "587",
:domain => Settings::HOST,
:enable_starttls_aut... |
github | scirate/scirate | https://github.com/scirate/scirate | config/initializers/cookies_serializer.rb | Ruby | mit | 181 | main | 209 | # Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :marshal
Rails.application.config.action_dispatch.cookies_same_site_protection = :lax |
github | scirate/scirate | https://github.com/scirate/scirate | config/environments/development.rb | Ruby | mit | 181 | main | 2,534 | 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 serve... |
github | scirate/scirate | https://github.com/scirate/scirate | config/environments/test.rb | Ruby | mit | 181 | main | 1,648 | SciRate::Application.configure do
# Settings specified here will take precedence over those in config/application.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 the test su... |
github | scirate/scirate | https://github.com/scirate/scirate | config/environments/production.rb | Ruby | mit | 181 | main | 3,616 | require 'exception_notifier'
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, allo... |
github | scirate/scirate | https://github.com/scirate/scirate | config/environments/profile.rb | Ruby | mit | 181 | main | 3,789 | require 'exception_notifier'
SciRate::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, a... |
github | scirate/scirate | https://github.com/scirate/scirate | db/seeds.rb | Ruby | mit | 181 | main | 29,532 | Feed.create!([
{uid: "alg-geom", source: "arxiv", fullname: "alg-geom", position: 0, subscriptions_count: 0, last_paper_date: "1998-01-02 01:00:00", parent_uid: nil},
{uid: "ao-sci", source: "arxiv", fullname: "ao-sci", position: 0, subscriptions_count: 0, last_paper_date: "1996-09-03 01:00:00", parent_uid: nil},
... |
github | scirate/scirate | https://github.com/scirate/scirate | db/schema.rb | Ruby | mit | 181 | main | 11,974 | # 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 | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20141008043049_add_creation_change_for_every_comment.rb | Ruby | mit | 181 | main | 310 | class AddCreationChangeForEveryComment < ActiveRecord::Migration
def up
puts "Recording creation event for every existing comment..."
Comment.all.each do |comment|
comment.record_change!(CommentChange::CREATED, comment.user_id)
end
end
def down
raise NotImplementedError
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140526054832_create_activities.rb | Ruby | mit | 181 | main | 207 | class CreateActivities < ActiveRecord::Migration
def change
create_table :activities do |t|
t.references :user, null: false
t.string :type, null: false
t.timestamps
end
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140429111101_add_provider_to_user.rb | Ruby | mit | 181 | main | 249 | class AddProviderToUser < ActiveRecord::Migration
def change
add_column :users, :provider, :string
add_column :users, :uid, :string
add_column :users, :oauth_token, :string
add_column :users, :oauth_expires_at, :datetime
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140501213221_create_auth_links.rb | Ruby | mit | 181 | main | 333 | class CreateAuthLinks < ActiveRecord::Migration
def change
create_table :auth_links do |t|
t.string :provider, null: false
t.string :uid, null: false
t.string :oauth_token, null: false
t.datetime :oauth_expires_at, null: false
t.references :user, null: false
t.timestamps
e... |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140916211924_create_comment_events.rb | Ruby | mit | 181 | main | 364 | class CreateCommentEvents < ActiveRecord::Migration
def change
create_table :comment_changes do |t|
t.references :comment, index: true, null: false
t.references :user, index: true, null: false
t.text :event, null: false
t.text :reason, null: false, default: ""
t.text :content, null: ... |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140529103318_add_website_and_location_to_user.rb | Ruby | mit | 181 | main | 210 | class AddWebsiteAndLocationToUser < ActiveRecord::Migration
def change
add_column :users, :url, :text, null: false, default: ''
add_column :users, :location, :text, null: false, default: ''
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140529132921_create_user_authors.rb | Ruby | mit | 181 | main | 214 | class CreateUserAuthors < ActiveRecord::Migration
def change
create_table :user_authors do |t|
t.references :user, null: false
t.text :paper_uid, null: false
t.timestamps
end
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140909185604_update_trackers.rb | Ruby | mit | 181 | main | 297 | class UpdateTrackers < ActiveRecord::Migration
def change
add_column :system, :arxiv_sync_dt, :datetime, null: false, default: Time.now.utc.beginning_of_day-1.days
add_column :system, :arxiv_author_sync_dt, :datetime, null: false, default: Time.now.utc.beginning_of_day-1.days
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20120313073916_core_schema.rb | Ruby | mit | 181 | main | 9,553 | class CoreSchema < ActiveRecord::Migration
def change
create_table "authors" do |t|
t.integer "position", null: false
t.text "fullname", null: false
t.text "searchterm", null: false
t.text "paper_uid"
end
add_index "authors", ["paper_uid"], name: "index_authors_on_pa... |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140501213230_remove_provider_from_user.rb | Ruby | mit | 181 | main | 228 | class RemoveProviderFromUser < ActiveRecord::Migration
def change
remove_column :users, :provider
remove_column :users, :uid
remove_column :users, :oauth_token
remove_column :users, :oauth_expires_at
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140526044959_add_affiliation_and_about_to_user.rb | Ruby | mit | 181 | main | 216 | class AddAffiliationAndAboutToUser < ActiveRecord::Migration
def change
add_column :users, :affiliation, :text, null: false, default: ''
add_column :users, :about, :text, null: false, default: ''
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140620083606_add_email_settings_to_user.rb | Ruby | mit | 181 | main | 310 | class AddEmailSettingsToUser < ActiveRecord::Migration
def change
add_column :users, :email_about_replies, :boolean, default: true
add_column :users, :email_about_comments_on_authored, :boolean, default: true
add_column :users, :email_about_comments_on_scited, :boolean, default: false
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140526065910_add_subject_to_activity.rb | Ruby | mit | 181 | main | 203 | class AddSubjectToActivity < ActiveRecord::Migration
def change
add_column :activities, :subject_id, :integer, null: false
add_column :activities, :subject_type, :string, null: false
end
end |
github | scirate/scirate | https://github.com/scirate/scirate | db/migrate/20140622150016_create_delayed_jobs.rb | Ruby | mit | 181 | main | 1,359 | class CreateDelayedJobs < ActiveRecord::Migration
def self.up
create_table :delayed_jobs, :force => true do |table|
table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
table.integer :attempts, :default => 0, :null => false # Provides for retrie... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | riemann-tools.gemspec | Ruby | mit | 181 | main | 1,714 | # frozen_string_literal: true
require_relative 'lib/riemann/tools/version'
Gem::Specification.new do |spec|
spec.name = 'riemann-tools'
spec.version = Riemann::Tools::VERSION
spec.authors = ['Kyle Kingsbury']
spec.email = ['aphyr@aphyr.com']
spec.summary = 'Utilities whic... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | Rakefile | Ruby | mit | 181 | main | 991 | # frozen_string_literal: true
require 'riemann/tools/version'
require 'bundler/gem_tasks'
require 'github_changelog_generator/task'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
config.user = 'riemann'
config.project = 'riemann-tools'
config.exclude_labels = %w[dependencies skip-changelog]
con... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | Gemfile | Ruby | mit | 181 | main | 312 | # frozen_string_literal: true
source 'https://rubygems.org'
# Specify your gem's dependencies in riemann-tools.gemspec
gemspec
gem 'github_changelog_generator'
gem 'maxmind-geoip2'
gem 'racc'
gem 'rackup'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'sinatra'
gem 'webrick' |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-marathon/Rakefile | Ruby | mit | 181 | main | 991 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-marathon/lib/riemann/tools/marathon.rb | Ruby | mit | 181 | main | 4,591 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
class Marathon
include Riemann::Tools
require 'faraday'
require 'json'
require 'uri'
opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
opt :open_timeout, 'Faraday open timeout'... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-munin/Rakefile | Ruby | mit | 181 | main | 926 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-munin/lib/riemann/tools/munin.rb | Ruby | mit | 181 | main | 986 | # frozen_string_literal: true
require 'riemann/tools'
# Gathers munin statistics and submits them to Riemann.
module Riemann
module Tools
class Munin
include Riemann::Tools
require 'munin-ruby'
def initialize
super
@munin = ::Munin::Node.new
end
def tick
... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-aws/Rakefile | Ruby | mit | 181 | main | 976 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-aws/lib/riemann/tools/aws/elb_metrics.rb | Ruby | mit | 181 | main | 6,485 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
module Aws
class ElbMetrics
include Riemann::Tools
require 'fog/aws'
require 'time'
opt :fog_credentials_file, 'Fog credentials file', type: String
opt :fog_credential, 'Fog credenti... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-aws/lib/riemann/tools/aws/s3_list.rb | Ruby | mit | 181 | main | 3,301 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
module Aws
class S3List
include Riemann::Tools
require 'fog/aws'
require 'time'
opt :fog_credentials_file, 'Fog credentials file', type: String
opt :fog_credential, 'Fog credentials ... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-aws/lib/riemann/tools/aws/status.rb | Ruby | mit | 181 | main | 2,842 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
module Aws
class Status
include Riemann::Tools
require 'fog/aws'
require 'date'
opt :fog_credentials_file, 'Fog credentials file', type: String
opt :fog_credential, 'Fog credentials ... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-aws/lib/riemann/tools/aws/s3_status.rb | Ruby | mit | 181 | main | 3,971 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
module Aws
class S3Status
include Riemann::Tools
require 'fog/aws'
require 'time'
opt :fog_credentials_file, 'Fog credentials file', type: String
opt :fog_credential, 'Fog credential... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-aws/lib/riemann/tools/aws/billing.rb | Ruby | mit | 181 | main | 3,725 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
module Aws
class Billing
include Riemann::Tools
require 'fog/aws'
opt :fog_credentials_file, 'Fog credentials file', type: String
opt :fog_credential, 'Fog credentials to use', type: String
... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-aws/lib/riemann/tools/aws/sqs_status.rb | Ruby | mit | 181 | main | 1,446 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
module Aws
class SqsStatus
include Riemann::Tools
require 'fog/aws'
opt :access_key, 'AWS access key', type: String
opt :secret_key, 'Secret access key', type: String
opt :region, 'A... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-aws/lib/riemann/tools/aws/rds_status.rb | Ruby | mit | 181 | main | 2,302 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
module Aws
class RdsStatus
include Riemann::Tools
require 'fog/aws'
require 'date'
require 'time'
require 'json'
opt :access_key, 'AWS access key', type: String
opt :... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-mesos/Rakefile | Ruby | mit | 181 | main | 985 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-mesos/lib/riemann/tools/mesos.rb | Ruby | mit | 181 | main | 4,186 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
class Mesos
include Riemann::Tools
require 'faraday'
require 'json'
require 'uri'
opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
opt :open_timeout, 'Faraday open timeout', t... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-chronos/Rakefile | Ruby | mit | 181 | main | 990 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-chronos/lib/riemann/tools/chronos.rb | Ruby | mit | 181 | main | 4,524 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
class Chronos
include Riemann::Tools
require 'faraday'
require 'json'
require 'uri'
opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
opt :open_timeout, 'Faraday open timeout',... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-docker/Rakefile | Ruby | mit | 181 | main | 925 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-docker/lib/riemann/tools/docker.rb | Ruby | mit | 181 | main | 6,544 | # frozen_string_literal: true
require 'riemann/tools'
# Reports current CPU, disk, load average, and memory use to riemann.
module Riemann
module Tools
class Docker
require 'docker'
require 'socket'
include Riemann::Tools
include ::Docker
opt :docker_host, 'Docker Container Host (... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-elasticsearch/Rakefile | Ruby | mit | 181 | main | 997 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-elasticsearch/lib/riemann/tools/elasticsearch.rb | Ruby | mit | 181 | main | 5,124 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
class Elasticsearch
include Riemann::Tools
require 'faraday'
require 'json'
require 'uri'
opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
opt :open_timeout, 'Faraday open tim... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-rabbitmq/Rakefile | Ruby | mit | 181 | main | 987 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-rabbitmq/lib/riemann/tools/rabbitmq.rb | Ruby | mit | 181 | main | 8,395 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
class Rabbitmq
include Riemann::Tools
require 'faraday'
require 'json'
require 'uri'
opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
opt :open_timeout, 'Faraday open timeout'... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-riak/Rakefile | Ruby | mit | 181 | main | 923 | # frozen_string_literal: true
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
require 'find'
# Don't include resource forks in tarballs on Mac OS X.
ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
ENV['COPYFILE_DISABLE'] = 'true'
# Gemspec
gemspec = Gem::Specification.new do |s|
s.name = 'r... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | tools/riemann-riak/lib/riemann/tools/riak.rb | Ruby | mit | 181 | main | 9,668 | # frozen_string_literal: true
require 'English'
require 'riemann/tools'
require 'riemann/tools/version'
# Forwards information on a Riak node to Riemann.
module Riemann
module Tools
class Riak
include Riemann::Tools
require 'net/http'
require 'net/https'
require 'yajl/json_gem'
o... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools.rb | Ruby | mit | 181 | main | 3,165 | # frozen_string_literal: true
module Riemann
module Tools
require 'optimist'
require 'riemann/tools/riemann_client_wrapper'
def self.included(base)
base.instance_eval do
def run
new.run
end
def opt(*args)
args.unshift :opt
@opts ||= []
... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/fd.rb | Ruby | mit | 181 | main | 3,067 | # frozen_string_literal: true
require 'riemann/tools'
# Reports current file descriptor use to riemann.
# By default reports the total system fd usage, can also report usage of individual processes
module Riemann
module Tools
class Fd
include Riemann::Tools
opt :fd_sys_warning, 'open file descripto... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/health.rb | Ruby | mit | 181 | main | 20,319 | # frozen_string_literal: true
require 'riemann/tools'
require 'riemann/tools/utils'
require 'riemann/tools/uptime_parser.tab'
# Reports current CPU, disk, load average, and memory use to riemann.
module Riemann
module Tools
class Health
include Riemann::Tools
include Riemann::Tools::Utils
PRO... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/haproxy.rb | Ruby | mit | 181 | main | 2,016 | # frozen_string_literal: true
require 'riemann/tools'
require 'riemann/tools/version'
# Gathers haproxy CSV statistics and submits them to Riemann.
module Riemann
module Tools
class Haproxy
include Riemann::Tools
require 'net/http'
require 'csv'
opt :stats_url, 'Full url to haproxy sta... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/diskstats.rb | Ruby | mit | 181 | main | 2,398 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
class Diskstats
include Riemann::Tools
opt :devices, 'Devices to monitor', type: :strings, default: nil
opt :ignore_devices, 'Devices to ignore', type: :strings, default: nil
def initialize
super
... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/http_check.rb | Ruby | mit | 181 | main | 11,613 | # frozen_string_literal: true
require 'net/http'
require 'resolv'
require 'socket'
require 'riemann/tools'
require 'riemann/tools/version'
# Test for HTTP requests
module Riemann
module Tools
class HttpCheck
REQUIRED_RUBY_VERSION = '2.7.0'
include Riemann::Tools
opt :uri, 'URI to fetch', sh... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/bench.rb | Ruby | mit | 181 | main | 1,585 | # frozen_string_literal: true
require 'riemann/tools'
require 'riemann/tools/version'
# Connects to a server (first arg) and populates it with a constant stream of
# events for testing.
module Riemann
module Tools
class Bench
include Riemann::Tools
attr_accessor :hosts, :services, :states
de... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/riemann_client_wrapper.rb | Ruby | mit | 181 | main | 2,009 | # frozen_string_literal: true
require 'singleton'
require 'riemann/client'
module Riemann
module Tools
class RiemannClientWrapper
attr_reader :options
BACKOFF_TMIN = 0.5 # Minimum delay between reconnection attempts
BACKOFF_TMAX = 30.0 # Maximum delay
BACKOFF_FACTOR = 2
def ini... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/memcached.rb | Ruby | mit | 181 | main | 911 | # frozen_string_literal: true
require 'riemann/tools'
# Gathers memcached STATS and submits them to Riemann.
module Riemann
module Tools
class Memcached
include Riemann::Tools
require 'socket'
opt :memcached_host, 'Memcached hostname', default: 'localhost'
opt :memcached_port, 'Memcach... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/dir_space.rb | Ruby | mit | 181 | main | 1,717 | # frozen_string_literal: true
require 'riemann/tools'
# Gathers the space used by a directory and submits it to riemann
module Riemann
module Tools
class DirSpace
include Riemann::Tools
opt :directory, '', default: '/var/log'
opt :service_prefix, 'The first part of the service name, before th... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/ntp.rb | Ruby | mit | 181 | main | 1,028 | # frozen_string_literal: true
require 'riemann/tools'
# Reports NTP stats to Riemann.
module Riemann
module Tools
class Ntp
include Riemann::Tools
def initialize
super
@hostname = `hostname`.chomp
@ostype = `uname -s`.chomp.downcase
abort 'WARNING: macOS not explici... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/kvm.rb | Ruby | mit | 181 | main | 463 | # frozen_string_literal: true
require 'riemann/tools'
module Riemann
module Tools
class Kvm
include Riemann::Tools
def tick
# determine how many instances I have according to libvirt
kvm_instances = `LANG=C virsh list | grep -c running`
# submit them to riemann
repo... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/hwmon.rb | Ruby | mit | 181 | main | 3,470 | # frozen_string_literal: true
require 'riemann/tools'
# See https://www.kernel.org/doc/html/latest/hwmon/index.html
module Riemann
module Tools
class Hwmon
include Riemann::Tools
class Device
attr_reader :hwmon, :type, :number, :crit, :lcrit, :service
def initialize(hwmon, type, nu... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/utils.rb | Ruby | mit | 181 | main | 2,982 | # frozen_string_literal: true
require 'socket'
module Riemann
module Tools
module Utils # :nodoc:
class StringTokenizer
attr_reader :tokens
def initialize(text)
@scanner = StringScanner.new(text)
@lineno = 1
@pos = 0
@line = next_line
@to... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/zookeeper.rb | Ruby | mit | 181 | main | 892 | # frozen_string_literal: true
require 'riemann/tools'
# Gathers zookeeper STATS and submits them to Riemann.
module Riemann
module Tools
class Zookeeper
include Riemann::Tools
require 'socket'
opt :zookeeper_host, 'Zookeeper hostname', default: 'localhost'
opt :zookeeper_port, 'Zookeep... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/apache_status.rb | Ruby | mit | 181 | main | 3,056 | # frozen_string_literal: true
require 'riemann/tools'
require 'riemann/tools/version'
# Collects Apache metrics and submits them to Riemann
# More information can be found at http://httpd.apache.org/docs/2.4/mod/mod_status.html
# Removes whitespace from 'Total Accesses' and 'Total kBytes' for output to graphite
modu... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/cloudant.rb | Ruby | mit | 181 | main | 1,982 | # frozen_string_literal: true
require 'riemann/tools'
require 'riemann/tools/version'
# Gathers load balancer statistics from Cloudant.com (shared cluster) and submits them to Riemann.
module Riemann
module Tools
class Cloudant
include Riemann::Tools
require 'net/http'
require 'json'
o... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/portcheck.rb | Ruby | mit | 181 | main | 1,152 | # frozen_string_literal: true
require 'riemann/tools'
# Checks for open tcp ports.
# (c) Max Voit 2017
module Riemann
module Tools
class Portcheck
include Riemann::Tools
require 'socket'
opt :hostname, 'Host, defaults to localhost', default: `hostname`.chomp
opt :ports, "List of ports ... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/varnish.rb | Ruby | mit | 181 | main | 1,489 | # frozen_string_literal: true
require 'open3'
require 'riemann/tools'
# Reports varnish stats to Riemann.
module Riemann
module Tools
class Varnish
include Riemann::Tools
opt :varnish_host, 'Varnish hostname', default: `hostname`.chomp
def initialize
super
cmd = 'varnishstat... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/md.rb | Ruby | mit | 181 | main | 1,330 | # frozen_string_literal: true
require 'riemann/tools'
require 'riemann/tools/mdstat_parser.tab'
module Riemann
module Tools
class Md
include Riemann::Tools
opt :devices, 'Devices to monitor', type: :strings, default: []
opt :ignore_devices, 'Devices to ignore', type: :strings, default: []
... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/nginx_status.rb | Ruby | mit | 181 | main | 3,322 | # frozen_string_literal: true
require 'riemann/tools'
require 'riemann/tools/version'
# Gathers nginx status stub statistics and submits them to Riemann.
# See http://wiki.nginx.org/HttpStubStatusModule for configuring Nginx appropriately
module Riemann
module Tools
class NginxStatus
include Riemann::Tool... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/freeswitch.rb | Ruby | mit | 181 | main | 4,433 | # frozen_string_literal: true
require 'English'
require 'riemann/tools'
module Riemann
module Tools
class Freeswitch
include Riemann::Tools
opt :calls_warning, 'Calls warning threshold', default: 100
opt :calls_critical, 'Calls critical threshold', default: 300
opt :pid_file, 'FreeSWITC... |
github | riemann/riemann-tools | https://github.com/riemann/riemann-tools | lib/riemann/tools/consul_health.rb | Ruby | mit | 181 | main | 3,970 | # frozen_string_literal: true
require 'riemann/tools'
require 'riemann/tools/version'
require 'socket'
require 'net/http'
require 'uri'
require 'json'
# Reports service and node status to riemann
module Riemann
module Tools
class ConsulHealth
include Riemann::Tools
opt :consul_host, 'Consul API Hos... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.