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 | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | lib/debt_ceiling/analysis_caches/git_note_adapter.rb | Ruby | mit | 84 | master | 788 | module DebtCeiling
class GitNoteAdapter
NotAGitRepo = Class.new(StandardError)
attr_reader :source_control
def initialize
raise NotAGitRepo unless SourceControlSystem::Git.supported?
@source_control = SourceControlSystem::Git.create
end
def get(key)
config_note_present_on_comm... |
github | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | lib/debt_ceiling/analysis_caches/analysis_cache.rb | Ruby | mit | 84 | master | 1,586 | require_relative "git_note_adapter"
module DebtCeiling
class AnalysisCache
attr_reader :adapter
def self.commit_identifier(commit)
"debt_ceiling_#{commit}_#{config_string}"
end
def self.config_string
@config_string ||= config_hash_string + ArcheologicalDig::ARCHEOLOGY_RECORD_VERSION_NUMB... |
github | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | lib/debt_ceiling/source_control_systems/base.rb | Ruby | mit | 84 | master | 820 | require "shellwords"
#copied from rubycritic, hope/plan to augment, pull into seperate gem and PR as shared code?
module DebtCeiling
module SourceControlSystem
class Base
@@systems = []
def self.register_system
@@systems << self
end
def self.systems
@@systems
end
... |
github | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | lib/debt_ceiling/source_control_systems/mercurial.rb | Ruby | mit | 84 | master | 828 | module DebtCeiling
module SourceControlSystem
class Mercurial < Base
register_system
def self.supported?
`hg verify 2>&1` && $?.success?
end
def self.to_s
"Mercurial"
end
def revisions_count(path)
`hg log #{path.shellescape} --template '1'`.size
... |
github | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | lib/debt_ceiling/source_control_systems/double.rb | Ruby | mit | 84 | master | 518 | module DebtCeiling
module SourceControlSystem
class Double < Base
def revisions_count(_)
"N/A"
end
def date_of_last_commit(_)
nil
end
def add_note_to(ref, message)
nil
end
def read_note_on(ref)
nil
end
def travel_to_commit(r... |
github | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | lib/debt_ceiling/source_control_systems/git.rb | Ruby | mit | 84 | master | 1,930 | module DebtCeiling
module SourceControlSystem
require 'open3'
class Git < Base
register_system
def self.supported?
`git branch 2>&1` && $?.success?
end
def self.to_s
"Git"
end
def revisions_count(path)
revisions_refs(path).count
end
d... |
github | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | spec/debt_ceiling_spec.rb | Ruby | mit | 84 | master | 2,583 | require 'spec_helper'
require 'debt_ceiling'
describe DebtCeiling do
it 'has failing exit status when debt_ceiling is exceeded' do
DebtCeiling.configure {|c| c.debt_ceiling = 0 }
expect(DebtCeiling.debt_ceiling).to eq(0)
expect_any_instance_of(DebtCeiling::Audit).to receive(:fail_test)
DebtCeiling.au... |
github | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | spec/archeological_dig_spec.rb | Ruby | mit | 84 | master | 1,965 | require 'spec_helper'
require 'debt_ceiling'
COMMIT_SHA = '94f98c2'
describe DebtCeiling::ArcheologicalDig do
CONFIG_STRING = "fake_config_string"
COMMIT_SHA_MSG = "debt_ceiling_#{COMMIT_SHA}_#{CONFIG_STRING}#{described_class::ARCHEOLOGY_RECORD_VERSION_NUMBER}\n {\"debt\":100,\"failed\":false,\"commi... |
github | bglusman/debt_ceiling | https://github.com/bglusman/debt_ceiling | spec/support/long_file_example.rb | Ruby | mit | 84 | master | 218 | module LongFileExample
def ends_on_line_13
"I'm not really long but I'm longer than configured to be allowd"
"blah blah"
"that's how long this file is, supposedly, though accounts differ"
end
end |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | cocoapods_repo_svn.gemspec | Ruby | mit | 84 | master | 938 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cocoapods_repo_svn'
Gem::Specification.new do |spec|
spec.name = 'cocoapods-repo-svn'
spec.version = CocoapodsRepoSvn::VERSION
spec.authors = ['Dustin Clark']
spec.em... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | Rakefile | Ruby | mit | 84 | master | 1,537 | #-----------------------------------------------------------------------#
# Bootstrap
#-----------------------------------------------------------------------#
desc 'Initializes your working copy to run the specs'
task :bootstrap do
if system('which bundle')
title 'Installing gems'
sh 'bundle install'
else... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | Gemfile | Ruby | mit | 84 | master | 427 | source 'https://rubygems.org'
gemspec
group :development do
gem 'cocoapods', :git => 'https://github.com/CocoaPods/CocoaPods.git', :branch => 'master'
gem 'cocoapods-core', :git => 'https://github.com/CocoaPods/Core.git', :branch => 'master'
gem 'claide', :git => 'https://github.com/CocoaPods/CLAid... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | lib/cocoapods_plugin.rb | Ruby | mit | 84 | master | 1,425 | require 'pod/command/repo_svn'
require 'svn_source'
# This pre_install hook requires cocoapods v. 0.38.0.beta.2 or higher
Pod::HooksManager.register('cocoapods-repo-svn', :source_provider) do |context, options|
Pod::UI.message 'cocoapods-repo-svn received source_provider hook'
return unless sources = options['... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | lib/svn_source.rb | Ruby | mit | 84 | master | 409 | module Pod
# Subclass of Pod::Source to provide support for SVN Specs repositories
#
class SvnSource < Source
# @return [String] The remote URL of the repository
#
attr_accessor :url
# @param [String] repo The name of the repository (aka. directory name)
#
# @param [String] url see {#url}... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | lib/pod/command/repo_svn.rb | Ruby | mit | 84 | master | 648 | require 'fileutils'
require 'cocoapods_repo_svn'
module Pod
class Command
class RepoSvn < Command
require 'pod/command/repo_svn/add'
require 'pod/command/repo_svn/lint'
require 'pod/command/repo_svn/push'
require 'pod/command/repo_svn/remove'
require 'pod/command/repo_svn/update'
... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | lib/pod/command/repo_svn/update.rb | Ruby | mit | 84 | master | 3,706 | module Pod
class Command
class RepoSvn
class Update < RepoSvn
self.summary = 'Update a svn spec-repo.'
self.description = <<-DESC
Updates the checked out spec-repo `NAME`.
DESC
self.arguments = [
CLAide::Argument.new('NAME', true)
]
de... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | lib/pod/command/repo_svn/add.rb | Ruby | mit | 84 | master | 1,330 | module Pod
class Command
class RepoSvn
class Add < RepoSvn
self.summary = 'Add a spec-repo using svn.'
self.description = <<-DESC
Check out `URL` in the local spec-repos directory at `~/.cocoapods/repos/`. The
remote can later be referred to by `NAME`.
DESC
... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | lib/pod/command/repo_svn/push.rb | Ruby | mit | 84 | master | 3,415 | module Pod
class Command
class RepoSvn
class Push < RepoSvn
self.summary = 'Push a podspec'
self.description = <<-DESC
Validates `NAME.podspec` or `*.podspec` in the current working dir, creates a
directory and version folder for the pod in the local copy of ... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | lib/pod/command/repo_svn/lint.rb | Ruby | mit | 84 | master | 2,616 | module Pod
class Command
class RepoSvn
class Lint < RepoSvn
self.summary = 'Validates all specs in a repo.'
self.description = <<-DESC
Lints the spec-repo `NAME`. If a directory is provided it is assumed
to be the root of a repo. Finally, if `NAME` is not provided this
... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | spec/spec_helper.rb | Ruby | mit | 84 | master | 1,220 | ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
require 'bundler/setup'
require 'bacon'
require 'fileutils'
require 'mocha-on-bacon'
require 'pretty_bacon'
require 'cocoapods'
require 'cocoapods_plugin'
require 'spec_helper/co... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | spec/spec_helper/command.rb | Ruby | mit | 84 | master | 646 | # spec/spec_helper/command.rb
module SpecHelper
module Command
def argv(*argv)
CLAide::ARGV.new(argv)
end
def command(*argv)
argv << '--no-ansi'
Pod::Command.parse(argv)
end
def run_command(*args)
Dir.chdir(SpecHelper.temporary_directory) do
Pod::UI.output = ''
... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | spec/spec_helper/temporary_repos.rb | Ruby | mit | 84 | master | 942 | module SpecHelper
def self.tmp_repos_path
TemporaryRepos.tmp_repos_path
end
module TemporaryRepos
extend Pod::Executable
executable :svn
# ..
def make_svn_repo
return unless !File.directory?(tmp_svn_path)
`svnadmin create #{tmp_svn_path}`
`svn import #{tmp_repos_path} ... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | spec/command/repo-svn_spec.rb | Ruby | mit | 84 | master | 218 | require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Command::RepoSvn do
it 'registers itself' do
Command.parse(%w(repo-svn)).should.be.instance_of Command::RepoSvn
end
end
end |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | spec/command/repo-svn/remove_spec.rb | Ruby | mit | 84 | master | 455 | require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::RepoSvn::Remove do
it 'returns the proper command class' do
Command.parse(%w( repo-svn remove )).should.be.instance_of Command::RepoSvn::Remove
end
it 'fails without a repository name' do
comman... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | spec/command/repo-svn/update_spec.rb | Ruby | mit | 84 | master | 531 | require File.expand_path('../../../spec_helper', __FILE__)
include CLAide::InformativeError
module Pod
describe Command::RepoSvn::Update do
it 'returns the proper command class' do
Command.parse(%w( repo-svn update )).should.be.instance_of Command::RepoSvn::Update
end
it 'fails without a repositor... |
github | dustywusty/cocoapods-repo-svn | https://github.com/dustywusty/cocoapods-repo-svn | spec/command/repo-svn/add_spec.rb | Ruby | mit | 84 | master | 751 | require File.expand_path('../../../spec_helper', __FILE__)
# https://github.com/clarkda/CocoaPods/blob/master/spec/functional/command/repo/add_spec.rb
module Pod
describe Command::RepoSvn::Add do
extend SpecHelper::Command
extend SpecHelper::TemporaryRepos
it 'returns the proper command class' do
... |
github | ddollar/heroku-anvil | https://github.com/ddollar/heroku-anvil | init.rb | Ruby | mit | 84 | master | 264 | Dir[File.join(File.expand_path("../vendor", __FILE__), "*")].each do |vendor|
$:.unshift File.join(vendor, "lib")
end
require "anvil/heroku/client"
require "anvil/heroku/command/build"
require "anvil/heroku/command/release"
require "anvil/heroku/command/start" |
github | ddollar/heroku-anvil | https://github.com/ddollar/heroku-anvil | Rakefile | Ruby | mit | 84 | master | 549 | desc "Revendor"
task :revendor do
FileUtils.rm_rf File.join(root, "vendor")
vendor "anvil", "https://github.com/ddollar/anvil-cli.git"
vendor "distributor", "https://github.com/ddollar/distributor.git"
vendor "listen", "https://github.com/guard/listen.git"
vendor "progress", "https://github.com... |
github | ddollar/heroku-anvil | https://github.com/ddollar/heroku-anvil | lib/anvil/heroku/client.rb | Ruby | mit | 84 | master | 1,548 | class Heroku::Client
# valid options:
#
# slug_url: url to a slug
#
def release(app_name, description, options={}, interval = 2)
release_options = json_encode({ "description" => description }.merge(Hash[options.map{|k,v| [k.to_s, v]}]))
headers = {:content_type => :json, :accept => :json}
respons... |
github | ddollar/heroku-anvil | https://github.com/ddollar/heroku-anvil | lib/anvil/heroku/command/build.rb | Ruby | mit | 84 | master | 2,598 | require "anvil/engine"
require "cgi"
require "digest/sha2"
require "heroku/command/base"
require "net/https"
require "pathname"
require "progress"
require "tmpdir"
require "uri"
# deploy code
#
class Heroku::Command::Build < Heroku::Command::Base
# build [SOURCE]
#
# build software on an anvil build server
#
... |
github | ddollar/heroku-anvil | https://github.com/ddollar/heroku-anvil | lib/anvil/heroku/command/start.rb | Ruby | mit | 84 | master | 7,369 | require "anvil/helpers"
require "anvil/manifest"
require "distributor/client"
require "listen"
require "pathname"
# run your local code on heroku
#
class Heroku::Command::Start < Heroku::Command::Base
include Anvil::Helpers
PROTOCOL_COMMAND_HEADER = "\000\042\000"
PROTOCOL_COMMAND_EXIT = 1
# start [DIR]
... |
github | ddollar/heroku-anvil | https://github.com/ddollar/heroku-anvil | lib/anvil/heroku/command/release.rb | Ruby | mit | 84 | master | 911 | # release slugs
#
class Heroku::Command::Release < Heroku::Command::Base
# release SLUG_URL
#
# release a slug
#
# -p, --procfile PROCFILE # use an alternate Procfile to define process types
#
def index
error("Usage: heroku release SLUG_URL") unless slug_url = shift_argument
validate_arguments!
... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | nancy.gemspec | Ruby | mit | 84 | master | 785 | require File.expand_path("../lib/nancy/version", __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Guillermo Iguaran", "Jon Raphaelson"]
gem.email = ["guilleiguaran@gmail.com", "jon@accidental.cc"]
gem.description = "Sinatra's little daughter"
gem.summary = "Ruby Microframework in... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | Gemfile | Ruby | mit | 84 | master | 317 | source "https://rubygems.org"
# runtime dependencies in nancy.gemspec
gemspec
# development/test dependencies here
gem "minitest"
gem "rack-test"
gem "rake"
gem "standard", ">= 1" # rubocop ruleset
gem "rubocop"
gem "rubocop-minitest"
gem "rubocop-rake"
gem "tilt" # template renderer, used in specs and examples |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | Rakefile | Ruby | mit | 84 | master | 261 | #!/usr/bin/env rake
require "rake/testtask"
desc "run tests"
task :test do
Dir.chdir("test")
end
Rake::TestTask.new(:test) do |t|
t.libs << "../lib"
t.libs << "../test"
t.test_files = FileList["*_test.rb"]
t.verbose = false
end
task default: :test |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | lib/nancy/render.rb | Ruby | mit | 84 | master | 426 | begin
require "tilt"
rescue LoadError => e
puts "Please install tilt gem to use Nancy::Render"
raise e
end
module Nancy
module Render
def render(template, locals = {}, options = {}, &block)
templates_cache.fetch(template) {
Tilt.new(template, options)
}.render(self, locals, &block)
... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | lib/nancy/base.rb | Ruby | mit | 84 | master | 2,616 | require "forwardable"
require "mustermann"
require "rack"
module Nancy
class Base
class << self
extend Forwardable
def_delegators :builder, :map, :use
%w[GET POST PATCH PUT DELETE HEAD OPTIONS].each do |verb|
define_method(verb.downcase) do |pattern, &block|
route_set[verb] ... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | examples/app.rb | Ruby | mit | 84 | master | 1,378 | $:.push File.expand_path("../../lib", __FILE__)
require "nancy/base"
require "nancy/render"
class MiniApp < Nancy::Base
get("/") { "Hello from MiniApp" }
get("/:something") { params["something"] }
end
class App < Nancy::Base
use Rack::Runtime
use Rack::Session::Cookie, secret: ENV["SECRET"]
use Rack::Stati... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | test/use_test.rb | Ruby | mit | 84 | master | 500 | require File.expand_path("../test_helper", __FILE__)
class Reverser
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
[status, headers, [body.first.reverse]]
end
end
class HelloApp < Nancy::Base
use Reverser
get "/" do
"Hello World"
end
end
class ... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | test/basic_render_test.rb | Ruby | mit | 84 | master | 882 | require File.expand_path("../test_helper", __FILE__)
require "nancy/basic_render"
class BasicRenderTest < Minitest::Test
include Rack::Test::Methods
class TestApp < Nancy::Base
include Nancy::BasicRender
get "/view" do
@message = "Hello from view"
render("#{view_path}/view.erb")
end
... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | test/test_helper.rb | Ruby | mit | 84 | master | 296 | testdir = File.dirname(__FILE__)
$LOAD_PATH.unshift testdir unless $LOAD_PATH.include?(testdir)
libdir = File.dirname(File.dirname(__FILE__)) + "/lib"
$LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
require "rubygems"
require "nancy"
require "minitest/autorun"
require "rack/test" |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | test/map_test.rb | Ruby | mit | 84 | master | 1,147 | require File.expand_path("../test_helper", __FILE__)
class RackApp
def call(env)
[200, {"Content-Type" => "text/html"}, ["Hello from RackApp"]]
end
end
class NancyApp < Nancy::Base
get "/" do
"Hello from NancyApp"
end
end
class MainApp < Nancy::Base
get "/" do
"Hello from MainApp"
end
map ... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | test/render_test.rb | Ruby | mit | 84 | master | 1,101 | require File.expand_path("../test_helper", __FILE__)
require "nancy/render"
class RenderTest < Minitest::Test
include Rack::Test::Methods
class TestApp < Nancy::Base
include Nancy::Render
get "/view" do
@message = "Hello from view"
render("#{view_path}/view.erb")
end
get "/layout" do... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | test/base_test.rb | Ruby | mit | 84 | master | 2,381 | require File.expand_path("../test_helper", __FILE__)
require "rack/session"
require "securerandom"
class BaseTest < Minitest::Test
include Rack::Test::Methods
class TestApp < Nancy::Base
use Rack::Session::Cookie, secret: SecureRandom.hex(64)
get "/" do
"Hello World"
end
get "/hello/:name... |
github | guilleiguaran/nancy | https://github.com/guilleiguaran/nancy | test/filters_test.rb | Ruby | mit | 84 | master | 2,238 | require File.expand_path("../test_helper", __FILE__)
class FiltersTest < Minitest::Test
include Rack::Test::Methods
class TestApp < Nancy::Base
before("/protected") do
halt 401, "unauthorized"
end
before("/object/:id") do |params|
@object = params["id"]
end
before("/splat/:root/*... |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | Rakefile | Ruby | mit | 85 | master | 211 | #!/usr/bin/env rake
# frozen_string_literal: true
require 'bundler'
require 'rspec/core/rake_task'
Bundler::GemHelper.install_tasks
RSpec::Core::RakeTask.new(:spec)
task(:default).clear
task default: [:spec] |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | pronto-rubocop.gemspec | Ruby | mit | 85 | master | 1,149 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path('lib', __dir__)
require 'pronto/rubocop/version'
require 'English'
Gem::Specification.new do |s|
s.name = 'pronto-rubocop'
s.version = Pronto::RubocopVersion::VERSION
s.platform = Gem::Platform::RUBY
s.author = 'Mindaugas Mozūras'
s.email = 'min... |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | lib/pronto/rubocop.rb | Ruby | mit | 85 | master | 493 | # frozen_string_literal: true
require 'pronto'
require 'rubocop'
require 'pronto/rubocop/patch_cop'
require 'pronto/rubocop/offense_line'
module Pronto
class Rubocop < Runner
def run
return [] unless @patches
@patches
.select { |patch| patch.additions.positive? }
.flat_map { |patch|... |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | lib/pronto/rubocop/offense_line.rb | Ruby | mit | 85 | master | 3,859 | # frozen_string_literal: true
module Pronto
class Rubocop < Runner
class OffenseLine
def initialize(patch_cop, offense, line)
@patch_cop = patch_cop
@offense = offense
@line = line
end
def message
Message.new(path, line, level, message_text, nil, Pronto::Rubocop... |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | lib/pronto/rubocop/patch_cop.rb | Ruby | mit | 85 | master | 2,939 | # frozen_string_literal: true
module Pronto
class Rubocop < Runner
class PatchCop
attr_reader :runner
def initialize(patch, runner)
@patch = patch
@runner = runner
end
def messages
return [] unless valid?
offenses
.map { |offense| first_relevan... |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | spec/spec_helper.rb | Ruby | mit | 85 | master | 589 | # frozen_string_literal: true
require 'rspec'
require 'rspec/its'
require 'pronto/rubocop'
RSpec.shared_context 'test repo' do
# To make changes to the fixture repository, you can rename the `git` folder
# to `.git`, commit, and rename it back to `git`.
let(:repo_path_git) { 'spec/fixtures/test.git/git' }
let... |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | spec/pronto/rubocop_spec.rb | Ruby | mit | 85 | master | 2,909 | # frozen_string_literal: true
require 'spec_helper'
module Pronto
describe Rubocop do
let(:rubocop) { Rubocop.new(patches) }
let(:patches) { nil }
let(:pronto_config) do
instance_double Pronto::ConfigFile, to_h: config_hash
end
let(:config_hash) { {} }
before do
allow(Pronto::Co... |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | spec/pronto/rubocop/offense_line_spec.rb | Ruby | mit | 85 | master | 2,202 | # frozen_string_literal: true
require 'spec_helper'
describe Pronto::Rubocop::OffenseLine do
let(:offense_line) { described_class.new(patch_cop, offense, line) }
let(:patch_cop) { instance_double Pronto::Rubocop::PatchCop, runner: runner }
let(:runner) do
instance_double Pronto::Rubocop, pronto_rubocop_conf... |
github | prontolabs/pronto-rubocop | https://github.com/prontolabs/pronto-rubocop | spec/pronto/rubocop/patch_cop_spec.rb | Ruby | mit | 85 | master | 1,473 | # frozen_string_literal: true
require 'spec_helper'
describe Pronto::Rubocop::PatchCop do
let(:patch_cop) { described_class.new(patch, runner) }
let(:patch) do
double :patch, new_file_full_path: 'example.rb', added_lines: [line]
end
let(:line) { double :line, new_lineno: 42 }
let(:runner) { double :runn... |
github | boldtrail/delayed_job_recurring | https://github.com/boldtrail/delayed_job_recurring | delayed_job_recurring.gemspec | Ruby | mit | 84 | master | 1,025 | require 'date'
Gem::Specification.new do |s|
s.name = 'delayed_job_recurring'
s.version = '0.3.9'
s.date = Date.today.to_s
s.summary = "Recurring jobs for delayed_job"
s.description = "Extends delayed_job to support recurring jobs, including timezone support"
s.authors = ["Tony No... |
github | boldtrail/delayed_job_recurring | https://github.com/boldtrail/delayed_job_recurring | spec/spec_helper.rb | Ruby | mit | 84 | master | 255 | require 'support/db'
require 'database_cleaner'
require 'timecop'
DatabaseCleaner.strategy = :transaction
RSpec.configure do |config|
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end |
github | boldtrail/delayed_job_recurring | https://github.com/boldtrail/delayed_job_recurring | spec/support/db.rb | Ruby | mit | 84 | master | 662 | require 'active_record'
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: ':memory:',
)
connection = ActiveRecord::Base.connection
connection.create_table "delayed_jobs", force: true do |t|
t.integer "priority", default: 0
t.integer "attempts", default: 0
t.text "handler"
t... |
github | boldtrail/delayed_job_recurring | https://github.com/boldtrail/delayed_job_recurring | spec/lib/delayed/recurring_job_spec.rb | Ruby | mit | 84 | master | 14,768 | require 'spec_helper'
require 'delayed_job_recurring'
class MyTask
include ::Delayed::RecurringJob
run_every 1.day
cattr_accessor :run_count
@@run_count = 0
def display_name
"MyCoolTask"
end
def perform
@@run_count += 1
end
end
class MyTas
include ::Delayed::RecurringJob
run_every 1.d... |
github | boldtrail/delayed_job_recurring | https://github.com/boldtrail/delayed_job_recurring | lib/delayed/recurring_job.rb | Ruby | mit | 84 | master | 6,287 | #
# Delayed::RecurringJob
#
# Inspired by https://gist.github.com/ginjo/3688965
#
module Delayed
module RecurringJob
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
@@logger = Delayed::Worker.logger
cattr_reader :logger
end
end
def failure
sche... |
github | muan/emoji-cli | https://github.com/muan/emoji-cli | Rakefile | Ruby | mit | 84 | master | 1,938 | require 'fileutils'
MRUBY_VERSION="1.2.0"
file :mruby do
#sh "git clone --depth=1 https://github.com/mruby/mruby"
sh "curl -L --fail --retry 3 --retry-delay 1 https://github.com/mruby/mruby/archive/1.2.0.tar.gz -s -o - | tar zxf -"
FileUtils.mv("mruby-1.2.0", "mruby")
end
APP_NAME=ENV["APP_NAME"] || "emoji-cli... |
github | muan/emoji-cli | https://github.com/muan/emoji-cli | build_config.rb | Ruby | mit | 84 | master | 2,247 | def gem_config(conf)
#conf.gembox 'default'
# be sure to include this gem (the cli app)
conf.gem File.expand_path(File.dirname(__FILE__))
end
MRuby::Build.new do |conf|
toolchain :clang
conf.enable_bintest
conf.enable_debug
conf.enable_test
gem_config(conf)
end
MRuby::Build.new('x86_64-pc-linux-gnu... |
github | muan/emoji-cli | https://github.com/muan/emoji-cli | emojilib.rb | Ruby | mit | 84 | master | 651 | require 'json'
data = JSON.parse `curl https://raw.githubusercontent.com/muan/emojilib/master/emojis.json`
new_data = {}
data.delete('keys')
data.each do |key, val|
words = val["keywords"]
emoji = val["char"]
break if emoji.nil?
(words << key).each do |word|
word = word.downcase
if !new_data[word].nil?... |
github | muan/emoji-cli | https://github.com/muan/emoji-cli | mrbgem.rake | Ruby | mit | 84 | master | 465 | MRuby::Gem::Specification.new('emoji-cli') do |spec|
spec.license = 'MIT'
spec.author = 'Mu-An Chiou'
spec.summary = 'emoji-cli'
spec.bins = ['emoji-cli']
spec.add_dependency 'mruby-print', :core => 'mruby-print'
spec.add_dependency 'mruby-mtest', :mgem => 'mruby-mtest'
spec.add_dependency 'mruby-ran... |
github | muan/emoji-cli | https://github.com/muan/emoji-cli | mrblib/emoji-cli.rb | Ruby | mit | 84 | master | 1,033 | def __main__(argv)
if argv[1] == "version"
puts "v#{EmojiCli::VERSION}"
else
if result = search(argv[1])
# copy emoji and notify
emoji = choose(result, argv.select{|arg| ["-r", "--random"].include? arg }.any?)
copy emoji
puts "Copied #{emoji} !"
else
puts "Emoji not found �... |
github | muan/emoji-cli | https://github.com/muan/emoji-cli | mrblib/emoji-cli/data.rb | Ruby | mit | 84 | master | 58,683 | # Generate/update with `ruby emojilib.rb`
module EmojiCli
DATA = {"face"=>["😀", "😁", "😂", "😃", "😄", "😅", "😆", "😇", "😉", "😊", "☺️", "😋", "😌", "😍", "😎", "😏", "😑", "😓", "😔", "😕", "😖", "😗", "😘", "😙", "😚", "😛", "😜", "😝", "😞", "😟", "😠", "😢", "😣", "😤", "😥", "😦", "😧", "😨", "😩", "😪", "😬... |
github | muan/emoji-cli | https://github.com/muan/emoji-cli | test/test_emoji-cli.rb | Ruby | mit | 84 | master | 344 | class TestEmojiCli < MTest::Unit::TestCase
def test_search
assert_equal search("poop"), ["💩"]
end
def test_choose
assert_equal choose(["💩"], false), "💩"
assert_block "when random is on just return a random one" do
["💩", "🎉"].include? choose(["💩", "🎉"], true)
end
end
end
MTest::Uni... |
github | muan/emoji-cli | https://github.com/muan/emoji-cli | bintest/emoji-cli.rb | Ruby | mit | 84 | master | 495 | BIN_PATH = File.join(File.dirname(__FILE__), "../mruby/bin/emoji-cli")
# Set up display for xclip
fork do
`Xvfb :1 2>&1 >/dev/null`
end
assert('version') do
output = `#{BIN_PATH} version`
assert_include output, "v0.0.3"
end
assert('poop') do
# Process hangs mysteriously, this is a workaround
pid = fork do
... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | Gemfile | Ruby | mit | 84 | master | 205 | source 'https://rubygems.org'
gemspec
group :development, :test do
gem 'byebug'
gem 'rspec'
end
group :test do
gem 'childprocess'
gem 'rspec_junit_formatter'
gem 'nokogiri'
gem 'fuubar'
end |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | paraspec.gemspec | Ruby | mit | 84 | master | 888 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "paraspec"
s.version = "0.0.3"
s.platform = Gem::Platform::RUBY
s.license = "MIT"
s.authors = ["Oleg Pudeyev"]
s.email = "oleg@olegp.name"
s.homepage = "https://github.com/paraspec/paraspec"
s.summary = ... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | spec/integration_spec.rb | Ruby | mit | 84 | master | 12,433 | require 'spec_helper'
require 'nokogiri'
describe 'Integration tests' do
context 'with concurrency 1' do
context 'single file test suite' do
let(:result) { run_paraspec_in_fixture('one-file-suite', '-c', '1') }
it 'succeeds' do
result.exit_code.should == 0
result.output.should includ... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | spec/spec_helper.rb | Ruby | mit | 84 | master | 1,318 | #$: << 'lib'
require 'ostruct'
require 'tempfile'
require 'childprocess'
require 'byebug'
module Macros
end
module Helpers
class ProcessWrapper
def initialize(process)
@process = process
end
attr_reader :process
def pid
process.pid
end
def wait
process.wait
proces... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec.rb | Ruby | mit | 84 | master | 744 | autoload :YAML, 'yaml'
autoload :Byebug, 'byebug'
require 'paraspec/rspec_patches'
require 'paraspec/version'
require 'paraspec/errors'
require 'paraspec/logger'
require 'paraspec/ipc'
require 'paraspec/drb_helpers'
require 'paraspec/process_helpers'
require 'paraspec/supervisor'
require 'paraspec/master'
require 'par... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/worker.rb | Ruby | mit | 84 | master | 4,272 | module Paraspec
# A worker process obtains a test to run from the master, runs the
# test and reports the results, as well as any output, back to the master,
# then obtains the next test to run and so on.
# There can be one or more workers participating in a test run.
# A worker generally loads all of the tes... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/drb_helpers.rb | Ruby | mit | 84 | master | 1,976 | require 'timeout'
module Paraspec
module DrbHelpers
WAIT_TIME = 500
=begin
class TimeoutWrapper < BasicObject
def initialize(target, timeout)
@target, @timeout = target, timeout
end
def method_missing(m, *args)
::Timeout.timeout(@timeout) do
@target.send(m, *args... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/supervisor.rb | Ruby | mit | 84 | master | 5,455 | module Paraspec
# Supervisor is the process that spawns all other processes.
# Its primary responsibility is to be a "clean slate", specifically
# the supervisor should not ever have any of the tests loaded in its
# address space.
class Supervisor
include DrbHelpers
include ProcessHelpers
def ini... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/worker_runner.rb | Ruby | mit | 84 | master | 3,322 | module Paraspec
# An RSpec test runner - in a worker process.
# This runner collects results and output and forwards them to the
# master process via DRb.
class WorkerRunner
def initialize(options={})
@master_client = options[:master_client]
# TODO capture stdout & stderr
class << STDERR
... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/msgpack_server.rb | Ruby | mit | 84 | master | 1,886 | require 'benchmark'
require 'msgpack'
require 'socket'
module Paraspec
class MsgpackServer
include MsgpackHelpers
def initialize(master)
@master = master
@lock = Mutex.new
end
def run
@socket = ::TCPServer.new('127.0.0.1', Paraspec::Ipc.master_app_port)
begin
while t... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/process_helpers.rb | Ruby | mit | 84 | master | 556 | module Paraspec
module ProcessHelpers
def kill_child_processes
# Only kill if we are in supervisor
return unless Process.pid == Process.getpgrp
child_pids = `pgrep -g #{$$}`
if $?.exitstatus != 0
warn "Failed to run pgrep (#{$?.exitstatus})"
end
child_pids = child_pids... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/msgpack_client.rb | Ruby | mit | 84 | master | 1,261 | require 'msgpack'
require 'socket'
module Paraspec
class MsgpackClient
include MsgpackHelpers
def initialize(options={})
@terminal = options[:terminal]
connect
end
def request(action, payload=nil)
req = {action: action, payload: payload, id: request_id}
Paraspec.logger.debu... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/ipc.rb | Ruby | mit | 84 | master | 520 | require 'hashie'
require 'socket'
module Paraspec
class IpcHash < Hash
include Hashie::Extensions::IndifferentAccess
end
module Ipc
class << self
def pick_master_app_port
port = 10000 + rand(40000)
begin
server = TCPServer.new('127.0.0.1', port)
server.close
... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/logger.rb | Ruby | mit | 84 | master | 899 | require 'logger'
module Paraspec
class LoggerWrapper
def initialize(logger)
@logger = logger
end
def method_missing(m, *args)
@logger.send(m, *args)
end
%w(ipc state perf).each do |subsystem|
define_method "log_#{subsystem}=" do |v|
@subsystems ||= {}
@subsyste... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/master_runner.rb | Ruby | mit | 84 | master | 201 | module Paraspec
# An RSpec test runner - in a master process.
# This runner queues the tests to run instead of running them.
# Worker processes then run the tests.
class MasterRunner
end
end |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/http_client.rb | Ruby | mit | 84 | master | 1,084 | require 'faraday'
require 'json'
module Paraspec
class HttpClient
def initialize(options={})
@terminal = options[:terminal]
@client = Faraday.new(url: "http://localhost:#{Paraspec::Ipc.master_app_port}") do |client|
client.adapter :net_http
if @terminal
client.options.timeo... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/master.rb | Ruby | mit | 84 | master | 7,084 | module Paraspec
# The master process has three responsibilities:
# 1. Load all tests and abort the run if there are errors outside of
# examples.
# 2. Maintain the queue of tests to feed the workers. The master
# process also synchronizes access to this queue.
# 3. Aggregate test reports from the work... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/worker_formatter.rb | Ruby | mit | 84 | master | 2,482 | require 'rspec/core'
module Paraspec
class WorkerFormatter
RSpec::Core::Formatters.register self,
#:start,
:example_group_started,
:example_started,
:example_passed,
:example_failed,
:example_pending,
:message,
#:stop,
:start_dump,
:dump_pending,
... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/rspec_facade.rb | Ruby | mit | 84 | master | 1,436 | require 'forwardable'
require 'singleton'
module Paraspec
class RSpecFacade
include Singleton
class << self
extend Forwardable
def_delegators :instance, :queueable_example_groups, :all_example_groups, :all_examples
end
def queueable_example_groups
@queueable_example_groups ||= beg... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/errors.rb | Ruby | mit | 84 | master | 587 | module Paraspec
# Base class for all Paraspec errors
class Error < StandardError; end
# Paraspec configuration error
class ConfigurationError < Error; end
# Different set of examples between master and a worker
class InconsistentTestSuite < Error; end
# A worker process exited with non-zero status
cl... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/rspec_patches.rb | Ruby | mit | 84 | master | 567 | require 'rspec/core'
class RSpec::Core::Configuration
# https://github.com/rspec/rspec-core/commit/e7bb36342b8a3aca2512a0335ea9836780a60605
# Will probably add a flag to configuration to load default_path
# regardless of $0
def command
'rspec'
end
end
class RSpec::Core::World
# https://github.com/rspe... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/http_server.rb | Ruby | mit | 84 | master | 528 | require 'sinatra'
module Paraspec
class HttpServer < Sinatra::Base
post '/:action' do
action = params[:action]
body = request.body.read
if body.empty?
args = []
else
payload = JSON.parse(body)
payload = IpcHash.new.merge(payload)
args = [payload]
end
... |
github | paraspec/paraspec | https://github.com/paraspec/paraspec | lib/paraspec/msgpack_helpers.rb | Ruby | mit | 84 | master | 1,175 | require 'time'
module Paraspec
module MsgpackHelpers
def packer(io)
pk = MessagePack::Packer.new(io)
pk.register_type(1, Time) do |time|
time.to_s
end
pk.register_type(2, RSpec::Core::Example::ExecutionResult) do |er|
serialized = {}
%w(started_at finished_at run_... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | activerecord-postgres-array.gemspec | Ruby | isc | 84 | master | 924 | Gem::Specification.new do |s|
s.name = "activerecord-postgres-array"
s.version = "0.0.10"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Tim Connor"]
s.date = %q{2012-02-08}
s.description = "Adds support for postgres arrays to ActiveRec... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | Rakefile | Ruby | isc | 84 | master | 268 | #!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
Bundler::GemHelper.install_tasks
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
task :default => :spec |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | lib/activerecord-postgres-array.rb | Ruby | isc | 84 | master | 450 | if defined? Rails
class ActiveRecordPostgresArray < Rails::Railtie
initializer 'activerecord-postgres-array' do
ActiveSupport.on_load :active_record do
require "activerecord-postgres-array/activerecord"
end
end
end
else
ActiveSupport.on_load :active_record do
require "activerecor... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | lib/activerecord-postgres-array/activerecord.rb | Ruby | isc | 84 | master | 4,582 | require 'active_record/connection_adapters/postgresql_adapter'
module ActiveRecord
class ArrayTypeMismatch < ActiveRecord::ActiveRecordError
end
class Base
def arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys)
attrs = {}
... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | lib/activerecord-postgres-array/string.rb | Ruby | isc | 84 | master | 1,516 | class String
def to_postgres_array
self
end
# Validates the array format. Valid formats are:
# * An empty string
# * A string like '{10000, 10000, 10000, 10000}'
# * TODO A multi dimensional array string like '{{"meeting", "lunch"}, {"training", "presentation"}}'
def valid_postgres_array?
string_... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | lib/activerecord-postgres-array/array.rb | Ruby | isc | 84 | master | 838 | class Array
# Generates a single quoted postgres array string format. This is the format used
# to insert or update stuff in the database.
def to_postgres_array(omit_quotes = false)
result = "#{omit_quotes ? '' : "'" }{"
result << collect do |value|
if value.is_a?(Array)
value.to_postgres_a... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | spec/array_ext_spec.rb | Ruby | isc | 84 | master | 922 | require 'spec_helper'
require 'activerecord-postgres-array/array'
describe "Array" do
describe "#to_postgres_array" do
it "returns '{}' if used on an empty array" do
[].to_postgres_array.should == "'{}'"
end
it "returns a correct array if used on a numerical array" do
[1,2,3].to_postgres_arr... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | spec/integration_spec.rb | Ruby | isc | 84 | master | 4,473 | require 'spec_helper'
describe Article do
describe ".create" do
it "builds valid arrays" do
article = Article.create(:languages => ["English", "German"], :author_ids => [1,2,3])
article.reload
article.languages_before_type_cast.should == "{English,German}"
article.languages.should == ["En... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | spec/string_ext_spec.rb | Ruby | isc | 84 | master | 3,428 | require 'spec_helper'
require 'activerecord-postgres-array/string'
describe "String" do
describe "#valid_postgres_array?" do
it 'returns true for an empty string' do
"".should be_valid_postgres_array
end
it 'returns true for a string consisting only of whitespace' do
" ".should be_valid_po... |
github | tlconnor/activerecord-postgres-array | https://github.com/tlconnor/activerecord-postgres-array | spec/spec_helper.rb | Ruby | isc | 84 | master | 327 | require 'rubygems'
require 'bundler'
require 'active_support/dependencies'
Bundler.require :default, :development
Combustion.initialize! :active_record
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :foc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.