Module: Sidekiq::WebCustom

Defined in:
lib/sidekiq/web_custom.rb,
lib/sidekiq/web_custom/job.rb,
lib/sidekiq/web_custom/queue.rb,
lib/sidekiq/web_custom/version.rb,
lib/sidekiq/web_custom/web_app.rb,
lib/sidekiq/web_custom/processor.rb,
lib/sidekiq/web_custom/web_action.rb,
lib/sidekiq/web_custom/configuration.rb

Defined Under Namespace

Modules: Job, Queue, WebAction Classes: ArgumentError, Configuration, ConfigurationEstablished, Error, ExecutionTimeExceeded, FileNotFound, Processor, StopExecution, WebApp

Constant Summary collapse

BREAK_BIT =
'__sidekiq-web_custom-breakbit__'
MAJOR =

With backwards incompatability. Requires annoucment and update documentation

0
MINOR =

With feature launch. Documentation of upgrade is useful via a changelog

6
PATCH =

With minor upgrades or patcing a small bug. No changelog necessary

0
VERSION =
[MAJOR,MINOR,PATCH].join('.')

Class Method Summary collapse

Class Method Details

.actions_rootObject



45
46
47
# File 'lib/sidekiq/web_custom.rb', line 45

def self.actions_root
  @actions_root ||= "#{local_erbs_root}/actions"
end

.configObject



57
58
59
60
61
62
# File 'lib/sidekiq/web_custom.rb', line 57

def self.config
  @config ||= Configuration.new.tap do |t|
    t.merge(base: :actions, params: default_available_actions_mapping)
    t.merge(base: :local_erbs, params: default_local_erb_mapping)
  end
end

.configure {|config| ... } ⇒ Object

Yields:



64
65
66
67
68
69
# File 'lib/sidekiq/web_custom.rb', line 64

def self.configure
  yield config if block_given?

  config.validate!
  __inject_dependencies
end

.default_available_actions_mappingObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sidekiq/web_custom.rb', line 24

def self.default_available_actions_mapping
  @available_actions_mapping ||= begin
    temp = {}
    Dir["#{actions_root}/**/*.erb"].map do |erb_path|
      base_path = File.basename(erb_path).split('.')[0]
      second_half = erb_path.split(actions_root)[1]
      action_type = second_half.split(base_path)[0]
      action_type = action_type.delete('/').to_sym
      temp[action_type] ||= {}
      temp[action_type][base_path.to_sym] = erb_path
    end
    temp
  end
end

.default_local_erb_mappingObject



39
40
41
42
43
# File 'lib/sidekiq/web_custom.rb', line 39

def self.default_local_erb_mapping
  @local_erb_mapping ||= Dir["#{local_erbs_root}/*.erb"].map do |erb_path|
    [File.basename(erb_path).split('.')[0].to_sym, erb_path]
  end.to_h
end

.get_versionObject



10
11
12
# File 'lib/sidekiq/web_custom/version.rb', line 10

def self.get_version
  puts VERSION
end

.local_erb_mappingObject



71
72
73
# File 'lib/sidekiq/web_custom.rb', line 71

def self.local_erb_mapping
  config.local_erbs
end

.local_erbs_rootObject



49
50
51
# File 'lib/sidekiq/web_custom.rb', line 49

def self.local_erbs_root
  @local_erbs_root ||= "#{root_path}/views"
end

.reset!Object



75
76
77
# File 'lib/sidekiq/web_custom.rb', line 75

def self.reset!
  @config = nil
end

.root_pathObject



53
54
55
# File 'lib/sidekiq/web_custom.rb', line 53

def self.root_path
  @root_path ||= File.dirname(__FILE__)
end