Class: Fare::GenerateLockFile

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/fare/generate_lock_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ GenerateLockFile

Returns a new instance of GenerateLockFile.



9
10
11
12
13
14
# File 'lib/fare/generate_lock_file.rb', line 9

def initialize(options = {})
  @force = options.delete(:force) { false }
  @configuration = LoadConfigurationFile.new(options)
  @topics = {}
  @queues = {}
end

Instance Attribute Details

#forceObject (readonly)

Returns the value of attribute force.



7
8
9
# File 'lib/fare/generate_lock_file.rb', line 7

def force
  @force
end

#queuesObject (readonly)

Returns the value of attribute queues.



7
8
9
# File 'lib/fare/generate_lock_file.rb', line 7

def queues
  @queues
end

#topicsObject (readonly)

Returns the value of attribute topics.



7
8
9
# File 'lib/fare/generate_lock_file.rb', line 7

def topics
  @topics
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fare/generate_lock_file.rb', line 20

def call
  return if skip_generating?

  configuration.load_environment(environment)

  find_publishing_topics
  find_subscriber_queues

  File.open(lock_filename, "w:utf-8") do |f|
    f.write(data.to_yaml)
  end
end

#configurationObject



16
17
18
# File 'lib/fare/generate_lock_file.rb', line 16

def configuration
  @configuration.configuration
end