Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor modules into separate gems #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

source 'https://rubygems.org'

gemspec
gemspec name: 'dog_collar'

Dir['dog_collar-*.gemspec'].each do |gemspec|
gemspec name: File.basename(gemspec, '.gemspec')
end

group :development, :test do
gem 'getsmarter-rubocop-style', git: 'https://github.com/getsmarter/getsmarter-rubocop-style'
Expand Down
39 changes: 39 additions & 0 deletions dog_collar-circuitry.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding: utf-8
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dog_collar/version'

extension_files = []
Dir['dog_collar-*.gemspec'].each do |gemspec|
next if gemspec == __FILE__

name = File.basename(gemspec, '.gemspec').delete_prefix('dog_collar-')
extension_files << "lib/dog_collar/#{name}.rb"

Dir["lib/dog_collar/contrib/#{name}/**/*.rb"].each do |file|
extension_files << file
end
end

Gem::Specification.new do |spec|
spec.name = 'dog_collar-circuitry'
spec.version = DogCollar::VERSION::STRING
spec.required_ruby_version = ">= #{DogCollar::VERSION::MINIMUM_RUBY_VERSION}"
spec.required_rubygems_version = '>= 2.0.0'
spec.authors = ['James Behr']
spec.email = ['[email protected]']
spec.summary = 'DogCollar Circuitry instrumentation'
spec.homepage = 'https://github.com/get-smarter/dog_collar'

spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.files = `git ls-files -- lib/dog_collar`.split("\n")
spec.files -= extension_files
spec.test_files = `git ls-files -- spec`.split("\n")
Comment on lines +32 to +34
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix list of files

spec.require_paths = ['lib']

spec.add_dependency 'amazing_print'
spec.add_dependency 'ddtrace', '~> 0.37.0'
end
39 changes: 39 additions & 0 deletions dog_collar-core.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding: utf-8
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dog_collar/version'

extension_files = []
Dir['dog_collar-*.gemspec'].each do |gemspec|
next if gemspec == __FILE__

name = File.basename(gemspec, '.gemspec').delete_prefix('dog_collar-')
extension_files << "lib/dog_collar/#{name}.rb"

Dir["lib/dog_collar/contrib/#{name}/**/*.rb"].each do |file|
extension_files << file
end
end

Gem::Specification.new do |spec|
spec.name = 'dog_collar-core'
spec.version = DogCollar::VERSION::STRING
spec.required_ruby_version = ">= #{DogCollar::VERSION::MINIMUM_RUBY_VERSION}"
spec.required_rubygems_version = '>= 2.0.0'
spec.authors = ['James Behr']
spec.email = ['[email protected]']
spec.summary = 'DogCollar core logging functionality'
spec.homepage = 'https://github.com/get-smarter/dog_collar'

spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.files = `git ls-files -- lib/dog_collar`.split("\n")
spec.files -= extension_files
spec.test_files = `git ls-files -- spec`.split("\n")
spec.require_paths = ['lib']

spec.add_dependency 'amazing_print'
spec.add_dependency 'ddtrace', '~> 0.37.0'
end
39 changes: 39 additions & 0 deletions dog_collar-ethon.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding: utf-8
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dog_collar/version'

extension_files = []
Dir['dog_collar-*.gemspec'].each do |gemspec|
next if gemspec == __FILE__

name = File.basename(gemspec, '.gemspec').delete_prefix('dog_collar-')
extension_files << "lib/dog_collar/#{name}.rb"

Dir["lib/dog_collar/contrib/#{name}/**/*.rb"].each do |file|
extension_files << file
end
end

Gem::Specification.new do |spec|
spec.name = 'dog_collar-ethon'
spec.version = DogCollar::VERSION::STRING
spec.required_ruby_version = ">= #{DogCollar::VERSION::MINIMUM_RUBY_VERSION}"
spec.required_rubygems_version = '>= 2.0.0'
spec.authors = ['James Behr']
spec.email = ['[email protected]']
spec.summary = 'DogCollar Ethon instrumentation'
spec.homepage = 'https://github.com/get-smarter/dog_collar'

spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.files = `git ls-files -- lib/dog_collar`.split("\n")
spec.files -= extension_files
spec.test_files = `git ls-files -- spec`.split("\n")
spec.require_paths = ['lib']

spec.add_dependency 'amazing_print'
spec.add_dependency 'ddtrace', '~> 0.37.0'
end
39 changes: 39 additions & 0 deletions dog_collar-rails.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding: utf-8
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dog_collar/version'

extension_files = []
Dir['dog_collar-*.gemspec'].each do |gemspec|
next if gemspec == __FILE__

name = File.basename(gemspec, '.gemspec').delete_prefix('dog_collar-')
extension_files << "lib/dog_collar/#{name}.rb"

Dir["lib/dog_collar/contrib/#{name}/**/*.rb"].each do |file|
extension_files << file
end
end

Gem::Specification.new do |spec|
spec.name = 'dog_collar-rails'
spec.version = DogCollar::VERSION::STRING
spec.required_ruby_version = ">= #{DogCollar::VERSION::MINIMUM_RUBY_VERSION}"
spec.required_rubygems_version = '>= 2.0.0'
spec.authors = ['James Behr']
spec.email = ['[email protected]']
spec.summary = 'DogCollar Rails instrumentation'
spec.homepage = 'https://github.com/get-smarter/dog_collar'

spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.files = `git ls-files -- lib/dog_collar/contrib/rails`.split("\n")
spec.files -= extension_files
spec.test_files = `git ls-files -- spec`.split("\n")
spec.require_paths = ['lib']

spec.add_dependency 'dog_collar-core', DogCollar::VERSION::STRING
spec.add_dependency 'lograge'
end
39 changes: 39 additions & 0 deletions dog_collar-sidekiq.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding: utf-8
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dog_collar/version'

extension_files = []
Dir['dog_collar-*.gemspec'].each do |gemspec|
next if gemspec == __FILE__

name = File.basename(gemspec, '.gemspec').delete_prefix('dog_collar-')
extension_files << "lib/dog_collar/#{name}.rb"

Dir["lib/dog_collar/contrib/#{name}/**/*.rb"].each do |file|
extension_files << file
end
end

Gem::Specification.new do |spec|
spec.name = 'dog_collar-sidekiq'
spec.version = DogCollar::VERSION::STRING
spec.required_ruby_version = ">= #{DogCollar::VERSION::MINIMUM_RUBY_VERSION}"
spec.required_rubygems_version = '>= 2.0.0'
spec.authors = ['James Behr']
spec.email = ['[email protected]']
spec.summary = 'DogCollar Sidekiq instrumentation'
spec.homepage = 'https://github.com/get-smarter/dog_collar'

spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.files = `git ls-files -- lib/dog_collar`.split("\n")
spec.files -= extension_files
spec.test_files = `git ls-files -- spec`.split("\n")
spec.require_paths = ['lib']

spec.add_dependency 'amazing_print'
spec.add_dependency 'ddtrace', '~> 0.37.0'
end
24 changes: 13 additions & 11 deletions dog_collar.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dog_collar/version'

Gem::Specification.new do |spec|
spec.name = 'dog_collar'
spec.version = DogCollar::VERSION::STRING
spec.name = 'dog_collar'
spec.version = DogCollar::VERSION::STRING
spec.required_ruby_version = ">= #{DogCollar::VERSION::MINIMUM_RUBY_VERSION}"
spec.required_rubygems_version = '>= 2.0.0'
spec.authors = ['James Behr']
spec.email = ['[email protected]']
spec.authors = ['James Behr']
spec.email = ['[email protected]']

spec.summary = 'Datadog wrapper'
spec.summary = 'Zero-configuration structured logging and instrumentation'
spec.description = <<-DESCRIPTION.gsub(/^[\s]+/, '')
Wrapper around ddtrace
DogCollar wraps ddtrace-rb with sensible defaults for instrumentation, as
well as including a structured logger that automatically relates logs to
the active trace.
DESCRIPTION

spec.homepage = 'https://github.com/get-smarter/dog_collar'
Expand All @@ -24,13 +26,13 @@ Gem::Specification.new do |spec|

spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.files = ['lib/dog_collar.rb']
spec.require_paths = ['lib']

# Optional extensions
spec.add_dependency 'amazing_print'
spec.add_dependency 'ddtrace', '~> 0.37.0'
spec.add_dependency 'lograge'
Dir['dog_collar-*.gemspec'].each do |gemspec|
extension = File.basename(gemspec, '.gemspec')
spec.add_dependency extension, DogCollar::VERSION::STRING
end

# Development dependencies
spec.add_development_dependency 'appraisal'
Expand Down
17 changes: 5 additions & 12 deletions lib/dog_collar.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# frozen_string_literal: true

require 'dog_collar/configuration'
require 'dog_collar/logging/logger'
require 'dog_collar/logging/instrumented_logger'

module DogCollar
extend Configuration
end

require 'dog_collar/contrib/sidekiq/integration'
require 'dog_collar/contrib/rails/integration'
require 'dog_collar/contrib/circuitry/integration'
require 'dog_collar/contrib/ethon/integration'
require 'dog_collar/core'
require 'dog_collar/circuitry'
require 'dog_collar/ethon'
require 'dog_collar/rails'
require 'dog_collar/sidekiq'
3 changes: 3 additions & 0 deletions lib/dog_collar/circuitry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require 'dog_collar/contrib/circuitry/integration'
10 changes: 10 additions & 0 deletions lib/dog_collar/core.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require 'ddtrace'
require 'dog_collar/configuration'
require 'dog_collar/logging/logger'
require 'dog_collar/logging/instrumented_logger'

module DogCollar
extend Configuration
end
3 changes: 3 additions & 0 deletions lib/dog_collar/ethon.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require 'dog_collar/contrib/ethon/integration'
3 changes: 3 additions & 0 deletions lib/dog_collar/rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require 'dog_collar/contrib/rails/integration'
2 changes: 1 addition & 1 deletion lib/dog_collar/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def logger
def autoload!
AUTOLOADS.each do |name|
integration = registry[name]
use(name) if integration.class.patchable?
use(name) if !integration.nil? && integration.class.patchable?
end
end

Expand Down
3 changes: 3 additions & 0 deletions lib/dog_collar/sidekiq.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require 'dog_collar/contrib/sidekiq/integration'