Class: Gitlab::SnowplowEventDefinitionGenerator

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

Constant Summary collapse

CE_DIR =
'config/events'
EE_DIR =
'ee/config/events'

Instance Method Summary collapse

Instance Method Details

#create_event_fileObject



18
19
20
21
22
# File 'lib/generators/gitlab/snowplow_event_definition_generator.rb', line 18

def create_event_file
  raise "Event definition already exists at #{file_path}" if definition_exists?

  template "event_definition.yml", file_path, force: false
end

#distributionsObject



24
25
26
# File 'lib/generators/gitlab/snowplow_event_definition_generator.rb', line 24

def distributions
  (ee? ? ['- ee'] : ['- ce', '- ee']).join("\n")
end

#ee?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/generators/gitlab/snowplow_event_definition_generator.rb', line 40

def ee?
  options[:ee]
end

#event_actionObject



32
33
34
# File 'lib/generators/gitlab/snowplow_event_definition_generator.rb', line 32

def event_action
  options[:action]
end

#event_categoryObject



28
29
30
# File 'lib/generators/gitlab/snowplow_event_definition_generator.rb', line 28

def event_category
  options[:category]
end

#milestoneObject



36
37
38
# File 'lib/generators/gitlab/snowplow_event_definition_generator.rb', line 36

def milestone
  Gitlab::VERSION.match('(\d+\.\d+)').captures.first
end