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
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/spec_helper.rb
Ruby
mit
98
master
647
# typed: ignore require 'simplecov' SimpleCov.start require 'bundler/setup' require 'parlour' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` confi...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/conflict_resolver_spec.rb
Ruby
mit
98
master
20,664
RSpec.describe Parlour::ConflictResolver do def gen Parlour::RbiGenerator.new end def pa(*a, **kw) Parlour::RbiGenerator::Parameter.new(*a, **kw) end it 'does not merge different kinds of definition' do m = gen.root.create_module('M') do |m| m.create_module('A') m.create_class('A') ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/types_spec.rb
Ruby
mit
98
master
3,815
# typed: ignore require 'parser/current' # TODO: Add unit tests for more types RSpec.describe Parlour::Types do describe 'Generic' do subject(:type) { Parlour::Types::Generic.new( Parlour::Types::Raw.new('Mapper'), [ Parlour::Types::Raw.new('String'), Parlour::Types::Ge...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/rbi_generator_spec.rb
Ruby
mit
98
master
21,087
# typed: ignore RSpec.describe Parlour::RbiGenerator do def fix_heredoc(x) lines = x.lines /^( *)/ === lines.first indent_amount = $1.length lines.map do |line| /^ +$/ === line[0...indent_amount] \ ? line[indent_amount..-1] : line end.join.rstrip end def pa(*a, **kw) ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/rbs_generator_spec.rb
Ruby
mit
98
master
13,995
# typed: ignore RSpec.describe Parlour::RbsGenerator do def fix_heredoc(x) lines = x.lines /^( *)/ === lines.first indent_amount = $1.length lines.map do |line| /^ +$/ === line[0...indent_amount] \ ? line[indent_amount..-1] : line end.join.rstrip end def pa(*a, **kw) ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/cli_spec.rb
Ruby
mit
98
master
1,680
require 'fileutils' require 'open3' require 'yaml' TMP_ROOT = '/tmp/parlour-test' FileUtils.rm_rf(TMP_ROOT) FileUtils.mkdir_p(TMP_ROOT) RSpec.describe 'command-line interface' do # Dyamically run a test for each subdirectory of /spec/cli Dir[File.join(__dir__, "cli", "*")].each do |test_dir| test_dir_basename...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/parameter_spec.rb
Ruby
mit
98
master
2,373
RSpec.describe Parlour::RbiGenerator::Parameter do def pa(*a, **kw) described_class.new(*a, **kw) end it 'determines kinds properly' do expect(pa('foo').kind).to eq :normal expect(pa('*foo').kind).to eq :splat expect(pa('**foo').kind).to eq :double_splat expect(pa('&foo').kind).to eq :block ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/type_loader_spec.rb
Ruby
mit
98
master
4,223
RSpec.describe Parlour::TypeLoader do it 'can load source' do ns = described_class.load_source(<<-RUBY) module A class B sig { returns(Integer) } def foo; 3; end sig { returns(T::Boolean) } def bar; true; end end class C sig { retur...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/plugin_spec.rb
Ruby
mit
98
master
1,023
# typed: ignore RSpec.describe Parlour::Plugin do before :each do described_class.registered_plugins.clear end it 'registers new subclasses' do class A < Parlour::Plugin end expect(described_class.registered_plugins).to eq('A' => A) end it 'executes a list of plugins' do class Tracker ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/rbi_to_rbs_converter_spec.rb
Ruby
mit
98
master
7,834
# typed: ignore RSpec.describe Parlour::Conversion::RbiToRbs do let(:rbi_gen) { Parlour::DetachedRbiGenerator.new } let(:rbs_gen) { Parlour::DetachedRbsGenerator.new } let(:converter) { described_class.new(rbs_gen) } def convert rbi_gen.root.children.each do |child| converter.convert_object(child, rb...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
spec/cli/can_be_used_without_the_parser/plugin.rb
Ruby
mit
98
master
267
require 'parlour' class Plugin < Parlour::Plugin def initialize(options) @class_name = options[:class_name] end def generate(root) root.create_module('C') do |c| c.create_class(@class_name) end end def strictness "strong" end end
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour.rb
Ruby
mit
98
master
1,967
# typed: strong require 'sorbet-runtime' require 'parlour/version' require 'parlour/debugging' require 'parlour/kernel_hack' require 'parlour/plugin' require 'parlour/types' require 'parlour/options' require 'parlour/typed_object' require 'parlour/generator' require 'parlour/mixin/searchable' require 'parlour/rb...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/detached_rbs_generator.rb
Ruby
mit
98
master
445
# typed: true module Parlour class DetachedRbsGenerator < RbsGenerator sig { returns(T.untyped) } def detached! raise "cannot call methods on a detached RBS generator" end sig { override.returns(Options) } def options detached! end sig { override.returns(T.nilable(Plugin)) }...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/typed_object.rb
Ruby
mit
98
master
5,121
# typed: true module Parlour # A generic superclass of all objects which form part of type definitions in, # specific formats, such as RbiObject and RbsObject. class TypedObject extend T::Sig extend T::Helpers abstract! sig { params(name: String).void } # Create a new typed object. def in...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/type_loader.rb
Ruby
mit
98
master
4,324
# typed: true require 'open3' require 'json' module Parlour module TypeLoader extend T::Sig # TODO: make this into a class which stores configuration and passes it to # all typeparsers sig { params(source: String, filename: T.nilable(String), generator: T.nilable(RbiGenerator)).returns(RbiGenerato...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/types.rb
Ruby
mit
98
master
14,895
# typed: true module Parlour # Contains structured types which can be used in type signatures. module Types TypeLike = T.type_alias { T.any(String, Type) } # The top-level, abstract class for a generalised type. All of the other # types inherit from this. Do not instantiate. class Type exten...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/options.rb
Ruby
mit
98
master
2,489
# typed: true module Parlour # A set of immutable formatting options. class Options extend T::Sig sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void } # Creates a new set of formatting options. # # @example Create Options with +break_params+ of +4+ and +tab...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator.rb
Ruby
mit
98
master
587
# typed: true module Parlour # The RBS generator. class RbsGenerator < Generator def initialize(**hash) super @root = RbsGenerator::Namespace.new(self) end sig { overridable.returns(RbsGenerator::Namespace) } # The root {Namespace} of this generator. # @return [Namespace] attr...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/parse_error.rb
Ruby
mit
98
master
330
# typed: true module Parlour class ParseError < StandardError extend T::Sig sig { returns(Parser::Source::Buffer) } attr_reader :buffer sig { returns(Parser::Source::Range) } attr_reader :range def initialize(buffer, range) super() @buffer = buffer @range = range end ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/generator.rb
Ruby
mit
98
master
1,162
# typed: true module Parlour class Generator extend T::Sig sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void } # Creates a new generator. # # @param break_params [Integer] If there are at least this many parameters in a # signature, then it is broke...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/conflict_resolver.rb
Ruby
mit
98
master
12,097
# typed: true require 'set' module Parlour # Responsible for resolving conflicts (that is, multiple definitions with the # same name) between objects defined in the same namespace. class ConflictResolver extend T::Sig def initialize @debugging_tree = Debugging::Tree.new(colour: true) end ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/detached_rbi_generator.rb
Ruby
mit
98
master
495
# typed: true module Parlour class DetachedRbiGenerator < RbiGenerator sig { returns(T.untyped) } def detached! raise "cannot call methods on a detached RBI generator" end sig { override.returns(Options) } def options detached! end sig { override.returns(T.nilable(Plugin)) }...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/debugging.rb
Ruby
mit
98
master
4,641
# typed: true require 'rainbow' module Parlour # Contains methods to enable debugging facilities for Parlour. module Debugging extend T::Sig @debug_mode = !ENV["PARLOUR_DEBUG"].nil? # Set whether debug messages should be printed. # @param [Boolean] value True if debug messages will be printed, fa...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/plugin.rb
Ruby
mit
98
master
2,593
# typed: true module Parlour # The base class for user-defined RBI generation plugins. # # This class is *abstract*. class Plugin extend T::Sig extend T::Helpers abstract! @@registered_plugins = {} sig { returns(T::Hash[String, T.class_of(Plugin)]) } # Returns all registered plugins, a...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator.rb
Ruby
mit
98
master
809
# typed: true module Parlour # The RBI generator. class RbiGenerator < Generator # For backwards compatibility. # Before Parlour 5.0, Parlour::Options was Parlour::RbiGenerator::Options. Options = Parlour::Options def initialize(**hash) super @root = RbiGenerator::Namespace.new(self) ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/type_parser.rb
Ruby
mit
98
master
41,887
# typed: true # TODO: support sig without runtime # Suppress versioning warnings - the majority of users will not actually be # using this, so we don't want to pollute their console old_verbose = $VERBOSE begin $VERBOSE = nil require 'parser/current' ensure $VERBOSE = old_verbose end module Parlour # Parses ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/class_namespace.rb
Ruby
mit
98
master
4,638
# typed: true module Parlour class RbiGenerator < Generator # Represents a class definition. class ClassNamespace < Namespace extend T::Sig Child = type_member {{ fixed: RbiObject }} sig do params( generator: Generator, name: String, final: T::Boolean,...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/enum_class_namespace.rb
Ruby
mit
98
master
4,621
# typed: true module Parlour class RbiGenerator < Generator # Represents an enum definition; that is, a class with an +enum+ call. class EnumClassNamespace < ClassNamespace extend T::Sig Child = type_member {{ fixed: RbiObject }} sig do params( generator: Generator, ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/method.rb
Ruby
mit
98
master
10,601
# typed: true module Parlour class RbiGenerator < Generator # Represents a method definition. class Method < RbiObject extend T::Sig sig do params( generator: Generator, name: String, parameters: T::Array[Parameter], return_type: T.nilable(Types::Ty...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/struct_class_namespace.rb
Ruby
mit
98
master
4,354
# typed: true module Parlour class RbiGenerator # Represents an struct definition; that is, a class which subclasses # +T::Struct+ and declares `prop` members. class StructClassNamespace < ClassNamespace extend T::Sig Child = type_member {{ fixed: RbiObject }} sig do params( ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/rbi_object.rb
Ruby
mit
98
master
3,047
# typed: true module Parlour class RbiGenerator < Generator # An abstract class which is subclassed by any classes which can generate # entire lines of an RBI, such as {Namespace} and {Method}. (As an example, # {Parameter} is _not_ a subclass because it does not generate lines, only # segments of def...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/namespace.rb
Ruby
mit
98
master
30,841
# typed: true module Parlour class RbiGenerator < Generator # A generic namespace. This shouldn't be used, except as the type of # {RbiGenerator#root}. class Namespace < RbiObject extend T::Sig extend T::Generic sig do override.overridable.params( indent_level: Integer...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/constant.rb
Ruby
mit
98
master
4,432
# typed: true module Parlour class RbiGenerator < Generator # Represents a constant definition. class Constant < RbiObject sig do params( generator: Generator, name: String, value: Types::TypeLike, eigen_constant: T::Boolean, heredocs: T.nilable(...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/include.rb
Ruby
mit
98
master
2,885
# typed: true module Parlour class RbiGenerator < Generator # Represents an +include+ call. class Include < RbiObject sig do params( generator: Generator, name: String, block: T.nilable(T.proc.params(x: Include).void) ).void end # Creates a new +...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/struct_prop.rb
Ruby
mit
98
master
4,314
# typed: true module Parlour class RbiGenerator < Generator # Represents a +T::Struct+ property. class StructProp extend T::Sig sig do params( name: String, type: Types::TypeLike, optional: T.nilable(T.any(T::Boolean, Symbol)), enum: T.nilable(Strin...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/parameter.rb
Ruby
mit
98
master
5,173
# typed: true require 'rainbow' module Parlour class RbiGenerator < Generator # Represents a method parameter with a Sorbet type signature. class Parameter extend T::Sig sig do params( name: String, type: T.nilable(Types::TypeLike), default: T.nilable(String)...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/extend.rb
Ruby
mit
98
master
2,871
# typed: true module Parlour class RbiGenerator < Generator # Represents an +extend+ call. class Extend < RbiObject sig do params( generator: Generator, name: String, block: T.nilable(T.proc.params(x: Extend).void) ).void end # Creates a new +ext...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/arbitrary.rb
Ruby
mit
98
master
2,961
# typed: true module Parlour class RbiGenerator < Generator # Represents miscellaneous Ruby code. class Arbitrary < RbiObject sig do params( generator: Generator, code: String, block: T.nilable(T.proc.params(x: Arbitrary).void) ).void end # Creat...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/type_alias.rb
Ruby
mit
98
master
3,302
# typed: true module Parlour class RbiGenerator < Generator # Represents a type alias. class TypeAlias < RbiObject sig do params( generator: Generator, name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: TypeAlias).void) ).void ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/attribute.rb
Ruby
mit
98
master
3,765
# typed: true module Parlour class RbiGenerator < Generator # Represents an attribute reader, writer or accessor. class Attribute < Method sig do params( generator: Generator, name: String, kind: Symbol, type: Types::TypeLike, class_attribute: T:...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbi_generator/module_namespace.rb
Ruby
mit
98
master
4,247
# typed: true module Parlour class RbiGenerator < Generator # Represents a module definition. class ModuleNamespace < Namespace extend T::Sig Child = type_member {{ fixed: RbiObject }} sig do params( generator: Generator, name: String, final: T::Boolea...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/mixin/searchable.rb
Ruby
mit
98
master
1,696
# typed: true module Parlour module Mixin # Extends a particular type system's Namespace class to provide searchable # children. module Searchable extend T::Sig extend T::Generic Child = type_member {{ upper: TypedObject }} abstract! sig { abstract.returns(T::Array[Child]...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/type_alias.rb
Ruby
mit
98
master
3,139
# typed: true module Parlour class RbsGenerator < Generator # Represents a type alias. class TypeAlias < RbsObject sig do params( generator: Generator, name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: TypeAlias).void) ).void ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/extend.rb
Ruby
mit
98
master
2,991
# typed: true module Parlour class RbsGenerator < Generator # Represents an +extend+ call. class Extend < RbsObject sig do params( generator: Generator, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Extend).void) ).void end # Creates a...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/rbs_object.rb
Ruby
mit
98
master
2,694
# typed: true module Parlour class RbsGenerator < Generator # An abstract class which is subclassed by any classes which can generate # entire lines of an RBS, such as {Namespace} and {Method}. (As an example, # {Parameter} is _not_ a subclass because it does not generate lines, only # segments of def...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/include.rb
Ruby
mit
98
master
3,007
# typed: true module Parlour class RbsGenerator < Generator # Represents an +include+ call. class Include < RbsObject sig do params( generator: Generator, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Include).void) ).void end # Create...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/namespace.rb
Ruby
mit
98
master
23,303
# typed: true module Parlour class RbsGenerator < Generator # A generic namespace. This shouldn't be used, except as the type of # {RbsGenerator#root}. class Namespace < RbsObject extend T::Sig extend T::Generic sig do override.overridable.params( indent_level: Integer...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/class_namespace.rb
Ruby
mit
98
master
3,644
# typed: true module Parlour class RbsGenerator < Generator # Represents a class definition. class ClassNamespace < Namespace extend T::Sig Child = type_member {{ fixed: RbsObject }} sig do params( generator: Generator, name: String, superclass: T.nila...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/interface_namespace.rb
Ruby
mit
98
master
1,099
# typed: true module Parlour class RbsGenerator < Generator # Represents an interface definition. class InterfaceNamespace < Namespace extend T::Sig Child = type_member {{ fixed: RbsObject }} sig do override.params( indent_level: Integer, options: Options ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/block.rb
Ruby
mit
98
master
1,661
# typed: true module Parlour class RbsGenerator < Generator # Represents a block in a method signature. # (This is not an RbsObject because it doesn't generate a full line.) class Block extend T::Sig sig { params(type: Types::Proc, required: T::Boolean).void } # Creates a new block for ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/arbitrary.rb
Ruby
mit
98
master
2,880
# typed: true module Parlour class RbsGenerator < Generator # Represents miscellaneous Ruby code. class Arbitrary < RbsObject sig do params( generator: Generator, code: String, block: T.nilable(T.proc.params(x: Arbitrary).void) ).void end # Creat...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/parameter.rb
Ruby
mit
98
master
5,001
# typed: true module Parlour class RbsGenerator < Generator # Represents a method parameter with a Sorbet type signature. class Parameter extend T::Sig sig do params( name: String, type: T.nilable(Types::TypeLike), required: T::Boolean, ).void e...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/constant.rb
Ruby
mit
98
master
3,203
# typed: true module Parlour class RbsGenerator < Generator # Represents a constant definition. class Constant < RbsObject sig do params( generator: Generator, name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Constant).void) )...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/method.rb
Ruby
mit
98
master
5,421
# typed: true module Parlour class RbsGenerator < Generator # Represents a method definition. class Method < RbsObject extend T::Sig sig do params( generator: Generator, name: String, signatures: T::Array[MethodSignature], class_method: T::Boolean, ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/module_namespace.rb
Ruby
mit
98
master
1,086
# typed: true module Parlour class RbsGenerator < Generator # Represents a module definition. class ModuleNamespace < Namespace extend T::Sig Child = type_member {{ fixed: RbsObject }} sig do override.params( indent_level: Integer, options: Options ).ret...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/attribute.rb
Ruby
mit
98
master
3,041
# typed: true module Parlour class RbsGenerator < Generator # Represents an attribute reader, writer or accessor. class Attribute < RbsGenerator::Method extend T::Sig sig do params( generator: Generator, name: String, kind: Symbol, type: Types::Type...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/rbs_generator/method_signature.rb
Ruby
mit
98
master
4,533
# typed: true module Parlour class RbsGenerator < Generator # Represents one signature in a method definition. # (This is not an RbsObject because it doesn't generate a full line.) class MethodSignature extend T::Sig sig do params( parameters: T::Array[Parameter], ...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/conversion/rbi_to_rbs.rb
Ruby
mit
98
master
7,443
# typed: true module Parlour module Conversion # Converts RBI types to RBS types. class RbiToRbs < Converter extend T::Sig sig { params(rbs_gen: RbsGenerator).void } def initialize(rbs_gen) super() @rbs_gen = rbs_gen end sig { returns(RbsGenerator) } attr_...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
lib/parlour/conversion/converter.rb
Ruby
mit
98
master
861
# typed: true require 'rainbow' module Parlour module Conversion # An abstract class which converts between the node trees of two type # systems. class Converter extend T::Sig extend T::Helpers abstract! def initialize @warnings = [] end sig { returns(T::Arra...
github
AaronC81/parlour
https://github.com/AaronC81/parlour
plugin_examples/foobar_plugin.rb
Ruby
mit
98
master
294
require 'parlour' module FooBar class Plugin < Parlour::Plugin def generate(root) root.create_module('Foo') do |foo| foo.add_comment('This is an example plugin!') foo.create_module('Bar') foo.create_module('Bar', interface: true) end end end end
github
moshen/jekyll-asset_bundler
https://github.com/moshen/jekyll-asset_bundler
asset_bundler.rb
Ruby
mit
98
master
11,999
# # Jekyll Asset Bundler # # Author : Colin Kennedy # Repo : http://github.com/moshen/jekyll-asset_bundler # Version: 0.12 # License: MIT, see LICENSE file # require 'yaml' require 'digest/md5' require 'net/http' require 'uri' module Jekyll class BundleTag < Liquid::Block def initialize(tag_name, text, token...
github
markolson/storyboard
https://github.com/markolson/storyboard
storyboard.gemspec
Ruby
mit
98
master
938
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'storyboard/version' Gem::Specification.new do |spec| spec.name = "storyboard" spec.version = Storyboard::VERSION spec.authors = ["Mark Olson"] spec.email = ["...
github
markolson/storyboard
https://github.com/markolson/storyboard
Gemfile
Ruby
mit
98
master
264
source 'https://rubygems.org' # Specify your gem's dependencies in storyboard.gemspec gem 'titlekit', git: 'https://github.com/markolson/titlekit.git' gem 'ruby-progressbar' gem 'hpricot' gem 'subdb' gem 'subtitle_it' gem 'addic7ed' gem 'osdb' gem 'suby' gemspec
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard.rb
Ruby
mit
98
master
1,653
require 'json' require 'prawn' require 'logger' require 'tmpdir' require 'tempfile' require 'shellwords' module Storyboard autoload :VERSION, "storyboard/version" autoload :CLI, "storyboard/cli" autoload :Binaries, "storyboard/binaries" autoload :Video, ...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/trollop.rb
Ruby
mit
98
master
27,551
## lib/trollop.rb -- trollop command-line processing library ## Author:: William Morgan (mailto: wmorgan-trollop@masanjin.net) ## Copyright:: Copyright 2007 William Morgan ## License:: the same terms as ruby itself require 'date' module Trollop VERSION = "2.0" ## Thrown by Parser in the event of a commandline ...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/video.rb
Ruby
mit
98
master
1,085
module Storyboard class Video attr_accessor :parent, :path, :raw_data attr_accessor :height, :width, :framerate, :duration def initialize(parent) @parent = parent @path = File.expand_path(parent.options['_video']) run_basic_probe parent.ui.log("#{File.basename(@path)} is #{@w...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles.rb
Ruby
mit
98
master
3,750
module Storyboard class Subtitles attr_accessor :runner, :subtitles, :encoding def initialize(parent) @runner = parent @encoding = 'UTF-8' @subtitles = [] @subtitle_file = ::Tempfile.new(['storyboard.ffmpeg', '.ass']) end def load_from(types) types.detect {|loader| loade...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/binaries.rb
Ruby
mit
98
master
2,615
module Storyboard class Binaries @@ffmpeg = nil @@ffprobe = nil @@convert = nil URLS = { 'ffmpeg' => false, 'ffprobe' => false, 'gifsicle' => false, 'convert' => false } def self.ffmpeg(args) %x(#{self.ffmpeg_cmd(args)}) end def self.ffmpeg_cmd(args) ...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/cli.rb
Ruby
mit
98
master
810
module Storyboard class CLI def self.options(opts, &block) opts.opt :subtitle_path, "Subtitle Path", :short => '-s', :long => '--subtitle', :type => :io opts.opt :nudge, "Subtitle Adjustment", :short => '-n', :long => '--nudge', :type => :string, ex: 'HH:MM:SS.ms' opts.opt :start_time, "Start T...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/runners/book.rb
Ruby
mit
98
master
920
module Storyboard::Runners class Book < Storyboard::Runners::Base def run pull_options! @extractor = Storyboard::Extractor::Points.new(self) @subtitles = Storyboard::Subtitles.new(self) load_from = [ Storyboard::Subtitles::Source::Path, Storyboard::Subtitles::Source...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/runners/base.rb
Ruby
mit
98
master
2,351
module Storyboard::Runners class Base attr_reader :ui, :options, :parser, :workdirectory attr_reader :video, :subtitles, :extractor attr_accessor :start_time, :end_time attr_reader :height, :width def self.run(parser, options, ui=Storyboard::UI::Console) Storyboard::Binaries.check # ...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/runners/gif.rb
Ruby
mit
98
master
1,179
module Storyboard::Runners class Gif < Storyboard::Runners::Base def run # do secondary checks. raise Trollop::CommandlineError, "--use_first_text_match requires --find-text" if @options[:use_first_text_match] && @options[:find_text].nil? pull_options! @extractor = Storyboard::Extractor::R...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/runners/movie.rb
Ruby
mit
98
master
534
module Storyboard::Runners class Movie < Storyboard::Runners::Base def run pull_options! @extractor = Storyboard::Extractor::Range.new(self) ui.log("Checking for subtitles") @subtitles = Storyboard::Subtitles.new(self) @extractor.fps = "fps=1/#{(@video.duration/475)}" # frame...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/file.rb
Ruby
mit
98
master
1,027
module Storyboard::Subtitles class File < Storyboard::Subtitles::Base def load_subs(path) job = Titlekit::Job.new input = job.have # re-save the file with a hopefully sane encoding.. really_temporary_temp = ::Tempfile.new(['storyboard.file', ::File.extname(path)]) cleaned_body = cl...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/base.rb
Ruby
mit
98
master
2,821
module Storyboard::Subtitles class Base attr_accessor :parent, :subs, :max_font_size, :tmpfile, :encoding attr_accessor :prawn_scratch def initialize(parent) @encoding = 'UTF-8' @parent = parent @min_font_sizes = [] @subs = [] @tmpfile = ::Tempfile.new('storyboard') end ...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/web.rb
Ruby
mit
98
master
917
module Storyboard::Subtitles class Web < Storyboard::Subtitles::File attr_accessor :osdb def initialize(parent) @osdb = OSDb::MovieFile.new(parent.options['_video'] ) super(parent) end def download server = OSDb::Server.new( :timeout => 90, :useragent => "SubDownloader 2.0.10" ...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/sources/text.rb
Ruby
mit
98
master
436
module Storyboard::Subtitles::Source class Text def self.run(subtitles, runner) return false unless runner.options[:use_text_given] raise Trollop::CommandlineError, "--start cannot be further than --end" if runner.start_time >= runner.end_time runner.ui.log("Adding subtitles from Source::Text") ...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/sources/local.rb
Ruby
mit
98
master
527
module Storyboard::Subtitles::Source class Local def self.run(subtitles, runner) path = runner.video.path subtitle_extension = %w(srt sub ssa ass).detect{ |ext| ext = ".#{ext}"; File.exist?(path.gsub(File.extname(path), ext)) } return false unless subtitle_extension subtitle_path = path.gsub(File...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/sources/web.rb
Ruby
mit
98
master
921
module Storyboard::Subtitles::Source class Web def self.run(subtitles, runner) runner.ui.log("Adding subtitles from Source::Web") osdb = OSDb::MovieFile.new(runner.video.path) server = OSDb::Server.new( :timeout => 90, :useragent => "SubDownloader 2.0.10" ) search_engines = [OS...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/sources/path.rb
Ruby
mit
98
master
331
module Storyboard::Subtitles::Source class Path def self.run(subtitles, runner) return false unless runner.options[:subtitle_path_given] runner.ui.log("Adding subtitles from Source::Path: #{runner.options[:subtitle_path]}") subtitles.load_from_file(runner.options[:subtitle_path]) return true en...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/filters/time.rb
Ruby
mit
98
master
223
module Storyboard::Subtitles::Filter class Time def self.run(subtitles, runner) subtitles.subtitles.select{|s| (s[:start] <= runner.end_time) && (s[:end] >= runner.start_time) } end end end
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/subtitles/filters/text.rb
Ruby
mit
98
master
995
module Storyboard::Subtitles::Filter class Text def self.run(subtitles, runner) return subtitles.subtitles unless runner.options[:find_text_given] found = subtitles.subtitles.select{|s| s[:lines].include?(runner.options[:find_text]) } chosen = nil if found.empty? r...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/builder/gif.rb
Ruby
mit
98
master
519
module Storyboard::Builder class GIF attr_accessor :parent def initialize(parent) @parent = parent end def run(scanfor='*.jpg') parent.ui.log("Outputting GIF", Logger::INFO) scanpath = File.join(@parent.workdirectory, scanfor) writepath = File.join(@parent.options['_output_dir...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/builder/pdf.rb
Ruby
mit
98
master
694
module Storyboard::Builder class PDF attr_accessor :parent def initialize(parent) @parent = parent end def run(scanfor='*.jpg') scanpath = File.join(@parent.workdirectory, scanfor) writepath = File.join(@parent.options['_output_director'], "#{File.basename(@parent.video.path)}.pdf")...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/ui/console.rb
Ruby
mit
98
master
1,211
module Storyboard::UI class Console require "highline/import" attr_accessor :parent, :logger def initialize(parent) @parent = parent @logger = Logger.new(STDOUT) # DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN @logger.level = Logger::DEBUG @logger.formatter = proc do |severit...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/extractors/range.rb
Ruby
mit
98
master
976
module Storyboard::Extractor class Range < Storyboard::Extractor::Base attr_accessor :fps def run filters << "fps=#{@fps}" offset = (@runner.start_time > 1) ? 1 : 0 @filters << "setpts=PTS-#{@runner.start_time}/TB" cmd = build_ffmpeg_command( :pre => ["-ss", Titlekit::ASS.bu...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/extractors/points.rb
Ruby
mit
98
master
2,428
module Storyboard::Extractor class Points < Storyboard::Extractor::Base attr_accessor :sub_points, :extracted_points def initialize(runner) @extracted_points, @sub_points = [], [] super(runner) end def run runner.ui.progress("Extracting images", raw_points.count) do |bar| ...
github
markolson/storyboard
https://github.com/markolson/storyboard
lib/storyboard/extractors/base.rb
Ruby
mit
98
master
804
require 'open3' module Storyboard::Extractor class Base attr_accessor :runner attr_accessor :pre, :post, :filters def initialize(runner) @runner = runner @pre, @post, @filters = [], [], [] @filters << "scale=#{@runner.width}:#{@runner.height || -1}" if @runner.options[:dimensions_given] ...
github
jamesgolick/attribute_fu
https://github.com/jamesgolick/attribute_fu
attribute_fu.gemspec
Ruby
mit
98
master
2,075
Gem::Specification.new do |s| s.name = "attribute_fu" s.version = "0.2.1" s.date = "2008-08-04" s.summary = "rails multi-model forms made easy!" s.email = "james@giraffesoft.ca" s.homepage = "http://jamesgolick.com/attribute_fu" s.description = "Creating multi-model f...
github
jamesgolick/attribute_fu
https://github.com/jamesgolick/attribute_fu
Rakefile
Ruby
mit
98
master
594
require 'rake' require "load_multi_rails_rake_tasks" require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the attribute_fu plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate ...
github
jamesgolick/attribute_fu
https://github.com/jamesgolick/attribute_fu
lib/attribute_fu/associations.rb
Ruby
mit
98
master
5,482
module AttributeFu module Associations #:nodoc: def self.included(base) #:nodoc: base.class_eval do extend ClassMethods class << self; alias_method_chain :has_many, :association_option; end class_inheritable_accessor :managed_association_attributes write_inheri...
github
jamesgolick/attribute_fu
https://github.com/jamesgolick/attribute_fu
lib/attribute_fu/associated_form_helper.rb
Ruby
mit
98
master
6,776
module AttributeFu # Methods for building forms that contain fields for associated models. # # Refer to the Conventions section in the README for the various expected defaults. # module AssociatedFormHelper # Works similarly to fields_for, but used for building forms for associated objects. # # A...
github
jamesgolick/attribute_fu
https://github.com/jamesgolick/attribute_fu
test/associated_form_helper_test.rb
Ruby
mit
98
master
12,540
require File.dirname(__FILE__)+'/test_helper' class AssociatedFormHelperTest < Test::Unit::TestCase include ActionView::Helpers::FormHelper include ActionView::Helpers::FormTagHelper include ActionView::Helpers::UrlHelper include ActionView::Helpers::TagHelper include ActionView::Helpers::TextHelper includ...
github
jamesgolick/attribute_fu
https://github.com/jamesgolick/attribute_fu
test/test_helper.rb
Ruby
mit
98
master
788
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') plugin_test_dir = File.dirname(__FILE__) require 'rubygems' require 'multi_rails_init' require 'active_record' require 'action_view' require 'test/unit' require 'mocha' require 'shoulda/rails' require 'attribute_fu' require 'attribute_fu/associations' require 'a...
github
jamesgolick/attribute_fu
https://github.com/jamesgolick/attribute_fu
test/photo_test.rb
Ruby
mit
98
master
5,624
require File.dirname(__FILE__) + '/test_helper' class PhotoTest < ActiveSupport::TestCase should_have_many :comments context "comment_attributes" do context "with valid children" do setup do create_photo_and_children @photo.comment_attributes = { @gob.id.to_s => { :author => "Bu...
github
jamesgolick/attribute_fu
https://github.com/jamesgolick/attribute_fu
test/db/schema.rb
Ruby
mit
98
master
301
ActiveRecord::Schema.define(:version => 2) do create_table :comments, :force => true do |t| t.integer :photo_id t.string :author t.text :body t.timestamps end create_table :photos, :force => true do |t| t.string :title t.text :description t.timestamps end end
github
mrbrdo/theine
https://github.com/mrbrdo/theine
theine.gemspec
Ruby
mit
98
master
649
Gem::Specification.new do |s| s.name = 'theine' s.version = '0.0.14' s.summary = "Theine" s.description = "A Rails preloader for JRuby" s.authors = ["Jan Berdajs"] s.email = 'mrbrdo@mrbrdo.net' s.files = ["lib/theine.rb", "lib/theine/client.rb", "lib/thein...
github
mrbrdo/theine
https://github.com/mrbrdo/theine
Gemfile
Ruby
mit
98
master
501
source "http://rubygems.org" # Declare your gem's dependencies in has_moderated.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development here instead of...
github
mrbrdo/theine
https://github.com/mrbrdo/theine
lib/theine/worker.rb
Ruby
mit
98
master
3,359
RAILS_ROOT_PATH = ARGV[2] APP_PATH = "#{RAILS_ROOT_PATH}/config/application" require 'drb/drb' module Theine class Worker attr_reader :port, :balancer COMMANDS = { rails: proc { require 'rails/commands' }, rake: proc { require 'rake' ::Rails.application.load_tasks i...
github
mrbrdo/theine
https://github.com/mrbrdo/theine
lib/theine/config.rb
Ruby
mit
98
master
673
require 'yaml' module Theine class ConfigReader attr_reader :rails_root attr_accessor :base_port, :max_port, :min_free_workers, :spawn_parallel def initialize(rails_root) @rails_root = rails_root @base_port = 11000 @max_port = 11100 @min_free_workers = 2 @spawn_parallel = tr...