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
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v3/sass_template.rb
Ruby
mit
88
master
1,208
# frozen_string_literal: true require_relative '../v2/sass_template' module Sprockets module Sass module V3 # Preprocessor for SASS files class SassTemplate < Sprockets::Sass::V2::SassTemplate def build_cache_store(context) return nil if context.environment.cache.nil? cache...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v3/functions.rb
Ruby
mit
88
master
263
# frozen_string_literal: true require_relative '../v2/functions' module Sprockets module Sass module V3 # Module used to inject helpers into SASS engine module Functions include Sprockets::Sass::V2::Functions end end end end
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v3/cache_store.rb
Ruby
mit
88
master
687
# frozen_string_literal: true module Sprockets module Sass module V3 # Internal: Cache wrapper for Sprockets cache adapter. (Sprockets >= 3) class CacheStore < ::Sass::CacheStores::Base VERSION = '1' def initialize(cache, version) @cache = cache @version = "#{VERSI...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v4/cache_store.rb
Ruby
mit
88
master
275
# frozen_string_literal: true require_relative '../v3/cache_store' module Sprockets module Sass module V4 # Internal: Cache wrapper for Sprockets cache adapter. (Sprockets >= 3) class CacheStore < Sprockets::Sass::V3::CacheStore end end end end
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v4/sass_template.rb
Ruby
mit
88
master
610
# frozen_string_literal: true require_relative '../v3/sass_template' module Sprockets module Sass module V4 # Preprocessor for SASS files class SassTemplate < Sprockets::Sass::V3::SassTemplate # This is removed # def self.default_mime_type # "text/#{syntax}" # end ...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v4/compressor.rb
Ruby
mit
88
master
237
# frozen_string_literal: true require_relative '../v3/compressor' module Sprockets module Sass module V4 # Class used to compress CSS files class Compressor < Sprockets::Sass::V3::Compressor end end end end
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v4/scss_template.rb
Ruby
mit
88
master
366
# frozen_string_literal: true require_relative './sass_template' # @TODO refactor the Sprockets::Sass::Functions , logical_path is unavailable module Sprockets module Sass module V4 # Preprocessor for SCSS files class ScssTemplate < Sprockets::Sass::V4::SassTemplate def self.syntax ...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v4/functions.rb
Ruby
mit
88
master
263
# frozen_string_literal: true require_relative '../v3/functions' module Sprockets module Sass module V4 # Module used to inject helpers into SASS engine module Functions include Sprockets::Sass::V3::Functions end end end end
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v4/importer.rb
Ruby
mit
88
master
4,802
# frozen_string_literal: true require_relative '../v3/importer' module Sprockets module Sass module V4 # class used for importing files from SCCS and SASS files class Importer < Sprockets::Sass::V3::Importer def syntax_mime_type(path) "text/#{syntax(path)}" end def e...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v2/importer.rb
Ruby
mit
88
master
7,806
# frozen_string_literal: true module Sprockets module Sass module V2 # class used for importing files from SCCS and SASS files class Importer < ::Sass::Importers::Base GLOB = /\*|\[.+\]/ # @see Sass::Importers::Base#find_relative def find_relative(path, base_path, options) ...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v2/scss_template.rb
Ruby
mit
88
master
306
# frozen_string_literal: true module Sprockets module Sass module V2 # Preprocessor for SCSS files class ScssTemplate < Sprockets::Sass::V2::SassTemplate # Define the expected syntax for the template def self.syntax :scss end end end end end
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v2/cache_store.rb
Ruby
mit
88
master
751
# frozen_string_literal: true module Sprockets module Sass module V2 # Internal: Cache wrapper for Sprockets cache adapter. (Sprockets 2.x) class CacheStore < ::Sass::CacheStores::Base attr_reader :environment def initialize(environment) @environment = environment en...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v2/functions.rb
Ruby
mit
88
master
5,836
# frozen_string_literal: true module Sprockets module Sass module V2 # Module used to inject helpers into SASS engine module Functions # Using Sprockets::Context#asset_data_uri return a Base64-encoded `data:` # URI with the contents of the asset at the specified path. # ...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v2/compressor.rb
Ruby
mit
88
master
759
# frozen_string_literal: true module Sprockets module Sass module V2 # Class used to compress CSS files class Compressor def self.instance @instance ||= new end def self.compress(input) instance.compress(input) end # Compresses the given CS...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
lib/sprockets/sass/v2/sass_template.rb
Ruby
mit
88
master
7,624
# frozen_string_literal: true module Sprockets module Sass module V2 # Preprocessor for SASS files class SassTemplate VERSION = '1' def self.default_mime_type 'text/css' end # Internal: Defines default sass syntax to use. Exposed so the ScssProcessor ...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/sprockets-sass_spec.rb
Ruby
mit
88
master
19,085
require 'spec_helper' describe Sprockets::Sass do before :each do @root = create_construct @assets = @root.directory 'assets' @public_dir = @root.directory 'public' @env = Sprockets::Environment.new @root.to_s @env.append_path @assets.to_s @env.register_postprocessor 'text/css', FailPostProce...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/custom_importer_spec.rb
Ruby
mit
88
master
848
require 'spec_helper' describe Sprockets::Sass::SassTemplate do before :each do # Create the custom importer. @custom_importer = Sprockets::Sass::DummyImporter.new Sprockets::Sass.options[:importer] = @custom_importer # Initialize the environment. @root = create_construct @assets = @root.d...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/spec_helper.rb
Ruby
mit
88
master
1,684
require 'rubygems' require 'bundler/setup' require 'sprockets' require 'sprockets-sass' require 'sprockets-helpers' require 'compass' require 'test_construct' RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/mini...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/importer_spec.rb
Ruby
mit
88
master
1,645
require 'spec_helper' describe Sprockets::Sass do before :each do @root = create_construct @assets = @root.directory 'assets' @public_dir = @root.directory 'public' @env = Sprockets::Environment.new @root.to_s @env.append_path @assets.to_s @env.register_postprocessor 'text/css', FailPostPro...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/support/fake_engine.rb
Ruby
mit
88
master
976
module Sprockets module Sass class FakeEngine VERSION = '1' def self.default_mime_type 'text/xyx' end # Public: Return singleton instance with default options. # # Returns SassProcessor object. def self.instance @instance ||= new end def sel...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/support/fail_postprocessor.rb
Ruby
mit
88
master
540
class FailPostProcessor def initialize(filename, &block) @filename = filename @source = block.call end def render(context, empty_hash_wtf) self.class.run(@filename, @source, context) end def self.run(filename, source, context) source.gsub /@import/, 'fail engine' end def self.call(inp...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/support/sass_template.rb
Ruby
mit
88
master
211
module Sprockets module Sass class SassTemplate < Sprockets::Sass::Utils.get_class_by_version("SassTemplate") def initialize(*args, &block) super(*args, &block) end end end end
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/support/dummy_importer.rb
Ruby
mit
88
master
481
module Sprockets module Sass class DummyImporter < Sprockets::Sass::Utils.get_class_by_version("Importer") attr_accessor :has_been_used def initialize super() @has_been_used = false end def find(path, options) @has_been_used = true super(path, options) ...
github
petebrowne/sprockets-sass
https://github.com/petebrowne/sprockets-sass
spec/support/be_fresh_matcher.rb
Ruby
mit
88
master
424
RSpec::Matchers.define :be_fresh do |env, old_asset| match do |actual| if actual.respond_to?(:fresh?) if actual.method(:fresh?).arity == 1 actual.fresh?(env) else actual.fresh? end else actual.eql?(old_asset) end end failure_message do |env| 'expected asset...
github
maik/xml-simple
https://github.com/maik/xml-simple
xml-simple.gemspec
Ruby
mit
88
master
373
Gem::Specification.new do |s| s.name = %q{xml-simple} s.version = "1.1.9" s.date = %q{2021-01-18} s.summary = %q{A simple API for XML processing.} s.email = %q{contact@maik-schmidt.de} s.homepage = %q{https://github.com/maik/xml-simple} s.license = "MIT" s.authors = ["Maik Schmidt"] s.files = ["lib/xm...
github
maik/xml-simple
https://github.com/maik/xml-simple
lib/xmlsimple.rb
Ruby
mit
88
master
31,446
# = XmlSimple # # Author:: Maik Schmidt <contact@maik-schmidt.de> # Copyright:: Copyright (c) 2003-2021 Maik Schmidt # License:: Distributes under the same terms as Ruby. # require 'rexml/document' require 'stringio' # Easy API to maintain XML (especially configuration files). class XmlSimple include REXML @...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_perl_mem_copy.rb
Ruby
mit
88
master
3,517
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' require 'fileutils' # The test cases below are copied from the original Perl version, # because I wanted to behave the Ruby version exactly as the Perl # version. I left some comments, that maybe do not make a lot of # sense in ...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_perl_out.rb
Ruby
mit
88
master
29,551
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' # The test cases below are copied from the original Perl version, # because I wanted to behave the Ruby version exactly as the Perl # version. I left some comments, that maybe do not make a lot of # sense in the current Ruby ver...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_perl_storable.rb
Ruby
mit
88
master
5,098
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' require 'fileutils' # The test cases below are copied from the original Perl version, # because I wanted to behave the Ruby version exactly as the Perl # version. I left some comments, that maybe do not make a lot of # sense in ...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_out.rb
Ruby
mit
88
master
3,925
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' class TC_Out < Test::Unit::TestCase # :nodoc: def test_simple_structure hash = { 'opt' => [ { 'x' => [ { 'content'=> 'text1'} ], 'y' => [ { 'content'=> 'text2'} ] } ] } ...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_markup.rb
Ruby
mit
88
master
578
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' # This test case checks if a bug regarding markup encoding # reported by Yan Zhang (Yan.Zhang (at) fedexkinkos.com) # has been fixed. class TC_Markup < Test::Unit::TestCase # :nodoc: def test_markup doc = <<-DOC <busin...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_perl_in.rb
Ruby
mit
88
master
37,169
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' # The test cases below are copied from the original Perl version, # because I wanted to behave the Ruby version exactly as the Perl # version. I left some comments, that maybe do not make a lot of # sense in the current Ruby ver...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_perl_mem_share.rb
Ruby
mit
88
master
3,518
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' require 'fileutils' # The test cases below are copied from the original Perl version, # because I wanted to behave the Ruby version exactly as the Perl # version. I left some comments, that maybe do not make a lot of # sense in ...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_attr_prefix.rb
Ruby
mit
88
master
2,630
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' class TC_AttrPrefix < Test::Unit::TestCase # :nodoc: def test_attr_prefix_option xml_str = <<-XML_STR <Customer id="12253"> <first_name>Joe</first_name> <last_name>Joe</last_name> <Address type="home"...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_string_in.rb
Ruby
mit
88
master
9,214
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' class TC_String_In < Test::Unit::TestCase # :nodoc: def test_simple_strings simple = XmlSimple.new expected = { 'username' => 'testuser', 'password' => 'frodo' } xml_string = '<opt username="testuser" password="fro...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_nick.rb
Ruby
mit
88
master
1,008
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' class NodeToTextTests < Test::Unit::TestCase def setup @xmlin = XmlSimple.new @element = REXML::Element.new("abc") @text = REXML::Text.new("<abc/>") @attribute = REXML::Attribute.new("name", "&lt;abc/&gt;") ...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_file_in.rb
Ruby
mit
88
master
12,183
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' class TC_File_In < Test::Unit::TestCase # :nodoc: def test_original original_pod = File.join(File.dirname(__FILE__), 'files', 'original_pod.xml') config = XmlSimple.new expected = { 'logdir' => '/var/l...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_symbol.rb
Ruby
mit
88
master
754
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' # This test case will test the KeyToSymbol option # added by Keith Veleba keith (at) veleba.net on 6/21/2006 class TC_Symbol < Test::Unit::TestCase # :nodoc: def test_key_to_symbol symbol_file = File.join(File.dirname(__F...
github
maik/xml-simple
https://github.com/maik/xml-simple
test/tc_curtis.rb
Ruby
mit
88
master
1,586
$: << File.join(File.dirname(__FILE__), '../lib') require 'test/unit' require 'xmlsimple' # This test class is named after Curtis Schofield, who # reported the bug whose absence is tested by this class :-) class TC_Curtis < Test::Unit::TestCase # :nodoc: def setup @test_file = File.join(File.dirname(__FILE__), ...
github
joker1007/rspec-power_assert
https://github.com/joker1007/rspec-power_assert
rspec-power_assert.gemspec
Ruby
mit
88
master
1,012
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rspec/power_assert/version' Gem::Specification.new do |spec| spec.name = "rspec-power_assert" spec.version = RSpec::PowerAssert::VERSION spec.authors = ["joker1007"] ...
github
joker1007/rspec-power_assert
https://github.com/joker1007/rspec-power_assert
lib/rspec/power_assert.rb
Ruby
mit
88
master
3,977
require "rspec/power_assert/version" require "rspec/core" require "power_assert" module PowerAssert INTERNAL_LIB_DIRS[RSpec::PowerAssert] = File.dirname(caller_locations(1, 1).first.path) end module RSpec module PowerAssert @verbose_successful_report = true def self.verbose_successful_report !!@ve...
github
joker1007/rspec-power_assert
https://github.com/joker1007/rspec-power_assert
spec/rspec/power_assert_spec.rb
Ruby
mit
88
master
3,014
require 'spec_helper' RSpec::PowerAssert.example_assertion_alias :assert RSpec::PowerAssert.example_group_assertion_alias :assert describe RSpec::PowerAssert do describe Array do describe "#map" do let(:array) { [1, 2, 3] } subject { %w(a b c) } before do @array = [1, 2, 3] end ...
github
gree/observed
https://github.com/gree/observed
observed.gemspec
Ruby
mit
88
master
1,127
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'observed/version' Gem::Specification.new do |spec| spec.name = "observed" spec.version = Observed::VERSION spec.authors = ["KUOKA Yusuke"] spec.email = ["yusu...
github
gree/observed
https://github.com/gree/observed
examples/00readme/clockwork.rb
Ruby
mit
88
master
380
require 'pathname' require 'clockwork' require 'observed/clockwork' include Clockwork # Below two lines are specific to Observed's Clockwork support. # Others lines are just standard `clockwork.rb` include Observed::Clockwork the_dir = Pathname.new(File.dirname(__FILE__)) register_observed_handler :config_file => ...
github
gree/observed
https://github.com/gree/observed
examples/00readme/observed.rb
Ruby
mit
88
master
355
require 'observed/http' observe 'google.health', via: 'http', with: { method: 'get', url: 'http://www.google.co.jp/' } report /google.health/, via: 'stdout', with: { format: -> tag, time, data { case data[:status] when :success 'Google is healthy! (^o^)' else 'Google is u...
github
gree/observed
https://github.com/gree/observed
plugins/observed-shell/lib/observed/shell.rb
Ruby
mit
88
master
1,278
require 'mixlib/shellout' require 'observed/observer' require 'observed/reporter' module Observed module Plugins end end class Observed::Plugins::ShellObserver < Observed::Observer plugin_name 'shell' attribute :command def observe c = Mixlib::ShellOut.new(*command) c.run_command { command: c...
github
gree/observed
https://github.com/gree/observed
plugins/observed-growl/lib/observed/growl.rb
Ruby
mit
88
master
1,959
require 'jsonpath' require 'ruby_gntp' require 'observed/reporter' module Observed module Plugins end end class Observed::Plugins::GrowlReporter < Observed::Reporter plugin_name 'growl' attribute :app_name attribute :title attribute :text attribute :icon attribute :app_name_path attribute :title_p...
github
gree/observed
https://github.com/gree/observed
plugins/observed-http/observed-http.gemspec
Ruby
mit
88
master
1,199
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'observed/http/version' Gem::Specification.new do |spec| spec.name = "observed-http" spec.version = Observed::Http::VERSION spec.authors = ["KUOKA Yusuke"] spec.email ...
github
gree/observed
https://github.com/gree/observed
plugins/observed-http/lib/observed/http.rb
Ruby
mit
88
master
1,584
require 'observed/http/version' require 'observed/observer' require 'observed/observer_helpers/timer' require 'observed/logging' require 'timeout' require 'net/http' module Observed module Plugins class HTTP < Observed::Observer include Observed::ObserverHelpers::Timer include Observed::Logging ...
github
gree/observed
https://github.com/gree/observed
plugins/observed-http/spec/http_spec.rb
Ruby
mit
88
master
1,332
require 'spec_helper' require 'observed/http' describe Observed::Plugins::HTTP do subject { Observed::Plugins::HTTP.new } before { subject.configure config } let(:config) { { timeout_in_milliseconds: 1000, method: 'get', url: 'http://google.com/', tag: 'test', ...
github
gree/observed
https://github.com/gree/observed
plugins/observed-http/spec/integration_spec.rb
Ruby
mit
88
master
296
require 'spec_helper' require 'observed/application/oneshot' describe Observed::Application::Oneshot do subject { Observed::Application::Oneshot.create( config_file: 'spec/fixtures/observed.conf' ) } it 'initializes' do expect(subject.run.size).not_to eq(0) end end
github
gree/observed
https://github.com/gree/observed
plugins/observed-http/spec/spec_helper.rb
Ruby
mit
88
master
649
require 'fakefs/spec_helpers' require 'rspec' Dir["#{File.expand_path('..', __FILE__)}/support/**/*.rb"].each { |f| require f } puts "Please do not update/create files while tests are running." RSpec.configure do |config| config.color_enabled = true config.order = :random config.filter_run :focus => true co...
github
gree/observed
https://github.com/gree/observed
plugins/observed-fluentd/Gemfile
Ruby
mit
88
master
338
source 'https://rubygems.org' # Specify your gem's dependencies in observed-fluentd.gemspec gemspec gem 'clockwork', :group => :test gem 'fluentd', :group => :test gem 'cucumber', :group => :test gem 'aruba', :group => :test gem 'observed', :group => :test gem 'observed-http', :group => :test gem 'observed-clockwork'...
github
gree/observed
https://github.com/gree/observed
plugins/observed-fluentd/observed-fluentd.gemspec
Ruby
mit
88
master
1,046
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'observed/fluentd/version' Gem::Specification.new do |spec| spec.name = 'observed-fluentd' spec.version = Observed::Fluentd::VERSION spec.authors = ['KUOKA Yusuke'] sp...
github
gree/observed
https://github.com/gree/observed
plugins/observed-fluentd/lib/observed/fluentd.rb
Ruby
mit
88
master
680
require 'observed/fluentd/version' require 'observed/reporter' require 'observed/reporter/regexp_matching' require 'fluent-logger' module Observed module Plugins class Fluentd < Observed::Reporter include Observed::Reporter::RegexpMatching plugin_name 'fluentd' attribute :tag attribute...
github
gree/observed
https://github.com/gree/observed
plugins/observed-fluentd/features/support/env.rb
Ruby
mit
88
master
762
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib') require 'aruba/cucumber' World(Aruba::Api) Before do @aruba_timeout_seconds = 120 end When /^I run the command "([^"]+)"$/ do |cmd| system cmd end When /^I start my daemon with "([^"]*)"$/ do |cmd| @root = Pathname.new(File.dirname(__FILE__)).parent.pa...
github
gree/observed
https://github.com/gree/observed
plugins/observed-gauge/observed-gauge.gemspec
Ruby
mit
88
master
1,207
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'observed/gauge/version' Gem::Specification.new do |spec| spec.name = 'observed-gauge' spec.version = Observed::Gauge::VERSION spec.authors = ['KUOKA Yusuke'] spec.ema...
github
gree/observed
https://github.com/gree/observed
plugins/observed-gauge/lib/observed/gauge.rb
Ruby
mit
88
master
3,164
require 'observed/logging' require 'observed/translator' require 'observed/reporter/regexp_matching' require 'observed/gauge/version' require 'logger' require 'rrd' module Observed module Plugins class Gauge < Observed::Translator plugin_name 'gauge' include Observed::Logging include Observed...
github
gree/observed
https://github.com/gree/observed
plugins/observed-gauge/spec/gauge_spec.rb
Ruby
mit
88
master
3,724
require 'spec_helper' require 'observed/gauge' require 'observed/system' shared_examples_for 'the observed-gauge plugin' do subject { described_class.new } before { File.delete(rrd) if File.exist?(rrd) subject.configure rrd: rrd, key_path: key_path } it 'matches against the tag using a patte...
github
gree/observed
https://github.com/gree/observed
lib/observed.rb
Ruby
mit
88
master
2,371
require 'observed/version' require 'observed/context' require 'observed/builtin_plugins' require 'forwardable' # The module to provide DSL to describe Observed configuration, intended to be used by including to Ruby's `main` object # like Clockwork(https://github.com/tomykaira/clockwork) does in their configuration fi...
github
gree/observed
https://github.com/gree/observed
lib/observed/config_dsl.rb
Ruby
mit
88
master
2,320
require 'observed/observer' require 'observed/configurable' require 'forwardable' require 'logger' module Observed # The DSL to describe Observed's configuration. # @example # context = ConfigDSL.new(builder: the_builder) # context.eval_file observed_conf_file(a.k.a user code describes Observed configuration) ...
github
gree/observed
https://github.com/gree/observed
lib/observed/event_bus.rb
Ruby
mit
88
master
668
require 'thread' require 'observed/basic_event_bus' module Observed class EventBus def initialize(args={}) @bus = Observed::BasicEventBus.new @receives = {} @task_factory = args[:task_factory] || fail("The parameter :task_factory is missing in args(#{args}") @mutex = ::Mutex.new end ...
github
gree/observed
https://github.com/gree/observed
lib/observed/logging.rb
Ruby
mit
88
master
1,113
require 'observed/configurable' module Observed module Logging include Observed::Configurable # !@attribute [r] logger # @return [Logger] attribute :logger # @return [Boolean] `true` if a value is set for the attribute :logger def logging_enabled? has_attribute_value? :logger end...
github
gree/observed
https://github.com/gree/observed
lib/observed/task.rb
Ruby
mit
88
master
3,956
require 'logger' require 'thread' module Observed class Task attr_accessor :name def then(*tasks) next_task = if tasks.size == 1 tasks.first elsif tasks.size > 1 ParallelTask.new(tasks) else raise 'No tasks to b...
github
gree/observed
https://github.com/gree/observed
lib/observed/observer.rb
Ruby
mit
88
master
284
require 'observed/configurable' require 'observed/pluggable' require 'observed/logging' module Observed class Observer include Pluggable include Configurable attribute :tag attribute :system def observe raise NotImplementedError.new end end end
github
gree/observed
https://github.com/gree/observed
lib/observed/reporter.rb
Ruby
mit
88
master
407
require 'observed/configurable' require 'observed/pluggable' module Observed class Reporter include Configurable include Pluggable # !@attribute [r] tag_pattern # @return [Regexp] attribute :tag_pattern # @param [String] tag def match(tag) raise NotImplementedError.new end ...
github
gree/observed
https://github.com/gree/observed
lib/observed/context.rb
Ruby
mit
88
master
2,081
require 'logger' require 'observed/system' require 'observed/config_builder' require 'observed/config_dsl' require 'observed/task' require 'observed/event_bus' module Observed # The run context of an Observed system. # It can be initialized via parameters to automatically configure the system and everything neede...
github
gree/observed
https://github.com/gree/observed
lib/observed/translator.rb
Ruby
mit
88
master
431
require 'observed/configurable' require 'observed/logging' require 'observed/pluggable' module Observed class Translator include Observed::Configurable include Observed::Logging include Observed::Pluggable attribute :tag_pattern def match(tag) tag_pattern.match(tag) end def tran...
github
gree/observed
https://github.com/gree/observed
lib/observed/configurable.rb
Ruby
mit
88
master
3,079
module Observed # Indicates that classes included this module to have attributes which are configurable. # `configurable` means that the attributes can be configured via named parameters of # the constructor and the `configure` instance method of the class included this module. module Configurable def init...
github
gree/observed
https://github.com/gree/observed
lib/observed/system.rb
Ruby
mit
88
master
1,108
require 'observed/observer' require 'observed/reporter' module Observed class System def initialize(args={}) @config = args[:config] if args[:config] @logger = args[:logger] if args[:logger] @context = args[:context] end def config=(config) @config = config end def conf...
github
gree/observed
https://github.com/gree/observed
lib/observed/observed_task_factory.rb
Ruby
mit
88
master
2,609
require 'observed/observer' require 'observed/reporter' require 'observed/translator' require 'observed/task' module Observed # An yet another cushion from the deprecated plugin interface to the new plugin interface class FakeSystem def initialize(args) @time = args[:time] || Time.now end def r...
github
gree/observed
https://github.com/gree/observed
lib/observed/basic_event_bus.rb
Ruby
mit
88
master
586
require 'thread' require 'monitor' module Observed class BasicEventBus def initialize @monitor = ::Monitor.new @subscribers = [] end def emit(tag, *params) handle_event(tag, *params) end def on_receive(pattern, &block) @monitor.synchronize do @subscribers.push [pa...
github
gree/observed
https://github.com/gree/observed
lib/observed/config_builder.rb
Ruby
mit
88
master
7,493
require 'logger' require 'thread' require 'observed/config' require 'observed/configurable' require 'observed/default' require 'observed/hash' require 'observed/translator' require 'observed/observed_task_factory' module Observed class ProcObserver < Observed::Observer def initialize(&block) @block = blo...
github
gree/observed
https://github.com/gree/observed
lib/observed/pluggable.rb
Ruby
mit
88
master
1,021
module Observed # Indicates that the class is pluggable (or extensible or a extension point). # "pluggable" means that the class included this module will be the outlet in where Observed plug-ins are plugged. # # @example # class Reader # include Pluggable # end # class FooReader < Reader; end # cla...
github
gree/observed
https://github.com/gree/observed
lib/observed/config.rb
Ruby
mit
88
master
668
require 'observed/configurable' module Observed # The configuration for Observed which may be built by Observed::Builder, # which may contains configured writers, readers, reporters, observers. class Config include Observed::Configurable # !@attribute [rw] readers # @return [Array<Observed::Reader...
github
gree/observed
https://github.com/gree/observed
lib/observed/application/oneshot.rb
Ruby
mit
88
master
2,567
require 'logger' require 'optparse' require 'pathname' require 'observed/config' require 'observed/context' module Observed module Application # The application which is usually ran from CLI to run health-checks and write the results to a log file, and then exit. # An "Oneshot" application is the opposite ...
github
gree/observed
https://github.com/gree/observed
lib/observed/reporter/report_formatting.rb
Ruby
mit
88
master
1,959
require 'observed/configurable' require 'observed/hash/fetcher' module Observed class Reporter # The module to equip an observer with a `formatter` to format the data being reported. # The `formatter` is just a proc and is able to be configured via an attribute. # # @example # class YourObserver ...
github
gree/observed
https://github.com/gree/observed
lib/observed/reporter/regexp_matching.rb
Ruby
mit
88
master
212
module Observed class Reporter module RegexpMatching def match(tag) tag_pattern = get_attribute_value(:tag_pattern) tag_pattern.match(tag) if tag_pattern end end end end
github
gree/observed
https://github.com/gree/observed
lib/observed/hash/builder.rb
Ruby
mit
88
master
427
require 'observed/hash/key_path_encoding' module Observed module Hash class Builder include Observed::Hash::KeyPathEncoding def initialize(defaults={}) @hash = defaults.dup end def []=(key_path, value) at_key_path_on_hash @hash, key_path, create_if_missing: true do |h, k...
github
gree/observed
https://github.com/gree/observed
lib/observed/hash/fetcher.rb
Ruby
mit
88
master
391
require 'observed/hash/key_path_encoding' module Observed module Hash class Fetcher include Observed::Hash::KeyPathEncoding def initialize(hash) @hash = hash || fail('The hash must not be nil') end def [](key_path) at_key_path_on_hash @hash, key_path, create_if_missing: ...
github
gree/observed
https://github.com/gree/observed
lib/observed/hash/key_path_encoding.rb
Ruby
mit
88
master
2,832
module Observed module Hash module KeyPathEncoding # Decodes the key path such as 'foo.bar' to dig into the hash and returns `hash[:foo][:bar]` # @param [Hash] hash The hash to be dug # @param [String] key_path The key path which is consisted of one or more keys from the parent-to-child order, ...
github
gree/observed
https://github.com/gree/observed
lib/observed/observer_helpers/timer.rb
Ruby
mit
88
master
1,490
module Observed module ObserverHelpers module Timer require 'timeout' def time(options={}, &block) timeout_in_seconds = options[:timeout_in_seconds] || fail("The key `:timeout_in_seconds` must be exist in the options: #{options}") begin before = system.now ...
github
gree/observed
https://github.com/gree/observed
lib/observed/builtin_plugins/stdout.rb
Ruby
mit
88
master
702
require 'observed/hash/fetcher' require 'observed/observer' require 'observed/reporter' require 'observed/reporter/regexp_matching' require 'observed/reporter/report_formatting' module Observed module BuiltinPlugins class Stdout < Observed::Reporter include Observed::Reporter::RegexpMatching include...
github
gree/observed
https://github.com/gree/observed
lib/observed/builtin_plugins/file.rb
Ruby
mit
88
master
1,107
require 'observed/hash/fetcher' require 'observed/reporter' require 'observed/reporter/regexp_matching' require 'observed/reporter/report_formatting' module Observed module BuiltinPlugins class File < Observed::Reporter include Observed::Reporter::RegexpMatching include Observed::Reporter::ReportFor...
github
gree/observed
https://github.com/gree/observed
spec/config_builder_spec.rb
Ruby
mit
88
master
3,408
require 'spec_helper' require 'observed/config_builder' describe Observed::ConfigBuilder do include FakeFS::SpecHelpers subject { Observed::ConfigBuilder.new( context: context, observer_plugins: observer_plugins, reporter_plugins: reporter_plugins, translator_plugins: translat...
github
gree/observed
https://github.com/gree/observed
spec/config_dsl_spec.rb
Ruby
mit
88
master
1,234
require 'spec_helper' require 'observed/config_dsl' require 'observed/observer' require 'observed/reporter' require 'observed/reporter/regexp_matching' require 'observed/config_builder' describe Observed::ConfigDSL do subject { Observed::ConfigDSL.new(builder: Observed::ConfigBuilder.new( context: contex...
github
gree/observed
https://github.com/gree/observed
spec/reporter_spec.rb
Ruby
mit
88
master
455
require 'spec_helper' require 'observed/reporter' describe Observed::Reporter do subject { described_class.new(tag_pattern: /foo/, system: sys) } let(:sys) { mock('system') } it 'fails when the method `match` is not overrode' do expect { subject.match('the_tag') }.to raise_error end it 'fails w...
github
gree/observed
https://github.com/gree/observed
spec/system_spec.rb
Ruby
mit
88
master
786
require 'spec_helper' require 'logger' require 'observed/system' describe Observed::System do subject { Observed::System.new(the_config) } context 'with observers configured' do let(:observers) { [observer] } let(:observer) { c = stub('observer') c.stubs(tag: 'bar') c...
github
gree/observed
https://github.com/gree/observed
spec/event_bus_spec.rb
Ruby
mit
88
master
698
require 'spec_helper' require 'observed/task' require 'observed/event_bus' describe Observed::EventBus do let(:out) { mock('out') } let(:factory) { executor = Observed::BlockingExecutor.new Observed::TaskFactory.new(executor: executor) } let(:the_task) { factory.task { |data, options| ...
github
gree/observed
https://github.com/gree/observed
spec/task_spec.rb
Ruby
mit
88
master
6,494
require 'spec_helper' require 'observed/task' describe Observed::MutableTask do let(:factory) { Observed::TaskFactory.new(:executor => Observed::BlockingExecutor.new) } it 'yields the given block' do yielded = nil task = factory.mutable_task { |data| data } task.now({a:1}, {b:2}) do |d...
github
gree/observed
https://github.com/gree/observed
spec/observer_spec.rb
Ruby
mit
88
master
3,250
require 'spec_helper' require 'observed/observer' describe Observed::Observer do subject { described_class.new(tag: 'the_tag', system: sys) } let(:sys) { mock('system') } it 'fails when the method `observe` is not overrode' do expect { subject.observe }.to raise_error end describe 'attribute' d...
github
gree/observed
https://github.com/gree/observed
spec/basic_event_bus_spec.rb
Ruby
mit
88
master
615
require 'spec_helper' require 'observed/basic_event_bus' describe Observed::BasicEventBus do it 'calls the handler for the emitted event' do handler_one_called = false handler_two_called = false bus = Observed::BasicEventBus.new expect { bus.emit('foo') }.to_not raise_error expect { bus.on_receiv...
github
gree/observed
https://github.com/gree/observed
spec/configurable_spec.rb
Ruby
mit
88
master
4,171
require 'spec_helper' require 'observed/configurable' require 'observed/pluggable' module ConfigurableSpec class Foo include Observed::Configurable attribute :foo, default: 123 attribute :bar, default: 234 attribute :baz default :bar => 345 end module ConfigurableModule include Observe...
github
gree/observed
https://github.com/gree/observed
spec/observed_spec.rb
Ruby
mit
88
master
10,961
require 'spec_helper' require 'observed' require 'observed/builtin_plugins' describe Observed do include FakeFS::SpecHelpers describe '#load!`' do context 'with a relative file path under the current working directory' do subject do mod = Module.new do extend Observed end ...
github
gree/observed
https://github.com/gree/observed
spec/observed_task_factory_spec.rb
Ruby
mit
88
master
1,043
require 'spec_helper' require 'observed/observed_task_factory' describe Observed::ObservedTaskFactory do subject { Observed::ObservedTaskFactory.new } it 'should convert observers, translators, reporters to tasks' do output = mock('output') the_observer = Class.new(Observed::Observer) do def o...
github
gree/observed
https://github.com/gree/observed
spec/spec_helper.rb
Ruby
mit
88
master
1,751
require 'fakefs/spec_helpers' require 'rspec' require 'coveralls' Coveralls.wear! Dir["#{File.expand_path('..', __FILE__)}/support/**/*.rb"].each { |f| require f } puts "Please do not update/create files while tests are running." RSpec.configure do |config| config.color_enabled = true config.order = :random ...
github
gree/observed
https://github.com/gree/observed
spec/oneshot_spec.rb
Ruby
mit
88
master
1,607
require 'spec_helper' require 'observed/application/oneshot' describe Observed::Application::Oneshot do let(:bar) { Class.new(Observed::Observer) do def observe sleep rand 'Bar' end plugin_name 'oneshot_spec_bar' end } before { bar } #context 'with Hash objects...
github
gree/observed
https://github.com/gree/observed
spec/task_factory_spec.rb
Ruby
mit
88
master
435
require 'spec_helper' require 'observed/task' describe Observed::TaskFactory do context 'when the executor not given' do it 'fails to initialize' do expect { Observed::TaskFactory.new() }.to raise_error end end context 'when a logger given' do it 'may prefer the given logger over the default o...
github
gree/observed
https://github.com/gree/observed
spec/input_helpers/timer_spec.rb
Ruby
mit
88
master
1,416
require 'spec_helper' require 'observed/observer_helpers/timer' require 'observed/observer' describe Observed::ObserverHelpers::Timer do include Observed::SpecHelpers before { class ExampleTimerPlugin < Observed::Observer include Observed::ObserverHelpers::Timer attribute :timeout_in_millisecond...
github
gree/observed
https://github.com/gree/observed
spec/hash/builder_spec.rb
Ruby
mit
88
master
805
require 'spec_helper' require 'observed/hash/builder' describe Observed::Hash::Builder do subject { described_class.new(hash) } context 'with a source hash' do let(:hash) { {} } context 'with a key path' do it 'decodes the key path and recursively creates missing Hash object for each part i...