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
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
Rakefile
Ruby
mit
19
master
526
require 'rubygems' require 'bundler/gem_tasks' def run(*args) raise "tests failed" unless system *args end require 'coveralls/rake/task' Coveralls::RakeTask.new task :default do run "rspec", "spec" Rake::Task['coveralls:push'].invoke end begin require "rdoc/task" rescue LoadError require 'rake/rdoctask' e...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
spec/spec_helper.rb
Ruby
mit
19
master
1,736
require 'coveralls' Coveralls.wear_merged! # Having ./support in the load path means Rails will load the generators at # ./support/generators/**/*_generator.rb and # ./support/rails/generators/**/*_generator.rb $LOAD_PATH.push File.join(File.dirname(__FILE__), "support") require 'bundler' Bundler.setup if ENV['RAILS...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
spec/generators/question_spec.rb
Ruby
mit
19
master
1,133
require 'spec_helper' shared_examples_for 'the question generator' do context "without input" do it "should raise an error" do expect(proc { expect(subject).to output("Are you a GOD?") }).to raise_error end end with_input "yes" do it "should act upon something" do expect(subject)...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
spec/generators/test_rails3_spec.rb
Ruby
mit
19
master
3,903
require 'spec_helper' describe :test_rails3 do within_source_root do FileUtils.touch "Gemfile" end it "should modify Gemfile" do out = "" expect(subject).to generate { expect(File.read("Gemfile").strip).not_to be_empty out.concat File.read("Gemfile") } expect(out.strip).to matc...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
spec/generators/migration_spec.rb
Ruby
mit
19
master
317
require 'spec_helper' if GenSpec.rails? describe :my_migration do it "should run migration template" do # bug, raising NameError: undefined local variable or method `interceptor' expect(proc { expect(subject).to generate(:migration_template, "1", "2") }).not_to raise_error end end end
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
spec/lib/genspec_spec.rb
Ruby
mit
19
master
503
require 'spec_helper' describe GenSpec do include GenSpec::GeneratorExampleGroup generator :test_rails3 with_args "one", "two" describe "with a custom root" do before { GenSpec.root = File.expand_path("../../tmp", File.dirname(__FILE__)) } after { GenSpec.root = nil } it "should generate fil...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
spec/support/generators/my_migration/my_migration_generator.rb
Ruby
mit
19
master
246
require 'rails/generators/active_record' class MyMigrationGenerator < ActiveRecord::Generators::Base def initialize(args, *options) super(["unused"]+args, *options) end def generate_migration migration_template "1", "2" end end
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
spec/support/generators/question/question_generator.rb
Ruby
mit
19
master
371
base = GenSpec.rails? ? Rails::Generators::Base : Thor::Group class Question < base include Thor::Actions include CustomActions def do_acting act_upon "something" end def ask_question yn = ask "Are you a GOD?" case yn.downcase[0] when ?y then say "Oh, uh... Good." else say "You'...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
spec/support/generators/test_rails3/test_rails3_generator.rb
Ruby
mit
19
master
757
base = GenSpec.rails? ? Rails::Generators::Base : Thor::Group class TestRails3 < base include Thor::Actions def self.source_root File.expand_path('../templates', __FILE__) end argument :argument1, :type => :string, :default => "default_file" argument :template_name, :type => :string, :default => "fi...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec.rb
Ruby
mit
19
master
1,544
require 'thor' if defined?(Rails) && defined?(Rails::VERSION) if Rails::VERSION::MAJOR == 2 raise "Use genspec 0.1.x for Rails 2; this version is for Rails 3." elsif [3, 4, 5].include? Rails::VERSION::MAJOR require 'rails/generators' else raise "Unsupported Rails version: #{Rails::VERSION::STRING}" ...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec/shell.rb
Ruby
mit
19
master
1,170
require 'thor/shell/basic' module GenSpec # Just like a Thor::Shell::Basic except that input and output are both redirected to # the specified streams. By default, these are initialized to instances of StringIO. class Shell < Thor::Shell::Basic attr_accessor :stdin, :stdout, :stderr alias_method :input, ...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec/version.rb
Ruby
mit
19
master
227
module GenSpec class Version MAJOR = 0 MINOR = 3 PATCH = 2 RELEASE = nil STRING = (RELEASE ? [MAJOR, MINOR, PATCH, RELEASE] : [MAJOR, MINOR, PATCH]).join('.') end VERSION = Version::STRING end
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec/matchers.rb
Ruby
mit
19
master
2,783
require 'genspec/matchers/base' require 'genspec/matchers/result_matcher' require 'genspec/matchers/generation_method_matcher' require 'genspec/matchers/output_matcher' module GenSpec module Matchers # Valid types: :dependency, :class_collisions, :file, :template, :complex_template, :directory, :readme, # :m...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec/generator_example_group.rb
Ruby
mit
19
master
7,737
module GenSpec module GeneratorExampleGroup include RSpec::Matchers include GenSpec::Matchers def self.included(base) base.send(:extend, GenSpec::GeneratorExampleGroup::ClassMethods) base.send(:subject) { generator_descriptor } end def within_source_root(&block) generator_i...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec/matchers/output_matcher.rb
Ruby
mit
19
master
825
module GenSpec module Matchers class OutputMatcher < GenSpec::Matchers::Base def output shell.output.string end def initialize(text_or_regexp) regexp = if text_or_regexp.kind_of?(Regexp) text_or_regexp else Regexp.comp...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec/matchers/generation_method_matcher.rb
Ruby
mit
19
master
4,822
class GenSpec::Matchers::GenerationMethodMatcher < GenSpec::Matchers::Base # The modules whose public instance methods will be converted into GenSpec matchers. # See #generation_methods for details. # # By default, this includes all of the following: # # * +Thor::Actions+ # * +Rails::Generators::Actions+ ...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec/matchers/base.rb
Ruby
mit
19
master
4,342
module GenSpec module Matchers class Base attr_reader :block, :generator, :args, :init_blocks attr_reader :destination_root attr_accessor :error def source_root generator.source_root end def initialize(&block) @block = block if block_given? ...
github
sinisterchipmunk/genspec
https://github.com/sinisterchipmunk/genspec
lib/genspec/matchers/result_matcher.rb
Ruby
mit
19
master
863
module GenSpec module Matchers class ResultMatcher < GenSpec::Matchers::Base attr_reader :filename def initialize(filename, &block) @filename = filename super(&block) end def generated if filename path = File.join(destination_root, filename) ...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
code_metrics.gemspec
Ruby
mit
19
master
1,139
$:.push File.expand_path("../lib", __FILE__) require "code_metrics/version" Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = "code_metrics" s.version = CodeMetrics::VERSION s.authors = ["David Heinemeier Hansson", "Benjamin Fleischer"] s.email = ["david@loudt...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
Rakefile
Ruby
mit
19
master
785
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end begin require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'CodeMetrics' rdoc.options << '--line-numbers' rdoc.rdoc_files.includ...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
lib/code_metrics/profiler.rb
Ruby
mit
19
master
2,799
module CodeMetrics class Profiler Error = Class.new(StandardError) attr_reader :path, :mode def initialize(path, mode=nil) assert_ruby_file_exists(path) @path, @mode = path, mode Gem.refresh # H/T https://github.com/pry/pry/blob/b02d0a4863/lib/pry/plugins.rb#L72 Gem::Specif...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
lib/code_metrics/statistics_calculator.rb
Ruby
mit
19
master
2,326
module CodeMetrics class StatisticsCalculator #:nodoc: attr_reader :lines, :code_lines, :classes, :methods PATTERNS = { rb: { line_comment: /^\s*#/, begin_block_comment: /^=begin/, end_block_comment: /^=end/, class: /^\s*class\s+[_A-Z]/, method: /^\s*def\s+[_a-z]...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
lib/code_metrics/statistics.rb
Ruby
mit
19
master
2,801
require 'code_metrics/statistics_calculator' require 'code_metrics/stats_directories' module CodeMetrics class Statistics TEST_TYPES = [] def initialize(*pairs) @pairs = pairs @statistics = calculate_statistics @total = calculate_total if pairs.length > 1 end def to_s ...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
lib/code_metrics/stats_directories.rb
Ruby
mit
19
master
4,085
# Try to get the root of the current project require 'pathname' module CodeMetrics class StatsDirectories StatDirectory = Struct.new(:description, :path) do def to_a [description, path] end def inspect to_a.inspect end def directory? File.directory?(path) ...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
lib/code_metrics/line_statistics.rb
Ruby
mit
19
master
953
module CodeMetrics class LineStatistics # @param files [Array, FileList, Enumerable] # e.g. FileList["lib/active_record/**/*.rb"] def initialize(files) @files = Array(files).compact end # Calculates LOC for each file # Outputs each file and a total LOC def print_loc lines, co...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
lib/tasks/statistics.rake
Ruby
mit
19
master
906
begin require 'rake' namespace :code_metrics do desc "Report code statistics (KLOCs, etc) from the application" task :stats do require 'code_metrics/statistics' STATS_DIRECTORIES = CodeMetrics::StatsDirectories.new.directories CodeMetrics::Statistics.new(*STATS_DIRECTORIES).to_s end ...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
test/statistics_calculator_test.rb
Ruby
mit
19
master
6,711
require 'test_helper' require 'code_metrics/statistics_calculator' class StatisticsCalculatorTest < ActiveSupport::TestCase def setup @code_metrics_calculator = CodeMetrics::StatisticsCalculator.new end test 'add statistics to another using #add' do code_metrics_calculator_1 = CodeMetrics::StatisticsCal...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
test/rake_test.rb
Ruby
mit
19
master
653
# coding:utf-8 require 'test_helper' require 'code_metrics/railtie' module CodeMetrics class RakeTest < ActiveSupport::TestCase def test_code_metrics_sanity assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0", Dir.chdir(app_path){ `rake code_metrics:stats` } end def t...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
test/dummy/config/application.rb
Ruby
mit
19
master
1,182
require File.expand_path('../boot', __FILE__) # require 'rails/all' # require "action_controller/railtie" # require "action_mailer/railtie" # require "active_model/railtie" # require "sprockets/railtie" require 'rails/railtie' require "rails/test_unit/railtie" Bundler.setup require "code_metrics" module Dummy clas...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
test/dummy/config/environments/development.rb
Ruby
mit
19
master
453
Dummy::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 ser...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
test/dummy/config/environments/test.rb
Ruby
mit
19
master
767
Dummy::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 sui...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
test/dummy/config/environments/production.rb
Ruby
mit
19
master
1,828
Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both thread web server...
github
bf4/code_metrics
https://github.com/bf4/code_metrics
test/dummy/config/initializers/secret_token.rb
Ruby
mit
19
master
659
# Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to diction...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
Rakefile
Ruby
mit
19
master
1,715
# encoding: utf-8 #!/usr/bin/env rake require "bundler/gem_tasks" require 'rake' require 'rspec/core' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| spec.pattern = FileList['spec/**/*_spec.rb'] end require 'reek/rake/task' Reek::Rake::Task.new do |t| t.fail_on_error = true t.verbose =...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
rusen.gemspec
Ruby
mit
19
master
1,503
# -*- encoding: utf-8 -*- require File.expand_path('../lib/rusen/version', __FILE__) Gem::Specification.new do |s| s.name = 'rusen' s.version = Rusen::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Adrian Gomez', 'Pablo Ifran'] s.summary = 'RUby Simple Except...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
spec/spec_helper.rb
Ruby
mit
19
master
372
require 'rspec' require 'shoulda' # For code coverage, must be required before all application / gem / library code. if RUBY_VERSION >= '1.9.2' require 'simplecov' require 'coveralls' SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::F...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
spec/lib/rusen_spec.rb
Ruby
mit
19
master
1,208
require 'spec_helper' require 'rusen' describe Rusen do describe '.settings' do it 'returns the global settings' do Rusen.settings.should be_instance_of(Rusen::Settings) end end describe '.notify' do let(:exception) { double(:exception) } let(:request) { double(:request) } let(:en...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
spec/lib/rusen/notifier_spec.rb
Ruby
mit
19
master
1,725
require 'spec_helper' require 'rusen/notifier' require 'rusen/settings' require 'rusen/notification' module Rusen module Notifiers class DummyNotifier def self.identification_symbol :dummy end def initialize(settings) end def notify(notification) end end e...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
spec/lib/rusen/settings_spec.rb
Ruby
mit
19
master
365
require 'spec_helper' require 'rusen/notifier' require 'rusen/settings' require 'rusen/notification' describe Rusen::Settings do describe '.initialize' do it 'initialize the attributes correctly if exists' do output = [:email] settings = Rusen::Settings.new({outputs: output}) expect(setting...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
spec/lib/rusen/notifiers/mail_notifier_spec.rb
Ruby
mit
19
master
1,493
require 'spec_helper' require 'rusen' require 'rusen/notifiers/mail_notifier' describe Rusen::Notifiers::MailNotifier do before(:all) do Mail.defaults do delivery_method :test end end describe '.identification_symbol' do it 'returns :mail' do Rusen::Notifiers::MailNotifier.identificat...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
spec/lib/rusen/notifiers/pony_notifier_spec.rb
Ruby
mit
19
master
1,081
require 'spec_helper' require 'rusen' require 'rusen/notifiers/pony_notifier' describe Rusen::Notifiers::PonyNotifier do describe '.identification_symbol' do it 'returns :pony' do Rusen::Notifiers::PonyNotifier.identification_symbol.should eq(:pony) end end let(:settings) { Rusen::Settings.new...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
spec/lib/rusen/notifiers/log4r_notifier_spec.rb
Ruby
mit
19
master
1,764
require 'spec_helper' require 'log4r' require 'log4r/yamlconfigurator' require 'rusen' require 'rusen/notifiers/log4r_notifier' describe Rusen::Notifiers::Log4rNotifier do describe '.identification_symbol' do it 'returns :log4r' do Rusen::Notifiers::Log4rNotifier.identification_symbol.should eq(:log4r)...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
spec/lib/rusen/notifiers/io_notifier_spec.rb
Ruby
mit
19
master
4,624
require 'spec_helper' require 'stringio' require 'rusen' require 'rusen/notifiers/io_notifier' describe Rusen::Notifiers::IONotifier do describe '.identification_symbol' do it 'returns :io' do Rusen::Notifiers::IONotifier.identification_symbol.should eq(:io) end end let(:settings) { Rusen::Se...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen.rb
Ruby
mit
19
master
795
require 'rusen/version' require 'rusen/settings' require 'rusen/notifier' # Rusen is a util to help you with the tracking on the # application exceptions, this could be used on any # ruby project. The exceptions can be sent to different # outputs depending on your apps requirements. module Rusen @settings = S...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/notifiers.rb
Ruby
mit
19
master
768
module Rusen module Notifiers NOTIFIERS = { :pony => :PonyNotifier, :mail => :MailNotifier, :io => :IONotifier, :log4r => :Log4rNotifier, } class << self def load_klass(ident, klass_sym = nil) klass_sym ||= NOTIFIERS[ident] if klass_sym requi...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/notifier.rb
Ruby
mit
19
master
1,629
require 'rusen/notifiers' require 'rusen/notification' module Rusen class Notifier def initialize(settings) @settings = settings @notifiers = [] @settings.outputs.each do |ident| ident = Notifiers.check_deprecation(ident) # For notifiers bundled in this gem klass = No...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/notification.rb
Ruby
mit
19
master
520
module Rusen # Class for holding all the information that can be sent in a notification. class Notification attr_reader :exception, :request, :environment, :session def initialize(exception, request = {} , environment = {}, session = {}) @exception = exception @request = request @...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/settings.rb
Ruby
mit
19
master
3,057
module Rusen class Settings attr_writer :outputs attr_writer :email_prefix attr_writer :email_via attr_writer :sender_address attr_writer :exception_recipients attr_writer :sections attr_writer :smtp_settings attr_writer :exclude_if attr_writer :filter_parameters attr_acces...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/sidekiq.rb
Ruby
mit
19
master
448
require 'rusen' require 'sidekiq' Rusen.settings.outputs = [:mail] Rusen.settings.sections = [:backtrace] if Sidekiq::VERSION < '3' require_relative 'middleware/rusen_sidekiq' Sidekiq.configure_server do |config| config.server_middleware do |chain| chain.add Rusen::Middleware::RusenSidekiq end en...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/middleware/rusen_rack.rb
Ruby
mit
19
master
892
require 'rusen/settings' require 'rusen/notifier' require 'rusen/notification' module Rusen module Middleware class RusenRack def initialize(app, settings = {}) @app = app if settings.is_a?(::Rusen::Settings) @settings = settings elsif settings.is_a?(Hash) @se...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/middleware/rusen_sidekiq.rb
Ruby
mit
19
master
766
require 'rusen' require 'sidekiq' module Rusen module Middleware # Intersect exceptions that happens on inside # sidekiq workers. If an exception occurred # on a worker Rusen will notify about that # exception and will raised up. class RusenSidekiq include Sidekiq::Util # Just...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/notifiers/base_notifier.rb
Ruby
mit
19
master
2,582
require 'erb' require_relative '../utils/parameter_filter' module Rusen module Notifiers # This class define all the base behaviour of all notifiers, # for creating new notifiers this class should be # extended. class BaseNotifier class << self # Symbol that represent the notifie...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/notifiers/mail_notifier.rb
Ruby
mit
19
master
2,029
require_relative 'base_notifier' begin require 'mail' rescue LoadError puts <<-MESSAGE [Rusen Error] To use Mail notifier add this to your Gemfile: gem 'mail' MESSAGE raise end module Rusen module Notifiers class MailNotifier < BaseNotifier def self.identification_symbol :mail ...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/notifiers/pony_notifier.rb
Ruby
mit
19
master
1,495
require_relative 'base_notifier' begin require 'pony' rescue LoadError puts <<-MESSAGE [Rusen Error] To use Pony notifier add this to your Gemfile: gem 'pony' MESSAGE raise end module Rusen module Notifiers class PonyNotifier < BaseNotifier def self.identification_symbol :pony ...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/notifiers/log4r_notifier.rb
Ruby
mit
19
master
1,555
require_relative 'base_notifier' begin require 'log4r' require 'log4r/yamlconfigurator' rescue LoadError puts <<-MESSAGE [Rusen Error] To use log4r notifier add this to your Gemfile: gem 'log4r' MESSAGE raise end module Rusen module Notifiers class Log4rNotifier < BaseNotifier def self.i...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/notifiers/io_notifier.rb
Ruby
mit
19
master
909
require_relative 'base_notifier' module Rusen module Notifiers class IONotifier < BaseNotifier STDOUT = $stdout def self.identification_symbol :io end def initialize(settings, output = STDOUT) super(settings) @output = output end def notify(notif...
github
thisisqubika/rusen
https://github.com/thisisqubika/rusen
lib/rusen/utils/parameter_filter.rb
Ruby
mit
19
master
1,504
class ParameterFilter FILTERED = '[FILTERED]'.freeze # :nodoc: def initialize(filters = []) @filters = filters end def filter(params) compiled_filter.call(params) end private def compiled_filter @compiled_filter ||= CompiledFilter.compile(@filters) end class CompiledFilter # :nodoc: ...
github
khell/homebrew-srm
https://github.com/khell/homebrew-srm
Formula/srm.rb
Ruby
bsd-2-clause
19
master
1,004
class Srm < Formula desc "Command-line program to delete files securely" homepage "https://srm.sourceforge.io/" url "https://downloads.sourceforge.net/project/srm/1.2.15/srm-1.2.15.tar.gz" sha256 "7583c1120e911e292f22b4a1d949b32c23518038afd966d527dae87c61565283" bottle do sha256 cellar: :any_skip_relocat...
github
sausheong/ruby-gpio
https://github.com/sausheong/ruby-gpio
gpio.gemspec
Ruby
mit
19
master
1,105
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'gpio/version' Gem::Specification.new do |spec| spec.name = "ruby-gpio" spec.version = Gpio::VERSION spec.authors = ["Chang Sau Sheong"] spec.email = ["sausheo...
github
sausheong/ruby-gpio
https://github.com/sausheong/ruby-gpio
examples/led.rb
Ruby
mit
19
master
558
require 'ruby-gpio' # blue, yellow and led are labels, 22, 23 and 27 are GPIO pin numbers GPIO.access(blue: 23, yellow: 27, led: 22) do blue.as :in # set pin GPIO23, labeled blue, as an input pin yellow.as :in led.as :out # watch GPIO23 and turn the led on when it is pulled high # use async to watch the pin...
github
sausheong/ruby-gpio
https://github.com/sausheong/ruby-gpio
lib/ruby-gpio.rb
Ruby
mit
19
master
2,517
require "gpio/version" require 'concurrent/async' class Hash def method_missing(name, *args, &block) return self[name.to_sym] end end module GPIO class Pin include Concurrent::Async attr_accessor :name, :number, :direction def initialize(name, number) init_mutex @name = name ...
github
PGSSoft/AutoMate-Templates
https://github.com/PGSSoft/AutoMate-Templates
Dangerfile
Ruby
mit
19
master
480
# Common provider provider = send(danger.scm_provider) # Sometimes it's a README fix, or something like that - which isn't relevant for # including in a project's CHANGELOG for example declared_trivial = provider.pr_title.include? "#trivial" # Make it more obvious that a PR is a work in progress and shouldn't be merg...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
vulkan-ruby.gemspec
Ruby
mit
19
master
2,170
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "vulkan/version" Gem::Specification.new do |spec| spec.name = "vulkan-ruby" spec.version = Vulkan::VERSION spec.authors = ["Colin MacKenzie IV"] spec.email = ["sinisterchipmun...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
Rakefile
Ruby
mit
19
master
312
require "bundler/gem_tasks" require "rake/testtask" Rake::TestTask.new(:test) do |t| t.libs << "test" t.libs << "lib" t.test_files = FileList["test/**/*_test.rb"] end Dir[File.expand_path('tasks/**/*.{rake,rb}', __dir__)].each do |file| load File.expand_path(file, __dir__) end task :default => :test
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/examples.rake
Ruby
mit
19
master
809
examples = [] namespace :examples do Dir[File.expand_path('../examples/*.rb', __dir__)].each do |filename| basename = File.basename(filename, '.rb') examples << "examples:#{basename}" desc "run the '#{basename}' example script. Influential vars: DEBUG=1, CALL_TRACE=1, MAX_FRAMES=N" task basename do ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/generate.rake
Ruby
mit
19
master
285
desc 'regenerate everything' task :generate => %w( generate:types generate:enums generate:structs generate:extensions generate:commands generate:version )
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/shaders.rake
Ruby
mit
19
master
208
desc 'recompile ./examples/shaders' task :shaders do chdir 'examples/shaders' do Dir['*.{vert,frag}'].each do |shader| sh 'glslangValidator', '-V', shader, '-o', "#{shader}.spv" end end end
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/fetch.rake
Ruby
mit
19
master
339
desc 'fetch latest version of vk.xml' task :fetch do require 'open-uri' require 'openssl' require 'vulkan/version' open(vk_xml_path, 'wb') do |file| file << URI.open("https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/xml/vk.xml", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NO...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/helpers.rb
Ruby
mit
19
master
1,731
def generate_dir require 'pathname' @generate_dir ||= begin Pathname.new(File.expand_path('../lib/vulkan/generated', __dir__)).tap do |generate_dir| mkdir_p generate_dir unless generate_dir.directory? end end end def vk_xml_path @vk_xml_path ||= generate_dir.join('vk.xml') end def vk_xml @vk_x...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/generate/extensions.rake
Ruby
mit
19
master
1,287
namespace :generate do desc 'generate extension enums, types, etc' task :extensions do # rm_rf generate_dir.join('extensions') # mkdir_p generate_dir.join('extensions') # File.open(generate_dir.join('extensions.rb'), 'w') do |extout| # extout.puts header_comment # extout.puts # ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/generate/version.rake
Ruby
mit
19
master
1,535
namespace :generate do desc "Regenerate Vulkan API version info" task :version do header_version = nil vk_xml.xpath("/registry/types/type[@category='define']").each do |type| name = type.xpath('name')&.text.to_s # we are relying on VK_HEADER_VERSION to appear before VK_HEADER_VERSION_COMPLETE ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/generate/enums.rake
Ruby
mit
19
master
3,662
ALL_ENUMS = {} def enum_offset(extnum, offset, dir = 1) base_value = 1000000000 range_size = 1000 (base_value + (extnum - 1) * range_size + offset) * dir end def find_enum_value(name) ALL_ENUMS.each do |category, enums| return enums[name] if enums.keys.include?(name) end nil end def resolve_enum_alia...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/generate/commands.rake
Ruby
mit
19
master
2,731
namespace :generate do desc 'generate commands' task :commands do core_features = vk_xml.css("feature[name=VK_VERSION_1_0] command").map { |command| command.attributes['name'].to_s } addl_features = vk_xml.css("feature command").map { |command| command.attributes['name'].to_s } - core_features instance_...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/generate/types.rake
Ruby
mit
19
master
4,897
# Include the manually specified types here, and then we will skip them while # processing vk.xml if they are encountered. This way, all special cases need # only be added to that file to be properly dealt with everywhere. require 'vulkan/manual_types' ::ManualTypes = Class.new do extend Fiddle::Importer # HACK, fi...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
tasks/generate/structs.rake
Ruby
mit
19
master
4,664
namespace :generate do desc 'generate structs' task structs: ['generate:types', 'generate:enums'] do require 'fiddle' open(generate_dir.join('structs.rb'), 'w') do |f| f.puts header_comment f.puts f.puts 'module Vulkan' @structs = {} if Fiddle::WINDOWS @structs['SECURIT...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/semaphores_test.rb
Ruby
mit
19
master
321
require "test_helper" class VulkanSemaphoresTest < Minitest::Test def setup @instance = Vulkan::Instance.new extensions: [] @device = @instance.physical_devices.first.create queues: [], extensions: [] end def test_create_semaphores assert_kind_of Vulkan::Semaphore, @device.create_semaphore end end
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/logical_device_test.rb
Ruby
mit
19
master
1,636
require "test_helper" class LogicalDeviceTest < Minitest::Test include Conversions def test_cannot_activate_an_unsupported_feature instance = Vulkan::Instance.new extensions: [] physical = instance.physical_devices.first # test is invalid on hardware that supports *everything* return if physical.u...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/pipelines_test.rb
Ruby
mit
19
master
1,507
require "test_helper" class PipelinesTest < Minitest::Test def setup @instance = Vulkan::Instance.new extensions: [] @device = @instance.physical_devices.first.create queues: [], extensions: ['VK_KHR_push_descriptor'] end def test_descriptors_and_layouts pipeline = @device.create_pipeline(viewport: ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/vulkan_test.rb
Ruby
mit
19
master
318
require "test_helper" class VulkanTest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Vulkan::VERSION end def test_available_extensions assert_kind_of Array, Vulkan::Instance.extensions end def test_available_layers assert_kind_of Array, Vulkan::Instance.layers end end
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/dispatch_table_test.rb
Ruby
mit
19
master
1,985
require "test_helper" class DispatchTableTest < Minitest::Test def setup @instance = Vulkan::Instance.new extensions: [] @device = @instance.physical_devices.first.create queues: [], extensions: [] end def test_maintain_instance_and_device_handles dispatch_table = Vulkan[@instance, @device] # D...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/barriers_test.rb
Ruby
mit
19
master
2,212
require "test_helper" class BarriersTest < Minitest::Test def setup @instance = Vulkan::Instance.new extensions: [] @device = @instance.physical_devices.first.create queues: [], extensions: [] @buffer = @device.create_buffer size: 64, usage: [ :transfer_dst, :vertex_bu...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/struct_test.rb
Ruby
mit
19
master
262
require "test_helper" class VulkanStructTest < Minitest::Test def test_offsetof s = Vulkan.struct(['int x', 'int y']) assert_nil s.offsetof('missing') assert_equal 0, s.offsetof('x') assert_equal Fiddle::SIZEOF_INT, s.offsetof('y') end end
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/generators_test.rb
Ruby
mit
19
master
2,364
require "test_helper" class GeneratorsTest < Minitest::Test def test_VkImageBlit_offsets_are_arrays assert_equal 2, VkImageBlit.malloc.srcOffsets.size assert_equal 2, VkImageBlit.malloc.dstOffsets.size end def test_version assert_kind_of Array, VK_HEADER_VERSION_COMPLETE assert_equal 4, VK_HEADE...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/conversions_test.rb
Ruby
mit
19
master
6,226
require "test_helper" class ConversionsTest < Minitest::Test include Vulkan::Conversions def test_sym_to_samples assert_equal VK_SAMPLE_COUNT_1_BIT, sym_to_samples( 1) assert_equal VK_SAMPLE_COUNT_2_BIT, sym_to_samples( 2) assert_equal VK_SAMPLE_COUNT_4_BIT, sym_to_samples( 4) assert_equal VK_S...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
test/swapchain_builder_test.rb
Ruby
mit
19
master
5,585
require "test_helper" class SwapchainBuilderTest < Minitest::Test include Vulkan def test_choosing_presentation_mode # Degrade from best quality to worst quality, but allow app config to # override as long as the override option is supported. surface_info = Mock::SwapchainSurfaceInfo.new presentation...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/fiddle_ext.rb
Ruby
mit
19
master
395
require 'fiddle' require 'fiddle/import' module Fiddle class Pointer # Copies data from the specified pointer into this one, starting at offset # 0 and ending at either this pointer's size or the size of `other`, # whichever is smaller. def copy_from(other) size = self.size > other.size ? other...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan.rb
Ruby
mit
19
master
2,436
require 'pathname' require 'rubygems/version' require 'vulkan/platform' require 'fiddle_ext' module Vulkan extend Fiddle::Importer extend Vulkan::Platform class << self def root Pathname.new(__dir__).join('vulkan') end def parse_signature(sig, type_alias = @type_alias) super(sig, type_a...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/image.rb
Ruby
mit
19
master
10,766
module Vulkan class Image include Vulkan::Checks include Vulkan::Conversions include Vulkan::Finalizer attr_reader :dimensions attr_reader :width attr_reader :height attr_reader :depth attr_reader :mip_levels attr_reader :array_layers attr_reader :format attr_reader :tilin...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/buffer.rb
Ruby
mit
19
master
1,771
module Vulkan class Buffer include Vulkan::Checks include Vulkan::Conversions include Vulkan::Finalizer attr_reader :memory attr_reader :size attr_reader :usage def initialize(vk, physical_device, size:, usage:, ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/platform.rb
Ruby
mit
19
master
908
require 'fiddle' require 'rbconfig' module Vulkan module Platform def calling_convention_human case calling_convention when Fiddle::Function::STDCALL then :stdcall when Fiddle::Function::DEFAULT then :default else raise "BUG: can't identify calling convention???" end rescue Name...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/buffer_memory_barrier.rb
Ruby
mit
19
master
1,591
module Vulkan class BufferMemoryBarrier include Vulkan::Conversions def initialize(src_access:, dst_access:, src_queue_family_index: VK_QUEUE_FAMILY_IGNORED, dst_queue_family_index: VK_QUEUE_FAMILY_IGNORED, buffer:, ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/swapchain_builder.rb
Ruby
mit
19
master
4,537
module Vulkan class SwapchainBuilder attr_reader :surface_info attr_reader :config def initialize(swapchain_surface_info, config = {}) @surface_info = swapchain_surface_info @config = config raise 'swapchain not supported' unless usage_supported? end # Chooses and returns a swa...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/finalizer.rb
Ruby
mit
19
master
1,298
module Vulkan module Finalizer module ClassMethods def finalizer(vk, cleanup_method_name, *cleanup_method_args) proc do begin unless ENV['NO_FINALIZE'] if ENV['CALL_TRACE'] cleanup_method_args_s = cleanup_method_args.map do |arg| ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/command_pool.rb
Ruby
mit
19
master
1,103
module Vulkan class CommandPool include Vulkan::Checks include Vulkan::Conversions include Vulkan::Finalizer def initialize(vk, queue_family:, transient: false, allow_reset: false) @vk = vk pool_info = VkCommandPoolCreateInfo.malloc pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_C...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/instance.rb
Ruby
mit
19
master
8,539
module Vulkan class Instance extend Vulkan::Checks extend Vulkan::Conversions include Vulkan::Checks include Vulkan::Conversions include Vulkan::Finalizer class << self def extensions @extensions ||= begin property_count_ptr = Vulkan.create_value("uint32_t", 0) ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/queue.rb
Ruby
mit
19
master
4,126
module Vulkan class Queue include Vulkan::Checks include Vulkan::Conversions attr_reader :priority attr_reader :index def initialize(vk, handle, priority:, index:) @vk = vk @handle = handle @priority = priority @index = index # pointers used and reused during queue...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/descriptor_set.rb
Ruby
mit
19
master
2,588
module Vulkan class DescriptorSet include Vulkan::Conversions include Vulkan::Finalizer class DescriptorWrite include Vulkan::Conversions def initialize(owner, layout) @changed = false @writer = VkWriteDescriptorSet.malloc @writer.sType = VK_STRUCTURE_TYPE_...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/descriptor_set_layout.rb
Ruby
mit
19
master
1,440
module Vulkan class DescriptorSetLayout include Vulkan::Checks include Vulkan::Conversions include Vulkan::Finalizer attr_reader :descriptors attr_reader :types def initialize(vk, *types, descriptors:) @vk = vk @types = types @descriptors = descriptors.map { |d| build_descr...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/image_view.rb
Ruby
mit
19
master
1,818
module Vulkan class ImageView include Vulkan::Checks include Vulkan::Conversions include Vulkan::Finalizer attr_reader :image def initialize(vk, image, image_format, view_type: VK_IMAGE_VIEW_TYPE_2D, red_swizzle: VK_COMPONENT_SWIZZLE_IDENTITY, ...
github
sinisterchipmunk/vulkan-ruby
https://github.com/sinisterchipmunk/vulkan-ruby
lib/vulkan/logical_device.rb
Ruby
mit
19
master
6,318
module Vulkan class LogicalDevice include Vulkan::Checks include Vulkan::Conversions include Vulkan::Finalizer attr_reader :physical_device attr_reader :queue_families attr_reader :enabled_features def initialize(instance, physical_device, queues:, extensions:, features: physical_dev...