octospy 0.0.2 → 0.0.3

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: 5cd0013747a9a0beb2685537dfe99b7afc590887
4
- data.tar.gz: ad7d7b31e172f099dfac8a0167db0568502e4506
3
+ metadata.gz: 8e08f9448c067f8b3f4574259fef52f9f8aaeeda
4
+ data.tar.gz: 2756eab8a7094619951b83abc0ea326a9db3586b
5
5
  SHA512:
6
- metadata.gz: 1acb8dcef9fafe09dce81b7104366a066a1c1f994522336833f3938e5adf4c40d855d1849ca6b614944453e5d301a1872cced2148049d8ee805681203e7da3ec
7
- data.tar.gz: 51b3b6dc3f079ac109471235edea04206f4508b9f84ffe29455486c8caeb154ad7c5de256a0c112ddcc87d529e47ee9e22ac8e1bdd5aff8e50b51c5314f99fa1
6
+ metadata.gz: 8f359f1433beeba18c9d37fca46afe892042897e6309581e43c7964b5f4009e16838ce39127c5aad2091b42284cd1a2b703f8459725dc21aeab06957ff4e96a9
7
+ data.tar.gz: 8b0ff9a217cdff09975808e77185931538b8344ad1cd139df0c330dc7dd04808731e6a7077bd77312c76732b9671d4ec17f245949666ba14f41842bebf9346de
data/.env.example CHANGED
@@ -1,4 +1,14 @@
1
+ # Required
1
2
  SERVER=irc.yourserver.net
2
3
  CHANNELS=yourchannel
3
4
  GITHUB_LOGIN=yourusername
4
5
  GITHUB_TOKEN=e17e1c6caa3e452433ab55****************
6
+
7
+ # Options
8
+ # HOST=6668
9
+ # SSL=true
10
+ # PASSWORD=*****************
11
+
12
+ # GitHub Enterprise
13
+ # GITHUB_API_ENDPOINT=http://your.enterprise.domain/api/v3
14
+ # GITHUB_WEB_ENDPOINT=http://your.enterprise.domain
data/lib/octospy.rb CHANGED
@@ -25,17 +25,20 @@ module Octospy
25
25
 
26
26
  def irc_bot
27
27
  Octokit.configure do |c|
28
- c.api_endpoint = Octospy.github_api_endpoint
29
- c.web_endpoint = Octospy.github_web_endpoint
30
- c.login = Octospy.github_login
28
+ c.api_endpoint = Octospy.github_api_endpoint if Octospy.github_api_endpoint
29
+ c.web_endpoint = Octospy.github_web_endpoint if Octospy.github_web_endpoint
30
+ c.login = Octospy.github_login
31
31
  c.access_token = Octospy.github_token
32
32
  end
33
33
 
34
34
  Cinch::Bot.new do
35
35
  configure do |c|
36
- c.server = Octospy.server
37
- c.nick = Octospy.nick
38
- c.channels = Octospy.channels
36
+ c.server = Octospy.server
37
+ c.nick = Octospy.nick
38
+ c.channels = Octospy.channels
39
+ c.port = Octospy.port if Octospy.port
40
+ c.password = Octospy.password if Octospy.password
41
+ c.ssl.use = Octospy.ssl if Octospy.ssl
39
42
  c.plugins.plugins = [
40
43
  Cinch::Plugins::Management,
41
44
  Cinch::Plugins::Octospy
@@ -3,7 +3,11 @@ module Octospy
3
3
  OPTIONS_KEYS = %i(
4
4
  channels
5
5
  server
6
+ port
7
+ ssl
8
+ password
6
9
  nick
10
+ cinch_config_block
7
11
  github_api_endpoint
8
12
  github_web_endpoint
9
13
  github_login
@@ -18,14 +22,14 @@ module Octospy
18
22
  end
19
23
  end
20
24
 
21
- DEFAULT_GITHUB_API_ENDPOINT = ENV['GITHUB_API_ENDPOINT'] || 'https://api.github.com'
22
- DEFAULT_GITHUB_WEB_ENDPOINT = ENV['GITHUB_WEB_ENDPOINT'] || 'https://github.com'
23
- DEFAULT_NICK = ENV['NICK'] || 'octospy'
24
-
25
25
  def configure
26
26
  yield self
27
27
  end
28
28
 
29
+ def cinch_config_block(&block)
30
+ @cinch_config_block = block
31
+ end
32
+
29
33
  def options
30
34
  Hash[Octospy::Configurable.keys.map{ |key|
31
35
  [key, instance_variable_get(:"@#{key}")]
@@ -33,17 +37,18 @@ module Octospy
33
37
  end
34
38
 
35
39
  def setup
36
- @github_api_endpoint = DEFAULT_GITHUB_API_ENDPOINT
37
- @github_web_endpoint = DEFAULT_GITHUB_WEB_ENDPOINT
38
- @nick = DEFAULT_NICK
39
- @channels = if ENV['CHANNELS']
40
- ENV['CHANNELS'].gsub(/\s|#/, '').split(',').map { |ch| "##{ch}" }
41
- else
42
- ''
43
- end
44
- @server = ENV['SERVER']
45
- @github_login = ENV['GITHUB_LOGIN']
46
- @github_token = ENV['GITHUB_TOKEN']
40
+ @github_api_endpoint = ENV['GITHUB_API_ENDPOINT']
41
+ @github_web_endpoint = ENV['GITHUB_WEB_ENDPOINT']
42
+ @nick = ENV['NICK'] || 'octospy'
43
+ @server = ENV['SERVER']
44
+ @port = ENV['PORT']
45
+ @ssl = !!ENV['SSL']
46
+ @password = ENV['PASSWORD']
47
+ @github_login = ENV['GITHUB_LOGIN']
48
+ @github_token = ENV['GITHUB_TOKEN']
49
+ @channels = ENV['CHANNELS'] ?
50
+ ENV['CHANNELS'].gsub(/\s|#/, '').split(',').map { |ch| "##{ch}" } : nil
51
+ @cinch_config_block = nil
47
52
  end
48
53
  end
49
54
  end
@@ -1,3 +1,3 @@
1
1
  module Octospy
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octospy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - linyows
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-25 00:00:00.000000000 Z
11
+ date: 2014-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -323,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
323
  version: '0'
324
324
  requirements: []
325
325
  rubyforge_project:
326
- rubygems_version: 2.2.2
326
+ rubygems_version: 2.2.0
327
327
  signing_key:
328
328
  specification_version: 4
329
329
  summary: Octospy notifies the repository activity to an IRC channel.