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 | laradji/zabbix | https://github.com/laradji/zabbix | attributes/default.rb | Ruby | apache-2.0 | 87 | master | 1,189 | #
# Cookbook Name:: zabbix
# Attributes:: default
case node['platform_family']
when 'windows'
if ENV['ProgramFiles'] == ENV['ProgramFiles(x86)']
# if user has never logged into an interactive session then ENV['homedrive'] will be nil
default['zabbix']['etc_dir'] = ::File.join((ENV['homedrive'] || 'C:'), '... |
github | laradji/zabbix | https://github.com/laradji/zabbix | attributes/web.rb | Ruby | apache-2.0 | 87 | master | 1,010 | default['zabbix']['web']['login'] = 'admin'
default['zabbix']['web']['password'] = 'zabbix'
default['zabbix']['web']['install_method'] = 'apache'
default['zabbix']['web']['fqdn'] = node['fqdn']
default['zabbix']['web']['aliases'] = ['zabbix']
default['zabbix']['web']['port'] = 80
default... |
github | laradji/zabbix | https://github.com/laradji/zabbix | attributes/agent.rb | Ruby | apache-2.0 | 87 | master | 2,554 | # Load default.rb to use node['zabbix']['etc_dir']
include_attribute 'zabbix'
default['zabbix']['agent']['install'] = true
default['zabbix']['agent']['service_state'] = [:start, :enable]
default['zabbix']['agent']['branch'] = 'ZABBIX%20Latest%20Stable'
default['zabbix']['agent']['version'] ... |
github | laradji/zabbix | https://github.com/laradji/zabbix | attributes/agent_prebuild.rb | Ruby | apache-2.0 | 87 | master | 490 | include_attribute 'zabbix::agent'
default['zabbix']['agent']['prebuild']['arch'] = node['kernel']['machine'] == 'x86_64' ? 'amd64' : 'i386'
default['zabbix']['agent']['prebuild']['url'] = "http://www.zabbix.com/downloads/#{node['zabbix']['agent']['version']}/zabbix_agents_#{node['zabbix']['agent']['version']}.li... |
github | laradji/zabbix | https://github.com/laradji/zabbix | files/default/tests/minitest/server_source_test.rb | Ruby | apache-2.0 | 87 | master | 294 | require File.expand_path('../support/helpers.rb', __FILE__)
describe 'zabbix::server_source' do
include Helpers::Zabbix
it 'creates a user for the daemon to run as' do
user('zabbix').must_exist
end
it 'runs as a daemon' do
service('zabbix_server').must_be_running
end
end |
github | laradji/zabbix | https://github.com/laradji/zabbix | files/default/tests/minitest/default_test.rb | Ruby | apache-2.0 | 87 | master | 287 | require File.expand_path('../support/helpers.rb', __FILE__)
describe 'zabbix::default' do
include Helpers::Zabbix
it 'creates a user for the daemon to run as' do
user('zabbix').must_exist
end
it 'runs as a daemon' do
service('zabbix_agentd').must_be_running
end
end |
github | laradji/zabbix | https://github.com/laradji/zabbix | libraries/zabbix_connection.rb | Ruby | apache-2.0 | 87 | master | 992 | require 'socket'
require 'timeout'
class Chef
module Zabbix
class << self
# Creates a Zabbix connection and passes it to the block provided
#
# @param [Hash] connection_spec The specification for your Zabbix connection
# @option connection_spec [String] :url The Url to your Zabbix server'... |
github | laradji/zabbix | https://github.com/laradji/zabbix | libraries/chef_zabbix_errors.rb | Ruby | apache-2.0 | 87 | master | 2,370 | #
# Cookbook Name:: zabbix
# Library:: chef_zabbix_errors
#
# Author:: Andrew Garson(<agarson@riotgames.com, andrew.garson@gmail.com>)
#
class Chef
module Zabbix
class ZabbixError < StandardError; end
class InvalidMySqlConnectionInfoError < ZabbixError
def initialize(bad_connection_info)
@bad_... |
github | laradji/zabbix | https://github.com/laradji/zabbix | libraries/chef_zabbix_api.rb | Ruby | apache-2.0 | 87 | master | 7,251 | require 'forwardable'
class Chef
module Zabbix
module API
class GraphItem
extend Forwardable
def_delegators :@options, :[], :[]=, :delete
def initialize(options)
if options[:item_template].to_s.empty? && options[:host].to_s.empty?
Chef::Application.fatal! ':ite... |
github | laradji/zabbix | https://github.com/laradji/zabbix | libraries/chef_zabbix_enumerations.rb | Ruby | apache-2.0 | 87 | master | 4,678 | class Chef
module Zabbix
module API
module Enumeration
class << self
def included(base)
base.extend(ClassMethods)
base.send(:include, ClassMethods)
end
def extended(base)
base.send(:include, ClassMethods)
end
end
... |
github | laradji/zabbix | https://github.com/laradji/zabbix | libraries/chef_zabbix.rb | Ruby | apache-2.0 | 87 | master | 225 | class Chef
module Zabbix
class << self
def default_download_url(branch, version)
"http://downloads.sourceforge.net/project/zabbix/#{branch}/#{version}/zabbix-#{version}.tar.gz"
end
end
end
end |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/database_oracle.rb | Ruby | apache-2.0 | 87 | master | 337 | # Stub Oracle provider
use_inline_resources
def whyrun_supported?
true
end
def load_current_resource
true
end
def database_exists?(_dbname, _host, _port, _root_username, _root_password)
true
end
action :create do
Chef::Log.info 'Oracle provider is a stub - does not do anything yet!'
end
def create_new_dat... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/trigger.rb | Ruby | apache-2.0 | 87 | master | 1,429 | action :create do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
# NOTE: Triggers in the zabbix api don't really have a "name"
# Instead we call it name so that lwrp users don't lose their minds
# and we just treat it as the description field the api wants
#
# The des... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/database_my_sql.rb | Ruby | apache-2.0 | 87 | master | 4,715 | def whyrun_supported?
true
end
def load_current_resource
require 'mysql'
@current_resource = Chef::Resource::ZabbixDatabase.new(@new_resource.dbname)
@current_resource.dbname(@new_resource.dbname)
@current_resource.host(@new_resource.host)
@current_resource.port(@new_resource.port)
@current_resource.root... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/template.rb | Ruby | apache-2.0 | 87 | master | 820 | action :create do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
template_ids = Zabbix::API.find_template_ids(connection, new_resource.name)
if template_ids.empty?
group_ids = Zabbix::API.find_hostgroup_ids(connection, new_resource.group)
if group_ids.empty?
... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/host_group.rb | Ruby | apache-2.0 | 87 | master | 1,017 | def whyrun_supported?
true
end
action :create do
if @current_resource.exists
Chef::Log.info("Create: Host Group '#{new_resource.group}' already exists")
else
converge_by("Creating Host Group '#{new_resource.group}'") do
create_group(new_resource.group)
end
new_resource.updated_by_last_actio... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/discovery_rule.rb | Ruby | apache-2.0 | 87 | master | 1,595 | action :create do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
template_ids = Zabbix::API.find_template_ids(connection, new_resource.template)
if template_ids.empty?
Chef::Application.fatal! "Could not find a template named #{new_resource.template}"
end
template_... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/database_postgres.rb | Ruby | apache-2.0 | 87 | master | 4,772 | def whyrun_supported?
true
end
def load_current_resource
require 'pg'
@current_resource = Chef::Resource::ZabbixDatabase.new(@new_resource.dbname)
@current_resource.dbname(@new_resource.dbname)
@current_resource.host(@new_resource.host)
@current_resource.port(@new_resource.port)
@current_resource.root_u... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/trigger_dependency.rb | Ruby | apache-2.0 | 87 | master | 1,876 | action :create do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
# NOTE: Triggers in the zabbix api don't really have a "name"
# Instead we call it name so that lwrp users don't lose their minds
# and we just treat it as the description field the api wants
#
# The des... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/item.rb | Ruby | apache-2.0 | 87 | master | 2,528 | action :create do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
template_ids = Zabbix::API.find_template_ids(connection, new_resource.template)
if template_ids.empty?
Chef::Application.fatal! "Could not find a template named #{new_resource.template}"
end
template_... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/interface.rb | Ruby | apache-2.0 | 87 | master | 1,611 | action :create do
# Translate the name of the interface to a type
# TODO: add error checking for bad interface names
types = {}
types['agent'] = 1
types['SNMP'] = 2
types['IPMI'] = 3
types['JMX'] = 4
# type = types[new_resource.name]
Chef::Zabbix.with_connection(new_resource.server_connection) do |... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/source.rb | Ruby | apache-2.0 | 87 | master | 2,939 | action :extract_only do
tar_path = zabbix_tar_path(new_resource.code_dir, new_resource.branch, new_resource.version)
if !::File.exist?(tar_path)
Chef::Log.info("Zabbix tar: #{tar_path} does't exist")
remote_file tar_path do
source new_resource.source_url
mode '0644'
action :create
end... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/application.rb | Ruby | apache-2.0 | 87 | master | 896 | action :create do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
# Convert the "hostname" (a template name) into a hostid
template_ids = Zabbix::API.find_template_ids(connection, new_resource.template)
if template_ids.empty?
Chef::Application.fatal! "Could not find a t... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/user.rb | Ruby | apache-2.0 | 87 | master | 6,367 | action :create_or_update do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
get_user_request = {
:method => 'user.get',
:params => {
:filter => {
:alias => new_resource.alias
}
}
}
users = connection.query(get_user_request)
if u... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/hostgroup.rb | Ruby | apache-2.0 | 87 | master | 598 | action :create do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
hostgroup_id = connection.query(
:method => 'hostgroup.get',
:params => {
:filter => {
:name => new_resource.parameters[:name]
}
}
)
if hostgroup_id.size == 0
co... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/host.rb | Ruby | apache-2.0 | 87 | master | 7,330 | action :create_or_update do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
get_host_request = {
:method => 'host.get',
:params => {
:filter => {
:host => new_resource.hostname
}
}
}
hosts = connection.query(get_host_request)
if... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/api_call.rb | Ruby | apache-2.0 | 87 | master | 485 | action :call do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
connection.query(
:method => new_resource.method,
:params => new_resource.parameters
)
end
new_resource.updated_by_last_action(true)
end
def load_current_resource
run_context.include_recipe 'zabbix:... |
github | laradji/zabbix | https://github.com/laradji/zabbix | providers/graph.rb | Ruby | apache-2.0 | 87 | master | 2,285 | action :create do
Chef::Zabbix.with_connection(new_resource.server_connection) do |connection|
new_resource.graph_items.each do |graph_item|
if graph_item[:item_template]
template_id = Zabbix::API.find_template_ids(connection, graph_item[:item_template]).first['templateid']
if new_resource.... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | Rakefile | Ruby | mit | 87 | master | 847 | # encoding: utf-8
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'rspec/core'
require 'rspec/core/rake_task'
RSpe... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | i18n-spec.gemspec | Ruby | mit | 87 | master | 686 | require_relative "lib/i18n-spec/version"
Gem::Specification.new do |s|
s.name = "i18n-spec"
s.version = I18nSpec::VERSION
s.required_ruby_version = ">= 2.4.0"
s.require_paths = ["lib"]
s.authors = ["Christopher Dell"]
s.description = "Includes a number of rspec matchers to make specing your locale files e... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec.rb | Ruby | mit | 87 | master | 471 | if defined?(Psych) and defined?(Psych::VERSION) and !defined?(YAML::ParseError)
YAML::ParseError = Psych::SyntaxError
end
require 'rspec/core'
require 'iso'
require 'yaml'
require 'i18n-spec/failure_message'
Dir[File.dirname(__FILE__) + '/i18n-spec/models/*.rb'].each {|file| require file }
Dir[File.dirname(__FILE__)... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/tasks.rb | Ruby | mit | 87 | master | 2,242 | require 'i18n-spec'
I18nSpec::LOG_DETAIL_PREDICATE = " - "
namespace :'i18n-spec' do
desc "Checks the validity of a locale file"
task :validate do
if ARGV[1].nil?
puts "You must specifiy a file path or a folder path"
return
elsif File.directory?(ARGV[1])
filepaths = Dir.glob("#{ARGV[1]}... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/failure_message.rb | Ruby | mit | 87 | master | 613 | module I18nSpec
module FailureMessage
def failure_for_should(&block)
if respond_to?(:failure_message)
# Rspec 3
failure_message { |f| instance_exec(f, &block) }
else
# Rspec 2
failure_message_for_should { |f| instance_exec(f, &block) }
end
end
def failure... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/matchers/be_a_subset_of_matcher.rb | Ruby | mit | 87 | master | 497 | RSpec::Matchers.define :be_a_subset_of do |default_locale_filepath|
extend I18nSpec::FailureMessage
match do |filepath|
locale_file = I18nSpec::LocaleFile.new(filepath)
default_locale = I18nSpec::LocaleFile.new(default_locale_filepath)
@superset = locale_file.flattened_translations.keys - default_local... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/matchers/be_a_complete_translation_of_matcher.rb | Ruby | mit | 87 | master | 501 | RSpec::Matchers.define :be_a_complete_translation_of do |default_locale_filepath|
extend I18nSpec::FailureMessage
match do |filepath|
locale_file = I18nSpec::LocaleFile.new(filepath)
default_locale = I18nSpec::LocaleFile.new(default_locale_filepath)
@misses = default_locale.flattened_translations.keys ... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/matchers/be_parseable_matcher.rb | Ruby | mit | 87 | master | 323 | RSpec::Matchers.define :be_parseable do
extend I18nSpec::FailureMessage
match do |actual|
@locale_file = I18nSpec::LocaleFile.new(actual)
@locale_file.is_parseable?
end
failure_for_should do |filepath|
"expected #{filepath} to be parseable but got :\n- #{@locale_file.errors[:unparseable]}"
end
e... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/matchers/have_valid_pluralization_keys_matcher.rb | Ruby | mit | 87 | master | 435 | RSpec::Matchers.define :have_valid_pluralization_keys do
extend I18nSpec::FailureMessage
match do |actual|
@locale_file = I18nSpec::LocaleFile.new(actual)
@locale_file.invalid_pluralization_keys.empty?
end
failure_for_should do |filepath|
"expected #{filepath} to not contain invalid pluralization ... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/matchers/have_missing_pluralization_keys_matcher.rb | Ruby | mit | 87 | master | 586 | RSpec::Matchers.define :have_missing_pluralization_keys do
extend I18nSpec::FailureMessage
match do |actual|
@locale_file = I18nSpec::LocaleFile.new(actual)
@locale_file.missing_pluralization_keys.any?
end
failure_for_should_not do |filepath|
flattened_keys = []
@locale_file.errors[:missing_p... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/models/locale_file.rb | Ruby | mit | 87 | master | 2,717 | module I18nSpec
class LocaleFile
PLURALIZATION_KEYS = %w{zero one two few many other}
attr_accessor :filepath
attr_reader :errors
def initialize(filepath)
@filepath = filepath
@errors = {}
end
def content
@content ||= IO.read(@filepath)
end
def translations
... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | lib/i18n-spec/shared_examples/valid_locale_file.rb | Ruby | mit | 87 | master | 476 | RSpec.shared_examples_for "a valid locale file" do |locale_file|
describe locale_file do
it { is_expected.to be_parseable }
it { is_expected.to have_valid_pluralization_keys }
it { is_expected.to_not have_missing_pluralization_keys }
it { is_expected.to have_one_top_level_namespace }
it { is_expec... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | spec/spec_helper.rb | Ruby | mit | 87 | master | 359 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'i18n-spec'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require ... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | spec/lib/i18n-spec/matchers_spec.rb | Ruby | mit | 87 | master | 1,280 | require 'spec_helper'
describe "Valid file" do
it_behaves_like "a valid locale file", 'spec/fixtures/en.yml'
end
describe "Invalid files" do
it { expect('spec/fixtures/unparseable.yml').not_to be_parseable }
it { expect('spec/fixtures/invalid_pluralization_keys.yml').not_to have_valid_pluralization_keys }
it ... |
github | tigrish/i18n-spec | https://github.com/tigrish/i18n-spec | spec/lib/i18n-spec/models/locale_file_spec.rb | Ruby | mit | 87 | master | 5,314 | require 'spec_helper'
module LocaleFileHelper
def locale_file_with_content(content)
locale_file = I18nSpec::LocaleFile.new('test.yml')
expect(locale_file).to receive(:content).and_return(content)
locale_file
end
end
describe I18nSpec::LocaleFile do
include LocaleFileHelper
describe "#locale_code"... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | Gemfile | Ruby | mit | 87 | main | 296 | source 'https://rubygems.org/'
gemspec
group :development do
gem 'rake'
gem 'rubygems-tasks', '~> 0.2'
gem 'rspec', '~> 3.0'
gem 'simplecov', '~> 0.20'
gem 'redcarpet', platform: :mri
gem 'yard', '~> 0.9'
gem 'dead_end', require: false
end |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | kramdown-man.gemspec | Ruby | mit | 87 | main | 2,108 | # frozen_string_literal: true
require 'yaml'
Gem::Specification.new do |gem|
gemspec = YAML.load_file('gemspec.yml')
gem.name = gemspec.fetch('name')
gem.version = gemspec.fetch('version') do
lib_dir = File.join(File.dirname(__FILE__),'lib')
$LOAD_PATH << lib_dir unless $... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | Rakefile | Ruby | mit | 87 | main | 392 | # frozen_string_literal: true
begin
require 'bundler/setup'
rescue LoadError => error
abort error.message
end
require 'rake'
require 'rubygems/tasks'
Gem::Tasks.new
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
task :test => :spec
task :default => :spec
require 'yard'
YARD::Rake::YardocTask.new
... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | spec/cli_spec.rb | Ruby | mit | 87 | main | 6,201 | require 'spec_helper'
require 'kramdown/man/cli'
require 'tempfile'
describe Kramdown::Man::CLI do
describe "#initialize" do
it "must default #output to nil" do
expect(subject.output).to be(nil)
end
it "must initialize #option_parser" do
expect(subject.option_parser).to be_kind_of(OptionPar... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | spec/converter_spec.rb | Ruby | mit | 87 | main | 24,553 | require 'spec_helper'
require 'kramdown/man/converter'
describe Kramdown::Man::Converter do
let(:markdown) { File.read('man/kramdown-man.1.md') }
let(:doc) { Kramdown::Document.new(markdown) }
let(:root) { doc.root }
subject { described_class.send(:new,root,{}) }
describe "#convert" do
let(:ma... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | spec/integration_spec.rb | Ruby | mit | 87 | main | 563 | require 'spec_helper'
require 'kramdown/man'
describe Kramdown::Document, :integration do
let(:man_dir) { File.expand_path('../man',__dir__) }
let(:markdown_path) { File.join(man_dir,'kramdown-man.1.md') }
let(:markdown) { File.read(markdown_path) }
subject { described_class.ne... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | lib/kramdown/man.rb | Ruby | mit | 87 | main | 573 | # frozen_string_literal: true
require 'kramdown'
require 'kramdown/man/version'
require 'kramdown/man/converter'
module Kramdown
class Document
#
# Converts the parsed markdown document to a man page.
#
# @param [Hash] options
# Additional options.
#
# @return [String]
# The con... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | lib/kramdown/man/task.rb | Ruby | mit | 87 | main | 1,558 | # frozen_string_literal: true
require 'kramdown'
require 'kramdown/man'
require 'rake/tasklib'
module Kramdown
module Man
#
# Defines a `man` rake task that generates man-pages within the `man/`
# directory from `.md` files.
#
class Task < Rake::TaskLib
# Markdown file glob pattern
... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | lib/kramdown/man/converter.rb | Ruby | mit | 87 | main | 25,626 | # frozen_string_literal: true
require 'kramdown/man/version'
require 'kramdown/converter/base'
module Kramdown
module Man
#
# Converts markdown into a roff man-page.
#
# @since 1.0.0
#
# @api private
#
class Converter < Kramdown::Converter::Base
# Comment header
HEADER ... |
github | postmodern/kramdown-man | https://github.com/postmodern/kramdown-man | lib/kramdown/man/cli.rb | Ruby | mit | 87 | main | 4,779 | require 'kramdown'
require 'kramdown/man'
require 'optparse'
module Kramdown
module Man
#
# Represents the `kramdown-man` command's logic.
#
# @api private
#
# @since 1.0.0
#
class CLI
# The program name.
PROGRAM_NAME = "kramdown-man"
# The URL to report bugs to.
... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | Guardfile | Ruby | mit | 87 | main | 812 | ignore %r{^vendor/gems/}
guard :minitest, all_on_start: false, all_after_pass: false do
watch(%r{^test/(.*)/?test_(.*)\.rb$})
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r{^test/test_helper\.rb$}) { "test" }
watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
watch(%... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | Gemfile | Ruby | mit | 87 | main | 1,368 | source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.3.0"
gem "rails"
gem "pg"
gem "puma"
gem "bootsnap", ">= 1.4.4", require: false
gem "jbuilder"
gem "httparty"
gem "pg_search"
gem "good_job"
gem "rack-cors"
gem "nokogiri"
gem "chordpro", git: "https://github.com/bke... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/schema.rb | Ruby | mit | 87 | main | 25,940 | # 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 | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20211213142622_create_albums.rb | Ruby | mit | 87 | main | 205 | class CreateAlbums < ActiveRecord::Migration[6.1]
def change
create_table :albums do |t|
t.string :title
t.json :metadata
t.references :artist
t.timestamps
end
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220527124410_add_password_reset_to_users.rb | Ruby | mit | 87 | main | 201 | class AddPasswordResetToUsers < ActiveRecord::Migration[7.0]
def change
change_table :users do |t|
t.string :password_reset_token
t.datetime :password_reset_sent_at
end
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220207123911_use_tsvector_column.rb | Ruby | mit | 87 | main | 786 | class UseTsvectorColumn < ActiveRecord::Migration[7.0]
def change
add_column :pg_search_documents, :content_tsv, :tsvector
add_index :pg_search_documents, :content_tsv, using: "gin"
add_index :pg_search_documents, :content, using: :gin, opclass: {title: :gin_trgm_ops}
reversible do |dir|
dir.up... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220514222126_add_object_changes_to_versions.rb | Ruby | mit | 87 | main | 301 | # This migration adds the optional `object_changes` column, in which PaperTrail
# will store the `changes` diff for each update event. See the readme for
# details.
class AddObjectChangesToVersions < ActiveRecord::Migration[7.0]
def change
add_column :versions, :object_changes, :json
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20241225124957_remove_password_reset_fields.rb | Ruby | mit | 87 | main | 201 | class RemovePasswordResetFields < ActiveRecord::Migration[8.0]
def change
change_table :users do |t|
t.remove :password_reset_token
t.remove :password_reset_sent_at
end
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220105203853_store_queried_fields.rb | Ruby | mit | 87 | main | 462 | class StoreQueriedFields < ActiveRecord::Migration[7.0]
def change
change_table :songsheets do |t|
t.string :title
end
change_table :artists do |t|
t.string :genre
t.string :style
end
change_table :albums do |t|
t.integer :released
t.decimal :score, precision: 3, sc... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220627133951_convert_to_uuid.rb | Ruby | mit | 87 | main | 3,902 | class ConvertToUuid < ActiveRecord::Migration[7.0]
TABLES = {
access_tokens: [:user_id],
ahoy_events: [:visit_id, :user_id],
ahoy_visits: [:user_id],
albums: [:artist_id, :genre_id],
artist_works: [:artist_id, :work_id],
artists: [:genre_id],
genres: [],
library_items: [:user_id, :item... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220106173432_create_pg_search_documents.rb | Ruby | mit | 87 | main | 581 | class CreatePgSearchDocuments < ActiveRecord::Migration[7.0]
def up
say_with_time("Creating table for pg_search multisearch") do
create_table :pg_search_documents do |t|
t.text :content
t.json :data
t.belongs_to :searchable, polymorphic: true, index: true
t.timestamps null: f... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220629192034_remove_unverified_artists.rb | Ruby | mit | 87 | main | 216 | class RemoveUnverifiedArtists < ActiveRecord::Migration[7.0]
def change
# FIXME: remove after running in production
Artist.where(verified: false).destroy_all
remove_column :artists, :verified
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20240522174643_install_searchjoy.rb | Ruby | mit | 87 | main | 835 | class InstallSearchjoy < ActiveRecord::Migration[7.1]
def change
create_table :searchjoy_searches do |t|
t.references :user
t.string :search_type
t.string :query
t.string :normalized_query
t.integer :results_count
t.datetime :created_at
t.datetime :converted_at
end
... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20230717140730_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb | Ruby | mit | 87 | main | 710 | # frozen_string_literal: true
class CreateIndexGoodJobsJobsOnPriorityCreatedAtWhenUnfinished < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20240503175432_create_references.rb | Ruby | mit | 87 | main | 358 | class CreateReferences < ActiveRecord::Migration[7.1]
def change
create_table :references, id: :uuid do |t|
t.references :record, polymorphic: true, null: false, type: :uuid
t.string :identifier
t.string :source
t.json :data
t.timestamps
t.index [:record_type, :record_id, :so... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20240523163020_move_metadata_to_references.rb | Ruby | mit | 87 | main | 613 | class MoveMetadataToReferences < ActiveRecord::Migration[7.1]
def up
{
Artist => "idArtist",
Album => "idAlbum",
Track => "idTrack"
}.each do |model, identifier|
model.find_in_batches do |records|
Reference.insert_all records.map { |record|
{
record_id: re... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20211218204534_add_foreign_keys_to_songsheets.rb | Ruby | mit | 87 | main | 478 | class AddForeignKeysToSongsheets < ActiveRecord::Migration[7.0]
def change
create_table :artist_works do |t|
t.references :artist, null: false, foreign_key: true
t.references :work, polymorphic: true, null: false
t.integer :order
t.index [:artist_id, :work_id, :work_type, :order], unique: ... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220521034543_create_tokens.rb | Ruby | mit | 87 | main | 440 | class CreateTokens < ActiveRecord::Migration[7.0]
def change
create_table :access_tokens do |t|
t.string :jti
t.belongs_to :user, null: false, foreign_key: true
t.datetime :expire_at
t.datetime :invalidated_at
t.string :refresh_token_digest, index: {unique: true}
t.string :remo... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220210133540_add_verified_to_artists.rb | Ruby | mit | 87 | main | 222 | class AddVerifiedToArtists < ActiveRecord::Migration[7.0]
def change
add_column :artists, :verified, :boolean, default: false
execute "UPDATE artists SET verified = (metadata->>'idArtist' IS NOT NULL)"
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20221226122025_convert_songsheet_plays_to_views.rb | Ruby | mit | 87 | main | 305 | class ConvertSongsheetPlaysToViews < ActiveRecord::Migration[7.0]
def up
execute <<-SQL
UPDATE ahoy_events SET
name = 'view',
properties = jsonb_build_object('id', properties->>'songsheet_id', 'action', 'show', 'type', 'Songsheet')
WHERE name = 'play';
SQL
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20211213180412_create_tracks.rb | Ruby | mit | 87 | main | 212 | class CreateTracks < ActiveRecord::Migration[6.1]
def change
create_table :tracks do |t|
t.string :title
t.json :metadata
t.references :artist, :album
t.timestamps
end
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220618131530_create_ahoy_visits_and_events.rb | Ruby | mit | 87 | main | 1,325 | class CreateAhoyVisitsAndEvents < ActiveRecord::Migration[7.0]
def change
create_table :ahoy_visits do |t|
t.string :visit_token
t.string :visitor_token
# the rest are recommended but optional
# simply remove any you don't want
# user
t.references :user
# standard
... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20221224153748_install_motor_notes.rb | Ruby | mit | 87 | main | 2,547 | class InstallMotorNotes < ActiveRecord::Migration[7.0]
def self.up
create_table :motor_notes do |t|
t.column :body, :text
t.column :author_id, :bigint
t.column :author_type, :string
t.column :record_id, :string, null: false
t.column :record_type, :string, null: false
t.column :... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220114165758_create_genres.rb | Ruby | mit | 87 | main | 1,105 | class CreateGenres < ActiveRecord::Migration[7.0]
class Genre < ApplicationRecord; end
class Artist < ApplicationRecord; end
class Track < ApplicationRecord; end
def change
create_table :genres do |t|
t.string :name
t.timestamps
end
change_table :artists do |t|
t.references :ge... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220115051449_associate_album_with_genre.rb | Ruby | mit | 87 | main | 589 | class AssociateAlbumWithGenre < ActiveRecord::Migration[7.0]
class Genre < ApplicationRecord; end
class Album < ApplicationRecord; end
def change
change_table :albums do |t|
t.references :genre, foreign_key: true
end
reversible do |dir|
dir.up do
Album.distinct.pluck(Arel.sql("m... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220523034318_create_library_items.rb | Ruby | mit | 87 | main | 347 | class CreateLibraryItems < ActiveRecord::Migration[7.0]
def change
create_table :library_items do |t|
t.references :user, null: false, foreign_key: true
t.references :item, null: false, polymorphic: true
t.timestamps
end
change_table :setlists do |t|
t.references :user, foreign_k... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20230120144044_create_flipper_tables.rb | Ruby | mit | 87 | main | 581 | class CreateFlipperTables < ActiveRecord::Migration[7.0]
def self.up
create_table :flipper_features do |t|
t.string :key, null: false
t.timestamps null: false
end
add_index :flipper_features, :key, unique: true
create_table :flipper_gates do |t|
t.string :feature_key, null: false
... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220519164332_create_users.rb | Ruby | mit | 87 | main | 249 | class CreateUsers < ActiveRecord::Migration[7.0]
def change
create_table :users do |t|
t.string :name
t.string :email
t.string :password_digest
t.timestamps
end
add_index :users, :email, unique: true
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220614211748_create_mailkick_subscriptions.rb | Ruby | mit | 87 | main | 405 | class CreateMailkickSubscriptions < ActiveRecord::Migration[7.0]
def change
create_table :mailkick_subscriptions do |t|
t.references :subscriber, polymorphic: true, index: false
t.string :list
t.timestamps
end
add_index :mailkick_subscriptions, [:subscriber_type, :subscriber_id, :list],... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220618132541_add_rank.rb | Ruby | mit | 87 | main | 309 | class AddRank < ActiveRecord::Migration[7.0]
def change
add_column :songsheets, :rank, :bigint
add_column :tracks, :rank, :bigint
add_column :albums, :rank, :bigint
add_column :artists, :rank, :bigint
add_column :setlists, :rank, :bigint
add_column :genres, :rank, :bigint
end
end |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220619124827_install_motor_admin.rb | Ruby | mit | 87 | main | 5,673 | class InstallMotorAdmin < ActiveRecord::Migration[7.0]
def self.up
create_table :motor_queries do |t|
t.column :name, :string, null: false
t.column :description, :text
t.column :sql_body, :text, null: false
t.column :preferences, :text, null: false
t.column :author_id, :bigint
... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20240225142314_recreate_good_job_cron_indexes_with_conditional.rb | Ruby | mit | 87 | main | 2,174 | # frozen_string_literal: true
class RecreateGoodJobCronIndexesWithConditional < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at_cond)
add_index :g... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220516172030_convert_has_songsheet_to_counter_cache.rb | Ruby | mit | 87 | main | 581 | class ConvertHasSongsheetToCounterCache < ActiveRecord::Migration[7.0]
def change
change_table :tracks do |t|
t.integer :songsheets_count, default: 0
t.remove :has_songsheet, type: :boolean
end
reversible do |dir|
dir.up do
execute <<~SQL
with c as (
select... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220514222125_create_versions.rb | Ruby | mit | 87 | main | 1,275 | # This migration creates the `versions` table, the only schema PT requires.
# All other migrations PT provides are optional.
class CreateVersions < ActiveRecord::Migration[7.0]
def change
create_table :versions do |t|
t.string :item_type, null: false
t.bigint :item_id, null: false
t.string :even... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20240225142318_create_index_good_job_jobs_for_candidate_lookup.rb | Ruby | mit | 87 | main | 655 | # frozen_string_literal: true
class CreateIndexGoodJobJobsForCandidateLookup < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if co... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220211173533_create_set_lists.rb | Ruby | mit | 87 | main | 374 | class CreateSetLists < ActiveRecord::Migration[7.0]
def change
create_table :setlists do |t|
t.string :title
t.text :description
t.timestamps
end
create_table :setlist_items do |t|
t.belongs_to :setlist, foreign_key: true
t.belongs_to :songsheet, foreign_key: true
t.b... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20241205173823_create_good_job_process_lock_indexes.rb | Ruby | mit | 87 | main | 1,870 | # frozen_string_literal: true
class CreateGoodJobProcessLockIndexes < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
reversible do |dir|
dir.up do
unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked)
add_index... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | db/migrate/20220112181445_create_good_jobs.rb | Ruby | mit | 87 | main | 1,608 | # frozen_string_literal: true
class CreateGoodJobs < ActiveRecord::Migration[7.0]
def change
enable_extension "pgcrypto"
create_table :good_jobs, id: :uuid do |t|
t.text :queue_name
t.integer :priority
t.jsonb :serialized_params
t.timestamp :scheduled_at
t.timestamp :performed_... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/routes.rb | Ruby | mit | 87 | main | 1,759 | Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
namespace :api, path: "" do
get "search(.:format)", to: "search#index", as: :search
get "search/:search_id/convert/:id", as: :convert_search, to: "search#convert"
resour... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/application.rb | Ruby | mit | 87 | main | 1,672 | 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 ChordBook
API_URI = URI(ENV.fetch("APP_API_URL", "http://localhost:3100"))
CLIENT_URI = begin
host = ENV.fetch("A... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/initializers/cors.rb | Ruby | mit | 87 | main | 393 | Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins ["localhost:3000", "chordbook.app", %r{\Ahttps://web-pr-.*\.onrender\.com\z}, ENV["APP_HOSTNAME"]].compact
resource "*",
headers: :any,
methods: [:get, :post, :patch, :put, :delete],
expose: ["Link", "Access-... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/initializers/sentry.rb | Ruby | mit | 87 | main | 365 | if ENV["APP_SENTRY_DSN"]
Sentry.init do |config|
config.dsn = ENV["APP_SENTRY_DSN"]
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/initializers/ahoy.rb | Ruby | mit | 87 | main | 291 | class Ahoy::Store < Ahoy::DatabaseStore
end
# set to true for JavaScript tracking
Ahoy.api = false
# set to true for geocoding (and add the geocoder gem to your Gemfile)
# we recommend configuring local geocoding as well
# see https://github.com/ankane/ahoy#geocoding
Ahoy.geocode = false |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/initializers/mail.rb | Ruby | mit | 87 | main | 331 | if ENV["MAILGUN_API_KEY"]
Mailgun.configure do |config|
config.api_key = ENV["MAILGUN_API_KEY"]
end
Rails.application.configure do
config.action_mailer.delivery_method = :mailgun
config.action_mailer.mailgun_settings = {
api_key: ENV["MAILGUN_API_KEY"],
domain: ENV["MAILGUN_DOMAIN"]
}... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/initializers/mailkick.rb | Ruby | mit | 87 | main | 833 | # https://github.com/ankane/mailkick#bounces-and-spam-reports
Mailkick.process_opt_outs_method = lambda do |opt_outs|
emails = opt_outs.map { |v| v[:email] }
subscribers = User.includes(:mailkick_subscriptions).where(email: emails).index_by(&:email)
opt_outs.each do |opt_out|
subscriber = subscribers[opt_out... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/initializers/good_job.rb | Ruby | mit | 87 | main | 1,016 | if Rails.env.production?
GoodJob::Engine.middleware.use(Rack::Auth::Basic) do |username, password|
ActiveSupport::SecurityUtils.secure_compare(ENV.fetch("ADMIN_USER"), username) &&
ActiveSupport::SecurityUtils.secure_compare(ENV.fetch("ADMIN_PASS"), password)
end
end
Rails.application.configure do
conf... |
github | chordbook/chordbook | https://github.com/chordbook/chordbook | config/initializers/motor.rb | Ruby | mit | 87 | main | 207 | ENV["MOTOR_AUTH_USERNAME"] = ENV["ADMIN_USER"]
ENV["MOTOR_AUTH_PASSWORD"] = ENV["ADMIN_PASS"]
Rails.application.config.to_prepare do
ENV["MOTOR_ALERTS_FROM_ADDRESS"] = ApplicationMailer::SUPPORT_FROM
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.