Class: Popper::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/popper/init.rb

Class Method Summary collapse

Class Method Details

.run(options) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/popper/init.rb', line 3

def self.run(options)
  filename = options[:config] || "/etc/popper.conf"
  unless FileTest.exist?(filename)
    open(filename,"w") do |e|
      e.puts sample_config
    end
    puts "create sample config #{filename}"
  end
end

.sample_configObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/popper/init.rb', line 13

def self.sample_config
  <<-EOS
interval = 60         # fetch interbal default:60

[default.condition]
subject = ["^(?!.*Re:).+$"]

[default.action.slack]
webhook_url = "webhook_url"
user = "slack"
channel = "#default_channel"
message = "default message"

[example.login]
server = "mail.examplejp"
user = "examplle_user"
password = "examplle_pass"

[example.default.condition]
subject = [".*default.*"]

[example.rules.normal_log.condition]
subject = ".*example.*"
body = ".*example.*"

[example.rules.normal_log.action.slack]
channel = "#test"
mentions = ["@test"]
message = "test message"

[example.rules.normal_log.action.git]
repo = "test/example"

[example.rules.normal_log.action.ghe]
repo = "test/example"
  EOS
end