slackbot_frd 0.2.5 → 0.2.6

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: 2f3e60209947c6f28fbfa5f9bf98973d90b652e2
4
- data.tar.gz: 4050aaa31b96245ca6c8280bee433eef2b692e79
3
+ metadata.gz: 2ea34ae19d44e102d85572f5047d4c6e75cca914
4
+ data.tar.gz: 3bc04597f27bb93bb6b7eae91e2cd8c8eedcb758
5
5
  SHA512:
6
- metadata.gz: a04dede3892daf4426b31a7f98e3146d5e3671513abcf9a6df94d4898720b79ea4b80643de52201a996841bc9aec4ec13bb5f02291c523759bd4ebaf02ccbb0e
7
- data.tar.gz: f44cc2a3427bdac3aea7150e376e7fd7b6aca9cd37f5bfdadd77f13f7584cb9b4dc173bfced189ae2942c4ffb549c7f60fac2acff0570f87a9e4066567a73160
6
+ metadata.gz: 1b462425254baf94e0ae5720a2cf562e5379415711b8ea2306110d5d6a936dfaa61cec70cdf63fd1423a9b61e23eb7d77a28df5223c267f378f9e95a7dc1577f
7
+ data.tar.gz: df9f9716ab50dabe50149e8e541fa264ee2582b625757ec24c693ec496001732b19dc034f78211a4ad4ac4b2edf9e3aba38e405bb2f113faa5bd7980eecacf27
data/bin/slackbot-frd CHANGED
@@ -8,6 +8,7 @@ require 'active_support/core_ext/string'
8
8
  require 'slackbot_frd/initializer/bot_starter'
9
9
  require 'slackbot_frd/lib/slack_connection'
10
10
  require 'slackbot_frd/lib/bot'
11
+ require 'slackbot_frd/lib/version'
11
12
 
12
13
  begin
13
14
  require 'byebug'
@@ -120,8 +121,7 @@ class SlackbotFrdBin < Thor
120
121
 
121
122
  config_file = options['config-file']
122
123
  config_file = config_file_location unless config_file
123
- $slackbotfrd_conf = config_file_json(config_file) if config_file
124
- $slackbotfrd_conf ||= {}
124
+ $slackbotfrd_conf = build_slackbotfrd_conf(config_file)
125
125
  $slackbotfrd_conf.freeze
126
126
 
127
127
  daemonize = false
@@ -218,6 +218,12 @@ class SlackbotFrdBin < Thor
218
218
  stop
219
219
  start(set_bots)
220
220
  end
221
+
222
+ desc 'version', 'Check current installed version of slackbot_frd'
223
+ def version
224
+ puts "SlackbotFrd - Version: #{SlackbotFrd::VERSION}"
225
+ end
226
+
221
227
  private
222
228
  def config_file_location
223
229
  "#{Dir.pwd}/#{DEFAULT_CONFIG_FILE}"
@@ -345,6 +351,37 @@ class SlackbotFrdBin < Thor
345
351
  end
346
352
  EXAMPLE_BOT
347
353
  end
354
+
355
+ private
356
+ def slackbotfrd_conf_key_to_keys(key)
357
+ ["SLACKBOT_FRD_#{key.upcase}", key.upcase]
358
+ end
359
+
360
+ private
361
+ def build_slackbotfrd_conf(config_file)
362
+ slackbotfrd_conf = config_file_json(config_file) if config_file
363
+ slackbotfrd_conf ||= {}
364
+ slackbotfrd_conf.keys.inject(slackbotfrd_conf) do |acc, key|
365
+ slackbotfrd_conf_key_to_keys(key).each do |k|
366
+ acc[k] = acc[key]
367
+ end
368
+ acc
369
+ end
370
+ # Copy env vars into the config so they can be used easily
371
+ ENV.keys.inject(slackbotfrd_conf) do |acc, key|
372
+ if key =~ /^SLACKBOT_FRD/i
373
+ acc[key] = ENV[key]
374
+ acc[key.downcase] = ENV[key]
375
+ acc[key.gsub(/SLACKBOT_FRD_?/i, '').downcase] = ENV[key]
376
+ end
377
+ acc
378
+ end
379
+ slackbotfrd_conf
380
+ end
348
381
  end
349
382
 
350
- SlackbotFrdBin.start(ARGV)
383
+ if !ARGV.empty? && %w[-v --version].include?(ARGV.first)
384
+ puts "SlackbotFrd - Version: #{SlackbotFrd::VERSION}"
385
+ else
386
+ SlackbotFrdBin.start(ARGV)
387
+ end
@@ -0,0 +1,4 @@
1
+ module SlackbotFrd
2
+ VERSION = '0.2.6'
3
+ DATE = '2016-07-15'
4
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackbot_frd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Porter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -172,6 +172,7 @@ files:
172
172
  - lib/slackbot_frd/lib/log.rb
173
173
  - lib/slackbot_frd/lib/slack_connection.rb
174
174
  - lib/slackbot_frd/lib/user_channel_callbacks.rb
175
+ - lib/slackbot_frd/lib/version.rb
175
176
  - lib/slackbot_frd/slack_methods/channels_info.rb
176
177
  - lib/slackbot_frd/slack_methods/channels_invite.rb
177
178
  - lib/slackbot_frd/slack_methods/channels_list.rb