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
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/library_generator_test.rb
Ruby
mit
200
master
1,075
require 'test_helper' require 'sprout/generators/library/library_generator' class LibraryGeneratorTest < Test::Unit::TestCase include Sprout::TestHelper context "A generated library" do setup do @temp = File.join(fixtures, 'generators', 'library') FileUtils.mkdir_p @temp @generator = Sprout...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/executable_option_parser_test.rb
Ruby
mit
200
master
4,475
require 'test_helper' require 'fixtures/examples/echo_inputs' class ExecutableOptionParserTest < Test::Unit::TestCase include Sprout::TestHelper context "a new ruby executable" do setup do @exe = EchoInputs.new @exe.abort_on_failure = false @default_input = '--input=lib/sprout.rb' e...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/string_param_test.rb
Ruby
mit
200
master
367
require 'test_helper' class StringParamTest < Test::Unit::TestCase include Sprout::TestHelper context "a new StringParam" do setup do @param = Sprout::Executable::StringParam.new @param.name = "string" end should "escape spaces" do @param.value = "a b c" assert_equal '--strin...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/files_param_test.rb
Ruby
mit
200
master
2,202
require 'test_helper' class FilesParamTest < Test::Unit::TestCase include Sprout::TestHelper context "a new FilesParam" do setup do @input1 = File.join(fixtures, "executable", "params", "input.as") @input2 = File.join(fixtures, "executable", "params", "input2.as") @input3 = File.join(fixtur...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/generator_test.rb
Ruby
mit
200
master
11,697
require 'test_helper' class GeneratorTest < Test::Unit::TestCase include Sprout::TestHelper context "The Sprout::Generator" do should "identify a default set of search paths" do File.stubs(:directory?).returns true ENV['SPROUT_GENERATORS'] = Dir.pwd paths = Sprout::Generator.search_paths ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/remote_file_target_test.rb
Ruby
mit
200
master
5,024
require 'test_helper' class RemoteFileTargetTest < Test::Unit::TestCase include Sprout::TestHelper context "an improperly configured remote file target" do should "throw validation error on archive_type" do assert_raises Sprout::Errors::ValidationError do t = Sprout::RemoteFileTarget.new ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/fake_other_executable.rb
Ruby
mit
200
master
556
class CustomFakeParameter < Sprout::Executable::StringParam; end class FakeOtherExecutableTask < Sprout::Executable::Base add_param :boolean_param, Boolean add_param :custom_param, CustomFakeParameter add_param :file_param, File add_param :files_param, Files add_param :number_param, Number add_para...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/generator_generator_test.rb
Ruby
mit
200
master
2,823
require 'test_helper' require 'sprout/generators/generator/generator_generator' class GeneratorGeneratorTest < Test::Unit::TestCase include Sprout::TestHelper context "A new generator generator" do setup do @temp = File.join(fixtures, 'generators', 'tmp') FileUtils.mkdir_p @temp ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/archive_unpacker_test.rb
Ruby
mit
200
master
3,795
require 'test_helper' class ArchiveUnpackerTest < Test::Unit::TestCase include Sprout::TestHelper def setup super fixture = File.join fixtures, 'archive_unpacker' @zip_file = File.join fixture, 'zip', 'some_file.zip' @zip_folder = File.join fixture, 'zip', 'some folder.zip' @tgz_fil...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/tool_generator_test.rb
Ruby
mit
200
master
1,199
require 'test_helper' require 'sprout/generators/tool/tool_generator' class ToolGeneratorTest < Test::Unit::TestCase include Sprout::TestHelper context "A generated tool" do setup do @temp = File.join(fixtures, 'generators', 'tool') FileUtils.mkdir_p @temp @generator = Sprout::ToolGenerato...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/specification_test.rb
Ruby
mit
200
master
5,218
require 'test_helper' class SpecificationTest < Test::Unit::TestCase include Sprout::TestHelper context "a newly defined specification" do setup do @spec = Sprout::Specification.new do |s| s.version = '1.0.pre' end end should "have a default name" do assert_equal 'specificat...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/library_test.rb
Ruby
mit
200
master
2,720
require 'test_helper' class LibraryTest < Test::Unit::TestCase include Sprout::TestHelper context "a new archive library" do setup do @path = File.join fixtures, 'library', 'archive' @archive = File.join @path, 'Archive.swc' create_and_register_library :fake_archive_lib, :swc, @archive e...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
test/unit/file_target_test.rb
Ruby
mit
200
master
1,253
require 'test_helper' class FileTargetTest < Test::Unit::TestCase include Sprout::TestHelper context "a file target" do setup do @asunit_swc = 'bin/AsUnit4-4.1.pre.swc' end context "that is created with a constructor block" do should "have the provided values" do target = Sprout::...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout.rb
Ruby
mit
200
master
3,272
lib = File.expand_path File.dirname(__FILE__) $:.unshift lib unless $:.include?(lib) # External tools and std libs: require 'rake' require 'delegate' require 'logger' # Core, Process and Platform support: require 'sprout/version' require 'sprout/output_buffer' require 'sprout/progress_bar' require 'sprout/dir' requir...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/concern.rb
Ruby
mit
200
master
2,611
module Sprout ## # This class was copied from Rails source code and enhances # Ruby's native mixin functionality for our Sprout::RubyFeature. # # I'd like to work to get rid of this class, and the confusion # that it introduces. # module Concern ## # Callback handler when a class is extended....
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/dir.rb
Ruby
mit
200
master
473
class Dir ## # Return true if the directory has no children. # # Code found here: http://www.ruby-forum.com/topic/84762 def empty? Dir.glob("#{ path }/*", File::FNM_DOTMATCH) do |e| return false unless %w( . .. ).include?(File::basename(e)) end return true end ## # Return true if th...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/string.rb
Ruby
mit
200
master
321
class String # "FooBar".snake_case #=> "foo_bar" def snake_case gsub(/\B[A-Z]/, '_\&').downcase end # "foo_bar".camel_case #=> "FooBar" def camel_case str = gsub(/^[a-z]|_+[a-z]/) { |a| a.upcase } str.gsub(/_/, '') end def dash_case self.snake_case.gsub('_', '-') end end
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generator.rb
Ruby
mit
200
master
9,412
require 'sprout/generator/base' require 'sprout/generator/command' require 'sprout/generator/manifest' require 'sprout/generator/file_manifest' require 'sprout/generator/template_manifest' require 'sprout/generator/directory_manifest' module Sprout ## # # = Introduction # # Sprout Generators are command lin...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable.rb
Ruby
mit
200
master
1,332
require 'sprout/executable/param' require 'sprout/executable/collection_param' require 'sprout/executable/boolean' require 'sprout/executable/number' require 'sprout/executable/string_param' require 'sprout/executable/strings' require 'sprout/executable/file_param' require 'sprout/executable/files' require 'sprout/exec...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/test_helper.rb
Ruby
mit
200
master
12,774
## # A collection of custom assertions and helper methods # to take some of the suck out of testing functionality # that is based on Sprout features. # # Include this module into your test cases to make # testing Sprout tools easier. # # require 'sprout/test/sprout_test_helper' # # class SomeTestCase < Test::Unit::...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/remote_file_target.rb
Ruby
mit
200
master
3,550
require 'digest/md5' module Sprout class RemoteFileTarget < FileTarget attr_accessor :archive_type attr_accessor :url attr_accessor :md5 def validate super raise Sprout::Errors::ValidationError.new "RemoteFileTarget.url is a required field" if url.nil? raise Sprout::Errors::Valid...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/system.rb
Ruby
mit
200
master
882
require 'sprout/system/base_system' require 'sprout/system/unix_system' require 'sprout/system/java_system' require 'sprout/system/osx_system' require 'sprout/system/win_system' require 'sprout/system/win_nix_system' require 'sprout/system/vista_system' module Sprout module System # This is the factory that on...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/output_buffer.rb
Ruby
mit
200
master
403
module Sprout class OutputBuffer < String def initialize *args super @characters = '' end def puts msg @characters << msg end def print msg @characters << msg end def printf msg @characters << msg end def read response = @characters ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/errors.rb
Ruby
mit
200
master
2,416
module Sprout ## # A module, below which, all errors should be found. # module Errors ## # A general Sprout Error was encountered. class SproutError < StandardError; end ## # An error in the Executable was encountered. class ExecutableError < SproutError; end ## # An error in...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/process_runner.rb
Ruby
mit
200
master
5,253
module Sprout # The ProcessRunner is a cross-platform wrapper for executing # external executable processes. # # This class is typically accesses via the concrete Sprout::System # classes in order to avoid ugly branching logic in the application # layer. # # An example of this kind of usage might be: ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/version.rb
Ruby
mit
200
master
352
module Sprout NAME = 'sprout' module VERSION STRING = File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION').strip) MAJOR = STRING.split('.')[0] MINOR = STRING.split('.')[1] TINY = STRING.split('.')[2] RELEASE = STRING.split('.')[3] MAJOR_MINOR = [MAJO...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/platform.rb
Ruby
mit
200
master
1,527
module Sprout ## # Determine what environment we're in so that we # can play nice with libraries, processes, executables, etc. # class Platform ## # Returns +true+ if the current platform is some flavor of Windows. # def windows? (/cygwin|mswin|mingw|bccwin|wince|emx|vista/ =~ ruby_pla...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/library.rb
Ruby
mit
200
master
9,006
module Sprout ## # Sprout Libraries provide support for sharing and versioning raw or # pre-compiled source code across projects. # # Sprout Libraries give us the ability to include raw (or pre-compiled) source # code directly within a Ruby Gem, or to refer to an archive somewhere on # the internet. #...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/archive_unpacker.rb
Ruby
mit
200
master
8,621
require 'zip/zip' require 'sprout/version' require 'archive/tar/minitar' ## # Given a source, destination and archive type (or ability to infer it), # unpack the provided archive. # # unpacker = Sprout::ArchiveUnpacker.new # unpacker.unpack "Foo.zip", "unpacked/" # class Sprout::ArchiveUnpacker ## # Unpack th...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/ruby_feature.rb
Ruby
mit
200
master
6,179
module Sprout ## # This class represents a Feature that is written in # Ruby code that exists on the other side of the # Ruby load path. # # The idea here, is that one can +include+ the Sprout::RubyFeature # module into their concrete class, and then accept # requests to +register+ and +load+ from clie...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/remote_file_loader.rb
Ruby
mit
200
master
2,134
module Sprout ## # This class is used to load remote files from the network. class RemoteFileLoader class << self def load uri, md5=nil, display_name=nil fetch uri.to_s, display_name end private def fetch uri, display_name=nil begin return open_...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/file_target.rb
Ruby
mit
200
master
2,686
module Sprout # This is a class that is generally used by the Sprout::Specification::add_file_target method. # # File targets are files that are embedded into (or referred to by) a RubyGem in such a way # that Sprouts can use them as a library or executable. # # A given FileTarget may be configured to wor...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/progress_bar.rb
Ruby
mit
200
master
7,468
# Ruby/ProgressBar - a text progress bar library # # Copyright (C) 2001-2005 Satoru Takabayashi <satoru@namazu.org> # All rights reserved. # This is free software with ABSOLUTELY NO WARRANTY. # # You can redistribute it and/or modify it under the terms # of Ruby's license. # # Modified by Luke Bayes to support ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/command_line.rb
Ruby
mit
200
master
676
module Sprout class CommandLine < Sprout::Executable::Base ## # Get the version of the Sprout gem add_param :version, Boolean, :default => false, :hidden_value => true add_param_alias :v, :version ## # @return [IO] default $stdout, Replace value in test context. attr_accessor :logger ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/rdoc_parser.rb
Ruby
mit
200
master
2,489
require 'rdoc/rdoc' module Sprout class RDocParser def parse content end def parse_from_caller_string caller_string class_name, file_name, line_number = parse_caller_string caller_string rdoc_description_for class_name, file_name, line_number end private ## # NOTE: Don't ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/specification.rb
Ruby
mit
200
master
7,394
module Sprout ## # Sprouts provides us with the ability to distribute source files, # precompiled libraries, and remote executables. It does all of # this by (ab)using RubyGems. # # RubyGems gives us the ability to version-manage, and distribute # arbitrary text and binary payloads. # # In order t...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/system/osx_system.rb
Ruby
mit
200
master
422
module Sprout::System class OSXSystem < UnixSystem LIBRARY = 'Library' def library lib = File.join(home, LIBRARY) if(File.exists?(lib)) return lib else return super end end def format_application_name(name) return name.capitalize end def can_ex...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/system/win_nix_system.rb
Ruby
mit
200
master
804
module Sprout::System # The concrete system for Cygwin and Mingw # We can't quite treat these users like # a typical *nix system, but we can't quite # treat them like Windows users either. # # One great thing about these users, # is that we get to use real processes, # rather than the broken processes ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/system/win_system.rb
Ruby
mit
200
master
1,612
module Sprout::System # The default Windows system. # This is the system type for all # major versions and flavors of Windows # (except Cygwin and Mingw). class WinSystem < BaseSystem LOCAL_SETTINGS = "Local\ Settings" APPLICATION_DATA = "Application\ Data" def home path = super if(p...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/system/vista_system.rb
Ruby
mit
200
master
221
module Sprout::System class VistaSystem < WinSystem def find_home return env_userprofile unless env_userprofile.nil? super end def env_userprofile ENV['USERPROFILE'] end end end
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/system/base_system.rb
Ruby
mit
200
master
6,736
module Sprout::System # The abstract base class for all supported system/platform types. # In general, users are created by calling the +create+ factory method # on the +System+ module. # # System.create # # Assuming you call the create method, you should wind up with # a concrete system that ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/system/unix_system.rb
Ruby
mit
200
master
1,863
module Sprout::System class UnixSystem < BaseSystem def clean_path path return if path.nil? if(path.include? '../') path = File.expand_path path end if(path.index(' ')) return path.split(' ').join('\ ') end return path end def execute(tool, options='...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generators/library/library_generator.rb
Ruby
mit
200
master
575
module Sprout class LibraryGenerator < Generator::Base #TODO: The library generator needs to: #Create the outer folder with the input passed in as the library name if no outer folder exists #Create a lib dir and put the file generated from the library.rb template in it #Create a vendor folder ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generators/library/templates/library.gemspec
Ruby
mit
200
master
780
# -*- encoding: utf-8 -*- require File.dirname(__FILE__) + '/<%= input.snake_case %>' require 'rake' Gem::Specification.new do |s| s.name = <%= input.camel_case %>::NAME s.version = <%= input.camel_case %>::VERSION s.author = "Your Name" s.email ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generators/tool/tool_generator.rb
Ruby
mit
200
master
977
module Sprout class ToolGenerator < Generator::Base add_param :author, String, { :default => 'Unknown' } add_param :description, String, { :default => 'This is an unconfigured Sprout Tool' } add_param :email, String, { :default => 'projectsprout@googlegroups.com' } add_param :exe, String, { :d...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generators/tool/templates/tool.gemspec
Ruby
mit
200
master
710
# -*- encoding: utf-8 -*- lib = File.expand_path File.dirname(__FILE__), 'lib' $:.unshift lib unless $:.include?(lib) require 'bundler' require 'rake' require '<%= input.snake_case %>' Gem::Specification.new do |s| s.name = <%= input.camel_case %>::NAME s.version = <%= input.camel_case %>::...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generators/generator/generator_generator.rb
Ruby
mit
200
master
2,950
module Sprout class GeneratorGenerator < Generator::Base ## # The default module that classes will be added # to. add_param :namespace, String, { :default => ''} ## # The name of the folder where external libraries # will be installed. add_param :lib, String, { :default => 'lib' } ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generators/ruby/ruby_generator.rb
Ruby
mit
200
master
1,687
module Sprout class RubyGenerator < Sprout::Generator::Base ## # The 3-part version for the new Ruby application. add_param :version, String, { :default => '0.0.0.pre' } ## # The name of the 'lib' directory - where your Ruby # files will be located. add_param :lib, String, { :default => ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/collection_param.rb
Ruby
mit
200
master
2,310
module Sprout module Executable ## # Included by any parameters that represent # a collection of values, rather than a single # value. # # Should only be included by classes that # extend Sprout::Executable::Param. # # @see Sprout::Executable::Files # @see Sprout::Executabl...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/strings.rb
Ruby
mit
200
master
301
module Sprout module Executable ## # A collection of String values. # # @see Sprout::Executable::String # @see Sprout::Executable::Param # @see Sprout::Executable::CollectionParam # class Strings < Executable::Param include CollectionParam end end end
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/paths.rb
Ruby
mit
200
master
508
module Sprout module Executable ## # A collection of Paths. # # @see Sprout::Executable::Path # @see Sprout::Executable::Param # @see Sprout::Executable::CollectionParam # class Paths < Files def prepare_prerequisites value.each do |path| files = FileList[pa...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/param.rb
Ruby
mit
200
master
13,458
module Sprout module Executable ## # The abstract base class for all Executable parameters. # # This class provides a variety of template methods and general # functionality to the different executable parameter types. # # Many of these parameter attributes are exposed to Sprout::Executa...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/number.rb
Ruby
mit
200
master
202
module Sprout module Executable ## # Concrete Sprout::Executable::Param object for numeric values. # # @see Sprout::Executable::Param # class Number < Param; end end end
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/file_param.rb
Ruby
mit
200
master
1,675
module Sprout module Executable ## # Concrete Sprout::Executable::Param object for File values. # # This class is used in Sprout::Excecutable s with: # # add_param :some_name, File # # This parameter is truly special in that whatever values # are sent to the File parameter will...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/files.rb
Ruby
mit
200
master
585
module Sprout module Executable ## # Concrete param object for collections of files # # @see Sprout::Executable::FileParam # @see Sprout::Executable::Param # @see Sprout::Executable::CollectionParam # class Files < Executable::Param include CollectionParam def to_shell_v...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/url.rb
Ruby
mit
200
master
277
module Sprout module Executable ## # A parameter that represents a URL. # # @see Sprout::Executable::Param # # TODO: Should provide some custom validations for values # that should be a URL. # class Url < StringParam end end end
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/base.rb
Ruby
mit
200
master
19,162
module Sprout module Executable class Base ## # Include the Executable module so that Classes # defined within it are available to subclasses of Base. include Sprout::Executable class << self ## # +add_param+ is the workhorse of the Task. # This method is us...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/parameter_factory.rb
Ruby
mit
200
master
1,748
module Sprout::Executable ## # A factory to create concrete Sprout::Executable::Param # entities from a set of known types. # # If an unrecognized Class reference is provided # we will instantiate it and ensure that it # responds to the public members of the # Executable::Param interface. # # Thi...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/boolean.rb
Ruby
mit
200
master
1,990
module Sprout module Executable ## # Concrete Sprout::Executable::Param object for Boolean values. # # By default Boolean parameters have their value set to false and # :hidden_value set to true. This means that when they are serialized # to the shell, they will usually be represented like: ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/string_param.rb
Ruby
mit
200
master
341
module Sprout module Executable ## # A parameter with a String value. # # Any spaces in the value will be escaped when # returned to a shell. # # @see Sprout::Executable::Param # class StringParam < Executable::Param def shell_value value.gsub(/ /, '\ ') end...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/path.rb
Ruby
mit
200
master
668
module Sprout module Executable ## # Concrete Sprout::Executable::Param object for Path values. # # Path parameters will create a FileList of prerequisites by concatenating the value with # the +file_expression+ that is set on the parameter or Sprout::Executable. # # @see Sprout::Executa...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/session.rb
Ruby
mit
200
master
8,141
module Sprout::Executable ## # The Sprout::Daemon class exposes the Domain Specific Language # provided by the Sprout::Executable, along with # enhancements (and modifications) to support long-lived processes # (like FDB and FCSH). # # ## # # The Foo class extends Sprout::Daemon # class Foo < S...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/executable/urls.rb
Ruby
mit
200
master
250
module Sprout module Executable ## # Collection of URL values. # # @see Sprout::Executable::Url # @see Sprout::Executable::Param # @see Sprout::Executable::CollectionParam # class Urls < Strings end end end
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generator/directory_manifest.rb
Ruby
mit
200
master
1,369
module Sprout::Generator class DirectoryManifest < Manifest attr_reader :children attr_reader :generators def initialize super @children = [] @generators = [] end def create if !File.directory?(path) FileUtils.mkdir_p path say "Created directory: #{path}...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generator/file_manifest.rb
Ruby
mit
200
master
1,594
module Sprout::Generator class FileManifest < Manifest attr_accessor :template attr_accessor :templates def create content = resolve_template if File.exists?(path) if generator.force write_file path, content say "Replaced file: #{path}" true ...
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generator/command.rb
Ruby
mit
200
master
2,419
module Sprout::Generator class Command attr_accessor :logger attr_accessor :working_dir def initialize generator @generator = generator @working_dir = DirectoryManifest.new @working_dir.generator = generator @working_dir.path = generator....
github
lukebayes/project-sprouts
https://github.com/lukebayes/project-sprouts
lib/sprout/generator/base.rb
Ruby
mit
200
master
4,996
module Sprout module Generator class Base < Sprout::Executable::Base def self.inherited base # NOTE: We can NOT instantiate the class here, # because only it's first line has been interpreted, if we # instantiate here, none of the code declared in the class body will # be ...
github
adworse/iguvium
https://github.com/adworse/iguvium
iguvium.gemspec
Ruby
mit
200
master
1,554
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'iguvium/version' Gem::Specification.new do |spec| spec.name = 'iguvium' spec.version = Iguvium::VERSION spec.authors = ['Dima Ermilov'] spec.email ...
github
adworse/iguvium
https://github.com/adworse/iguvium
lib/iguvium.rb
Ruby
mit
200
master
4,303
# frozen_string_literal: true require 'convolver-light' require 'fileutils' require 'logger' require 'matrix' require 'oily_png' require 'pdf-reader' require 'rbconfig' require 'shellwords' require_relative 'iguvium/labeler' require_relative 'iguvium/cv' require_relative 'iguvium/image' require_relative 'iguvium/page...
github
adworse/iguvium
https://github.com/adworse/iguvium
lib/iguvium/image.rb
Ruby
mit
200
master
1,208
# frozen_string_literal: true module Iguvium # PDF to image converter class Image # Prints single page without text to .rgb file and reads it back to memory # # @param path [String] path to PDF file to be read # @param pagenumber [Integer] number of page, first page is 1, not 0 # # @option ...
github
adworse/iguvium
https://github.com/adworse/iguvium
lib/iguvium/labeler.rb
Ruby
mit
200
master
3,486
# frozen_string_literal: true module Iguvium NEIGHBORS = [[0, -1], [-1, -1], [-1, 0], [-1, 1]].freeze FLAT_THRESHOLD = 0.2 private_constant :NEIGHBORS, :FLAT_THRESHOLD # Clusterizes connected pixels using two-pass connected component labelling algorithm (Hoshen-Kopelman), # 8-connectivity is used. Line-lik...
github
adworse/iguvium
https://github.com/adworse/iguvium
lib/iguvium/cv.rb
Ruby
mit
200
master
5,306
# frozen_string_literal: true module Iguvium GAUSS = NArray[ [0.0125786, 0.0251572, 0.0314465, 0.0251572, 0.0125786], [0.0251572, 0.0566038, 0.0754717, 0.0566038, 0.0251572], [0.0314465, 0.0754717, 0.0943396, 0.0754717, 0.0314465], [0.0251572, 0.0566038, 0.0754717, 0.0566038, 0.0251572], ...
github
adworse/iguvium
https://github.com/adworse/iguvium
lib/iguvium/page.rb
Ruby
mit
200
master
3,324
# frozen_string_literal: true module Iguvium # It's document page, you can extract tables from here. to do so, use {Iguvium::Page#extract_tables!}. # # {Iguvium::Page#text} method is handy in order to pre-analyze whether you need this page. # # @example # pages = Iguvium.read('nixon.pdf', gspath: '/usr/...
github
adworse/iguvium
https://github.com/adworse/iguvium
lib/iguvium/row.rb
Ruby
mit
200
master
663
# frozen_string_literal: true module Iguvium class Row # gets characters limited by yrange and set of column ranges def initialize(columns, characters, phrases: true) @columns = columns if phrases characters = characters .sort .chunk_while { |a, b| a.mergabl...
github
adworse/iguvium
https://github.com/adworse/iguvium
lib/iguvium/table.rb
Ruby
mit
200
master
4,635
# frozen_string_literal: true module Iguvium # Represents single table from the [Iguvium::Page]: # * table outer borders aka box, # * set of detected horizontal and vertical lines to form table's grid, # * set of characters with its coordinates to fill the grid. # # Additional functionality like an option ...
github
adworse/iguvium
https://github.com/adworse/iguvium
spec/cv_spec.rb
Ruby
mit
200
master
3,739
# frozen_string_literal: true require 'rspec' RSpec.describe Iguvium::CV do subject(:cv) { Iguvium::CV.new(Iguvium::Image.read(path, page_index + 1, images: true, gspath: gspath)) } context 'auction' do let(:path) { 'spec/files/auction.pdf' } let(:page_index) { 0 } let(:gspath) do return 'gs' ...
github
adworse/iguvium
https://github.com/adworse/iguvium
spec/page_spec.rb
Ruby
mit
200
master
2,719
# frozen_string_literal: true require 'rspec' RSpec.describe Iguvium::Page do subject(:page) { Iguvium.read(path, images: true)[page_index] } context 'auction' do let(:path) { 'spec/files/auction.pdf' } let(:page_index) { 0 } let(:tables) { page.extract_tables! } it { expect(page.text).to be_a S...
github
adworse/iguvium
https://github.com/adworse/iguvium
spec/iguvium_spec.rb
Ruby
mit
200
master
430
# frozen_string_literal: true require 'rspec' RSpec.describe Iguvium do describe '.read' do subject(:pages) { Iguvium.read(path) } { './spec/files/anna.pdf' => 24, './spec/files/quote.pdf' => 2 }.each do |path, count| context path do let(:path) { path } it { expect(pa...
github
adworse/iguvium
https://github.com/adworse/iguvium
spec/spec_helper.rb
Ruby
mit
200
master
363
require "bundler/setup" require "iguvium" 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` config.disable_monkey_patching! config.expect_with :rsp...
github
adworse/iguvium
https://github.com/adworse/iguvium
spec/table_spec.rb
Ruby
mit
200
master
11,699
# frozen_string_literal: true require 'rspec' RSpec.describe Iguvium::Table do subject(:table) { Iguvium.read(path)[page_index].extract_tables![table_index] } context 'auction' do let(:path) { 'spec/files/auction.pdf' } let(:page_index) { 0 } let(:table_index) { 0 } it { expect(table.to_a(...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
Rakefile
Ruby
mit
200
master
857
# frozen_string_literal: true require "bundler/gem_tasks" require 'rake/testtask' require 'yard' require 'redcarpet' # rake test Rake::TestTask.new do |t| t.libs.push "lib" t.test_files = FileList[File.expand_path('../test/**/*_test.rb', __FILE__)] - FileList[File.expand_path('../test/**/beaneater_test.rb', _...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
beaneater.gemspec
Ruby
mit
200
master
999
# frozen_string_literal: true # -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'beaneater/version' Gem::Specification.new do |gem| gem.name = "beaneater" gem.version = Beaneater::VERSION gem.authors = ["Nico ...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
Gemfile
Ruby
mit
200
master
284
# frozen_string_literal: true source 'https://rubygems.org' # Specify your gem's dependencies in beaneater.gemspec gemspec group :development do gem 'redcarpet', '~> 1' gem 'github-markup' gem 'yard' end group :development, :test do gem 'coveralls', :require => false end
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
examples/demo.rb
Ruby
mit
200
master
1,997
# frozen_string_literal: true require 'term/ansicolor' class String; include Term::ANSIColor; end def step(msg); "\n[STEP] #{msg}...".yellow; end $:.unshift("../lib") require 'beaneater' # Establish a pool of beanstalks puts step("Connecting to Beanstalk") bc = Beaneater.new('localhost') puts bc # Print out key stat...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater.rb
Ruby
mit
200
master
1,967
# frozen_string_literal: true require 'thread' unless defined?(Mutex) %w(version configuration errors connection tube job stats).each do |f| require "beaneater/#{f}" end class Beaneater # @!attribute connection # @return <Beaneater::Connection> returns the associated connection object attr_reader :connect...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/errors.rb
Ruby
mit
200
master
3,264
# frozen_string_literal: true class Beaneater # Raises when a beanstalkd instance is no longer accessible. class NotConnected < RuntimeError; end # Raises when the tube name specified is invalid. class InvalidTubeName < RuntimeError; end # Raises when a job has not been reserved properly. class JobNotReser...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/connection.rb
Ruby
mit
200
master
8,743
# frozen_string_literal: true require 'yaml' require 'socket' class Beaneater # Represents a connection to a beanstalkd instance. class Connection # Default number of retries to send a command to a connection MAX_RETRIES = 3 # Default retry interval DEFAULT_RETRY_INTERVAL = 1 # @!attribute ...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/stats.rb
Ruby
mit
200
master
2,096
# frozen_string_literal: true require 'beaneater/stats/fast_struct' require 'beaneater/stats/stat_struct' class Beaneater # Represents stats related to the beanstalkd pool. class Stats # @!attribute client # @return [Beaneater] returns the client instance attr_reader :client # Creates new stat...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/configuration.rb
Ruby
mit
200
master
1,229
# frozen_string_literal: true class Beaneater class Configuration attr_accessor :default_put_delay # default delay value to put a job attr_accessor :default_put_pri # default priority value to put a job attr_accessor :default_put_ttr # default ttr value to put a job attr_accessor :job_parse...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/tube/record.rb
Ruby
mit
200
master
5,349
# frozen_string_literal: true class Beaneater # Beanstalk tube which contains jobs which can be inserted, reserved, et al. class Tube # @!attribute name # @return [String] name of the tube # @!attribute client # @return [Beaneater] returns the client instance attr_reader :name, :client ...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/tube/collection.rb
Ruby
mit
200
master
4,980
# frozen_string_literal: true class Beaneater # Represents collection of tube related commands. class Tubes include Enumerable # @!attribute client # @return [Beaneater] returns the client instance attr_reader :client # Creates new tubes instance. # # @param [Beaneater] client The ...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/job/record.rb
Ruby
mit
200
master
6,091
# frozen_string_literal: true class Beaneater # Represents job related commands. class Job # @!attribute id # @return [Integer] id for the job. # @!attribute body # @return [String] the job's body. # @!attribute reserved # @return [Boolean] whether the job has been reserved. # @!...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/job/collection.rb
Ruby
mit
200
master
4,707
# frozen_string_literal: true class Beaneater # Exception to stop processing jobs during a `process!` loop. # Simply `raise AbortProcessingError` in any job process handler to stop the processing loop. class AbortProcessingError < RuntimeError; end # Represents collection of job-related commands. class Jobs...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/stats/stat_struct.rb
Ruby
mit
200
master
1,244
# frozen_string_literal: true class Beaneater # Represents a stats hash with proper underscored keys class StatStruct < FasterOpenStruct # Convert a stats hash into a struct. # # @param [Hash{String => String}] hash Hash Stats hash to convert to struct # @return [Beaneater::StatStruct, nil] Stats s...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
lib/beaneater/stats/fast_struct.rb
Ruby
mit
200
master
3,412
# frozen_string_literal: true class Beaneater # # Borrowed from: # https://github.com/dolzenko/faster_open_struct/blob/master/lib/faster_open_struct.rb # # Up to 40 (!) times more memory efficient version of OpenStruct # # Differences from Ruby MRI OpenStruct: # # 1. Doesn't `dup` passed initializati...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
test/stat_struct_test.rb
Ruby
mit
200
master
1,436
# frozen_string_literal: true # test/stat_struct_test.rb require File.expand_path('../test_helper', __FILE__) describe Beaneater::StatStruct do before do @hash = { :foo => "bar", :bar => "baz", :baz => "foo", :"under-score" => "demo" } @struct = Beaneater::StatStruct.from_hash(@hash) end describe "for...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
test/jobs_test.rb
Ruby
mit
200
master
3,214
# frozen_string_literal: true # test/jobs_test.rb require File.expand_path('../test_helper', __FILE__) describe Beaneater::Jobs do before do @beanstalk = Beaneater.new('localhost') @jobs = Beaneater::Jobs.new(@beanstalk) @tube = @beanstalk.tubes.find('baz') end describe "for #find" do before d...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
test/stats_test.rb
Ruby
mit
200
master
1,219
# frozen_string_literal: true # test/stats_test.rb require File.expand_path('../test_helper', __FILE__) describe Beaneater::Stats do before do connection = stub(:transmit => { :body => { 'uptime' => 1, 'cmd-use' => 2 }, :status => "OK"}) @beanstalk = stub(:connection => connection) @stats = Beaneater::...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
test/test_helper.rb
Ruby
mit
200
master
1,018
# frozen_string_literal: true ENV["TEST"] = 'true' require 'rubygems' require 'coveralls' Coveralls.wear! require 'minitest/autorun' $:.unshift File.expand_path("../../lib") require 'beaneater' require 'timeout' begin require 'mocha/minitest' rescue LoadError require 'mocha' end require 'json' class MiniTest::Uni...
github
beanstalkd/beaneater
https://github.com/beanstalkd/beaneater
test/errors_test.rb
Ruby
mit
200
master
1,355
# frozen_string_literal: true # test/errors_test.rb require File.expand_path('../test_helper', __FILE__) describe "Beaneater::Errors" do it 'should raise proper exception for invalid status NOT_FOUND' do @klazz = Beaneater::UnexpectedResponse.from_status("NOT_FOUND", "job-stats -1") assert_kind_of(Beaneate...