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
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
spec/code_lens_spec.rb
Ruby
mit
217
main
14,508
# typed: false # frozen_string_literal: true require_relative "spec_helper" RSpec.describe RubyLsp::RSpec do include RubyLsp::TestHelper let(:uri) { URI("file://#{File.expand_path("fake_spec.rb", __dir__)}") } describe "code lens" do context "with full test discovery" do it "generates code lens thro...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
lib/ruby_lsp/ruby_lsp_rspec/rspec_formatter.rb
Ruby
mit
217
main
2,641
# typed: true # frozen_string_literal: true require "rspec/core/formatters" require "rspec/core/formatters/progress_formatter" require "ruby_lsp/test_reporters/lsp_reporter" module RubyLsp module RSpec class RSpecFormatter < ::RSpec::Core::Formatters::ProgressFormatter ::RSpec::Core::Formatters.register( ...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
lib/ruby_lsp/ruby_lsp_rspec/test_discovery.rb
Ruby
mit
217
main
3,880
# typed: strict # frozen_string_literal: true module RubyLsp module RSpec class TestDiscovery include ::RubyLsp::Requests::Support::Common #: (ResponseBuilders::TestCollection, Prism::Dispatcher, URI::Generic, String) -> void def initialize(response_builder, dispatcher, uri, workspace_path) ...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
lib/ruby_lsp/ruby_lsp_rspec/indexing_enhancement.rb
Ruby
mit
217
main
1,687
# typed: strict # frozen_string_literal: true module RubyLsp module RSpec class IndexingEnhancement < RubyIndexer::Enhancement # @override #: (Prism::CallNode) -> void def on_call_node_enter(node) return if node.receiver name = node.name case name when :let, :l...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
lib/ruby_lsp/ruby_lsp_rspec/definition.rb
Ruby
mit
217
main
1,388
# typed: strict # frozen_string_literal: true module RubyLsp module RSpec class Definition include ::RubyLsp::Requests::Support::Common #: (ResponseBuilders::CollectionResponseBuilder[Interface::LocationLink | Interface::Location], URI::Generic, NodeContext, RubyIndexer::Index, Prism::Dispatcher) ->...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
lib/ruby_lsp/ruby_lsp_rspec/addon.rb
Ruby
mit
217
main
5,406
# typed: strict # frozen_string_literal: true require "ruby_lsp/addon" require "ruby_lsp/internal" require_relative "code_lens" require_relative "document_symbol" require_relative "definition" require_relative "indexing_enhancement" require_relative "test_discovery" require_relative "spec_style_patch" module RubyLsp...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
lib/ruby_lsp/ruby_lsp_rspec/document_symbol.rb
Ruby
mit
217
main
2,292
# typed: strict # frozen_string_literal: true module RubyLsp module RSpec class DocumentSymbol include ::RubyLsp::Requests::Support::Common #: (ResponseBuilders::DocumentSymbol, Prism::Dispatcher) -> void def initialize(response_builder, dispatcher) @response_builder = response_builder...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
lib/ruby_lsp/ruby_lsp_rspec/code_lens.rb
Ruby
mit
217
main
4,003
# typed: strict # frozen_string_literal: true module RubyLsp module RSpec class CodeLens include ::RubyLsp::Requests::Support::Common #: (ResponseBuilders::CollectionResponseBuilder[Interface::CodeLens], URI::Generic, Prism::Dispatcher, String, ?debug: bool) -> void def initialize(response_bui...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
lib/ruby_lsp/ruby_lsp_rspec/spec_style_patch.rb
Ruby
mit
217
main
390
# typed: strict # frozen_string_literal: true module RubyLsp module Listeners # Patching this listener so it doesn't generate test items for RSpec tests class SpecStyle #: (ResponseBuilders::TestCollection, GlobalState, Prism::Dispatcher, URI::Generic) -> void def initialize(response_builder, glo...
github
st0012/ruby-lsp-rspec
https://github.com/st0012/ruby-lsp-rspec
sorbet/tapioca/require.rb
Ruby
mit
217
main
244
# typed: strict # frozen_string_literal: true # Add your extra requires here (`bin/tapioca require` can be used to bootstrap this list) require "ruby_lsp/internal" require "ruby_lsp/test_helper" require "ruby_lsp/test_reporters/lsp_reporter"
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
influxdb-rails.gemspec
Ruby
mit
216
master
2,055
lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "influxdb/rails/version" Gem::Specification.new do |spec| spec.name = "influxdb-rails" spec.summary = "InfluxDB bindings for Ruby on Rails." spec.description = "This gem instruments your Ruby on Rail...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
Rakefile
Ruby
mit
216
master
716
require "bundler/gem_tasks" require "rubocop/rake_task" RuboCop::RakeTask.new targeted_files = ARGV.drop(1) require "rspec/core" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = targeted_files unless targeted_files.empty? end RSpec.configure do |config| config.color = true co...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
sample-dashboard/Rakefile
Ruby
mit
216
master
1,115
task default: %w[prepare] # rubocop:disable Layout/LineLength task :prepare do sh "cat 'Ruby On Rails Performance.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/performance.json" sh "cat 'Ruby On Rails Performance per Request.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/performanc...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/spec_helper.rb
Ruby
mit
216
master
917
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib")) $LOAD_PATH.unshift(File.dirname(__FILE__)) require "active_support" require_relative "../lib/influxdb/rails/helpers/rspec_matchers" require File.expand_path("#{File.dirname(__FILE__)}/support/broken_client") require "webmock/rspec" WebMock.disable_net_...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/integration/influxdb_rails_sends_metrics_spec.rb
Ruby
mit
216
master
1,054
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "InfluxDB Rails sends metrics" do it "does a HTTP request to InfluxDB server with correct tags and fields" do travel_to Time.zone.local(2018, 1, 1, 9, 0, 0) configure("bucket", "org") stub_hostname("hostname") request = write_request.w...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/action_view_partial_metrics_spec.rb
Ruby
mit
216
master
1,544
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActionView partial metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(ActionDispatch::Request).to receive(:request_id).and_return(:request...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/action_controller_metrics_spec.rb
Ruby
mit
216
master
2,707
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActionController metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(ActionDispatch::Request).to receive(:request_id).and_return(:request_i...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/active_job_perform_metrics_spec.rb
Ruby
mit
216
master
1,678
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActiveJobs perform metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(InfluxDB::Rails::Configuration).to receive(:ignored_environments).an...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/active_record_instantiation_metrics_spec.rb
Ruby
mit
216
master
1,733
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActiveRecord instantiation metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end let(:metric) { Metric.create!(name: "name") } before do allow_any_instance_of(InfluxDB::Ra...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/action_view_collection_metrics_spec.rb
Ruby
mit
216
master
1,653
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActionView collection metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(ActionDispatch::Request).to receive(:request_id).and_return(:requ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/logger_spec.rb
Ruby
mit
216
master
292
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "Logger" do it "logs exception" do InfluxDB::Rails.client = build_broken_client("error message") out = capture_influxdb_output do get "/metrics" end expect(out).to include("error message") end end
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/context_spec.rb
Ruby
mit
216
master
760
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "Context" do it "resets the context after a request" do get "/metrics" expect_metric( tags: a_hash_including( location: "MetricsController#index", hook: "sql", cached: false ) ) expect(Influx...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/action_mailer_deliver_metrics_spec.rb
Ruby
mit
216
master
1,326
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActionMailer deliver metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(InfluxDB::Rails::Configuration).to receive(:ignored_environments)....
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/active_record_sql_metrics_spec.rb
Ruby
mit
216
master
1,729
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActiveRecord SQL metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(ActionDispatch::Request).to receive(:request_id).and_return(:request_i...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/block_inistrumentation_spec.rb
Ruby
mit
216
master
1,604
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "BlockInstrumentation metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(ActionDispatch::Request).to receive(:request_id).and_return(:reque...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/action_view_template_metrics_spec.rb
Ruby
mit
216
master
1,549
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActionView template metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(ActionDispatch::Request).to receive(:request_id).and_return(:reques...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/requests/active_job_enqueue_metrics_spec.rb
Ruby
mit
216
master
1,625
require "#{File.dirname(__FILE__)}/../spec_helper" RSpec.describe "ActiveJob enqueue metrics" do let(:tags_middleware) do lambda do |tags| tags.merge(tags_middleware: :tags_middleware) end end before do allow_any_instance_of(InfluxDB::Rails::Configuration).to receive(:ignored_environments).and...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/unit/configuration_spec.rb
Ruby
mit
216
master
3,250
require "spec_helper" RSpec.describe InfluxDB::Rails::Configuration do before do @configuration = described_class.new end describe "client configuration" do subject { InfluxDB::Rails.configuration.client } describe "#max_retries" do it "defaults to 0" do expect(subject.max_retries).to...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/unit/tags.rb
Ruby
mit
216
master
1,623
require "spec_helper" RSpec.describe InfluxDB::Rails::Tags do let(:config) { InfluxDB::Rails::Configuration.new } describe ".to_h" do it "returns TrueClass" do subject = described_class.new(config: config, tags: { hans: true }) expect(subject.to_h).to a_hash_including(hans: true) end it "...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/unit/block_instrumentation_spec.rb
Ruby
mit
216
master
437
require "spec_helper" RSpec.describe InfluxDB::Rails do describe ".instrument" do it "supports calling wihout a block" do described_class.instrument "name", values: { value: 1 } expect_metric( fields: a_hash_including(value: 1), tags: a_hash_including( hook: "block_in...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/unit/sql/query_spec.rb
Ruby
mit
216
master
961
require "spec_helper" RSpec.describe InfluxDB::Rails::Sql::Query do subject { described_class.new(payload) } let(:payload) do { sql: "select * from users where user_id = 42;", name: "User Load", } end describe "#class_name" do it { expect(subject.class_name).to eq("User") } end ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/unit/sql/normalizer_spec.rb
Ruby
mit
216
master
1,335
require "spec_helper" RSpec.describe InfluxDB::Rails::Sql::Normalizer do describe "#perform" do it { expect(described_class.new("SELECT * FROM posts WHERE id = 1").perform).to eq("SELECT * FROM posts WHERE id = xxx") } it { expect(described_class.new("SELECT * FROM posts WHERE id = 1".freeze).perform).to eq(...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/support/broken_client.rb
Ruby
mit
216
master
244
module InfluxDB module Rails module BrokenClient def build_broken_client(message = "message") client = double allow(client).to receive(:create_write_api).and_raise(message) client end end end end
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
spec/support/rails6/app.rb
Ruby
mit
216
master
2,082
require "action_controller/railtie" require "active_record/railtie" require "active_job" require "action_mailer" app = Class.new(Rails::Application) app.config.secret_key_base = "1234567890abcdef1234567890abcdef" app.config.secret_token = "1234567890abcdef1234567890abcdef" app.config.session_store :cookie_store, key: ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb-rails.rb
Ruby
mit
216
master
2,483
require "net/http" require "net/https" require "rubygems" require "socket" require "influxdb-client" require "influxdb/rails/middleware/block_instrumentation_subscriber" require "influxdb/rails/middleware/render_subscriber" require "influxdb/rails/middleware/request_subscriber" require "influxdb/rails/middleware/sql_su...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/rails/generators/influxdb/influxdb_generator.rb
Ruby
mit
216
master
367
require "rails/generators" class InfluxdbGenerator < Rails::Generators::Base desc "Description:\n This creates a Rails initializer for InfluxDB::Rails." source_root File.expand_path("templates", __dir__) def copy_initializer_file template "initializer.rb", "config/initializers/influxdb_rails.rb" end ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/rails/generators/influxdb/templates/initializer.rb
Ruby
mit
216
master
1,257
InfluxDB::Rails.configure do |config| ## The only settings you actually need to set are org, bucket and token. config.client.bucket = "bucket" config.client.org = "org" config.client.token = "token" # config.client.url = "localhost:8086", ## Various other client and connection options. These are used to cr...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/tags.rb
Ruby
mit
216
master
593
module InfluxDB module Rails class Tags def initialize(config:, tags: {}, additional_tags: InfluxDB::Rails.current.tags) @tags = tags @config = config @additional_tags = additional_tags end def to_h config.tags_middleware.call(tags.merge(default_tags)) end ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/metric.rb
Ruby
mit
216
master
760
require "influxdb/rails/tags" module InfluxDB module Rails class Metric def initialize(configuration:, timestamp:, tags: {}, fields: {}) @configuration = configuration @timestamp = timestamp @tags = tags @fields = fields end def write write_api.write(dat...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/railtie.rb
Ruby
mit
216
master
1,929
require "influxdb-client" require "rails" module InfluxDB module Rails class Railtie < ::Rails::Railtie # :nodoc: # rubocop:disable Metrics/BlockLength config.after_initialize do InfluxDB::Rails.configure do |config| config.environment ||= ::Rails.env end ActiveSupp...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/test_client.rb
Ruby
mit
216
master
253
module InfluxDB module Rails class TestClient cattr_accessor :metrics do [] end def write(options = {}) metrics << options[:data] end def create_write_api(*) self end end end end
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/values.rb
Ruby
mit
216
master
482
module InfluxDB module Rails class Values def initialize(values: {}, additional_values: InfluxDB::Rails.current.values) @values = values @additional_values = additional_values end def to_h expanded_values.reject do |_, value| value.to_s.blank? end ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/context.rb
Ruby
mit
216
master
571
module InfluxDB module Rails class Context def reset Thread.current[:_influxdb_rails_tags] = {} Thread.current[:_influxdb_rails_fields] = {} end def tags Thread.current[:_influxdb_rails_tags].to_h end def tags=(tags) Thread.current[:_influxdb_rails_t...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/configuration.rb
Ruby
mit
216
master
2,299
require "active_support/concern" module InfluxDB module Rails module Configurable extend ActiveSupport::Concern class_methods do def defaults @defaults ||= {} end def set_defaults(**values) defaults.merge! values attr_accessor(*defaults.keys) ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/helpers/rspec_matchers.rb
Ruby
mit
216
master
2,072
require_relative "../test_client" require "launchy" module InfluxDB module Rails module Matchers def expect_metric(name: "rails", tags: a_hash_including, fields: a_hash_including, **options) expect(filtered_metrics(tags)).to include( a_hash_including( name: name, ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/middleware/active_job_subscriber.rb
Ruby
mit
216
master
1,303
require "influxdb/rails/middleware/subscriber" module InfluxDB module Rails module Middleware class ActiveJobSubscriber < Subscriber # :nodoc: private JOB_STATE = { "enqueue" => "queued", "perform_start" => "running", "perform" => "succeeded", ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/middleware/render_subscriber.rb
Ruby
mit
216
master
782
require "influxdb/rails/middleware/subscriber" module InfluxDB module Rails module Middleware class RenderSubscriber < Subscriber # :nodoc: private def fields { value: duration, count: payload[:count], cache_hits: payload[:cache_hits]...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/middleware/sql_subscriber.rb
Ruby
mit
216
master
843
require "influxdb/rails/middleware/subscriber" require "influxdb/rails/sql/query" module InfluxDB module Rails module Middleware class SqlSubscriber < Subscriber # :nodoc: private def fields { value: duration, sql: InfluxDB::Rails::Sql::Normalizer.new(pa...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/middleware/subscriber.rb
Ruby
mit
216
master
1,805
require "influxdb/rails/metric" module InfluxDB module Rails module Middleware # Subscriber acts as base class for different *Subscriber classes, # which are intended as ActiveSupport::Notifications.subscribe # consumers. class Subscriber def initialize(configuration:, hook_name:,...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/middleware/block_instrumentation_subscriber.rb
Ruby
mit
216
master
473
require "influxdb/rails/middleware/subscriber" module InfluxDB module Rails module Middleware class BlockInstrumentationSubscriber < Subscriber private def fields { value: duration, }.merge(payload[:fields].to_h) end def tags { ...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/middleware/active_record_subscriber.rb
Ruby
mit
216
master
521
require "influxdb/rails/middleware/subscriber" require "influxdb/rails/sql/query" module InfluxDB module Rails module Middleware class ActiveRecordSubscriber < Subscriber # :nodoc: private def fields { value: duration, record_count: payload[:record_...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/middleware/request_subscriber.rb
Ruby
mit
216
master
1,290
require "influxdb/rails/middleware/subscriber" module InfluxDB module Rails module Middleware class RequestSubscriber < Subscriber # :nodoc: def write super ensure InfluxDB::Rails.current.reset end private def tags { method...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/middleware/action_mailer_subscriber.rb
Ruby
mit
216
master
381
require "influxdb/rails/middleware/subscriber" module InfluxDB module Rails module Middleware class ActionMailerSubscriber < Subscriber # :nodoc: private def fields { value: 1 } end def tags { hook: "deliver", mailer: payload[:...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/sql/query.rb
Ruby
mit
216
master
715
require "influxdb/rails/sql/normalizer" module InfluxDB module Rails module Sql class Query # :nodoc: attr_reader :query, :name TRACKED_SQL_COMMANDS = %w[SELECT INSERT UPDATE DELETE].freeze UNTRACKED_NAMES = %w[SCHEMA].freeze def initialize(payload) @query = payl...
github
InfluxCommunity/influxdb-rails
https://github.com/InfluxCommunity/influxdb-rails
lib/influxdb/rails/sql/normalizer.rb
Ruby
mit
216
master
763
module InfluxDB module Rails module Sql class Normalizer # :nodoc: def initialize(query) @query = query.dup end def perform query.squish! query.gsub!(/(\s(=|>|<|>=|<=|<>|!=)\s)('[^']+'|[$+\-\w.]+)/, '\1xxx') query.gsub!(/(\sIN\s)\([^()]+\)/i, ...
github
stevegraham/certified
https://github.com/stevegraham/certified
certified.gemspec
Ruby
mit
216
master
1,117
Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'certified' s.version = '1.0.0' s.licenses = ['MIT'] s.summary = 'Ensure net/https uses OpenSSL::SSL::VERIFY_PEER to verify SSL certifica...
github
stevegraham/certified
https://github.com/stevegraham/certified
certified.rb
Ruby
mit
216
master
467
require 'net/https' Net::HTTP.class_eval do alias _use_ssl= use_ssl= def use_ssl= boolean self.ca_file = "#{File.dirname(__FILE__)}/certs/ca-bundle.crt" self.verify_mode = OpenSSL::SSL::VERIFY_PEER self._use_ssl = boolean end end OpenSSL::X509::Store.class_eval do alias _set_default_paths ...
github
jpignata/temping
https://github.com/jpignata/temping
Appraisals
Ruby
mit
215
master
1,620
appraise "activerecord-6.0" do gem "activerecord", "~> 6.0.0" gem "activesupport", "~> 6.0.0" gem "sqlite3", "~> 1.4", platforms: [:ruby, :truffleruby] gem "concurrent-ruby", "1.3.4" # https://stackoverflow.com/a/79361034 end appraise "activerecord-6.1" do gem "activerecord", "~> 6.1.0" gem "activesupport"...
github
jpignata/temping
https://github.com/jpignata/temping
temping.gemspec
Ruby
mit
215
master
1,583
Gem::Specification.new do |s| s.name = "temping" s.version = "4.4.0" s.authors = ["John Pignata"] s.email = "john@pignata.com" s.homepage = "https://github.com/jpignata/temping" s.summary = "Create temporary table-backed ActiveRecord models for use in tests" s.license = "MIT" s.files = Dir["lib/**/*.rb...
github
jpignata/temping
https://github.com/jpignata/temping
Rakefile
Ruby
mit
215
master
846
require "rspec/core/rake_task" require "standard/rake" require_relative "spec/test_config" task default: [:standard, :spec] task spec: TestConfig.adapter_versions.map { |adapter_version| "spec:#{adapter_version}" } TestConfig.adapter_versions.each do |adapter_version| namespace :spec do RSpec::Core::RakeTask.n...
github
jpignata/temping
https://github.com/jpignata/temping
spec/spec_helper.rb
Ruby
mit
215
master
1,950
require "simplecov" SimpleCov.start do enable_coverage :branch if respond_to?(:enable_coverage) add_filter "test_config.rb" end $LOAD_PATH << File.join(File.dirname(__FILE__), "/../lib") require "bundler/setup" require_relative "test_config" require "temping" RSpec.configure do |config| config.before(:suite) d...
github
jpignata/temping
https://github.com/jpignata/temping
spec/temping_spec.rb
Ruby
mit
215
master
23,097
require File.join(File.dirname(__FILE__), "/spec_helper") TABLE_NOT_EXISTS_REGEX = Regexp.new( "(Could not find table)|(Table .+? doesn't exist)|(relation .+? does not exist)", Regexp::IGNORECASE ) describe Temping do let(:is_mysql_or_sqlite) do %w[mysql sqlite].any? do |name| ActiveRecord::Base.conne...
github
jpignata/temping
https://github.com/jpignata/temping
spec/test_config.rb
Ruby
mit
215
master
1,374
require "yaml" module TestConfig class << self def current_config config[current_adapter_version] || raise("adapter '#{name}' is not configured") end def adapter_versions @adapter_versions ||= config.keys.reject { |key| skipped_adapters.any? { |adapter| key.to_s.include?(adapter) } }...
github
jpignata/temping
https://github.com/jpignata/temping
lib/temping.rb
Ruby
mit
215
master
5,860
require "active_record" require "active_support/core_ext/string" class Temping; end require "temping/namespace_factory" require "temping/model_factory" class Temping @namespaces = [] @models = [] class << self # Create a new temporary ActiveRecord model with a name specified by `name`. # # Provide...
github
jpignata/temping
https://github.com/jpignata/temping
lib/temping/namespace_factory.rb
Ruby
mit
215
master
437
class Temping::NamespaceFactory def initialize(name) @name = name end def klass @klass ||= @name.split("::").reduce(Object) { |parent, name_part| build(parent, name_part) } end private def build(parent, name_part) parent.const_get(name_part) rescue NameError parent.const_set( name...
github
jpignata/temping
https://github.com/jpignata/temping
lib/temping/model_factory.rb
Ruby
mit
215
master
1,351
class Temping::ModelFactory DEFAULT_OPTIONS = {temporary: true} def initialize(name, namespace, options = {}, &block) @name = name @namespace = namespace @options = options klass.class_eval(&block) if block klass.reset_column_information end def klass @klass ||= @namespace.const_get(@n...
github
qrush/motion-layout
https://github.com/qrush/motion-layout
motion-layout.gemspec
Ruby
mit
215
master
804
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'motion-layout/version' Gem::Specification.new do |gem| gem.name = "motion-layout" gem.version = Motion::Layout::VERSION gem.authors = ["Nick Quaranto"] gem....
github
qrush/motion-layout
https://github.com/qrush/motion-layout
Rakefile
Ruby
mit
215
master
293
#!/usr/bin/env rake require "bundler/gem_tasks" desc "Test by generating an app" task :default do dir = "MotionLayoutTest" `rm -rf #{dir}` `motion create #{dir}` `rm -f #{dir}/app_delegate.rb` `cp -r example/* #{dir}/` Dir.chdir(dir) do sh "bundle --local && rake" end end
github
qrush/motion-layout
https://github.com/qrush/motion-layout
example/Rakefile
Ruby
mit
215
master
218
# -*- coding: utf-8 -*- $:.unshift("/Library/RubyMotion/lib") require 'motion/project' require 'bundler' Bundler.setup require 'motion-layout' Motion::Project::App.setup do |app| app.name = 'MotionLayoutTest' end
github
qrush/motion-layout
https://github.com/qrush/motion-layout
example/app/app_delegate.rb
Ruby
mit
215
master
1,477
# Copyright (c) 2012 HipByte SPRL and Contributors # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the “Software”), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modif...
github
qrush/motion-layout
https://github.com/qrush/motion-layout
example/app/timer_controller.rb
Ruby
mit
215
master
2,489
# Copyright (c) 2012 HipByte SPRL and Contributors # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the “Software”), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modif...
github
qrush/motion-layout
https://github.com/qrush/motion-layout
lib/motion-layout.rb
Ruby
mit
215
master
278
unless defined?(Motion::Project::Config) raise "This file must be required within a RubyMotion project Rakefile." end Motion::Project::App.setup do |app| Dir.glob(File.join(File.dirname(__FILE__), 'motion-layout/*.rb')).each do |file| app.files.unshift(file) end end
github
qrush/motion-layout
https://github.com/qrush/motion-layout
lib/motion-layout/layout.rb
Ruby
mit
215
master
1,320
module Motion class Layout def initialize(&block) @verticals = [] @horizontals = [] @metrics = {} yield self strain end def metrics(metrics) @metrics = Hash[metrics.keys.map(&:to_s).zip(metrics.values)] end def subviews(subviews) @subviews = Hash[...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
Capfile
Ruby
mit
215
master
787
# Load DSL and Setup Up Stages require 'capistrano/setup' # Includes default deployment tasks require 'capistrano/deploy' # Includes tasks from other gems included in your Gemfile # # For documentation on these, see for example: # # https://github.com/capistrano/rvm # https://github.com/capistrano/rbenv # https...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
Vagrantfile
Ruby
mit
215
master
1,394
# -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commen...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
Gemfile
Ruby
mit
215
master
2,810
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 4.2' # Use sqlite3 as the database for Active Record #gem 'sqlite3' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.5' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/test_helper.rb
Ruby
mit
215
master
2,161
ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'webmock/minitest' #require "mocha/test_unit" require 'mocha/minitest' FileUtils.cp(Dir[File.join(Rails.root, "/test/fixtures/data/*.tif")].select {|f| test ?f, f}, File.join(Rails.root, "/test/...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/controllers/imports_controller_test.rb
Ruby
mit
215
master
2,045
require 'test_helper' class ImportsControllerTest < ActionController::TestCase include Devise::TestHelpers tests ImportsController setup do @user = FactoryGirl.create(:admin) request.env["devise.mapping"] = Devise.mappings[:admin] sign_in @user @import = FactoryGirl.create(:import, :user ...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/controllers/api/v1/activity_controller_test.rb
Ruby
mit
215
master
754
require 'test_helper' #note auditing is disabled for tests, so we just test basics class ActivityControllerTest < ActionController::TestCase include Devise::Test::ControllerHelpers tests Api::V1::ActivityController setup do admin_sign_in end test "stats" do get "stats" assert_response :success ...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/controllers/api/v1/maps_controller_test.rb
Ruby
mit
215
master
19,250
require 'test_helper' class MapsControllerTest < ActionController::TestCase include Devise::Test::ControllerHelpers tests Api::V1::MapsController Paperclip::DataUriAdapter.register #enable this in the test environment as we use that to mock tests setup do @map = FactoryGirl.create(:available_map) ...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/controllers/api/v1/users_controller_test.rb
Ruby
mit
215
master
1,914
require 'test_helper' class UsersControllerTest < ActionController::TestCase include Devise::Test::ControllerHelpers tests Api::V1::UsersController setup do @user = FactoryGirl.create(:user) request.env["devise.mapping"] = Devise.mappings[:user] sign_in @user end def admin_sign_in ...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/controllers/api/v1/layers_controller_test.rb
Ruby
mit
215
master
9,901
require 'test_helper' class LayersControllerTest < ActionController::TestCase include Devise::Test::ControllerHelpers tests Api::V1::LayersController setup do @layer_user = FactoryGirl.create(:user) @layer = FactoryGirl.create(:layer_with_maps, :user_id => @layer_user.id) request.env["devise.mapp...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/controllers/api/v1/imports_controller_test.rb
Ruby
mit
215
master
2,560
require 'test_helper' class ApiImportsControllerTest < ActionController::TestCase include Devise::TestHelpers tests Api::V1::ImportsController setup do @user = FactoryGirl.create(:admin) request.env["devise.mapping"] = Devise.mappings[:admin] sign_in @user @import = FactoryGirl.create(:im...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/controllers/api/v1/gcps_controller_test.rb
Ruby
mit
215
master
2,353
require 'test_helper' class GcpsControllerTest < ActionController::TestCase include Devise::Test::ControllerHelpers tests Api::V1::GcpsController setup do @map = FactoryGirl.create(:warped_map) @gcp = FactoryGirl.create(:gcp_1, :map => @map) @gcp_2 = FactoryGirl.create(:gcp_2, :map => @map...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/factories/layer.rb
Ruby
mit
215
master
1,042
FactoryGirl.define do factory :layer, :class => Layer do name "name" description "description" factory :layer_with_maps do after(:create) do |layer| map1 = FactoryGirl.create(:another_available_map) layer.maps << map1 end end factory ...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/factories/map.rb
Ruby
mit
215
master
2,639
FactoryGirl.define do factory :basic_map, :class => Map do title "title" description "description" end factory :unstubbed_map, :parent => :basic_map do upload { File.new(Rails.root.join('test', 'fixtures', 'data', '100x70map.png')) } end factory :index_map, :parent => :basic_map do seque...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/factories/gcp.rb
Ruby
mit
215
master
371
FactoryGirl.define do factory :gcp, :class => Gcp do factory :gcp_1 do x 51.5 y 27.7 lat 58.380 lon 26.737 end factory :gcp_2 do x 13.0 y 61.5 lat 58.353 lon 26.679 end factory :gcp_3 do x 78.7 y 35.7 lat 5...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/factories/user.rb
Ruby
mit
215
master
802
FactoryGirl.define do factory :user, :class => User do login "user" email "test@example.com" password "password" password_confirmation "password" confirmed_at Date.today end factory :admin, :class => User do login "admin" email "admin@example.com" password "password" passwo...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/models/user_warning_test.rb
Ruby
mit
215
master
1,868
require 'test_helper' class UserWarningTest < ActiveSupport::TestCase setup do @user = FactoryGirl.create(:user) @warning = FactoryGirl.create(:warning, :user => @user, :category => "foo", :status => "open", :note => "maps are nice") end test "be valid" do assert @warning.valid? end test "...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/models/layer_test.rb
Ruby
mit
215
master
865
require 'test_helper' class LayerTest < ActiveSupport::TestCase setup do @layer = FactoryGirl.create(:layer_with_maps) end teardown do @layer.send(:delete_tileindex) end test "be valid" do assert @layer.valid? end test "can have maps" do assert_equal 1, @layer.maps.count end ...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
test/models/map_test.rb
Ruby
mit
215
master
2,365
require 'test_helper' class MapTest < ActiveSupport::TestCase setup do @map = FactoryGirl.create(:available_map) FactoryGirl.create(:gcp_1, :map => @map) FactoryGirl.create(:gcp_2, :map => @map) FactoryGirl.create(:gcp_3, :map => @map) end teardown do delete_created_images(@map) ...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/gcp.rb
Ruby
mit
215
master
3,235
class Gcp < ActiveRecord::Base require 'csv' belongs_to :map audited :allow_mass_assignment => true validates_numericality_of :x, :y, :lat, :lon validates_presence_of :x, :y, :lat, :lon, :map_id scope :soft, -> { where(:soft => true)} scope :hard, -> { where('soft IS NULL OR soft = ?', false) } ...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/import.rb
Ruby
mit
215
master
6,519
class Import < ActiveRecord::Base require 'csv' has_many :maps belongs_to :layer belongs_to :user, :class_name => "User" has_and_belongs_to_many :layers has_attached_file :metadata, path: ":rails_root/db/:class/:attachment/:id_partition/:filename", url: ":rails_root/db/:class/:attachment/:id_p...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/layer.rb
Ruby
mit
215
master
5,609
class Layer < ActiveRecord::Base has_many :layers_maps, :dependent => :destroy has_many :maps,:through => :layers_maps belongs_to :user acts_as_commentable include PgSearch multisearchable :against => [:name, :description] validates_presence_of :name validates_length_of :depicts_year, :maximu...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/user_warning.rb
Ruby
mit
215
master
365
class UserWarning < ActiveRecord::Base #This class is to keep track of what warnings have been given to users. #notes text #category string #status string belongs_to :user validates :user_id, uniqueness: { scope: [:category, :status], message: "already has an open warning with this category" }, i...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/map.rb
Ruby
mit
215
master
32,454
require "open3" require "error_calculator" require 'csv' include ErrorCalculator class Map < ActiveRecord::Base has_many :gcps, :dependent => :destroy has_many :layers_maps, :dependent => :destroy has_many :layers, :through => :layers_maps # ,:after_add, :after_remove has_many :my_maps, :dependent => :dest...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/group.rb
Ruby
mit
215
master
265
class Group < ActiveRecord::Base has_many :memberships, :dependent => :destroy has_many :users, :through => :memberships has_many :groups_maps, :dependent => :destroy has_many :maps, :through => :groups_maps belongs_to :creator, :class_name => "User" end
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/error_calculator.rb
Ruby
mit
215
master
3,402
#A module to assist in calculation RMS error of the control points and the map #adapted to ruby by tim waters and based on bsd licenced code #oldmapsonline.org Klokan Petr Pridal gcps2wld.py (new BSD licence) #takes in an enumeration of control points, and returns them with error attribute #and returns the rms of the w...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/user.rb
Ruby
mit
215
master
6,457
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable # :encryptable for custom authentication methods devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :valida...
github
timwaters/mapwarper
https://github.com/timwaters/mapwarper
app/models/user_mailer.rb
Ruby
mit
215
master
825
class UserMailer < ActionMailer::Base default from: APP_CONFIG['email'] def disabled_change_password(user) @user = user @subject = I18n.t('user_mailer.disabled_change_password.subject', :site_name => APP_CONFIG['site_name']) mail(to: @user.email, subject: @subject) end def new_registration(user)...