Class: RunLoop::CLI::Locale

Inherits:
Thor
  • Object
show all
Defined in:
lib/run_loop/cli/locale.rb

Instance Method Summary collapse

Instance Method Details



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/run_loop/cli/locale.rb', line 11

def print_alert_regexes
  dir = File.expand_path(File.dirname(__FILE__))
  scripts_dir = File.join(dir, "..", "..", "..", "scripts")
  on_alert = File.join(scripts_dir, "lib", "on_alert.js")

  lines = []
  File.read(on_alert).force_encoding("UTF-8").split($-0).each do |line|
    if line[/\[\".+\", \/.+\/\]/, 0]
      line.chomp!
      if line[-1,1] == ","
        line = line[0, line.length - 1]
      end
      lines << line
    end
  end

  puts lines.join(",#{$-0}")
end