slackbot_frd 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7556cdfe493b4f528cba8227e391ff9451feb83c
4
- data.tar.gz: 218c8755f1730b986970078c0313a2b3f92d47f5
3
+ metadata.gz: 7ffc381e9ce6ec71a7454fc1b5149467b68f0735
4
+ data.tar.gz: 492ee45b4ecf16b697c64c1179429286f18ac3e7
5
5
  SHA512:
6
- metadata.gz: ac2790ee9f222f722ff3508d7b0d8d6653057eb829092cb302af0078f725a1cee5ac079124e43734f5957cd04033c210e03c4d84ee34a776ac9f5c50dbc59d16
7
- data.tar.gz: 52da196a510039cf41ef40f0cac55d99f25485183c82e0f3b3c4707433735b2f5726c202863fabfd096107b9dcad8c94d9bff81b6c824b8beddd1c77aa9db540
6
+ metadata.gz: 6ea3381601043e30939c03363fe0c82a17946a2cbff891f71d7bc9e4f12dbec92aaee0a709b2860c3a2d61f5916e75d6613798d5c51aa118e01bbb16b2b37962
7
+ data.tar.gz: 6cab09aa37ce70ec106458da6da16c0982321f4959c0db08d4328237ce9aa12cfcaa62b4ac2f2712418fb4c63c185cb9378dbe3e461fb507d2302d8c9beca65e
data/bin/slackbot-frd CHANGED
@@ -127,25 +127,25 @@ class SlackbotFrdBin < Thor
127
127
  daemonize = false
128
128
  daemonize = $slackbotfrd_conf['daemonize'] if $slackbotfrd_conf['daemonize']
129
129
  if ENV['SLACKBOT_FRD_DAEMONIZE']
130
- daemonize = ENV['SLACKBOT_FRD_DAEMONIZE']
130
+ daemonize = ENV['SLACKBOT_FRD_DAEMONIZE'].chomp
131
131
  daemonize = daemonize == 'true' || daemonize == '1'
132
132
  end
133
133
  daemonize = options[:daemonize] if options[:daemonize]
134
134
 
135
135
  botdir = Dir.pwd
136
136
  botdir = $slackbotfrd_conf['botdir'] if $slackbotfrd_conf['botdir']
137
- botdir = ENV['SLACKBOT_FRD_BOTDIR'] if ENV['SLACKBOT_FRD_BOTDIR']
137
+ botdir = ENV['SLACKBOT_FRD_BOTDIR'].chomp if ENV['SLACKBOT_FRD_BOTDIR']
138
138
  botdir = options[:botdir] if options[:botdir]
139
139
  botdir = File.expand_path(botdir)
140
140
 
141
141
  SlackbotFrd::Log.logfile = "#{botdir}/#{LOG_FILE}"
142
142
  SlackbotFrd::Log.logfile = $slackbotfrd_conf['log_file'] if $slackbotfrd_conf['log_file']
143
- SlackbotFrd::Log.logfile = ENV['SLACKBOT_FRD_LOG_FILE'] if ENV['SLACKBOT_FRD_LOG_FILE']
143
+ SlackbotFrd::Log.logfile = ENV['SLACKBOT_FRD_LOG_FILE'].chomp if ENV['SLACKBOT_FRD_LOG_FILE']
144
144
  SlackbotFrd::Log.logfile = options['log-file'] if options['log-file']
145
145
 
146
146
  SlackbotFrd::Log.level = :info
147
147
  SlackbotFrd::Log.level = $slackbotfrd_conf['log_level'] if $slackbotfrd_conf['log_level']
148
- SlackbotFrd::Log.level = ENV['SLACKBOT_FRD_LOG_LEVEL'] if ENV['SLACKBOT_FRD_LOG_LEVEL']
148
+ SlackbotFrd::Log.level = ENV['SLACKBOT_FRD_LOG_LEVEL'].chomp if ENV['SLACKBOT_FRD_LOG_LEVEL']
149
149
  SlackbotFrd::Log.level = options['log-level'] if options['log-level']
150
150
 
151
151
  # If we got a number for log level that is valid, just use that
@@ -366,21 +366,27 @@ class SlackbotFrdBin < Thor
366
366
  slackbotfrd_conf ||= {}
367
367
  slackbotfrd_conf.keys.inject(slackbotfrd_conf) do |acc, key|
368
368
  slackbotfrd_conf_key_to_keys(key).each do |k|
369
- acc[k] = acc[key]
369
+ acc[k] = chomp_if_string(acc[key])
370
370
  end
371
371
  acc
372
372
  end
373
373
  # Copy env vars into the config so they can be used easily
374
374
  ENV.keys.inject(slackbotfrd_conf) do |acc, key|
375
375
  if key =~ /^SLACKBOT_FRD/i
376
- acc[key] = ENV[key]
377
- acc[key.downcase] = ENV[key]
378
- acc[key.gsub(/SLACKBOT_FRD_?/i, '').downcase] = ENV[key]
376
+ acc[key] = chomp_if_string(ENV[key])
377
+ acc[key.downcase] = chomp_if_string(ENV[key])
378
+ acc[key.gsub(/SLACKBOT_FRD_?/i, '').downcase] = chomp_if_string(ENV[key])
379
379
  end
380
380
  acc
381
381
  end
382
382
  slackbotfrd_conf
383
383
  end
384
+
385
+ private
386
+ def chomp_if_string(str)
387
+ return str.chomp if str.is_a?(String)
388
+ str
389
+ end
384
390
  end
385
391
 
386
392
  if !ARGV.empty? && %w[-v --version].include?(ARGV.first)
@@ -1,4 +1,4 @@
1
1
  module SlackbotFrd
2
- VERSION = '0.2.8'
2
+ VERSION = '0.2.9'
3
3
  DATE = '2016-07-19'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackbot_frd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Porter