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 | boltops-tools/cody | https://github.com/boltops-tools/cody | lib/cody/dsl/project.rb | Ruby | mit | 19 | master | 3,864 | module Cody::Dsl
module Project
include Ssm
PROPERTIES = %w[
Artifacts
BadgeEnabled
Cache
Description
EncryptionKey
Environment
LogsConfig
Name
QueuedTimeoutInMinutes
SecondaryArtifacts
SecondarySources
ServiceRole
Source
Tag... |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | lib/cody/dsl/project/ssm.rb | Ruby | mit | 19 | master | 648 | require "aws-sdk-ssm"
module Cody::Dsl::Project
module Ssm
# This method grabs the ssm parameter store value at "compile" time vs
# CloudFormation run time. In case we need it as part of the DSL compile phase.
def ssm(name)
resp = ssm_client.get_parameter(name: name)
if resp.parameter.type ==... |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | lib/cody/dsl/role/registry.rb | Ruby | mit | 19 | master | 847 | require "set"
module Cody::Dsl::Role
class Registry
class_attribute :iam_statements
self.iam_statements = nil # nil to allow fallback to default_iam_statements in cody/role.rb
class_attribute :managed_policy_arns
self.managed_policy_arns = nil # nil to allow fallback to default_managed_policy_arns in... |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | lib/cody/evaluate/interface.rb | Ruby | mit | 19 | master | 277 | module Cody::Evaluate
module Interface
# Useful interface methods if want to run more generalized code in the evaluated DSL files
def project_name
@options["project_name"]
end
def full_project_name
@options["full_project_name"]
end
end
end |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | lib/cody/stack/base.rb | Ruby | mit | 19 | master | 3,376 | class Cody::Stack
class Base
include Cody::AwsServices
include Status
def initialize(options)
@options = options
@project_name = @options[:project_name] || inferred_project_name
@stack_name = normalize_stack_name(options[:stack_name] || inferred_stack_name(@project_name))
@full_p... |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | lib/cody/stack/update.rb | Ruby | mit | 19 | master | 310 | class Cody::Stack
class Update < Base
def perform
cfn.update_stack(
stack_name: @stack_name,
template_body: YAML.dump(@template),
capabilities: ["CAPABILITY_IAM"]
)
puts "Updating stack #{@stack_name}. Check CloudFormation console for status."
end
end
end |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | lib/cody/stack/create.rb | Ruby | mit | 19 | master | 310 | class Cody::Stack
class Create < Base
def perform
cfn.create_stack(
stack_name: @stack_name,
template_body: YAML.dump(@template),
capabilities: ["CAPABILITY_IAM"]
)
puts "Creating stack #{@stack_name}. Check CloudFormation console for status."
end
end
end |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | spec/spec_helper.rb | Ruby | mit | 19 | master | 1,780 | ENV["CODY_TEST"] = "1"
ENV["AWS_REGION"] ||= "us-west-2"
# CodeClimate test coverage: https://docs.codeclimate.com/docs/configuring-test-coverage
# require 'simplecov'
# SimpleCov.start
# Ensures aws api never called. Fixture home folder does not contain ~/.aws/credentails
ENV['HOME'] = File.join(Dir.pwd,'spec/fixtur... |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | spec/lib/tailer_spec.rb | Ruby | mit | 19 | master | 1,100 | describe Cody::Tailer do
context "first call before cloudwatch log group name is set" do
let(:logs) do
logs = Cody::Tailer.new({}, :fake_build_id)
allow(logs).to receive(:codebuild).and_return(codebuild)
logs
end
let(:codebuild) do
client = double(:codebuild).as_null_object
a... |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | spec/lib/cli_spec.rb | Ruby | mit | 19 | master | 238 | describe Cody::CLI do
before(:all) do
@args = "--noop"
@cody_bin = "exe/cody"
end
describe "cody" do
it "deploy" do
out = execute("#{@cody_bin} deploy #{@args}")
expect(out).to include("")
end
end
end |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | spec/lib/schedule_spec.rb | Ruby | mit | 19 | master | 364 | describe Cody::Schedule do
let(:schedule) do
Cody::Schedule.new(schedule_path: "spec/fixtures/app/.cody/schedule.rb")
end
context "general" do
it "builds up the template in memory" do
template = schedule.run
expect(template.keys).to eq ["EventsRule", "EventsRuleRole"]
expect(template["Ev... |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | spec/lib/role_spec.rb | Ruby | mit | 19 | master | 2,091 | describe Cody::Role do
let(:role) { Cody::Role.new(role_path: role_path) }
let(:role_path) { "spec/fixtures/app/.cody/role.rb" }
subject(:template) { role.run }
context "general" do
it "builds up the template in memory" do
expect(template.keys).to eq ["IamRole"]
expect(template["IamRole"]).to b... |
github | boltops-tools/cody | https://github.com/boltops-tools/cody | spec/lib/project_spec.rb | Ruby | mit | 19 | master | 338 | describe Cody::Project do
let(:project) do
Cody::Project.new(project_path: "spec/fixtures/app/.cody/project.rb")
end
context "general" do
it "builds up the template in memory" do
template = project.run
expect(template.keys).to eq ["CodeBuild"]
expect(template["CodeBuild"]).to be_a(Hash)
... |
github | mkmcc/watch-calibration | https://github.com/mkmcc/watch-calibration | test-results/test-results.rb | Ruby | apache-2.0 | 19 | master | 8,044 | require 'Tioga/FigureMaker'
require './plot_styles.rb'
require 'Dobjects/Function'
class MyPlots
include Math
include Tioga
include FigureConstants
include MyPlotStyles
def t
@figure_maker
end
def initialize
@figure_maker = FigureMaker.default
t.tex_preview_preamble += "\n\t\\usepackage{m... |
github | mkmcc/watch-calibration | https://github.com/mkmcc/watch-calibration | test-results/plot_styles.rb | Ruby | apache-2.0 | 19 | master | 8,712 | # plot_styles.rb: Set some default options and some global functions
# for use in my Tioga figures.
#
# Time-stamp: <2013-07-01 12:16:46 (mkmcc)>
require 'Tioga/FigureMaker'
module MyPlotStyles
include FigureConstants
# Default to the sans-serif font. TODO: make this compatible with
# the fontspec packag... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | fast_ignore.gemspec | Ruby | mit | 19 | main | 1,511 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fast_ignore/version'
Gem::Specification.new do |spec|
spec.name = 'fast_ignore'
spec.version = FastIgnore::VERSION
spec.authors = ['Dana Sherson']
spec.email = ['robot@dana.sh'... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | Rakefile | Ruby | mit | 19 | main | 474 | # frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'spellr/rake_task'
RuboCop::RakeTask.new
RSpec::Core::RakeTask.new(:spec)
Spellr::RakeTask.generate_task
default_tasks = if RUBY_PLATFORM == 'java'
[:spec, :build]
else
require 'leftovers/... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/fuzz_spec.rb | Ruby | mit | 19 | main | 1,164 | # frozen-string-literal: true
require_relative 'support/fuzz'
::RSpec.describe Fuzz do
next if ENV['COVERAGE']
around do |e|
original_verbose = $VERBOSE
$VERBOSE = false
within_temp_dir { e.run }
$VERBOSE = original_verbose
end
ENV.fetch('FUZZ_ITERATIONS', '100').to_i.times do |i|
it "ig... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/gitconfig_parser_spec.rb | Ruby | mit | 19 | main | 22,892 | # frozen_string_literal: true
RSpec.describe FastIgnore::GitconfigParser do
around { |e| within_temp_dir { e.run } }
it 'returns nil for empty file' do
create_file('', path: '.gitconfig')
expect(described_class.parse('.gitconfig')).to eq(nil)
end
it 'raises for invalid file' do
create_file('[', ... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/ignore_or_include_spec.rb | Ruby | mit | 19 | main | 41,640 | # frozen_string_literal: true
RSpec.describe FastIgnore do
around { |e| within_temp_dir { e.run } }
let(:root) { Dir.pwd }
shared_examples 'the gitignore documentation' do
describe 'A blank line matches no files, so it can serve as a separator for readability.' do
before { create_file_list 'foo', 'ba... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/fast_ignore_spec.rb | Ruby | mit | 19 | main | 26,701 | # frozen_string_literal: true
require 'pathname'
RSpec.describe FastIgnore do
it 'has a version number' do
expect(FastIgnore::VERSION).not_to be nil
end
describe '.new' do
subject { described_class.new(relative: true, **args) }
let(:args) { {} }
around { |e| within_temp_dir { e.run } }
i... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/spec_helper.rb | Ruby | mit | 19 | main | 1,155 | # frozen_string_literal: true
if RUBY_PLATFORM != 'java'
module Warning # leftovers:allow
def warn(msg) # leftovers:allow
raise msg unless msg.include?('FastIgnore deprecation:')
end
end
end
$doing_include = false
require 'fileutils'
FileUtils.rm_rf(File.join(__dir__, '..', 'coverage'))
require 'b... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/gitignore_spec.rb | Ruby | mit | 19 | main | 2,523 | # frozen_string_literal: true
RSpec.describe FastIgnore do
around { |e| within_temp_dir { e.run } }
let(:root) { Dir.pwd }
shared_examples 'gitignore: true' do
describe 'Patterns read from a .gitignore file in the same directory as the path, or in any parent directory' do
# (up to the toplevel of the... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/global_gitgnore_spec.rb | Ruby | mit | 19 | main | 8,531 | # frozen_string_literal: true
RSpec.describe FastIgnore::GlobalGitignore do
subject { described_class.path(root: root) }
let(:default_ignore_path) { "#{home}/.config/git/ignore" }
let(:home) { ENV['HOME'] }
let(:root) { Dir.pwd }
let(:config_content) { "[core]\n\texcludesfile = #{excludesfile_value}\n" }
... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/support/temp_dir_helper.rb | Ruby | mit | 19 | main | 1,037 | # frozen_string_literal: true
require 'pathname'
require 'tmpdir'
module TempDirHelper
module WithinTempDir
def create_file(*lines, path:)
path = Pathname.pwd.join(path)
path.parent.mkpath
if lines.empty?
path.write('')
else
path.write(lines.join("\n"))
end
pa... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/support/fuzz.rb | Ruby | mit | 19 | main | 783 | # frozen_string_literal: true
module Fuzz
class << self
def determine(iteration)
srand ::RSpec.configuration.seed + iteration
end
def gitignore(iteration)
determine(iteration)
build_entry + maybe_newline
end
private
def maybe_newline
coinflip ? "\n" : ''
end
... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/support/stub_global_gitignore_helper.rb | Ruby | mit | 19 | main | 642 | # frozen_string_literal: true
module StubGlobalGitignoreHelper
def stub_blank_global_config # rubocop:disable Metrics/MethodLength
stub_env(
XDG_CONFIG_HOME: nil,
GIT_CONFIG_GLOBAL: nil,
GIT_CONFIG_SYSTEM: nil,
GIT_CONFIG_NOSYSTEM: nil
)
stub_file(nil, path: "#{Dir.pwd}/.git/conf... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/support/stub_file_helper.rb | Ruby | mit | 19 | main | 852 | # frozen_string_literal: true
module StubFileHelper
def stub_file_original
@stub_file_original ||= begin
stub_file_attributes.each_key do |method|
allow(::File).to receive(method).at_least(:once).and_call_original
end
end
end
def stub_file(*lines, path:)
stub_file_original
s... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/support/matchers.rb | Ruby | mit | 19 | main | 1,299 | # frozen_string_literal: true
RSpec::Matchers.define(:match_files) do |*expected|
match do |actual|
@actual = actual.to_a
if defined?($doing_include) && $doing_include
expect(@actual).to allow_files(*expected)
else
expect(@actual).not_to allow_files(*expected)
end
true
end
matc... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | spec/support/stub_env_helper.rb | Ruby | mit | 19 | main | 438 | # frozen_string_literal: true
module StubENVHelper
def stub_env_original
@stub_env_original ||= begin
allow(::ENV).to receive(:[]).at_least(:once).and_call_original
end
end
def stub_env(**values)
stub_env_original
values.each do |key, value|
allow(::ENV).to receive(:[]).with(key.to_s... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore.rb | Ruby | mit | 19 | main | 2,729 | # frozen_string_literal: true
require 'set'
require 'strscan'
class FastIgnore
class Error < StandardError; end
require_relative 'fast_ignore/rule_groups'
require_relative 'fast_ignore/global_gitignore'
require_relative 'fast_ignore/gitignore_rule_builder'
require_relative 'fast_ignore/gitignore_include_ru... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/global_gitignore.rb | Ruby | mit | 19 | main | 2,224 | # frozen_string_literal: true
class FastIgnore
module GlobalGitignore
class << self
def path(root:)
ignore_path = gitconfigs_gitignore_path(root) ||
default_global_gitignore_path
ignore_path unless ignore_path.empty?
end
private
def gitconfigs_gitignore_path(r... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/relative_candidate.rb | Ruby | mit | 19 | main | 368 | # frozen-string-literal: true
class FastIgnore
class RelativeCandidate
attr_reader :relative_path
def initialize(relative_path, root_candidate)
@relative_path = relative_path
@root_candidate = root_candidate
end
def filename
@root_candidate.filename
end
def first_line
... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/path_regexp_builder.rb | Ruby | mit | 19 | main | 2,299 | # frozen_string_literal: true
class FastIgnore
class PathRegexpBuilder
def initialize
@string = +''
end
def to_regexp
# Regexp::IGNORECASE = 1
::Regexp.new(@string, 1)
end
# String methods
def dup
out = super
@string = @string.dup
out
end
def ... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/gitconfig_parser.rb | Ruby | mit | 19 | main | 6,233 | # frozen_string_literal: true
require 'strscan'
class FastIgnore
class GitconfigParseError < FastIgnore::Error; end
class GitconfigParser # rubocop:disable Metrics/ClassLength
def self.parse(file, root: Dir.pwd, nesting: 1)
new(file, root: root, nesting: nesting).parse
end
def initialize(path, ... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/path_expander.rb | Ruby | mit | 19 | main | 230 | # frozen_string_literal: true
class FastIgnore
module PathExpander
def self.expand_path(path, dir)
::File.expand_path(path, dir)
rescue ::ArgumentError
::File.expand_path("./#{path}", dir)
end
end
end |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/gitignore_include_rule_builder.rb | Ruby | mit | 19 | main | 1,737 | # frozen_string_literal: true
class FastIgnore
class GitignoreIncludeRuleBuilder < GitignoreRuleBuilder
def initialize(rule, expand_path_with: nil)
super
@negation = true
end
def negated!
@negation = false
end
def unmatchable_rule!
throw :abort_build, ::FastIgnore::Matc... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/gitignore_rule_builder.rb | Ruby | mit | 19 | main | 4,950 | # frozen_string_literal: true
class FastIgnore
class GitignoreRuleBuilder # rubocop:disable Metrics/ClassLength
def initialize(rule, expand_path_with: nil)
@re = ::FastIgnore::PathRegexpBuilder.new
@s = ::FastIgnore::GitignoreRuleScanner.new(rule)
@expand_path_with = expand_path_with
@ne... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/rule_group.rb | Ruby | mit | 19 | main | 949 | # frozen_string_literal: true
class FastIgnore
class RuleGroup
def initialize(patterns, allow)
@matchers = Array(patterns).flat_map { |x| x.build_matchers(allow: allow) }.compact
@allow = allow
@allowed_recursive = { ::FastIgnore::Candidate.root.key => true }.compare_by_identity
end
de... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/gitignore_rule_scanner.rb | Ruby | mit | 19 | main | 1,468 | # frozen_string_literal: true
class FastIgnore
class GitignoreRuleScanner < StringScanner
def character_class_end?
skip(/\]/)
end
def character_class_start?
skip(/\[/)
end
def character_class_negation?
skip(/\^|!/)
end
def end?
skip(/\s*\z/)
end
def sla... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/rule_groups.rb | Ruby | mit | 19 | main | 1,778 | # frozen_string_literal: true
class FastIgnore
class RuleGroups
def initialize( # rubocop:disable Metrics/ParameterLists, Metrics/AbcSize, Metrics/MethodLength
root:,
ignore_rules: nil,
ignore_files: nil,
gitignore: true,
include_rules: nil,
include_files: nil,
argv_rule... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/patterns.rb | Ruby | mit | 19 | main | 1,128 | # frozen-string-literal: true
class FastIgnore
class Patterns
def initialize(*patterns, from_file: nil, format: :gitignore, root: nil)
if from_file
@root = root || ::File.dirname(from_file)
@patterns = ::File.exist?(from_file) ? ::File.readlines(from_file) : []
else
@root = ro... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/gitignore_rule_group.rb | Ruby | mit | 19 | main | 976 | # frozen-string-literal: true
require 'set'
class FastIgnore
class GitignoreRuleGroup < ::FastIgnore::RuleGroup
def initialize(root)
@root = root
@loaded_paths = Set[root]
super([
::FastIgnore::Patterns.new('.git', root: '/'),
::FastIgnore::Patterns.new(from_file: ::FastIgnore... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/candidate.rb | Ruby | mit | 19 | main | 2,187 | # frozen-string-literal: true
class FastIgnore
class Candidate
class << self
def root
@root ||= new('/', nil, true, true, nil)
end
end
def initialize(full_path, filename, directory, exists, content)
@full_path = full_path
@filename = filename
(@directory = directory... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/walkers/gitignore_collecting_file_system.rb | Ruby | mit | 19 | main | 1,735 | # frozen-string-literal: true
class FastIgnore
module Walkers
class GitignoreCollectingFileSystem < Base
def allowed?(path, root: Dir.pwd, directory: nil, content: nil, exists: nil, include_directories: false) # rubocop:disable Metrics/ParameterLists
full_path = PathExpander.expand_path(path, root)... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/walkers/base.rb | Ruby | mit | 19 | main | 597 | # frozen-string-literal: true
class FastIgnore
module Walkers
class Base
def initialize(rule_groups, follow_symlinks:)
warn 'FastIgnore deprecation: follow_symlinks argument is deprecated' if follow_symlinks
@follow_symlinks = follow_symlinks
@rule_groups = rule_groups
end
... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/walkers/file_system.rb | Ruby | mit | 19 | main | 1,578 | # frozen-string-literal: true
class FastIgnore
module Walkers
class FileSystem < Base
def allowed?(path, root: Dir.pwd, directory: nil, content: nil, exists: nil, include_directories: false) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
full_path = PathExpander.expand_path(path, ro... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/builders/shebang_or_gitignore.rb | Ruby | mit | 19 | main | 404 | # frozen_string_literal: true
class FastIgnore
module Builders
module ShebangOrGitignore
def self.build(rule, allow, expand_path_with: nil)
if rule.delete_prefix!('#!:')
::FastIgnore::Builders::Shebang.build(rule, allow)
else
::FastIgnore::Builders::Gitignore.build(rule,... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/builders/shebang.rb | Ruby | mit | 19 | main | 487 | # frozen_string_literal: true
class FastIgnore
module Builders
module Shebang
def self.build(shebang, allow)
shebang.strip!
pattern = /\A#!.*\b#{::Regexp.escape(shebang)}\b/i
rule = ::FastIgnore::Matchers::ShebangRegexp.new(pattern, allow)
return rule unless allow
#... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/builders/gitignore.rb | Ruby | mit | 19 | main | 415 | # frozen_string_literal: true
class FastIgnore
module Builders
module Gitignore
def self.build(rule, allow, expand_path_with: nil)
if allow
::FastIgnore::GitignoreIncludeRuleBuilder.new(rule, expand_path_with: expand_path_with).build
else
::FastIgnore::GitignoreRuleBuild... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/matchers/unmatchable.rb | Ruby | mit | 19 | main | 430 | # frozen_string_literal: true
class FastIgnore
module Matchers
module Unmatchable
class << self
def dir_only?
false
end
def file_only?
false
end
def weight
0
end
# :nocov:
def inspect
'#<Unmatchable>'... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/matchers/within_dir.rb | Ruby | mit | 19 | main | 1,268 | # frozen_string_literal: true
class FastIgnore
module Matchers
class WithinDir
attr_reader :weight
def initialize(matchers, root)
@dir_matchers = squash_matchers(matchers.reject(&:file_only?))
@file_matchers = squash_matchers(matchers.reject(&:dir_only?))
@weight = @dir_matc... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/matchers/ignore_path_regexp.rb | Ruby | mit | 19 | main | 889 | # frozen_string_literal: true
class FastIgnore
module Matchers
class IgnorePathRegexp
attr_reader :dir_only
alias_method :dir_only?, :dir_only
undef :dir_only
attr_reader :squash_id
attr_reader :rule
def initialize(rule, anchored, dir_only)
@rule = rule
@dir_... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/matchers/shebang_regexp.rb | Ruby | mit | 19 | main | 893 | # frozen_string_literal: true
class FastIgnore
module Matchers
class ShebangRegexp
attr_reader :squash_id
attr_reader :rule
def initialize(rule, negation)
@rule = rule
@return_value = negation ? :allow : :ignore
@squash_id = negation ? :allow_shebang : :ignore_shebang
... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/matchers/allow_any_dir.rb | Ruby | mit | 19 | main | 540 | # frozen_string_literal: true
class FastIgnore
module Matchers
module AllowAnyDir
class << self
def squash_id
:allow_any_dir
end
def dir_only?
true
end
def file_only?
false
end
def squash(_)
self
end
... |
github | robotdana/fast_ignore | https://github.com/robotdana/fast_ignore | lib/fast_ignore/matchers/allow_path_regexp.rb | Ruby | mit | 19 | main | 895 | # frozen_string_literal: true
class FastIgnore
module Matchers
class AllowPathRegexp
attr_reader :dir_only
alias_method :dir_only?, :dir_only
undef :dir_only
attr_reader :squash_id
attr_reader :rule
def initialize(rule, squashable, dir_only)
@rule = rule
@dir... |
github | daveallie/where_is | https://github.com/daveallie/where_is | Rakefile | Ruby | mit | 19 | master | 216 | # frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)
RSpec::Core::RakeTask.new(:spec)
task default: %i[rubocop spec] |
github | daveallie/where_is | https://github.com/daveallie/where_is | where_is.gemspec | Ruby | mit | 19 | master | 1,227 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'where_is/version'
Gem::Specification.new do |spec|
spec.name = 'where_is'
spec.version = Where::VERSION
spec.authors = ['Dave Allie']
spec.email = ... |
github | daveallie/where_is | https://github.com/daveallie/where_is | spec/where_is_spec.rb | Ruby | mit | 19 | master | 7,508 | # frozen_string_literal: true
require 'spec_helper'
describe Where do
it 'has a version number' do
expect(Where::VERSION).not_to be nil
end
context 'with method defined in C' do
let(:split_location) do
{
file: 'String#split(*)',
line: nil,
path: 'String#split(*)'
}
... |
github | daveallie/where_is | https://github.com/daveallie/where_is | spec/spec_helper.rb | Ruby | mit | 19 | master | 645 | # frozen_string_literal: true
require 'where_is'
require 'tempfile'
def with_temp_file(contents)
contents = { name: 'source', content: contents } if contents.is_a?(String)
file = Tempfile.new([contents[:name], '.rb'])
begin
file.write(contents[:content])
file.close
yield file.path
ensure
file.... |
github | daveallie/where_is | https://github.com/daveallie/where_is | lib/where_is.rb | Ruby | mit | 19 | master | 2,045 | # frozen_string_literal: true
require 'where_is/extractors'
require 'where_is/version'
module Where
class << self
include Where::Extractors
def is(klass, method = nil)
are(klass, method)[0]
end
def are(klass, method = nil)
if method
begin
Where.are_instance_methods(kl... |
github | daveallie/where_is | https://github.com/daveallie/where_is | lib/where_is/extractors.rb | Ruby | mit | 19 | master | 2,113 | # frozen_string_literal: true
module Where
module Extractors
attr_accessor :ignore
private
def ensure_class(klass)
[Class, Module].include?(klass.class) ? klass : klass.class
end
def source_location(method)
source_location = method.source_location
source_location = [method.to... |
github | ghidorsi/install-party-parrots-slack | https://github.com/ghidorsi/install-party-parrots-slack | base.rb | Ruby | mit | 19 | master | 3,228 | require 'selenium-webdriver'
require 'io/console'
require 'io/console'
require 'ruby-progressbar'
app_dir = File.expand_path(File.dirname(__FILE__))
parrots_dir = app_dir + '/parrots/'
unless Dir.exists?(parrots_dir)
puts "First, lets download all the parrots!"
`wget -q https://cultofthepartyparrot.com/parrots-8... |
github | sue445/today_anime | https://github.com/sue445/today_anime | today_anime.rb | Ruby | mit | 19 | master | 2,741 | ENV["ENVIRONMENT"] ||= "development"
Bundler.require(*[:default, ENV["ENVIRONMENT"]].compact)
require "yaml"
raise "SLACK_WEBHOOK_URL is required" unless ENV["SLACK_WEBHOOK_URL"]
SLACK_WEBHOOK_URL = ENV["SLACK_WEBHOOK_URL"]
END_HOUR = 4
END_MINUTE = 0
Time.zone = "Tokyo"
class Syobocalite::Program
# Slackに投稿する... |
github | sue445/today_anime | https://github.com/sue445/today_anime | Gemfile | Ruby | mit | 19 | master | 286 | # frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "activesupport", require: "active_support/all"
gem "libxml-ruby"
gem "slack-notifier", ">= 2.4.0"
gem "syobocalite", ">= 1.2.0"
gem "uri", ">= 1.0.3" |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | Gemfile | Ruby | mit | 19 | main | 830 | source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby File.read('.ruby-version')
gem 'rails', '~> 8.1.2'
gem "aws-sdk-s3", require: false
gem 'bootsnap', require: false
gem 'bootstrap', '< 5'
gem 'coffee-rails'
gem 'hashid-rails'
gem 'jbuilder'
gem 'jquery-rails'
gem 'ka... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | db/schema.rb | Ruby | mit | 19 | main | 3,126 | # 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 | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | db/migrate/20180519223254_enable_uuid.rb | Ruby | mit | 19 | main | 217 | class EnableUuid < ActiveRecord::Migration[5.2]
def up
enable_extension 'uuid-ossp'
enable_extension 'pgcrypto'
end
def down
disable_extension 'uuid-ossp'
disable_extension 'pgcrypto'
end
end |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | db/migrate/20180520002943_create_rsvps.rb | Ruby | mit | 19 | main | 222 | class CreateRsvps < ActiveRecord::Migration[5.2]
def change
create_table :rsvps do |t|
t.references :event, foreign_key: true
t.string :name
t.string :response
t.timestamps
end
end
end |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | db/migrate/20180519223613_create_events.rb | Ruby | mit | 19 | main | 260 | class CreateEvents < ActiveRecord::Migration[5.2]
def change
create_table :events do |t|
t.string :title, null: false
t.date :date, null: false
t.text :body
t.string :admin_token, null: false
t.timestamps
end
end
end |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/presenters/admin/event_stats.rb | Ruby | mit | 19 | main | 2,506 | # frozen_string_literal: true
require "action_view"
require "action_view/helpers"
module Admin
class EventStats
include ActionView::Helpers::NumberHelper
DEFAULT_MONTHS_BACK = 6
attr_reader :events, :now, :months_back
# events: ActiveRecord::Relation or Array of Event objects
# months_back: I... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/models/rsvp.rb | Ruby | mit | 19 | main | 374 | class Rsvp < ApplicationRecord
include Hashid::Rails
RESPONSES = [
:yes,
:maybe,
:no
]
belongs_to :event
validates :name, presence: true
validates :response, presence: true
# Use this to avoid including new (unsaved) records
scope :persisted, -> { where.not(id: nil) }
def session_key
... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/models/event.rb | Ruby | mit | 19 | main | 324 | class Event < ApplicationRecord
include Hashid::Rails
has_many :rsvps
before_create :set_admin_token
validates :title, presence: true
validates :date, presence: true
def to_param
"#{hashid}-#{title.parameterize}"
end
private
def set_admin_token
self.admin_token = SecureRandom.uuid
end
... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/controllers/image_uploads_controller.rb | Ruby | mit | 19 | main | 488 | class ImageUploadsController < ApplicationController
def create
@image_upload = ImageUpload.new(image_upload_params)
respond_to do |format|
if @image_upload.save
format.json { render json: { url: url_for(@image_upload.image) }, status: :ok }
else
format.json { render json: @image_... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/controllers/events_controller.rb | Ruby | mit | 19 | main | 1,286 | class EventsController < ApplicationController
before_action :set_event, only: [:show]
before_action :set_placeholders, only: [:new]
def show
@rsvp = @event.rsvps.new
@rsvps = @event.rsvps.persisted.order(created_at: :asc)
@user_rsvp_hashids = session[@event.hashid] || []
@responded = @rsvps.any... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/controllers/rsvps_controller.rb | Ruby | mit | 19 | main | 1,017 | class RsvpsController < ApplicationController
before_action :set_event
def create
response = Rsvp::RESPONSES.find { |r| r == params[:commit].downcase.to_sym }
@rsvp = @event.rsvps.new(rsvp_params.merge(response: response))
if @rsvp.save
session[@event.hashid] ||= []
session[@event.hashid] ... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/controllers/events_admin_controller.rb | Ruby | mit | 19 | main | 1,143 | class EventsAdminController < ApplicationController
before_action :set_event
def show
@rsvps = @event.rsvps.persisted.order(created_at: :asc)
end
def edit
end
def update
if @event.update(event_params)
redirect_to event_admin_path(@event, @event.admin_token), notice: 'Your event was updated.... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/controllers/admin/events_controller.rb | Ruby | mit | 19 | main | 378 | module Admin
class EventsController < AdminController
def index
all_events = Event.all.includes(:rsvps).order(id: :desc).to_a
all_events.sort_by! { |event| -event.rsvps.size } if params[:sort] == "rsvps"
@event_stats = Admin::EventStats.new(all_events)
@events = Kaminari.paginate_array(al... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/controllers/admin/base_controller.rb | Ruby | mit | 19 | main | 404 | module Admin
class BaseController < ApplicationController
before_action :set_event
private
def set_event
hashid = hashid_from_param(params[:event_id])
id = Event.decode_id(hashid)
@event = Event.find_by!(id: id, admin_token: params[:admin_admin_token])
end
def hashid_from_par... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/controllers/admin/email_requests_controller.rb | Ruby | mit | 19 | main | 582 | module Admin
class EmailRequestsController < BaseController
def create
email_address = email_address_param
if email_address_param.blank?
redirect_to event_admin_path(@event, @event.admin_token), alert: "Please enter your email address"
else
UserMailer.admin_url_request_email(ema... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | app/controllers/admin/rsvps_controller.rb | Ruby | mit | 19 | main | 725 | module Admin
class RsvpsController < BaseController
before_action :set_rsvp
def update
if @rsvp.update(rsvp_params)
redirect_to event_admin_path(@event, @event.admin_token), notice: 'The RSVP was updated.'
else
redirect_to event_admin_path(@event, @event.admin_token), alert: "The ... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | config/application.rb | Ruby | mit | 19 | main | 1,874 | require_relative 'boot'
# require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable/engine"
# require "action_... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | config/routes.rb | Ruby | mit | 19 | main | 618 | Rails.application.routes.draw do
resources :events, path: '/', only: [:new, :create, :show] do
resources :admin,
controller: :events_admin,
param: :admin_token,
only: [:show, :edit, :update, :destroy] do
post :toggle_publish, on: :member
scope module: 'admin' do
resources :... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | config/initializers/web_app_manifest.rb | Ruby | mit | 19 | main | 542 | # This file was generated by rails_favicon_generator, from
# https://realfavicongenerator.net/
# It makes files with .webmanifest extension first class files in the asset
# pipeline. This is to preserve this extension, as is it referenced in a call
# to asset_path in the _favicon.html.erb partial.
Rails.application.c... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | config/initializers/rollbar.rb | Ruby | mit | 19 | main | 3,014 | Rollbar.configure do |config|
# Without configuration, Rollbar is enabled in all environments.
# To disable in specific environments, set config.enabled=false.
config.access_token = ENV['ROLLBAR_ACCESS_TOKEN']
# Here we'll disable in 'test':
if Rails.env.test?
config.enabled = false
end
# By defaul... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | config/initializers/simple_form_bootstrap.rb | Ruby | mit | 19 | main | 21,032 | # frozen_string_literal: true
# Please do not make direct changes to this file!
# This generator is maintained by the community around simple_form-bootstrap:
# https://github.com/rafaelfranca/simple_form-bootstrap
# All future development, tests, and organization should happen there.
# Background history: https://gith... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | config/initializers/simple_form.rb | Ruby | mit | 19 | main | 7,135 | # frozen_string_literal: true
#
# Uncomment this and change the path if necessary to include your own
# components.
# See https://github.com/plataformatec/simple_form#custom-components to know
# more about custom components.
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
#
# Use this setup bloc... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | config/environments/development.rb | Ruby | mit | 19 | main | 2,438 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Make code changes take effect immediately without server restart.
config.enable_reloading = true
# Do not eager load code on boot.
config.eager... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | config/environments/production.rb | Ruby | mit | 19 | main | 3,662 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot for better performance and memory savings (ignor... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | spec/rails_helper.rb | Ruby | mit | 19 | main | 2,803 | # This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rail... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | spec/features/admin_dashboard_spec.rb | Ruby | mit | 19 | main | 1,821 | require 'rails_helper'
describe 'admin dashboard stats', type: :feature do
before do
# Create events in different years and months
Event.create!(title: "Old Event", date: Date.new(2021, 5, 10), created_at: Date.new(2021, 5, 10))
Event.create!(title: "Mid Event", date: Date.new(2022, 7, 15), created_at: D... |
github | KevinBongart/easy-rsvp | https://github.com/KevinBongart/easy-rsvp | spec/features/event_spec.rb | Ruby | mit | 19 | main | 2,162 | require 'rails_helper'
describe 'event creation' do
it 'works' do
visit '/'
fill_in 'What are you planning?', with: "Batman's surprise birthday"
select Date.today.year, from: 'event_date_1i'
select 'April', from: 'event_date_2i'
select '7', from: 'event_date_3i'
click_button 'Create your e... |
github | partydrone/connect-sdk-ruby | https://github.com/partydrone/connect-sdk-ruby | op_connect.gemspec | Ruby | mit | 20 | main | 1,341 | # frozen_string_literal: true
require_relative "lib/op_connect/version"
Gem::Specification.new do |spec|
spec.name = "op_connect"
spec.version = OpConnect::VERSION
spec.authors = ["Andrew Porter"]
spec.email = ["partydrone@icloud.com"]
spec.summary = "A Ruby SDK for the 1Password Connect API."
spec.descr... |
github | partydrone/connect-sdk-ruby | https://github.com/partydrone/connect-sdk-ruby | Gemfile | Ruby | mit | 20 | main | 370 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in op_connect.gemspec
gemspec
gem "rake", "~> 13.0"
gem "minitest", "~> 5.0"
gem "minitest-reporters"
gem "guard"
gem "guard-minitest"
gem "pry"
gem "standard"
gem "simplecov", require: false
gem "simplecov-lcov", require: ... |
github | partydrone/connect-sdk-ruby | https://github.com/partydrone/connect-sdk-ruby | Guardfile | Ruby | mit | 20 | main | 840 | # A sample Guardfile
# More info at https://github.com/guard/guard#readme
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
## Note: if you are using the `directo... |
github | partydrone/connect-sdk-ruby | https://github.com/partydrone/connect-sdk-ruby | test/test_helper.rb | Ruby | mit | 20 | main | 839 | # frozen_string_literal: true
require "simplecov"
require "simplecov-lcov"
require "simplecov-tailwindcss"
SimpleCov.start do
add_filter "/test/"
coverage_dir "test/coverage"
formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::LcovFormatter,
SimpleCov::Formatter::TailwindFormatte... |
github | partydrone/connect-sdk-ruby | https://github.com/partydrone/connect-sdk-ruby | test/op_connect_test.rb | Ruby | mit | 20 | main | 1,087 | # frozen_string_literal: true
require "test_helper"
describe OpConnect do
subject { OpConnect }
before do
subject.setup
end
it "has a version number" do
_(::OpConnect::VERSION).wont_be_nil
end
it "sets defaults" do
OpConnect::Configurable.keys.each do |key|
default = OpConnect::Defaul... |
github | partydrone/connect-sdk-ruby | https://github.com/partydrone/connect-sdk-ruby | test/op_connect/object_test.rb | Ruby | mit | 20 | main | 568 | require "test_helper"
describe OpConnect::Object do
subject { OpConnect::Object }
it "creates an object from a hash" do
_(subject.new(foo: "bar").foo).must_equal "bar"
end
it "handles nested hashes" do
_(subject.new(foo: {bar: {baz: "foobar"}}).foo.bar.baz).must_equal "foobar"
end
it "handles nu... |
github | partydrone/connect-sdk-ruby | https://github.com/partydrone/connect-sdk-ruby | test/op_connect/client_test.rb | Ruby | mit | 20 | main | 5,675 | require "test_helper"
describe OpConnect::Client do
subject { OpConnect::Client }
before do
OpConnect.reset!
end
after do
OpConnect.reset!
end
describe "module configuration" do
before do
OpConnect.reset!
OpConnect.configure do |config|
OpConnect::Configurable.keys.each d... |
github | partydrone/connect-sdk-ruby | https://github.com/partydrone/connect-sdk-ruby | test/op_connect/client/vaults_test.rb | Ruby | mit | 20 | main | 839 | require "test_helper"
describe OpConnect::Client::Vaults do
let(:stubs) { Faraday::Adapter::Test::Stubs.new }
let(:client) { OpConnect::Client.new(access_token: "fake", adapter: :test, stubs: stubs) }
describe "list_vaults" do
it "returns a list of vaults" do
stubs.get("/v1/vaults") { [200, {"Content-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.