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
github-linguist/linguist
https://github.com/github-linguist/linguist
test/test_language.rb
Ruby
mit
13,437
main
22,018
require_relative "./helper" class TestLanguage < Minitest::Test include Linguist def test_find_by_alias assert_equal Language['ASP.NET'], Language.find_by_alias('aspx') assert_equal Language['ASP.NET'], Language.find_by_alias('aspx-vb') assert_equal Language['ActionScript'], Language.find_by_alias('as...
github
github-linguist/linguist
https://github.com/github-linguist/linguist
samples/Ruby/formula.rb
Ruby
mit
13,437
main
20,210
require 'download_strategy' require 'dependencies' require 'formula_support' require 'hardware' require 'bottles' require 'extend/fileutils' require 'patches' require 'compilers' # Derive and define at least @url, see Library/Formula for examples class Formula include FileUtils attr_reader :name, :path, :url, :ve...
github
github-linguist/linguist
https://github.com/github-linguist/linguist
samples/Ruby/resque.rb
Ruby
mit
13,437
main
10,939
require 'redis/namespace' require 'resque/version' require 'resque/errors' require 'resque/failure' require 'resque/failure/base' require 'resque/helpers' require 'resque/stat' require 'resque/job' require 'resque/worker' require 'resque/plugin' require 'resque/queue' require 'resque/multi_queue' require 'resque/co...
github
github-linguist/linguist
https://github.com/github-linguist/linguist
samples/Ruby/inflector.rb
Ruby
mit
13,437
main
12,344
# encoding: utf-8 require 'active_support/inflector/inflections' module ActiveSupport # The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without, # and class names to foreign keys. The default inflections for pluralization, singularization, and un...
github
github-linguist/linguist
https://github.com/github-linguist/linguist
samples/Ruby/jekyll.rb
Ruby
mit
13,437
main
3,847
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed # Require all of the Ruby files in the given directory. # # path - The String relative path from here to the directory. # # Returns nothing. def require_all(path) glob = File.join(File.dirname(__FILE__), path, '*.rb') Dir[glob].each do |f...
github
github-linguist/linguist
https://github.com/github-linguist/linguist
samples/Ruby/racc.rb
Ruby
mit
13,437
main
5,296
# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.7 # from Racc grammer file "". # require 'racc/parser.rb' module RJSON class Parser < Racc::Parser require 'rjson/handler' attr_reader :handler def initialize tokenizer, handler = Handler.new @tokenizer = tokenizer @handler ...
github
github-linguist/linguist
https://github.com/github-linguist/linguist
samples/Ruby/sinatra.rb
Ruby
mit
13,437
main
58,261
# external dependencies require 'rack' require 'tilt' require "rack/protection" # stdlib dependencies require 'thread' require 'time' require 'uri' # other files we need require 'sinatra/showexceptions' require 'sinatra/version' module Sinatra # The request object. See Rack::Request for more info: # http://rack....
github
github-linguist/linguist
https://github.com/github-linguist/linguist
samples/Ruby/filenames/Dangerfile
Ruby
mit
13,437
main
3,376
# Sometimes its a README fix, or something like that - which isn't relevant for # including in a CHANGELOG for example # From https://github.com/danger/danger/blob/master/Dangerfile has_app_changes = !git.modified_files.grep(/lib/).empty? has_test_changes = !git.modified_files.grep(/spec/).empty? is_version_bump = git...
github
github-linguist/linguist
https://github.com/github-linguist/linguist
samples/Ruby/filenames/Podfile
Ruby
mit
13,437
main
400
source 'https://github.com/CocoaPods/Specs.git' platform :ios, :deployment_target => '6.0' inhibit_all_warnings! xcodeproj 'Wikipedia' pod 'AFNetworking/NSURLConnection', '~> 2.5' pod 'hpple', '~> 0.2' pod 'blockskit/Core', '~> 2.2' pod 'Masonry', '~> 0.6' pod 'HockeySDK', '3.6.2' target 'WikipediaUnitTests', :exc...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
capistrano.gemspec
Ruby
mit
12,944
master
1,458
# -*- encoding: utf-8 -*- lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "capistrano/version" Gem::Specification.new do |gem| gem.name = "capistrano" gem.version = Capistrano::VERSION gem.authors = ["Tom Clements", "Lee Hambley"] ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
Rakefile
Ruby
mit
12,944
master
551
require "bundler/gem_tasks" require "rspec/core/rake_task" begin require "rubocop/rake_task" desc "Run RuboCop checks" RuboCop::RakeTask.new task default: %i(spec rubocop) rescue LoadError task default: :spec end RSpec::Core::RakeTask.new begin require "cucumber/rake/task" Cucumber::Rake::Task.new(:fea...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/spec_helper.rb
Ruby
mit
12,944
master
824
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib")) $LOAD_PATH.unshift(File.dirname(__FILE__)) require "capistrano/all" require "rspec" require "mocha/api" require "time" # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. Dir['#{File.dirname(__FILE_...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/application_spec.rb
Ruby
mit
12,944
master
1,900
require "spec_helper" describe Capistrano::Application do it "provides a --trace option which enables SSHKit/NetSSH trace output" it "provides a --format option which enables the choice of output formatting" it "displays documentation URL as help banner", capture_io: true do flags "--help", "-h" expect...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/immutable_task_spec.rb
Ruby
mit
12,944
master
805
require "spec_helper" require "rake" require "capistrano/immutable_task" module Capistrano describe ImmutableTask do after do # Ensure that any tasks we create in these tests don't pollute other tests Rake::Task.clear end it "prints warning and raises when task is enhanced" do extend(R...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/dsl_spec.rb
Ruby
mit
12,944
master
2,901
require "spec_helper" module Capistrano class DummyDSL include DSL end # see also - spec/integration/dsl_spec.rb describe DSL do let(:dsl) { DummyDSL.new } describe "#t" do before do I18n.expects(:t).with(:phrase, count: 2, scope: :capistrano) end it "delegates to I18n"...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration_spec.rb
Ruby
mit
12,944
master
10,122
require "spec_helper" module Capistrano describe Configuration do let(:config) { Configuration.new } let(:servers) { stub } describe ".new" do it "accepts initial hash" do configuration = described_class.new(custom: "value") expect(configuration.fetch(:custom)).to eq("value") ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/version_validator_spec.rb
Ruby
mit
12,944
master
2,874
require "spec_helper" module Capistrano describe VersionValidator do let(:validator) { VersionValidator.new(version) } let(:version) { stub } describe "#new" do it "takes a version" do expect(validator) end end describe "#verify" do let(:current_version) { "3.0.1" } ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/scm_spec.rb
Ruby
mit
12,944
master
2,409
require "spec_helper" require "capistrano/scm" module RaiseNotImplementedMacro def raise_not_implemented_on(method) it "should raise NotImplemented on #{method}" do expect do subject.send(method) end.to raise_error(NotImplementedError) end end end RSpec.configure do include RaiseNot...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/plugin_spec.rb
Ruby
mit
12,944
master
2,225
require "spec_helper" require "capistrano/plugin" module Capistrano describe Plugin do include Rake::DSL include Capistrano::DSL class DummyPlugin < Capistrano::Plugin def define_tasks task :hello do end end def register_hooks before "deploy:published", "hello"...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/upload_task_spec.rb
Ruby
mit
12,944
master
569
require "spec_helper" describe Capistrano::UploadTask do let(:app) { Rake.application = Rake::Application.new } subject(:upload_task) { described_class.define_task("path/file.yml") } it { is_expected.to be_a(Rake::FileCreationTask) } it { is_expected.to be_needed } context "inside namespace" do let(:n...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/dsl/task_enhancements_spec.rb
Ruby
mit
12,944
master
3,183
require "spec_helper" module Capistrano class DummyTaskEnhancements include TaskEnhancements end describe TaskEnhancements do let(:task_enhancements) { DummyTaskEnhancements.new } describe "ordering" do after do task.clear before_task.clear after_task.clear Rak...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/dsl/paths_spec.rb
Ruby
mit
12,944
master
5,648
require "spec_helper" describe Capistrano::DSL::Paths do let(:dsl) { Class.new.extend Capistrano::DSL } let(:parent) { Pathname.new("/var/shared") } let(:paths) { Class.new.extend Capistrano::DSL::Paths } let(:linked_dirs) { %w{log public/system} } let(:linked_files) { %w{config/database.yml log/my.log log/...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/scm/hg_spec.rb
Ruby
mit
12,944
master
3,254
require "spec_helper" require "capistrano/scm/hg" module Capistrano describe SCM::Hg do subject { Capistrano::SCM::Hg.new } # This allows us to easily use `set`, `fetch`, etc. in the examples. let(:env) { Capistrano::Configuration.env } # Stub the SSHKit backend so we can set up expectations witho...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/scm/svn_spec.rb
Ruby
mit
12,944
master
4,518
require "spec_helper" require "capistrano/scm/svn" module Capistrano describe SCM::Svn do subject { Capistrano::SCM::Svn.new } # This allows us to easily use `set`, `fetch`, etc. in the examples. let(:env) { Capistrano::Configuration.env } # Stub the SSHKit backend so we can set up expectations wi...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/scm/git_spec.rb
Ruby
mit
12,944
master
6,412
require "spec_helper" require "capistrano/scm/git" module Capistrano describe SCM::Git do subject { Capistrano::SCM::Git.new } # This allows us to easily use `set`, `fetch`, etc. in the examples. let(:env) { Capistrano::Configuration.env } # Stub the SSHKit backend so we can set up expectations wi...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/doctor/environment_doctor_spec.rb
Ruby
mit
12,944
master
1,227
require "spec_helper" require "capistrano/doctor/environment_doctor" module Capistrano module Doctor describe EnvironmentDoctor do let(:doc) { EnvironmentDoctor.new } it "prints using 4-space indentation" do expect { doc.call }.to output(/^ {4}/).to_stdout end it "prints the Rub...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/doctor/servers_doctor_spec.rb
Ruby
mit
12,944
master
2,629
require "spec_helper" require "capistrano/doctor/servers_doctor" module Capistrano module Doctor describe ServersDoctor do include Capistrano::DSL let(:doc) { ServersDoctor.new } before { Capistrano::Configuration.reset! } after { Capistrano::Configuration.reset! } it "prints usin...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/doctor/output_helpers_spec.rb
Ruby
mit
12,944
master
1,366
require "spec_helper" require "capistrano/doctor/output_helpers" module Capistrano module Doctor describe OutputHelpers do include OutputHelpers # Force color for the purpose of these tests before { ENV.stubs(:[]).with("SSHKIT_COLOR").returns("1") } it "prints titles in blue with newlin...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/doctor/gems_doctor_spec.rb
Ruby
mit
12,944
master
1,960
require "spec_helper" require "capistrano/doctor/gems_doctor" require "airbrussh/version" require "sshkit/version" require "net/ssh/version" module Capistrano module Doctor describe GemsDoctor do let(:doc) { GemsDoctor.new } it "prints using 4-space indentation" do expect { doc.call }.to out...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/doctor/variables_doctor_spec.rb
Ruby
mit
12,944
master
2,817
require "spec_helper" require "capistrano/doctor/variables_doctor" module Capistrano module Doctor describe VariablesDoctor do include Capistrano::DSL let(:doc) { VariablesDoctor.new } before do set :branch, "master" set :pty, false env.variables.untrusted! do ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/scm_resolver_spec.rb
Ruby
mit
12,944
master
1,442
require "spec_helper" require "capistrano/scm" module Capistrano class Configuration describe SCMResolver do include Capistrano::DSL let(:resolver) { SCMResolver.new } before do Rake::Task.define_task("deploy:check") Rake::Task.define_task("deploy:new_release_path") Ra...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/filter_spec.rb
Ruby
mit
12,944
master
3,506
require "spec_helper" module Capistrano class Configuration describe Filter do let(:available) do [ Server.new("server1").add_roles(%i(web db)), Server.new("server2").add_role(:web), Server.new("server3").add_role(:redis), Server.new("server4").add_role(:db),...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/host_filter_spec.rb
Ruby
mit
12,944
master
2,268
require "spec_helper" module Capistrano class Configuration describe HostFilter do subject(:host_filter) { HostFilter.new(values) } let(:available) do [Server.new("server1"), Server.new("server2"), Server.new("server3"), Server.new("server4"), Server.new("...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/empty_filter_spec.rb
Ruby
mit
12,944
master
348
require "spec_helper" module Capistrano class Configuration describe EmptyFilter do subject(:empty_filter) { EmptyFilter.new } describe "#filter" do let(:servers) { mock("servers") } it "returns an empty array" do expect(empty_filter.filter(servers)).to eq([]) end ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/server_spec.rb
Ruby
mit
12,944
master
8,955
require "spec_helper" module Capistrano class Configuration describe Server do let(:server) { Server.new("root@hostname:1234") } describe "adding a role" do subject { server.add_role(:test) } it "adds the role" do expect { subject }.to change { server.roles.size }.from(0).t...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/plugin_installer_spec.rb
Ruby
mit
12,944
master
2,508
require "spec_helper" require "capistrano/plugin" require "capistrano/scm/plugin" module Capistrano class Configuration class ExamplePlugin < Capistrano::Plugin def set_defaults set_if_empty :example_variable, "foo" end def define_tasks task :example task :example_prere...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/role_filter_spec.rb
Ruby
mit
12,944
master
2,567
require "spec_helper" module Capistrano class Configuration describe RoleFilter do subject(:role_filter) { RoleFilter.new(values) } let(:available) do [ Server.new("server1").add_roles(%i(web db)), Server.new("server2").add_role(:web), Server.new("server3").add_...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/null_filter_spec.rb
Ruby
mit
12,944
master
369
require "spec_helper" module Capistrano class Configuration describe NullFilter do subject(:null_filter) { NullFilter.new } describe "#filter" do let(:servers) { mock("servers") } it "returns the servers passed in as arguments" do expect(null_filter.filter(servers)).to eq(...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/question_spec.rb
Ruby
mit
12,944
master
3,081
require "spec_helper" module Capistrano class Configuration describe Question do let(:question) { Question.new(key, default, stdin: stdin) } let(:question_without_echo) { Question.new(key, default, echo: false, stdin: stdin) } let(:question_without_default) { Question.new(key, nil, stdin: stdin...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/lib/capistrano/configuration/servers_spec.rb
Ruby
mit
12,944
master
12,434
require "spec_helper" module Capistrano class Configuration describe Servers do let(:servers) { Servers.new } describe "adding a role" do it "adds two new server instances" do expect { servers.add_role(:app, %w{1 2}) } .to change { servers.count }.from(0).to(2) ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/integration/dsl_spec.rb
Ruby
mit
12,944
master
20,919
require "spec_helper" describe Capistrano::DSL do let(:dsl) { Class.new.extend Capistrano::DSL } before do Capistrano::Configuration.reset! end describe "setting and fetching hosts" do describe "when defining a host using the `server` syntax" do before do dsl.server "example1.com", role...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/support/test_app.rb
Ruby
mit
12,944
master
4,334
require "English" require "fileutils" require "pathname" require "open3" module TestApp extend self def install install_test_app_with(default_config) end def default_config <<-CONFIG set :deploy_to, '#{deploy_to}' set :repo_url, 'https://github.com/capistrano/capistrano.git' set :br...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/support/tasks/root.rake
Ruby
mit
12,944
master
223
task :am_i_root do on roles(:all) do |host| host.user = "root" ident = capture :id, "-a" info "I am #{ident}" end on roles(:all) do |_host| ident = capture :id, "-a" info "I am #{ident}" end end
github
capistrano/capistrano
https://github.com/capistrano/capistrano
spec/support/tasks/database.rake
Ruby
mit
12,944
master
232
namespace :deploy do namespace :check do task linked_files: "config/database.yml" end end remote_file "config/database.yml" => "/tmp/database.yml", :roles => :all file "/tmp/database.yml" do |t| sh "touch #{t.name}" end
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/dsl.rb
Ruby
mit
12,944
master
3,218
require "capistrano/dsl/task_enhancements" require "capistrano/dsl/paths" require "capistrano/dsl/stages" require "capistrano/dsl/env" require "capistrano/configuration/filter" module Capistrano module DSL include TaskEnhancements include Env include Paths include Stages def invoke(task_name, *a...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/doctor.rb
Ruby
mit
12,944
master
232
require "capistrano/doctor/environment_doctor" require "capistrano/doctor/gems_doctor" require "capistrano/doctor/variables_doctor" require "capistrano/doctor/servers_doctor" load File.expand_path("../tasks/doctor.rake", __FILE__)
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/scm.rb
Ruby
mit
12,944
master
2,810
module Capistrano # Base class for SCM strategy providers. # # @abstract # # @attr_reader [Rake] context # # @author Hartog de Mik # class SCM attr_reader :context # Provide a wrapper for the SCM that loads a strategy for the user. # # @param [Rake] context The context in which th...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/i18n.rb
Ruby
mit
12,944
master
2,069
require "i18n" en = { starting: "Starting", capified: "Capified", start: "Start", update: "Update", finalize: "Finalise", finishing: "Finishing", finished: "Finished", stage_not_set: "Stage not set, please call something such as `cap production deploy`, where production is a stage you have defined.", ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/defaults.rb
Ruby
mit
12,944
master
1,235
validate :application do |_key, value| changed_value = value.gsub(/[^A-Z0-9\.\-]/i, "_") if value != changed_value warn %Q(The :application value "#{value}" is invalid!) warn "Use only letters, numbers, hyphens, dots, and underscores. For example:" warn " set :application, '#{changed_value}'" raise...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/setup.rb
Ruby
mit
12,944
master
951
require "capistrano/doctor" require "capistrano/immutable_task" include Capistrano::DSL namespace :load do task :defaults do load "capistrano/defaults.rb" end end require "airbrussh/capistrano" # We don't need to show the "using Airbrussh" banner announcement since # Airbrussh is now the built-in formatter. A...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/all.rb
Ruby
mit
12,944
master
352
require "rake" require "sshkit" require "io/console" Rake.application.options.trace = true require "capistrano/version" require "capistrano/version_validator" require "capistrano/i18n" require "capistrano/dsl" require "capistrano/application" require "capistrano/configuration" require "capistrano/configuration/scm_r...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration.rb
Ruby
mit
12,944
master
4,918
require_relative "configuration/filter" require_relative "configuration/question" require_relative "configuration/plugin_installer" require_relative "configuration/server" require_relative "configuration/servers" require_relative "configuration/validated_variables" require_relative "configuration/variables" module Cap...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/version_validator.rb
Ruby
mit
12,944
master
528
module Capistrano class VersionValidator def initialize(version) @version = version end def verify return self if match? raise "Capfile locked at #{version}, but #{current_version} is loaded" end private attr_reader :version def match? available =~ requested ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/application.rb
Ruby
mit
12,944
master
4,112
module Capistrano class Application < Rake::Application def initialize super @rakefiles = %w{capfile Capfile capfile.rb Capfile.rb} end def name "cap" end def run Rake.application = self super end def sort_options(options) not_applicable_to_capistrano...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/plugin.rb
Ruby
mit
12,944
master
2,925
require "capistrano/all" require "rake/tasklib" # IMPORTANT: The Capistrano::Plugin system is not yet considered a stable, # public API, and is subject to change without notice. Eventually it will be # officially documented and supported, but for now, use it at your own risk. # # Base class for Capistrano plugins. Mak...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/immutable_task.rb
Ruby
mit
12,944
master
964
module Capistrano # This module extends a Rake::Task to freeze it to prevent it from being # enhanced. This is used to prevent users from enhancing a task at the wrong # point of Capistrano's boot process, which can happen if a Capistrano plugin # is loaded in deploy.rb by mistake (instead of in the Capfile). ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/proc_helpers.rb
Ruby
mit
12,944
master
449
module Capistrano module ProcHelpers module_function # Tests whether the given object appears to respond to `call` with # zero parameters. In Capistrano, such a proc is used to represent a # "deferred value". That is, a value that is resolved by invoking `call` at # the time it is first needed. ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/scm/svn.rb
Ruby
mit
12,944
master
1,604
require "capistrano/scm/plugin" class Capistrano::SCM::Svn < Capistrano::SCM::Plugin def register_hooks after "deploy:new_release_path", "svn:create_release" before "deploy:check", "svn:check" before "deploy:set_current_revision", "svn:set_current_revision" end def define_tasks eval_rakefile Fil...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/scm/git.rb
Ruby
mit
12,944
master
3,066
require "capistrano/scm/plugin" require "cgi" require "securerandom" require "shellwords" require "stringio" require "uri" class Capistrano::SCM::Git < Capistrano::SCM::Plugin def set_defaults set_if_empty :git_shallow_clone, false set_if_empty :git_wrapper_path, lambda { # Use a unique name that won't...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/scm/plugin.rb
Ruby
mit
12,944
master
423
require "capistrano/plugin" require "capistrano/scm" # Base class for all built-in and third-party SCM plugins. Notice that this # class doesn't really do anything other than provide an `scm?` predicate. This # tells Capistrano that the plugin provides SCM functionality. All other plugin # features are inherited from ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/scm/hg.rb
Ruby
mit
12,944
master
1,379
require "capistrano/scm/plugin" require "securerandom" class Capistrano::SCM::Hg < Capistrano::SCM::Plugin def register_hooks after "deploy:new_release_path", "hg:create_release" before "deploy:check", "hg:check" before "deploy:set_current_revision", "hg:set_current_revision" end def define_tasks ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/scm/tasks/svn.rake
Ruby
mit
12,944
master
1,185
# TODO: this is nearly identical to git.rake. DRY up? # This trick lets us access the Svn plugin within `on` blocks. svn_plugin = self namespace :svn do desc "Check that the repo is reachable" task :check do on release_roles :all do svn_plugin.check_repo_is_reachable end end desc "Clone the rep...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/scm/tasks/hg.rake
Ruby
mit
12,944
master
1,174
# TODO: this is nearly identical to git.rake. DRY up? # This trick lets us access the Hg plugin within `on` blocks. hg_plugin = self namespace :hg do desc "Check that the repo is reachable" task :check do on release_roles :all do hg_plugin.check_repo_is_reachable end end desc "Clone the repo to...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/scm/tasks/git.rake
Ruby
mit
12,944
master
3,129
# This trick lets us access the Git plugin within `on` blocks. git_plugin = self namespace :git do desc "Upload the git wrapper script, this script guarantees that we can script git without getting an interactive prompt" task :wrapper do on release_roles(:all), in: :groups, limit: fetch(:git_max_concurrent_con...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/server.rb
Ruby
mit
12,944
master
2,829
require "set" module Capistrano class Configuration class Server < SSHKit::Host extend Forwardable def_delegators :properties, :roles, :fetch, :set def self.[](host) host.is_a?(Server) ? host : new(host) end def add_roles(roles) Array(roles).each { |role| add_role(r...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/plugin_installer.rb
Ruby
mit
12,944
master
1,612
# Encapsulates the logic for installing plugins into Capistrano. Plugins must # simply conform to a basic API; the PluginInstaller takes care of invoking the # API at appropriate times. # # This class is not used directly; instead it is typically accessed via the # `install_plugin` method of the Capistrano DSL. # modul...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/host_filter.rb
Ruby
mit
12,944
master
695
module Capistrano class Configuration class HostFilter def initialize(values) av = Array(values).dup av = av.flat_map { |v| v.is_a?(String) && v =~ /^(?<name>[-A-Za-z0-9.]+)(,\g<name>)*$/ ? v.split(",") : v } @rex = regex_matcher(av) end def filter(servers) Array...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/servers.rb
Ruby
mit
12,944
master
2,198
require "set" require "capistrano/configuration" require "capistrano/configuration/filter" module Capistrano class Configuration class Servers include Enumerable def add_host(host, properties={}) new_host = Server[host] new_host.port = properties[:port] if properties.key?(:port) ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/role_filter.rb
Ruby
mit
12,944
master
683
module Capistrano class Configuration class RoleFilter def initialize(values) av = Array(values).dup av = av.flat_map { |v| v.is_a?(String) ? v.split(",") : v } @rex = regex_matcher(av) end def filter(servers) Array(servers).select { |s| s.is_a?(String) ? false :...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/validated_variables.rb
Ruby
mit
12,944
master
3,526
require "capistrano/proc_helpers" require "delegate" module Capistrano class Configuration # Decorates a Variables object to additionally perform an optional set of # user-supplied validation rules. Each rule for a given key is invoked # immediately whenever `set` is called with a value for that key. ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/question.rb
Ruby
mit
12,944
master
1,590
module Capistrano class Configuration class Question def initialize(key, default, options={}) @key = key @default = default @options = options end def call ask_question value_or_default end private attr_reader :key, :default, :options ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/scm_resolver.rb
Ruby
mit
12,944
master
4,727
module Capistrano class Configuration # In earlier versions of Capistrano, users would specify the desired SCM # implementation using `set :scm, :git`, for example. Capistrano would then # load the matching .rb file based on this variable. # # Now we expect users to explicitly `require` and call `...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/filter.rb
Ruby
mit
12,944
master
865
require "capistrano/configuration" require "capistrano/configuration/empty_filter" require "capistrano/configuration/host_filter" require "capistrano/configuration/null_filter" require "capistrano/configuration/role_filter" module Capistrano class Configuration class Filter def initialize(type, values=nil)...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/configuration/variables.rb
Ruby
mit
12,944
master
2,912
require "capistrano/proc_helpers" module Capistrano class Configuration # Holds the variables assigned at Capistrano runtime via `set` and retrieved # with `fetch`. Does internal bookkeeping to help identify user mistakes # like spelling errors or unused variables that may lead to unexpected # behavi...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/templates/Capfile
Ruby
mit
12,944
master
1,102
# Load DSL and set up stages require "capistrano/setup" # Include default deployment tasks require "capistrano/deploy" # Load the SCM plugin appropriate to your project: # # require "capistrano/scm/hg" # install_plugin Capistrano::SCM::Hg # or # require "capistrano/scm/svn" # install_plugin Capistrano::SCM::Svn # or ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/tasks/console.rake
Ruby
mit
12,944
master
486
desc "Execute remote commands" task :console do stage = fetch(:stage) puts I18n.t("console.welcome", scope: :capistrano, stage: stage) loop do print "#{stage}> " command = (input = $stdin.gets) ? input.chomp : "exit" next if command.empty? if %w{quit exit q}.include? command puts t("conso...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/tasks/doctor.rake
Ruby
mit
12,944
master
675
desc "Display a Capistrano troubleshooting report (all doctor: tasks)" task doctor: ["doctor:environment", "doctor:gems", "doctor:variables", "doctor:servers"] namespace :doctor do desc "Display Ruby environment details" task :environment do Capistrano::Doctor::EnvironmentDoctor.new.call end desc "Display...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/tasks/install.rake
Ruby
mit
12,944
master
1,299
require "erb" require "pathname" desc "Install Capistrano, cap install STAGES=staging,production" task :install do envs = ENV["STAGES"] || "staging,production" tasks_dir = Pathname.new("lib/capistrano/tasks") config_dir = Pathname.new("config") deploy_dir = config_dir.join("deploy") deploy_rb = File.expand_...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/tasks/deploy.rake
Ruby
mit
12,944
master
8,275
namespace :deploy do task :starting do invoke "deploy:print_config_variables" if fetch(:print_config_variables, false) invoke "deploy:check" invoke "deploy:set_previous_revision" invoke "deploy:set_previous_revision_time" end task :print_config_variables do puts puts "------- Printing cur...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/tasks/framework.rake
Ruby
mit
12,944
master
1,196
namespace :deploy do desc "Start a deployment, make sure server(s) ready." task :starting do end desc "Started" task :started do end desc "Update server(s) by setting up a new release." task :updating do end desc "Updated" task :updated do end desc "Revert server(s) to previous release." ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/dsl/stages.rb
Ruby
mit
12,944
master
730
module Capistrano module DSL module Stages RESERVED_NAMES = %w(deploy doctor install).freeze private_constant :RESERVED_NAMES def stages names = Dir[stage_definitions].map { |f| File.basename(f, ".rb") } assert_valid_stage_names(names) names end def stage_de...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/dsl/task_enhancements.rb
Ruby
mit
12,944
master
1,584
require "capistrano/upload_task" module Capistrano module TaskEnhancements def before(task, prerequisite, *args, &block) prerequisite = Rake::Task.define_task(prerequisite, *args, &block) if block_given? Rake::Task[task].enhance [prerequisite] end def after(task, post_task, *args, &block) ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/dsl/env.rb
Ruby
mit
12,944
master
1,037
require "forwardable" module Capistrano module DSL module Env extend Forwardable def_delegators :env, :configure_backend, :fetch, :set, :set_if_empty, :delete, :ask, :role, :server, :primary, :validate, :append, :remove, :dry_run?, :insta...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/dsl/paths.rb
Ruby
mit
12,944
master
1,908
require "pathname" module Capistrano module DSL module Paths def deploy_to fetch(:deploy_to) end def deploy_path Pathname.new(deploy_to) end def current_path deploy_path.join(fetch(:current_directory, "current")) end def releases_path de...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/doctor/gems_doctor.rb
Ruby
mit
12,944
master
1,193
require "capistrano/doctor/output_helpers" module Capistrano module Doctor # Prints table of all Capistrano-related gems and their version numbers. If # there is a newer version of a gem available, call attention to it. class GemsDoctor include Capistrano::Doctor::OutputHelpers def call ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/doctor/servers_doctor.rb
Ruby
mit
12,944
master
2,507
require "capistrano/doctor/output_helpers" module Capistrano module Doctor class ServersDoctor include Capistrano::Doctor::OutputHelpers def initialize(env=Capistrano::Configuration.env) @servers = env.servers.to_a end def call title("Servers (#{servers.size})") ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/doctor/variables_doctor.rb
Ruby
mit
12,944
master
1,930
require "capistrano/doctor/output_helpers" module Capistrano module Doctor # Prints a table of all Capistrano variables and their current values. If # there are unrecognized variables, print warnings for them. class VariablesDoctor # These are keys that are recognized by Capistrano, but do not have...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/doctor/output_helpers.rb
Ruby
mit
12,944
master
2,266
module Capistrano module Doctor # Helper methods for pretty-printing doctor output to stdout. All output # (other than `title`) is indented by four spaces to facilitate copying and # pasting this output into e.g. GitHub or Stack Overflow to achieve code # formatting. module OutputHelpers cla...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
lib/capistrano/doctor/environment_doctor.rb
Ruby
mit
12,944
master
480
require "capistrano/doctor/output_helpers" module Capistrano module Doctor class EnvironmentDoctor include Capistrano::Doctor::OutputHelpers def call title("Environment") puts <<-OUT.gsub(/^\s+/, "") Ruby #{RUBY_DESCRIPTION} Rubygems #{Gem::VERSION} ...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
features/step_definitions/assertions.rb
Ruby
mit
12,944
master
5,058
require "shellwords" Then(/^references in the remote repo are listed$/) do expect(@output).to include("refs/heads/master") end Then(/^git wrapper permissions are 0700$/) do permissions_test = %Q([ $(stat -c "%a" #{TestApp.git_wrapper_path_glob}) == "700" ]) expect { run_remote_ssh_command(permissions_test) }.no...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
features/step_definitions/setup.rb
Ruby
mit
12,944
master
2,696
Given(/^a test app with the default configuration$/) do TestApp.install end Given(/^a test app without any configuration$/) do TestApp.create_test_app end Given(/^servers with the roles app and web$/) do start_ssh_server wait_for_ssh_server end Given(/^a linked file "(.*?)"$/) do |file| # ignoring other li...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
features/step_definitions/cap_commands.rb
Ruby
mit
12,944
master
602
When(/^I run cap "(.*?)"$/) do |task| @success, @output = TestApp.cap(task) end When(/^I run cap "(.*?)" within the "(.*?)" directory$/) do |task, directory| @success, @output = TestApp.cap(task, directory) end When(/^I run cap "(.*?)" as part of a release$/) do |task| TestApp.cap("deploy:new_release_path #{tas...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
features/support/remote_ssh_helpers.rb
Ruby
mit
12,944
master
749
require "open3" require "socket" require_relative "docker_gateway" module RemoteSSHHelpers extend self class RemoteSSHCommandError < RuntimeError; end def start_ssh_server docker_gateway.start end def wait_for_ssh_server(retries=3) Socket.tcp("localhost", 2022, connect_timeout: 1).close rescue E...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
features/support/docker_gateway.rb
Ruby
mit
12,944
master
1,208
# Ensure Docker container is completely stopped when Ruby exits. at_exit do DockerGateway.new.stop end # Manages the Docker-based SSH server that is declared in docker-compose.yml. class DockerGateway def initialize(log_proc=$stderr.method(:puts)) @log_proc = log_proc end def start run_compose_command...
github
capistrano/capistrano
https://github.com/capistrano/capistrano
features/support/remote_command_helpers.rb
Ruby
mit
12,944
master
539
module RemoteCommandHelpers def test_dir_exists(path) exists?("d", path) end def test_symlink_exists(path) exists?("L", path) end def test_file_exists(path) exists?("f", path) end def exists?(type, path) %Q{[[ -#{type} "#{path}" ]]} end def symlinked?(symlink_path, target_path) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
rubocop.gemspec
Ruby
mit
12,856
master
1,966
# frozen_string_literal: true require_relative 'lib/rubocop/version' Gem::Specification.new do |s| s.name = 'rubocop' s.version = RuboCop::Version::STRING s.platform = Gem::Platform::RUBY s.required_ruby_version = '>= 2.7.0' s.authors = ['Bozhidar Batsov', 'Jonas Arvidsson', 'Yuji Nakayama'] s.description...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
Rakefile
Ruby
mit
12,856
master
3,298
# frozen_string_literal: true # For code coverage measurements to work properly, `SimpleCov` should be loaded # and started before any application code is loaded. require 'simplecov' if ENV['COVERAGE'] desc 'Check for no pending changelog entries before release' task release: 'changelog:check_clean' # Before task is ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
Gemfile
Ruby
mit
12,856
master
940
# frozen_string_literal: true source 'https://rubygems.org' gemspec gem 'asciidoctor' gem 'bump', require: false gem 'fiddle', platform: :windows if RUBY_VERSION >= '3.4' gem 'irb' gem 'mcp', '>= 0.9.2', '<= 1.0' gem 'memory_profiler', '!= 1.0.2', platform: :mri gem 'rake', '~> 13.0' gem 'rspec', '~> 3.7' gem 'ruboc...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/project_spec.rb
Ruby
mit
12,856
master
13,500
# frozen_string_literal: true RSpec.describe 'RuboCop Project', type: :feature do let(:cop_names) do RuboCop::Cop::Registry .global .without_department(:InternalAffairs) .reject { |cop| cop.cop_name.start_with?('Test/') } .map(&:cop_name) end version_regexp = /\A\d+\.\d+\z|\A<<next>>...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/spec_helper.rb
Ruby
mit
12,856
master
2,220
# frozen_string_literal: true # Disable colors in specs require 'rainbow' Rainbow.enabled = false require_relative 'support/strict_warnings' StrictWarnings.enable! require 'rubocop' require 'rubocop/cop/internal_affairs' require 'rubocop/server' require 'webmock/rspec' require_relative 'core_ext/string' begin r...