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
ankane/chartkick
https://github.com/ankane/chartkick
lib/chartkick.rb
Ruby
mit
6,526
master
563
# stdlib require "erb" require "json" # modules require_relative "chartkick/core_ext" require_relative "chartkick/helper" require_relative "chartkick/utils" require_relative "chartkick/version" # integrations require_relative "chartkick/engine" if defined?(Rails) require_relative "chartkick/sinatra" if defined?(Sinat...
github
ankane/chartkick
https://github.com/ankane/chartkick
lib/chartkick/utils.rb
Ruby
mit
6,526
master
852
module Chartkick module Utils # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_merge.rb def self.deep_merge(hash_a, hash_b) hash_a = hash_a.dup hash_b.each_pair do |k, v| tv = hash_a[k] hash_a[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? de...
github
ankane/chartkick
https://github.com/ankane/chartkick
lib/chartkick/core_ext.rb
Ruby
mit
6,526
master
528
# for both multiple series and # making sure hash order is preserved in JavaScript class Array def chart_json map do |v| if v.is_a?(Hash) && v[:data].is_a?(Hash) v = v.dup v[:data] = v[:data].to_a end v end.to_json end end class Hash def chart_json if (key = keys.fi...
github
ankane/chartkick
https://github.com/ankane/chartkick
lib/chartkick/helper.rb
Ruby
mit
6,526
master
4,929
module Chartkick module Helper def line_chart(data_source, **options) chartkick_chart "LineChart", data_source, **options end def pie_chart(data_source, **options) chartkick_chart "PieChart", data_source, **options end def column_chart(data_source, **options) chartkick_chart "C...
github
ankane/chartkick
https://github.com/ankane/chartkick
lib/chartkick/engine.rb
Ruby
mit
6,526
master
363
module Chartkick class Engine < ::Rails::Engine # for assets # for importmap initializer "chartkick.importmap" do |app| if app.config.respond_to?(:assets) && defined?(Importmap) && defined?(Sprockets) app.config.assets.precompile << "chartkick.js" app.config.assets.precompile << "Ch...
github
ankane/chartkick
https://github.com/ankane/chartkick
test/chartkick_test.rb
Ruby
mit
6,526
master
4,977
require_relative "test_helper" class ChartkickTest < Minitest::Test include Chartkick::Helper def setup @data = [[34, 42], [56, 49]] @content_for = {} end def test_line_chart assert_chart line_chart(@data) end def test_pie_chart assert_chart pie_chart(@data) end def test_column_char...
github
guard/guard
https://github.com/guard/guard
guard.gemspec
Ruby
mit
6,479
master
1,534
# frozen_string_literal: true $LOAD_PATH.push File.expand_path("lib", __dir__) require "guard/version" Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength s.name = "guard" s.version = Guard::VERSION s.platform = Gem::Platform::RUBY s.license = "MIT" s.authors = ["Thibaud Guillaume-Gentil"] ...
github
guard/guard
https://github.com/guard/guard
Rakefile
Ruby
mit
6,479
master
1,696
# frozen_string_literal: true require "nenv" require "bundler/gem_tasks" require "tasks/releaser" default_tasks = [] require "rspec/core/rake_task" default_tasks << RSpec::Core::RakeTask.new(:spec) do |t| t.verbose = Nenv.ci? end require "guard/rake_task" unless defined?(JRUBY_VERSION) Guard::RakeTask.new(:gu...
github
guard/guard
https://github.com/guard/guard
config/Guardfile
Ruby
mit
6,479
master
1,530
scope(groups: %w(specs)) directories %w(bin spec lib config features man) watch ("config/Guardfile") { UI.info "Exiting guard because config changed"; exit 0 } group :specs, halt_on_fail: true do guard :rspec, cmd: "bundle exec rspec", failed_mode: :keep do require "guard/rspec/dsl" dsl = Guard::RSpec::Dsl...
github
guard/guard
https://github.com/guard/guard
Gemfile
Ruby
mit
6,479
master
1,262
# frozen_string_literal: true source "https://rubygems.org" gemspec unless ENV["USE_INSTALLED_GUARD"] == "1" gem "rake" # The development group will not be # installed on Travis CI. group :development do # See http://help.houndci.com/en/articles/2461415-supported-linters. gem "rubocop", "0.83.0", require: fals...
github
guard/guard
https://github.com/guard/guard
lib/tasks/releaser.rb
Ruby
mit
6,479
master
2,982
# frozen_string_literal: true # TODO: extract to gem? # @private class Releaser def initialize(options = {}) @project_name = options.delete(:project_name) do fail "project_name is needed!" end @gem_name = options.delete(:gem_name) do fail "gem_name is needed!" end @github_repo = op...
github
guard/guard
https://github.com/guard/guard
lib/guard/interactor.rb
Ruby
mit
6,479
master
1,220
# frozen_string_literal: true require "forwardable" require "guard/jobs/pry_wrapper" require "guard/jobs/sleep" module Guard # @private class Interactor attr_reader :interactive # Initializes the interactor. This configures # Pry and creates some custom commands and aliases # for Guard. # ...
github
guard/guard
https://github.com/guard/guard
lib/guard/watcher.rb
Ruby
mit
6,479
master
2,659
# frozen_string_literal: true require "guard/ui" require "guard/watcher/pattern" require "guard/watcher/pattern/match_result" module Guard # The watcher defines a RegExp that will be matched against file system # modifications. # When a watcher matches a change, an optional action block is executed to # enabl...
github
guard/guard
https://github.com/guard/guard
lib/guard/config.rb
Ruby
mit
6,479
master
352
# frozen_string_literal: true require "nenv" module Guard config_class = Nenv::Builder.build do create_method(:strict?) create_method(:gem_silence_deprecations?) end # @private class Config < config_class def initialize super "guard" end def silence_deprecations? gem_silence_...
github
guard/guard
https://github.com/guard/guard
lib/guard/engine.rb
Ruby
mit
6,479
master
9,367
# frozen_string_literal: true require "forwardable" require "listen" require "guard/dsl_describer" require "guard/guardfile/evaluator" require "guard/interactor" require "guard/internals/helpers" require "guard/internals/queue" require "guard/internals/session" require "guard/internals/traps" require "guard/notifier"...
github
guard/guard
https://github.com/guard/guard
lib/guard/plugin_util.rb
Ruby
mit
6,479
master
4,770
# frozen_string_literal: true require "guard/guardfile/evaluator" require "guard/plugin" require "guard/ui" module Guard # @private # This class contains useful methods to: # # * Fetch all the Guard plugins names; # * Initialize a plugin, get its location; # * Return its class name; # * Add its template...
github
guard/guard
https://github.com/guard/guard
lib/guard/ui.rb
Ruby
mit
6,479
master
8,777
# frozen_string_literal: true require "guard/ui/colors" require "guard/ui/config" require "guard/ui/logger_config" require "guard/terminal" require "forwardable" # TODO: rework this class from the bottom-up # - remove dependency on Session # - extract into a separate gem # - change UI to class module Guard # Th...
github
guard/guard
https://github.com/guard/guard
lib/guard/dsl_describer.rb
Ruby
mit
6,479
master
4,148
# frozen_string_literal: true require "formatador" require "guard/ui" require "guard/notifier" require "guard/plugin_util" require "set" module Guard # @private # The DslDescriber evaluates the Guardfile and creates an internal structure # of it that is used in some inspection utility methods like the CLI com...
github
guard/guard
https://github.com/guard/guard
lib/guard/terminal.rb
Ruby
mit
6,479
master
340
# frozen_string_literal: true require "shellany/sheller" module Guard # @private class Terminal class << self def clear cmd = Gem.win_platform? ? "cls" : "printf '\33c\e[3J';" stat, _, stderr = Shellany::Sheller.system(cmd) fail Errno::ENOENT, stderr unless stat.success? en...
github
guard/guard
https://github.com/guard/guard
lib/guard/notifier.rb
Ruby
mit
6,479
master
1,726
# frozen_string_literal: true require "notiffany/notifier" require "guard/ui" module Guard module Notifier # @private def self.connect(options = {}) @notifier ||= nil fail "Already connected!" if @notifier begin opts = options.merge(namespace: "guard", logger: UI) @notifie...
github
guard/guard
https://github.com/guard/guard
lib/guard/test_helpers.rb
Ruby
mit
6,479
master
1,893
# frozen_string_literal: true require "guard/engine" module Guard # @private module TestHelpers extend self def self.plugin_options { engine: Engine.new } end class Template class Session class MultipleGuardNotImplemented < RuntimeError def message "mult...
github
guard/guard
https://github.com/guard/guard
lib/guard/plugin.rb
Ruby
mit
6,479
master
9,875
# frozen_string_literal: true require "guard/internals/groups" require "guard/ui" module Guard # Base class from which every Guard plugin implementation must inherit. # # Guard will trigger the {#start}, {#stop}, {#reload}, {#run_all} and # {#run_on_changes} ({#run_on_additions}, {#run_on_modifications} and ...
github
guard/guard
https://github.com/guard/guard
lib/guard/dsl.rb
Ruby
mit
6,479
master
13,547
# frozen_string_literal: true require "guard/guardfile/result" require "guard/ui" require "guard/watcher" module Guard # @private # The Dsl class provides the methods that are used in each `Guardfile` to # describe the behaviour of Guard. # # The main keywords of the DSL are {#guard} and {#watch}. These are...
github
guard/guard
https://github.com/guard/guard
lib/guard/rake_task.rb
Ruby
mit
6,479
master
938
#!/usr/bin/env ruby # frozen_string_literal: true require "rake" require "rake/tasklib" require "guard/cli" module Guard # Provides a method to define a Rake task that # runs the Guard plugins. # class RakeTask < ::Rake::TaskLib # Name of the main, top level task attr_accessor :name # CLI option...
github
guard/guard
https://github.com/guard/guard
lib/guard/cli.rb
Ruby
mit
6,479
master
6,069
# frozen_string_literal: true require "thor" require "guard/cli/environments/read_only" require "guard/cli/environments/write" require "guard/dsl_describer" require "guard/engine" require "guard/version" module Guard # Facade for the Guard command line interface managed by # [Thor](https://github.com/wycats/thor...
github
guard/guard
https://github.com/guard/guard
lib/guard/options.rb
Ruby
mit
6,479
master
667
# frozen_string_literal: true require "thor/core_ext/hash_with_indifferent_access" module Guard # @private # A class that holds options. Can be instantiated with default options. # class Options < Thor::CoreExt::HashWithIndifferentAccess # Initializes an Guard::Options object. `default_opts` is merged int...
github
guard/guard
https://github.com/guard/guard
lib/guard/group.rb
Ruby
mit
6,479
master
1,854
# frozen_string_literal: true module Guard # A group of Guard plugins. There are two reasons why you want to group your # Guard plugins: # # * You can start only certain groups from the command line by passing the # `--group` option to `guard start`. # * Abort task execution chain on failure within a gro...
github
guard/guard
https://github.com/guard/guard
lib/guard/runner.rb
Ruby
mit
6,479
master
4,406
# frozen_string_literal: true require "lumberjack" require "guard/ui" require "guard/watcher" module Guard # @private # The runner is responsible for running all methods defined on each plugin. # class Runner def initialize(session) @session = session @plugins = session.plugins end #...
github
guard/guard
https://github.com/guard/guard
lib/guard/internals/session.rb
Ruby
mit
6,479
master
6,459
# frozen_string_literal: true require "guard/options" require "guard/internals/debugging" require "guard/internals/plugins" require "guard/internals/groups" module Guard # @private api module Internals # TODO: split into a commandline class and session (plugins, groups) # TODO: swap session and metadata ...
github
guard/guard
https://github.com/guard/guard
lib/guard/internals/tracing.rb
Ruby
mit
6,479
master
961
# frozen_string_literal: true module Guard module Internals module Tracing def self.trace(mod, meth) meta = (class << mod; self; end) original_meth = "original_#{meth}".to_sym if mod.respond_to?(original_meth) fail "ALREADY TRACED: #{mod}.#{meth}" end met...
github
guard/guard
https://github.com/guard/guard
lib/guard/internals/queue.rb
Ruby
mit
6,479
master
1,132
# frozen_string_literal: true require "forwardable" module Guard module Internals class Queue extend Forwardable delegate :<< => :queue def initialize(engine, runner) @engine = engine @runner = runner @queue = ::Queue.new end # Process the change queue, r...
github
guard/guard
https://github.com/guard/guard
lib/guard/internals/plugins.rb
Ruby
mit
6,479
master
1,287
# frozen_string_literal: true require "guard/plugin_util" module Guard # @private api module Internals class Plugins def initialize @plugins = [] end def add(name, options) PluginUtil.new(name).initialize_plugin(options).tap do |plugin| @plugins << plugin e...
github
guard/guard
https://github.com/guard/guard
lib/guard/internals/traps.rb
Ruby
mit
6,479
master
230
# frozen_string_literal: true module Guard module Internals module Traps def self.handle(signal, &block) return unless Signal.list.key?(signal) Signal.trap(signal, &block) end end end end
github
guard/guard
https://github.com/guard/guard
lib/guard/internals/groups.rb
Ruby
mit
6,479
master
1,142
# frozen_string_literal: true require "forwardable" require "guard/group" module Guard # @private api module Internals class Groups extend Forwardable DEFAULT_GROUP = :default def initialize @groups = [Group.new(DEFAULT_GROUP)] end delegate each: :all def all(f...
github
guard/guard
https://github.com/guard/guard
lib/guard/internals/helpers.rb
Ruby
mit
6,479
master
395
# frozen_string_literal: true module Guard # @private api module Internals module Helpers def _relative_pathnames(paths) paths.map { |path| _relative_pathname(path) } end def _relative_pathname(path) full_path = Pathname(path) full_path.relative_path_from(Pathname.pwd...
github
guard/guard
https://github.com/guard/guard
lib/guard/internals/debugging.rb
Ruby
mit
6,479
master
1,515
# frozen_string_literal: true # Because it's used by Sheller require "open3" require "logger" require "guard/internals/tracing" require "guard/ui" module Guard # @private api module Internals class Debugging class << self TRACES = [ [Kernel, :system], [Kernel, :spawn], ...
github
guard/guard
https://github.com/guard/guard
lib/guard/guardfile/result.rb
Ruby
mit
6,479
master
1,832
# frozen_string_literal: true require "guard/internals/groups" module Guard module Guardfile # This class is responsible for storing the result of the Guardfile evaluation. # # @see Guard::Dsl # class Result attr_accessor :clearing def plugin_names plugins.map(&:first).map(&...
github
guard/guard
https://github.com/guard/guard
lib/guard/guardfile/evaluator.rb
Ruby
mit
6,479
master
3,588
# frozen_string_literal: true require "guard/dsl" require "guard/ui" module Guard module Guardfile # This class is responsible for evaluating the Guardfile. It delegates to # Guard::Dsl for the actual objects generation from the Guardfile content. # # @see Guard::Dsl # class Evaluator ...
github
guard/guard
https://github.com/guard/guard
lib/guard/guardfile/generator.rb
Ruby
mit
6,479
master
3,002
# frozen_string_literal: true require "guard/plugin_util" require "guard/ui" module Guard module Guardfile # This class is responsible for generating the Guardfile and adding Guard' # plugins' templates into it. # # @see Guard::CLI # class Generator # @private INFO_TEMPLATE_ADDED...
github
guard/guard
https://github.com/guard/guard
lib/guard/templates/Guardfile
Ruby
mit
6,479
master
661
# frozen_string_literal: true # A sample Guardfile # More info at https://github.com/guard/guard#readme ## Uncomment and set this to only include directories you want to watch # directories %w(app lib config test spec features) \ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")} ## Note:...
github
guard/guard
https://github.com/guard/guard
lib/guard/cli/environments/read_only.rb
Ruby
mit
6,479
master
963
# frozen_string_literal: true require "guard/cli/environments/base" require "guard/dsl" require "guard/engine" require "guard/guardfile/evaluator" require "guard/ui" module Guard module Cli module Environments class ReadOnly < Base def evaluate(evaluator: Guardfile::Evaluator.new(options)) ...
github
guard/guard
https://github.com/guard/guard
lib/guard/cli/environments/base.rb
Ruby
mit
6,479
master
1,223
# frozen_string_literal: true require "guard/ui" module Guard module Cli module Environments class Base # Initialize a new Guard::Cli::Environments::Base object. # # @option options [Boolean] no_bundler_warning whether to show the "Bundler should be used" warning or not # ...
github
guard/guard
https://github.com/guard/guard
lib/guard/cli/environments/write.rb
Ruby
mit
6,479
master
1,127
# frozen_string_literal: true require "guard/cli/environments/base" require "guard/guardfile/evaluator" require "guard/guardfile/generator" require "guard/ui" module Guard module Cli module Environments class Write < Base def initialize_guardfile( plugin_names = [], evaluator: ...
github
guard/guard
https://github.com/guard/guard
lib/guard/ui/colors.rb
Ruby
mit
6,479
master
1,185
# frozen_string_literal: true module Guard module UI # @private module Colors # Brighten the color ANSI_ESCAPE_BRIGHT = "1" # Black foreground color ANSI_ESCAPE_BLACK = "30" # Red foreground color ANSI_ESCAPE_RED = "31" # Green foreground color ANSI_ESCAPE_G...
github
guard/guard
https://github.com/guard/guard
lib/guard/ui/config.rb
Ruby
mit
6,479
master
1,148
# frozen_string_literal: true require "guard/options" require "guard/ui" module Guard module UI # @private class Config < Guard::Options DEFAULTS = { only: nil, except: nil, # nil (will be whatever $stderr is later) or LumberJack device, e.g. # $stderr or 'foo.log' ...
github
guard/guard
https://github.com/guard/guard
lib/guard/ui/logger_config.rb
Ruby
mit
6,479
master
745
# frozen_string_literal: true require "logger" require "guard/options" module Guard module UI # @private # Specific logger config. class LoggerConfig < Guard::Options DEFAULTS = { progname: "Guard", level: :info, template: ":time - :severity - :message", time_format...
github
guard/guard
https://github.com/guard/guard
lib/guard/jobs/sleep.rb
Ruby
mit
6,479
master
521
# frozen_string_literal: true require "guard/jobs/base" require "guard/ui" module Guard module Jobs class Sleep < Base def foreground UI.debug "Guards jobs done. Sleeping..." sleep UI.debug "Sleep interrupted by events." :continue rescue Interrupt UI.debug "Sl...
github
guard/guard
https://github.com/guard/guard
lib/guard/jobs/base.rb
Ruby
mit
6,479
master
518
# frozen_string_literal: true module Guard module Jobs class Base def initialize(engine, _options = {}) @engine = engine end # @return [Symbol] :continue once job is finished # @return [Symbol] :exit to tell Guard to terminate def foreground; end def background; end ...
github
guard/guard
https://github.com/guard/guard
lib/guard/jobs/pry_wrapper.rb
Ruby
mit
6,479
master
9,445
# frozen_string_literal: true require "shellany/sheller" require "guard/commands/all" require "guard/commands/change" require "guard/commands/notification" require "guard/commands/pause" require "guard/commands/reload" require "guard/commands/scope" require "guard/commands/show" require "guard/jobs/base" require "gua...
github
guard/guard
https://github.com/guard/guard
lib/guard/commands/pause.rb
Ruby
mit
6,479
master
757
# frozen_string_literal: true require "pry" module Guard module Commands class Pause def self.import Pry::Commands.create_command "pause" do group "Guard" description "Toggles the file listener." banner <<-BANNER Usage: pause Toggles the file lis...
github
guard/guard
https://github.com/guard/guard
lib/guard/commands/notification.rb
Ruby
mit
6,479
master
553
# frozen_string_literal: true require "pry" require "guard/notifier" module Guard module Commands class Notification def self.import Pry::Commands.create_command "notification" do group "Guard" description "Toggles the notifications." banner <<-BANNER Usag...
github
guard/guard
https://github.com/guard/guard
lib/guard/commands/all.rb
Ruby
mit
6,479
master
786
# frozen_string_literal: true require "pry" module Guard module Commands class All def self.import Pry::Commands.create_command "all" do group "Guard" description "Run all plugins." banner <<-BANNER Usage: all <scope> Run the Guard plugin `run_al...
github
guard/guard
https://github.com/guard/guard
lib/guard/commands/change.rb
Ruby
mit
6,479
master
861
# frozen_string_literal: true require "pry" require "guard" module Guard module Commands class Change def self.import Pry::Commands.create_command "change" do group "Guard" description "Trigger a file change." banner <<-BANNER Usage: change <file> <other_f...
github
guard/guard
https://github.com/guard/guard
lib/guard/commands/show.rb
Ruby
mit
6,479
master
646
# frozen_string_literal: true require "pry" module Guard module Commands class Show def self.import Pry::Commands.create_command "show" do group "Guard" description "Show all Guard plugins." banner <<-BANNER Usage: show Show all defined Guard plu...
github
guard/guard
https://github.com/guard/guard
lib/guard/commands/scope.rb
Ruby
mit
6,479
master
1,021
# frozen_string_literal: true require "pry" module Guard module Commands class Scope def self.import Pry::Commands.create_command "scope" do group "Guard" description "Scope Guard actions to groups and plugins." banner <<-BANNER Usage: scope <scope> ...
github
guard/guard
https://github.com/guard/guard
lib/guard/commands/reload.rb
Ruby
mit
6,479
master
796
# frozen_string_literal: true require "pry" module Guard module Commands class Reload def self.import Pry::Commands.create_command "reload" do group "Guard" description "Reload all plugins." banner <<-BANNER Usage: reload <scope> Run the Guard pl...
github
guard/guard
https://github.com/guard/guard
lib/guard/watcher/pattern.rb
Ruby
mit
6,479
master
388
# frozen_string_literal: true require "guard/ui" require_relative "pattern/matcher" require_relative "pattern/simple_path" module Guard class Watcher # @private class Pattern def self.create(pattern) case pattern when String, Pathname SimplePath.new(pattern) else ...
github
guard/guard
https://github.com/guard/guard
lib/guard/watcher/pattern/simple_path.rb
Ruby
mit
6,479
master
614
# frozen_string_literal: true module Guard class Watcher class Pattern class SimplePath def initialize(string_or_pathname) @path = normalize(string_or_pathname) end def to_s @path end alias_method :inspect, :to_s def match(string_or_path...
github
guard/guard
https://github.com/guard/guard
lib/guard/watcher/pattern/matcher.rb
Ruby
mit
6,479
master
871
# frozen_string_literal: true module Guard class Watcher class Pattern class Matcher attr_reader :matcher def initialize(obj) @matcher = obj end def to_s matcher.to_s end alias_method :inspect, :to_s # Compare with other matcher...
github
guard/guard
https://github.com/guard/guard
lib/guard/watcher/pattern/match_result.rb
Ruby
mit
6,479
master
458
# frozen_string_literal: true module Guard class Watcher class Pattern class MatchResult def initialize(match_result, original_value) @match_result = match_result @original_value = original_value end def [](index) return @match_result[index] if index.i...
github
guard/guard
https://github.com/guard/guard
spec/spec_helper.rb
Ruby
mit
6,479
master
8,650
# frozen_string_literal: true # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to expl...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/interactor_spec.rb
Ruby
mit
6,479
master
5,204
# frozen_string_literal: true require "guard/interactor" RSpec.describe Guard::Interactor, :stub_ui do include_context "with engine" let(:interactive) { true } subject { described_class.new(engine, interactive) } let!(:pry_interactor) { instance_double("Guard::Jobs::PryWrapper", foreground: true, backgroun...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/watcher_spec.rb
Ruby
mit
6,479
master
11,778
# frozen_string_literal: true require "guard/watcher" require "guard/plugin" RSpec.describe Guard::Watcher, :stub_ui do let(:args) { [] } subject { described_class.new(*args) } describe "#initialize" do context "with no arguments" do let(:args) { [] } it "raises an error" do expect { sub...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/runner_spec.rb
Ruby
mit
6,479
master
7,912
# frozen_string_literal: true require "guard/runner" RSpec.describe Guard::Runner, :stub_ui do include_context "with engine" let(:frontend_group) { engine.groups.add(:frontend) } let(:backend_group) { engine.groups.add(:backend) } let!(:dummy_plugin) { plugins.add("dummy", group: frontend_group, watchers: [G...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/notifier_spec.rb
Ruby
mit
6,479
master
1,991
# frozen_string_literal: true require "guard/notifier" RSpec.describe Guard::Notifier, :stub_ui do subject { described_class } let(:notifier) { instance_double("Notiffany::Notifier") } before do allow(Notiffany::Notifier).to receive(:new).and_return(notifier) end after do Guard::Notifier.instance_...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/bin_spec.rb
Ruby
mit
6,479
master
3,049
# frozen_string_literal: true path = File.expand_path("../../../bin/guard", __dir__) load path RSpec.describe GuardReloader do let(:config) { instance_double(described_class::Config) } subject { described_class.new(config) } let(:guard_core_path) { "/home/me/.rvm/gems/ruby-2.2.2/bin/_guard-core" } before d...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/plugin_util_spec.rb
Ruby
mit
6,479
master
8,143
# frozen_string_literal: true require "guard/plugin_util" RSpec.describe Guard::PluginUtil, :stub_ui do let(:evaluator) { instance_double("Guard::Guardfile::Evaluator", evaluate: true, guardfile_include?: false) } describe ".plugin_names" do before do spec = Gem::Specification gems = [ in...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/options_spec.rb
Ruby
mit
6,479
master
840
# frozen_string_literal: true require "guard/options" RSpec.describe Guard::Options do describe ".initialize" do it "handles nil options" do expect { described_class.new(nil) }.to_not raise_error end it "has indifferent access" do options = described_class.new({ foo: "bar" }, "foo2" => "baz...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/engine_spec.rb
Ruby
mit
6,479
master
13,329
# frozen_string_literal: true require "guard/engine" require "guard/plugin" require "guard/jobs/pry_wrapper" require "guard/jobs/sleep" RSpec.describe Guard::Engine, :stub_ui do include_context "with engine" let(:traps) { Guard::Internals::Traps } describe "#session" do it "passes options to #session" do ...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/config_spec.rb
Ruby
mit
6,479
master
586
# frozen_string_literal: true require "guard/config" RSpec.describe Guard::Config do it { is_expected.to respond_to(:strict?) } it { is_expected.to respond_to(:silence_deprecations?) } describe ".strict?" do before do allow(subject).to receive(:strict?).and_return(result) end context "when G...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/dsl_spec.rb
Ruby
mit
6,479
master
2,943
# frozen_string_literal: true require "guard/dsl" RSpec.describe Guard::Dsl do describe "#notification" do it "stores notification as a hash when :off is passed" do subject.notification(:off) expect(subject.result.notification).to eq(off: {}) end it "stores notification as a hash" do ...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/terminal_spec.rb
Ruby
mit
6,479
master
1,979
# frozen_string_literal: true require "guard/terminal" RSpec.describe Guard::Terminal do subject { described_class } it { is_expected.to respond_to(:clear) } let(:sheller) { class_double("Shellany::Sheller") } before do stub_const("Shellany::Sheller", sheller) end describe ".clear" do context ...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/cli_spec.rb
Ruby
mit
6,479
master
4,011
# frozen_string_literal: true require "guard/cli" RSpec.describe Guard::CLI do include_context "Guard options" let(:write_environment) { instance_double("Guard::Cli::Environments::Write") } let(:read_only_environment) do instance_double("Guard::Cli::Environments::ReadOnly") end let(:dsl_describer) { in...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/ui_spec.rb
Ruby
mit
6,479
master
8,334
# frozen_string_literal: true require "guard/ui" RSpec.describe Guard::UI do include_context "with engine" let(:logger) { instance_double("Lumberjack::Logger") } let(:terminal) { class_double("Guard::Terminal") } before do described_class.reset stub_const("Guard::Terminal", terminal) allow(Lum...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/plugin_spec.rb
Ruby
mit
6,479
master
6,062
# frozen_string_literal: true require "guard/plugin" RSpec.describe Guard::Plugin, :stub_ui do include_context "with engine" subject { described_class.new(engine: engine) } describe "#initialize" do it "assigns the defined watchers" do watchers = [double("foo")] expect(described_class.new(wat...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/group_spec.rb
Ruby
mit
6,479
master
774
# frozen_string_literal: true require "guard/group" RSpec.describe Guard::Group do subject { described_class.new(name, options) } let(:name) { :foo } let(:options) { {} } describe "#name" do specify { expect(subject.name).to eq :foo } context "when initialized from a string" do let(:name) { "...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/dsl_describer_spec.rb
Ruby
mit
6,479
master
3,879
# frozen_string_literal: true require "guard/dsl_describer" require "guard/guardfile/result" RSpec.describe Guard::DslDescriber, :stub_ui do let(:guardfile_result) { Guard::Guardfile::Result.new } let(:interactor) { instance_double(Guard::Interactor) } let(:env) { double("ENV") } subject { described_class.ne...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/watcher/pattern_spec.rb
Ruby
mit
6,479
master
790
# frozen_string_literal: true require "guard/watcher/pattern" RSpec.describe Guard::Watcher::Pattern do describe ".create" do subject { described_class.create(pattern) } context "when a string is given" do let(:pattern) { "foo.rb" } it { is_expected.to be_a(described_class::SimplePath) } en...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/watcher/pattern/match_result_spec.rb
Ruby
mit
6,479
master
1,297
# frozen_string_literal: true require "guard/watcher/pattern/match_result" RSpec.describe Guard::Watcher::Pattern::MatchResult do let(:match_result) { double("match_data") } let(:original_value) { "foo/bar.rb" } subject { described_class.new(match_result, original_value) } describe "#initialize" do conte...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/watcher/pattern/simple_path_spec.rb
Ruby
mit
6,479
master
1,119
# frozen_string_literal: true require "guard/watcher/pattern/simple_path" RSpec.describe Guard::Watcher::Pattern::SimplePath do subject { described_class.new(path) } describe "#match result" do context "when constructed with filename string" do let(:path) { "foo.rb" } context "when matched file ...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/watcher/pattern/matcher_spec.rb
Ruby
mit
6,479
master
2,836
# frozen_string_literal: true require "guard/watcher/pattern/matcher" RSpec.describe Guard::Watcher::Pattern::Matcher do subject { described_class.new(obj) } describe "#match" do let(:expected) { double("match_result") } context "when constructed with valid matcher object" do let(:obj) { double("ma...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/commands/show_spec.rb
Ruby
mit
6,479
master
489
# frozen_string_literal: true require "guard/commands/show" RSpec.describe Guard::Commands::Show, :stub_ui do include_context "with engine" include_context "with fake pry" before do allow(Pry::Commands).to receive(:create_command).with("show") do |&block| FakePry.instance_eval(&block) end de...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/commands/notification_spec.rb
Ruby
mit
6,479
master
546
# frozen_string_literal: true require "guard/commands/notification" RSpec.describe Guard::Commands::Notification, :stub_ui do include_context "with engine" include_context "with fake pry" let(:output) { instance_double(Pry::Output) } before do allow(Pry::Commands).to receive(:create_command) .with...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/commands/pause_spec.rb
Ruby
mit
6,479
master
525
# frozen_string_literal: true require "guard/commands/pause" RSpec.describe Guard::Commands::Pause, :stub_ui do include_context "with engine" include_context "with fake pry" let(:output) { instance_double(Pry::Output) } before do allow(Pry::Commands).to receive(:create_command).with("pause") do |&block|...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/commands/change_spec.rb
Ruby
mit
6,479
master
1,167
# frozen_string_literal: true require "guard/commands/change" RSpec.describe Guard::Commands::Change, :stub_ui do include_context "with engine" include_context "with fake pry" let(:output) { instance_double(Pry::Output) } before do allow(Pry::Commands).to receive(:create_command).with("change") do |&blo...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/commands/all_spec.rb
Ruby
mit
6,479
master
1,370
# frozen_string_literal: true require "guard/commands/all" RSpec.describe Guard::Commands::All, :stub_ui do include_context "with engine" include_context "with fake pry" let(:foo_group) { double } let(:bar_guard) { double } before do allow(Pry::Commands).to receive(:create_command).with("all") do |&bl...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/commands/reload_spec.rb
Ruby
mit
6,479
master
1,075
# frozen_string_literal: true require "guard/commands/reload" RSpec.describe Guard::Commands::Reload, :stub_ui do include_context "with engine" include_context "with fake pry" let(:foo_group) { double } let(:bar_guard) { double } before do allow(Pry::Commands).to receive(:create_command).with("reload"...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/commands/scope_spec.rb
Ruby
mit
6,479
master
1,253
# frozen_string_literal: true require "guard/commands/scope" RSpec.describe Guard::Commands::Scope, :stub_ui do include_context "with engine" include_context "with fake pry" let!(:frontend_group) { engine.groups.add("frontend") } let!(:dummy_plugin) { engine.plugins.add("dummy", group: frontend_group) } b...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/cli/environments/base_spec.rb
Ruby
mit
6,479
master
2,021
# frozen_string_literal: true require "guard/cli/environments/base" RSpec.describe Guard::Cli::Environments::Base, :stub_ui do let(:no_bundler_warning) { false } let(:options) { { no_bundler_warning: no_bundler_warning } } shared_examples "avoids Bundler warning" do it "does not show the Bundler warning" d...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/cli/environments/write_spec.rb
Ruby
mit
6,479
master
3,505
# frozen_string_literal: true require "guard/cli/environments/write" RSpec.describe Guard::Cli::Environments::Write, :stub_ui do let(:options) { {} } subject { described_class.new(options) } before do allow(subject).to receive(:bundler_check) end describe "#initialize_guardfile" do let(:evaluator...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/cli/environments/read_only_spec.rb
Ruby
mit
6,479
master
3,546
# frozen_string_literal: true require "guard/cli/environments/read_only" RSpec.describe Guard::Cli::Environments::ReadOnly, :stub_ui do include_context "Guard options" before do allow(subject).to receive(:bundler_check) end subject { described_class.new(options) } describe "#evaluate" do let(:eva...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/guardfile/evaluator_spec.rb
Ruby
mit
6,479
master
4,745
# frozen_string_literal: true require "guard/guardfile/evaluator" RSpec.describe Guard::Guardfile::Evaluator, :stub_ui do let(:options) { { inline: "guard :dummy" } } let(:plugin_options) { { callbacks: [], group: :default, watchers: [] } } let(:valid_guardfile_string) { "group :foo; do guard :bar; end; end; " ...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/guardfile/generator_spec.rb
Ruby
mit
6,479
master
4,511
# frozen_string_literal: true require "guard/guardfile/generator" RSpec.describe Guard::Guardfile::Generator, :stub_ui do let(:plugin_util) { instance_double("Guard::PluginUtil") } it "has a valid Guardfile template" do allow(File).to receive(:exist?) .with(described_class::GUARDFILE_TEMPLATE).and_call...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/guardfile/result_spec.rb
Ruby
mit
6,479
master
2,540
# frozen_string_literal: true require "guard/guardfile/result" RSpec.describe Guard::Guardfile::Result, :stub_ui do let(:options) { {} } let(:valid_guardfile_string) { "group :foo; do guard :bar; end; end; " } let(:dsl) { instance_double("Guard::Dsl") } subject { described_class.new } describe "#plugin_na...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/internals/traps_spec.rb
Ruby
mit
6,479
master
906
# frozen_string_literal: true require "guard/internals/traps" RSpec.describe Guard::Internals::Traps do describe ".handle" do let(:signal_class) { class_double(Signal) } before do stub_const("Signal", signal_class) end context "with a supported signal name" do let(:signal) { "USR1" } ...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/internals/plugins_spec.rb
Ruby
mit
6,479
master
3,208
# frozen_string_literal: true require "guard/internals/plugins" RSpec.describe Guard::Internals::Plugins, :stub_ui do include_context "with testing plugins" let(:frontend_group) { Guard::Group.new(:frontend) } let(:backend_group) { Guard::Group.new(:backend) } let!(:dummy_plugin) { subject.add("dummy", group...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/internals/tracing_spec.rb
Ruby
mit
6,479
master
2,985
# frozen_string_literal: true require "guard/internals/tracing" RSpec.describe Guard::Internals::Tracing do let(:null) { IO::NULL } # NOTE: Calling system() is different from calling Kernel.system() # # We can capture system() calls by stubbing Kernel.system, but to capture # Kernel.system() calls, we need...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/internals/debugging_spec.rb
Ruby
mit
6,479
master
2,944
# frozen_string_literal: true require "guard/internals/debugging" RSpec.describe Guard::Internals::Debugging do let(:null) { IO::NULL } let(:ui) { class_double(::Guard::UI) } let(:tracing) { class_spy(::Guard::Internals::Tracing) } before do stub_const("::Guard::Internals::Tracing", tracing) stub_con...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/internals/session_spec.rb
Ruby
mit
6,479
master
12,845
# frozen_string_literal: true require "guard/internals/session" RSpec.describe Guard::Internals::Session, :stub_ui do include_context "with engine" let(:options) { {} } subject { engine.session } describe "#initialize" do describe "#listener_args" do subject { described_class.new(options).listener...
github
guard/guard
https://github.com/guard/guard
spec/lib/guard/internals/groups_spec.rb
Ruby
mit
6,479
master
3,775
# frozen_string_literal: true require "guard/internals/groups" RSpec.describe Guard::Internals::Groups do describe "#all" do let(:default) { instance_double("Guard::Group", name: :default) } before do allow(Guard::Group).to receive(:new).with(:default).and_return(default) end context "with o...