slackbot_frd 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bb68aca99439d177c185daf2ca3009ed2926868
4
- data.tar.gz: 8d35953ceec1d879df5d1cd0735cbef50b63f439
3
+ metadata.gz: fd42f15c6b386a233d064d8dd584806014af4435
4
+ data.tar.gz: 0d7fa366f7141f126df3aa80316dabea78f1ae1c
5
5
  SHA512:
6
- metadata.gz: a6e04365893893331d10d2a7f4c31cf9f23e78d9a9d18263b051d41a889ad5760133bf376aa28f8816f6518aae187166f8302ec5b658a4066bf69af9fba86177
7
- data.tar.gz: f34fed3e5bb0ff20ac207834f17838160322cdc295c52cbc342992319806b597b39751184966e7695b865bdddb7918905e599c99b6217db36c300aa441c1129c
6
+ metadata.gz: da8f260a9cb49e4506e14a7f3eca4ac994fbb1c24a7312427a65f61d80424a13cb8f1a9df45d645e3b13a2ca965dd803be19a615670fe02e96c9ceba0e6c17da
7
+ data.tar.gz: 82d2a87547f7ef172814b67b5b694ec88b14aa438395cf5e396f81601aa6998c22c70b5a98a2bc1aa5c2b554aa245b3f58e39537282216c7fa6f88250bcb5c93
data/bin/slackbot-frd CHANGED
@@ -85,7 +85,8 @@ class SlackbotFrdBin < Thor
85
85
  "token" : "<put-token-here>",
86
86
  "botdir" : ".",
87
87
  "daemonize" : false,
88
- "bots" : []
88
+ "bots" : [],
89
+ "my_bots_config_option" : "<bot-specific-option>"
89
90
  }
90
91
  CONFIG_FILE_SKELETON
91
92
  end
@@ -117,27 +118,28 @@ class SlackbotFrdBin < Thor
117
118
 
118
119
  config_file = options['config-file']
119
120
  config_file = config_file_location unless config_file
120
- json = config_file_json(config_file) if config_file
121
- json ||= {}
121
+ $slackbotfrd_conf = config_file_json(config_file) if config_file
122
+ $slackbotfrd_conf ||= {}
123
+ $slackbotfrd_conf.freeze
122
124
 
123
125
  daemonize = false
124
- daemonize = json["daemonize"] if json["daemonize"]
126
+ daemonize = $slackbotfrd_conf["daemonize"] if $slackbotfrd_conf["daemonize"]
125
127
  daemonize = ENV["SLACKBOT_FRD_DAEMONIZE"] if ENV["SLACKBOT_FRD_DAEMONIZE"]
126
128
  daemonize = options[:daemonize] if options[:daemonize]
127
129
 
128
130
  botdir = Dir.pwd
129
- botdir = json["botdir"] if json["botdir"]
131
+ botdir = $slackbotfrd_conf["botdir"] if $slackbotfrd_conf["botdir"]
130
132
  botdir = ENV["SLACKBOT_FRD_BOTDIR"] if ENV["SLACKBOT_FRD_BOTDIR"]
131
133
  botdir = options[:botdir] if options[:botdir]
132
134
  botdir = File.expand_path(botdir)
133
135
 
134
136
  SlackbotFrd::Log.logfile = "#{botdir}/#{LOG_FILE}"
135
- SlackbotFrd::Log.logfile = json["log_file"] if json["log_file"]
137
+ SlackbotFrd::Log.logfile = $slackbotfrd_conf["log_file"] if $slackbotfrd_conf["log_file"]
136
138
  SlackbotFrd::Log.logfile = ENV["SLACKBOT_FRD_LOG_FILE"] if ENV["SLACKBOT_FRD_LOG_FILE"]
137
139
  SlackbotFrd::Log.logfile = options["log-file"] if options['log-file']
138
140
 
139
141
  SlackbotFrd::Log.level = :info
140
- SlackbotFrd::Log.level = json["log_level"] if json["log_level"]
142
+ SlackbotFrd::Log.level = $slackbotfrd_conf["log_level"] if $slackbotfrd_conf["log_level"]
141
143
  SlackbotFrd::Log.level = ENV["SLACKBOT_FRD_LOG_LEVEL"] if ENV["SLACKBOT_FRD_LOG_LEVEL"]
142
144
  SlackbotFrd::Log.level = options["log-level"] if options['log-level']
143
145
 
@@ -161,7 +163,7 @@ class SlackbotFrdBin < Thor
161
163
  SlackbotFrd::Log.warn("Logging to file '#{SlackbotFrd::Log.logfile}'")
162
164
  SlackbotFrd::Log.warn("Logging level set to '#{SlackbotFrd::Log.level}'")
163
165
 
164
- token = json["token"]
166
+ token = $slackbotfrd_conf["token"]
165
167
  token = ENV["SLACKBOT_FRD_TOKEN"] if ENV["SLACKBOT_FRD_TOKEN"]
166
168
  token = options[:token] if options[:token]
167
169
  unless token
@@ -24,10 +24,13 @@ module SlackbotFrd
24
24
  end
25
25
 
26
26
  def members
27
- @response["channel"]["members"]
27
+ if @response["channel"]
28
+ @response["channel"]["members"]
29
+ else
30
+ []
31
+ end
28
32
  end
29
33
  alias_method :users, :members
30
-
31
34
  end
32
35
  end
33
36
  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.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Porter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-12 00:00:00.000000000 Z
11
+ date: 2015-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0.13'
33
+ version: 0.13.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0.13'
40
+ version: 0.13.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faye-websocket
43
43
  requirement: !ruby/object:Gem::Requirement