Class: Gitlab::UsageMetricGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/gitlab/usage_metric_generator.rb

Constant Summary collapse

CE_DIR =
'lib/gitlab/usage/metrics/instrumentations'
EE_DIR =
'ee/lib/gitlab/usage/metrics/instrumentations'
SPEC_CE_DIR =
'spec/lib/gitlab/usage/metrics/instrumentations'
SPEC_EE_DIR =
'ee/spec/lib/gitlab/usage/metrics/instrumentations'
ALLOWED_SUPERCLASSES =
{
  generic: 'Generic',
  database: 'Database',
  redis: 'Redis'
}.freeze
ALLOWED_OPERATIONS =
%w(count distinct_count estimate_batch_distinct_count).freeze

Instance Method Summary collapse

Instance Method Details

#create_class_filesObject


28
29
30
31
32
33
34
35
# File 'lib/generators/gitlab/usage_metric_generator.rb', line 28

def create_class_files
  validate!

  template "database_instrumentation_class.rb.template", file_path if type == 'database'
  template "generic_instrumentation_class.rb.template", file_path if type == 'generic'

  template "instrumentation_class_spec.rb.template", spec_file_path
end