|
@ -1,7 +1,7 @@ |
|
|
require 'dotenv' |
|
|
require 'dotenv' |
|
|
|
|
|
|
|
|
# DEFINABLE_THREAD_GROUP ||= ThreadGroup.new |
|
|
# DEFINABLE_THREAD_GROUP ||= ThreadGroup.new |
|
|
DEFINABLE_LISTENERS ||= [] # rubocop:disable Lint/OrAssignmentToConstant |
|
|
|
|
|
|
|
|
DEFINABLE_LISTENERS ||= [] # rubocop:disable Lint/OrAssignmentToConstant,Style/MutableConstant |
|
|
|
|
|
|
|
|
module Live |
|
|
module Live |
|
|
# offers typed constant defintions with default value, by using lots of introspecting... |
|
|
# offers typed constant defintions with default value, by using lots of introspecting... |
|
@ -31,10 +31,8 @@ module Live |
|
|
def trigger_rolling_event(changes) |
|
|
def trigger_rolling_event(changes) |
|
|
logger.info ' ', dimensions: Semantic::FancyDimensions.new(rails: '╔═╗', before: 1) |
|
|
logger.info ' ', dimensions: Semantic::FancyDimensions.new(rails: '╔═╗', before: 1) |
|
|
changes.each do |change| |
|
|
changes.each do |change| |
|
|
kind = change[:kind] |
|
|
|
|
|
constant = change[:constant] |
|
|
|
|
|
value = change[:new_value] |
|
|
|
|
|
logger.warn "Constant #{kind}:#{Semantic::AnsiColors::CLEAR} #{constant} = #{value.ai}" |
|
|
|
|
|
|
|
|
value = change[:new_value].ai |
|
|
|
|
|
logger.warn "Constant #{change[:kind]}:#{Semantic::AnsiColors::CLEAR} #{change[:constant]} = #{value}" |
|
|
end |
|
|
end |
|
|
logger.info ' ', dimensions: Semantic::FancyDimensions.new(rails: '╚═╝') |
|
|
logger.info ' ', dimensions: Semantic::FancyDimensions.new(rails: '╚═╝') |
|
|
|
|
|
|
|
@ -132,7 +130,12 @@ module Live |
|
|
raise "unexpected directory: #{dir_file} != #{dir_source_location}" unless dir_file == dir_source_location |
|
|
raise "unexpected directory: #{dir_file} != #{dir_source_location}" unless dir_file == dir_source_location |
|
|
|
|
|
|
|
|
@lines ||= File.readlines(file) # cached source code |
|
|
@lines ||= File.readlines(file) # cached source code |
|
|
@lines[line].match(/\s*(.\w+)/)[1] # TODO: should be uppercase! |
|
|
|
|
|
|
|
|
constant = @lines[line].match(/\s*(.\w+)/)[1] |
|
|
|
|
|
unless constant.upcase == constant |
|
|
|
|
|
backtrace = ["#{file}:#{line + 1}"] |
|
|
|
|
|
raise ArgumentError, "unexpected case: a definable constant <#{constant}> must be uppercase!", backtrace |
|
|
|
|
|
end |
|
|
|
|
|
constant |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |