syndi 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +8 -0
- data/INSTALL.md +86 -0
- data/LICENSE +28 -0
- data/README.md +104 -0
- data/Rakefile +26 -0
- data/WINDOWS.md +64 -0
- data/bin/syndi +102 -0
- data/bin/syndi-conf +47 -0
- data/conf/example.yml +101 -0
- data/docs/Events.md +103 -0
- data/docs/Upgrade.md +16 -0
- data/ext/csyndi/events.c +50 -0
- data/ext/csyndi/extconf.rb +20 -0
- data/ext/csyndi/integer.c +53 -0
- data/ext/csyndi/libauto.c +37 -0
- data/ext/csyndi/logger.c +228 -0
- data/include/syndi/csyndi.h +38 -0
- data/include/syndi/events.h +19 -0
- data/include/syndi/integer.h +17 -0
- data/include/syndi/logger.h +57 -0
- data/include/syndi.h +22 -0
- data/lib/syndi/actress.rb +12 -0
- data/lib/syndi/api/events.rb +170 -0
- data/lib/syndi/api/object.rb +29 -0
- data/lib/syndi/api/plugin.rb +155 -0
- data/lib/syndi/api.rb +7 -0
- data/lib/syndi/bot.rb +270 -0
- data/lib/syndi/config.rb +113 -0
- data/lib/syndi/configure/cli.rb +23 -0
- data/lib/syndi/configure/generator.rb +410 -0
- data/lib/syndi/configure.rb +19 -0
- data/lib/syndi/dsl/base.rb +74 -0
- data/lib/syndi/dsl/irc.rb +13 -0
- data/lib/syndi/events.rb +114 -0
- data/lib/syndi/irc/common.rb +63 -0
- data/lib/syndi/irc/library.rb +89 -0
- data/lib/syndi/irc/object/channel.rb +21 -0
- data/lib/syndi/irc/object/entity.rb +90 -0
- data/lib/syndi/irc/object/message.rb +99 -0
- data/lib/syndi/irc/object/user.rb +139 -0
- data/lib/syndi/irc/protocol/numerics.rb +60 -0
- data/lib/syndi/irc/protocol.rb +164 -0
- data/lib/syndi/irc/sasl/diffie_hellman.rb +36 -0
- data/lib/syndi/irc/sasl/mech/dh_blowfish.rb +83 -0
- data/lib/syndi/irc/sasl/mech/plain.rb +39 -0
- data/lib/syndi/irc/sasl/mech.rb +15 -0
- data/lib/syndi/irc/server.rb +301 -0
- data/lib/syndi/irc/state/channel_manager.rb +6 -0
- data/lib/syndi/irc/state/support.rb +142 -0
- data/lib/syndi/irc/state/user_manager.rb +6 -0
- data/lib/syndi/irc/std/commands.rb +99 -0
- data/lib/syndi/irc/std/numerics.rb +216 -0
- data/lib/syndi/irc.rb +8 -0
- data/lib/syndi/jewel/specification.rb +121 -0
- data/lib/syndi/jewel/util.rb +27 -0
- data/lib/syndi/jewel.rb +5 -0
- data/lib/syndi/rubyext/string.rb +10 -0
- data/lib/syndi/verbosity.rb +10 -0
- data/lib/syndi/version.rb +38 -0
- data/lib/syndi.rb +129 -0
- data/spec/helper.rb +32 -0
- data/spec/syndi/events_spec.rb +43 -0
- data/tasks/compile.rake +15 -0
- data/tasks/install.rake +10 -0
- data/tasks/package.rake +13 -0
- data/tasks/spec.rake +12 -0
- metadata +101 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27ade4d78970ed7812bb1e4f7edb12b755e2ad84
|
4
|
+
data.tar.gz: cdc9beaf0aba4162ca054d0085ab053dd7929844
|
5
5
|
!binary "U0hBNTEy":
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d8e880065a0bfdbe71e6ed8963944026214745d9f6f4351b41888faf898494db17a71dd1920f59aa9825679ce09eddc8df3c5d12bb1c77bde2a61e33ea89c8
|
7
|
+
data.tar.gz: d3d4ac783179808b7ae38391b0fe3cef5796f2c931e65b09806c088cf7b2c5c817488a90f2062bd53f1f1687dc861867b2f5e8eb9eee75ec094300c60af7da8f
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/INSTALL.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
*This is a copy of https://github.com/Syndi/Syndi/wiki/Install-Guide as it appeared Jan 13 2013 4:16 UTC.*
|
2
|
+
|
3
|
+
Thank you for choosing **Syndi 4** to serve your needs! Please foremost read the [licensing terms](/Syndi/Syndi/wiki/License), as *by proceeding you confirm your agreement to them*.
|
4
|
+
|
5
|
+
Before installing, you must decide on how you would like to install Syndi. There is a relatively easy way, and a somewhat more advanced way.
|
6
|
+
|
7
|
+
For most users, the relatively easy way is advisable, and that is the **gem method**.
|
8
|
+
|
9
|
+
Users who have some reason for doing so and are more advanced can install Syndi from source. See further below for that.
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+
# Gem
|
14
|
+
|
15
|
+
You must have [Ruby 1.9.2 or later](http://www.ruby-lang.org).
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
There is a complete list of releases and links therefor on the [official releases page](http://syndi.syndiproj.org/releases.html).
|
20
|
+
|
21
|
+
We recommend merely installing the latest (pre-)release from [RubyGems](https://rubygems.org/gems/Syndi):
|
22
|
+
|
23
|
+
$ gem install Syndi --pre
|
24
|
+
|
25
|
+
If you downloaded the source, either from Git or in an archive, do this in the main directory to compile a gem:
|
26
|
+
|
27
|
+
$ gem build Syndi.gemspec
|
28
|
+
$ gem install Syndi-*.gem
|
29
|
+
|
30
|
+
Depending on which database management system you wish to use, you must separately download the respective gem whether you use the distributed **Syndi** or your own build:
|
31
|
+
|
32
|
+
**SQLite**: `$ gem install sqlite3`
|
33
|
+
**MySQL**: `$ gem install mysqlplus`
|
34
|
+
**PostgreSQL**: `$ gem install pg`
|
35
|
+
|
36
|
+
## Configuration
|
37
|
+
|
38
|
+
The indispensable [Syndi Configure](/Syndi/Syndi/wiki/Syndi-Configure) utility will help you configure Syndi, and this is the suggested method as it is the easiest.
|
39
|
+
|
40
|
+
$ syndi-conf
|
41
|
+
|
42
|
+
Otherwise you must navigate to the path to which **syndibot** was installed (typically somewhere in `~/.gem/`) and find the `conf/` directory; that is unless you cloned from Git, in which case you'll find it in `Syndi/conf/`.
|
43
|
+
|
44
|
+
The **Y**AML **A**in't **M**arkup **L**anguage configuration, which is suggested, is `example.yml`. Open it with your favorite editor and save it as `~/.config/syndibot/syndi.yml`. You can also save it to a path of your choosing, but remember to invoke Syndi with `--config=path/to/config.yml`:
|
45
|
+
|
46
|
+
$ syndi --config=/somewhere/where/cows/speak/syndi.yml
|
47
|
+
|
48
|
+
If you prefer, the **J**ava **S**cript **O**bject **N**otation configuration is `example.json`. Modify it as above (except use a `.json` extension). Invoke Syndi with the `-j` flag (unless you specify `--config`, in which case the `--j` is superfluous).
|
49
|
+
|
50
|
+
$ syndi -j
|
51
|
+
|
52
|
+
## Start
|
53
|
+
|
54
|
+
$ syndi
|
55
|
+
|
56
|
+
Consult with the [Syndi Handbook](/Syndi/Syndi/wiki/Syndi-Handbook) for information on using Syndi.
|
57
|
+
|
58
|
+
# Source
|
59
|
+
|
60
|
+
You need at least [Ruby 1.9.2](http://www.ruby-lang.org)!
|
61
|
+
|
62
|
+
The easiest way to install Syndi's gem prerequisites is to use [**GemBundler**](https://rubygems.org/gems/bundler). Install it:
|
63
|
+
|
64
|
+
$ gem install bundler
|
65
|
+
|
66
|
+
After downloading the source code and entering the main directory, invoke bundler:
|
67
|
+
|
68
|
+
$ bundle install --without dev
|
69
|
+
|
70
|
+
If testing and/or development are among your intentions, exclude the `--without dev` to install testing/development dependencies.
|
71
|
+
|
72
|
+
Depending on which database management system you wish to use, you must separately download the respective gem:
|
73
|
+
|
74
|
+
**SQLite**: `$ gem install sqlite3`
|
75
|
+
**MySQL**: `$ gem install mysqlplus`
|
76
|
+
**PostgreSQL**: `$ gem install pg`
|
77
|
+
|
78
|
+
All releases can be obtained in either Git, Tar/GZ, or Zip format from the [official releases page](http://syndi.syndiproj.org/releases.html).
|
79
|
+
|
80
|
+
Compile the source code:
|
81
|
+
|
82
|
+
$ rake compile
|
83
|
+
|
84
|
+
To test Syndi (and you must have installed the testing dependencies), invoke:
|
85
|
+
|
86
|
+
$ rake test
|
data/LICENSE
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
(Two-clause "FreeBSD" license.)
|
2
|
+
|
3
|
+
Copyright (c) 2009-2013, Autumn Perrault
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
8
|
+
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
10
|
+
list of conditions and the following disclaimer.
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
13
|
+
and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
19
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
|
26
|
+
The views and conclusions contained in the software and documentation are those
|
27
|
+
of the authors and should not be interpreted as representing official policies,
|
28
|
+
either expressed or implied, of the Syndi Project.
|
data/README.md
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
Syndi
|
2
|
+
=====
|
3
|
+
|
4
|
+
_A modern, elegant, extensible multi-protocol chat bot—reloaded._
|
5
|
+
|
6
|
+
**Formerly known as Auto.**
|
7
|
+
|
8
|
+
**Version**: 0.1.0 "Phoenix"
|
9
|
+
[![Build Status](https://travis-ci.org/syndibot/syndi.png?branch=master)](https://travis-ci.org/syndibot/syndi)
|
10
|
+
[![Dependency Status](https://gemnasium.com/syndibot/syndi.png)](https://gemnasium.com/syndibot/syndi)
|
11
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/syndibot/syndi)
|
12
|
+
|
13
|
+
+ [Homepage](http://syndibot.com) (lots of information)
|
14
|
+
+ [RubyGems](https://rubygems.org/gems/syndi)
|
15
|
+
+ [Wiki](https://github.com/syndibot/syndi/wiki)
|
16
|
+
+ [Mailing List](https://groups.google.com/group/syndibot)
|
17
|
+
+ [Issue Hub](https://github.com/syndibot/syndi/issues)
|
18
|
+
|
19
|
+
|
20
|
+
Our official IRC channel is [#syndi on irc.freenode.net](irc://irc.freenode.net/#syndi).
|
21
|
+
|
22
|
+
### Is it Production-Ready™?
|
23
|
+
|
24
|
+
Not yet. Syndi 4's a fairly sizable project. We're getting close though.
|
25
|
+
|
26
|
+
Synopsis
|
27
|
+
--------
|
28
|
+
|
29
|
+
Syndi is automated chat bot software, developed per this philosophy:
|
30
|
+
|
31
|
+
* _Friendly_ to users, and to developers.
|
32
|
+
* _Simple_, _smart_, and _clean_.
|
33
|
+
* _Minimal_ but _extensible_.
|
34
|
+
|
35
|
+
It is a reboot of Auto, an old IRC bot which, though featureful, suffered of design flaws.
|
36
|
+
|
37
|
+
Installation
|
38
|
+
------------
|
39
|
+
|
40
|
+
Please read the [Syndi Handbook](https://github.com/syndibot/syndi/wiki/Handbook).
|
41
|
+
|
42
|
+
**Compiling from source:**
|
43
|
+
|
44
|
+
```shell
|
45
|
+
$ git clone git://github.com/syndibot/syndi.git syndi
|
46
|
+
$ cd syndi/
|
47
|
+
```
|
48
|
+
Use a [specific version](https://github.com/syndibot/syndi/tags):
|
49
|
+
|
50
|
+
```shell
|
51
|
+
$ git checkout v4.0.0.alpha.1
|
52
|
+
```
|
53
|
+
|
54
|
+
Or the cutting-edge HEAD:
|
55
|
+
|
56
|
+
```shell
|
57
|
+
$ git checkout master
|
58
|
+
```
|
59
|
+
|
60
|
+
```shell
|
61
|
+
$ bundle install
|
62
|
+
$ rake
|
63
|
+
$ rake install
|
64
|
+
```
|
65
|
+
|
66
|
+
Syndi is currently known to function on these operating systems:
|
67
|
+
|
68
|
+
+ Microsoft Windows
|
69
|
+
+ Mac OS X
|
70
|
+
+ Linux
|
71
|
+
+ BSD flavors
|
72
|
+
|
73
|
+
Using these Ruby virtual machines:
|
74
|
+
|
75
|
+
+ MRI/YARV (official) 2.0.0
|
76
|
+
|
77
|
+
Support
|
78
|
+
-------
|
79
|
+
|
80
|
+
If you should find yourself in need of support, please foremost consult with the
|
81
|
+
documentation on the [wiki](https://github.com/syndibot/syndi/wiki).
|
82
|
+
|
83
|
+
If the wiki fails to address your needs, please either:
|
84
|
+
|
85
|
+
1. Post to the [syndibot](https://groups.google.com/group/syndibot)
|
86
|
+
group under the _support_ category, **or**
|
87
|
+
2. Join the official IRC chatroom at
|
88
|
+
[#syndi on irc.freenode.net](http://webchat.freenode.net/?randomnick=1&channels=#syndi&prompt=1)
|
89
|
+
|
90
|
+
**Bugs** should be reported on the [issue management hub](https://github.com/syndibot/syndi/issues).
|
91
|
+
|
92
|
+
Authors
|
93
|
+
-------
|
94
|
+
|
95
|
+
Syndi 4 was rewritten from scratch by Autumn Perrault (noxgirl) in Ruby and C,
|
96
|
+
and is actively developed by the core team.
|
97
|
+
|
98
|
+
Legal
|
99
|
+
-----
|
100
|
+
|
101
|
+
Copyright (c) 2009-2013, Autumn Perrault. All rights reserved.
|
102
|
+
|
103
|
+
Syndi is free, open-source software, distributed per the terms of the two-clause
|
104
|
+
("FreeBSD") license, the full terms of which are in [**LICENSE**](LICENSE).
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2013, Autumn Perrault, et al. All rights reserved.
|
2
|
+
# This free software is distributed under the FreeBSD license (see LICENSE).
|
3
|
+
|
4
|
+
# import the gemspec
|
5
|
+
GEMSPEC = 'Syndi.gemspec'
|
6
|
+
$gemspec ||= eval(File.read(GEMSPEC), binding, GEMSPEC)
|
7
|
+
|
8
|
+
def perform t
|
9
|
+
Rake::Task[t].invoke
|
10
|
+
end
|
11
|
+
|
12
|
+
# Directives for Ruby Make (rake)
|
13
|
+
# to test/compile Syndi 4, and optionally
|
14
|
+
# push to RubyGems
|
15
|
+
|
16
|
+
# load all of the tasks
|
17
|
+
Dir["tasks/**/*.rake"].each do |t|
|
18
|
+
load File.expand_path t
|
19
|
+
end
|
20
|
+
|
21
|
+
# groups
|
22
|
+
task :default => %i[compile native gem]
|
23
|
+
task :typical => %i[compile spec]
|
24
|
+
task :full => %i[clean typical gem install]
|
25
|
+
|
26
|
+
# vim: set ts=4 sts=2 sw=2 et:
|
data/WINDOWS.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
Syndi on Windows
|
2
|
+
===============
|
3
|
+
|
4
|
+
Yay
|
5
|
+
---
|
6
|
+
|
7
|
+
Syndi 4.0 _Phoenix_ brings back something which hasn't existed since version 1.0:
|
8
|
+
support for Microsoft Windows!
|
9
|
+
|
10
|
+
This is because we have prioritized programming v4.0 with platform independence
|
11
|
+
from its inception.
|
12
|
+
|
13
|
+
How It Works
|
14
|
+
------------
|
15
|
+
|
16
|
+
Windows users can install Syndi easily by downloading and installing from RubyGems:
|
17
|
+
|
18
|
+
$ gem install Syndi [--pre]
|
19
|
+
|
20
|
+
On Windows, this will install the native Windows distribution, which includes the
|
21
|
+
_libsyndi_ library cross-compiled with [Minimalist GNU for Windows](http://www.mingw.org/),
|
22
|
+
commonly called MinGW.
|
23
|
+
|
24
|
+
This assumes that you have installed Ruby compiled with MinGW; this is the case
|
25
|
+
if you used [RubyInstaller for Windows](http://rubyinstaller.org/).
|
26
|
+
|
27
|
+
Compiling
|
28
|
+
---------
|
29
|
+
|
30
|
+
Users who have good cause for doing so are also welcome to compile the source
|
31
|
+
for Syndi themselves.
|
32
|
+
|
33
|
+
We should hope that [DevKit](http://rubyinstaller.org/downloads) will provide
|
34
|
+
a sufficiently sane build environment for this on Windows. We haven't tested
|
35
|
+
it since we cross-compile on UNIX systems when packaging gems.
|
36
|
+
|
37
|
+
You must then force RubyGems to download the distribution without binaries, so
|
38
|
+
that _libsyndi_ will be compiled:
|
39
|
+
|
40
|
+
$ gem install Syndi [--pre] --platform=ruby --development
|
41
|
+
|
42
|
+
Cross-compiling
|
43
|
+
---------------
|
44
|
+
|
45
|
+
You must have a cross-compiling toolset installed on your system. Install the
|
46
|
+
MinGW toolset.
|
47
|
+
|
48
|
+
On Arch Linux, this can be installed with:
|
49
|
+
|
50
|
+
# pacman -Syu mingw32-gcc mingw32-pthreads
|
51
|
+
|
52
|
+
Then configure rake-compiler:
|
53
|
+
|
54
|
+
$ rake-compiler cross-ruby VERSION=1.9.3-p362
|
55
|
+
|
56
|
+
Now compile the source code for Windows:
|
57
|
+
|
58
|
+
$ rake cross compile
|
59
|
+
|
60
|
+
Package the native distribution gem:
|
61
|
+
|
62
|
+
$ rake cross native gem
|
63
|
+
|
64
|
+
_Et voila!_ You should find the native gem in `pkg/`.
|
data/bin/syndi
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright (c) 2013, Autumn Perrault, et al. All rights reserved.
|
3
|
+
# This free software is distributed under the FreeBSD license (see LICENSE).
|
4
|
+
|
5
|
+
require 'English'
|
6
|
+
require 'rbconfig'
|
7
|
+
|
8
|
+
# Perform a check of the Ruby version.
|
9
|
+
if ::RbConfig::CONFIG['ruby_version'] < '2.0.0'
|
10
|
+
puts 'Syndi requires Ruby v2.0.0 or later. Please read the Syndi Handbook.'
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
|
14
|
+
# Forbid root.
|
15
|
+
if ENV.include? 'USER'
|
16
|
+
if ENV['USER'] == 'root'
|
17
|
+
puts 'It is forbidden to run Syndi as the root user!'
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Import necessary libraries.
|
23
|
+
require 'slop'
|
24
|
+
# Import system Syndi libraries, or fall back to internal ones.
|
25
|
+
begin
|
26
|
+
require 'syndi'
|
27
|
+
rescue LoadError
|
28
|
+
$LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
|
29
|
+
require 'syndi'
|
30
|
+
end
|
31
|
+
require 'syndi/verbosity'
|
32
|
+
|
33
|
+
# Change to the Syndi directory.
|
34
|
+
SYNDI_DIR = File.join ENV['HOME'], '.syndi'
|
35
|
+
Dir.mkdir SYNDI_DIR unless Dir.exists? SYNDI_DIR
|
36
|
+
Dir.chdir SYNDI_DIR
|
37
|
+
|
38
|
+
$VERBOSITY = 0
|
39
|
+
|
40
|
+
# Parse options.
|
41
|
+
opts = Slop.parse(:banner => "Usage: #$PROGRAM_NAME [options]") do
|
42
|
+
on :h, :help, "You're looking at it." do
|
43
|
+
puts self
|
44
|
+
exit 0
|
45
|
+
end
|
46
|
+
|
47
|
+
on :v, :version, 'Display version and exit.' do
|
48
|
+
puts <<-EOV
|
49
|
+
Syndi #{Syndi::FULLVERSION}
|
50
|
+
[os: #{::RbConfig::CONFIG['host_os']}] [rb: #{::RbConfig::CONFIG['ruby_version']}] [arch: #{::RbConfig::CONFIG['arch']}]
|
51
|
+
|
52
|
+
http://syndiproj.org
|
53
|
+
EOV
|
54
|
+
exit 0
|
55
|
+
end
|
56
|
+
|
57
|
+
on(:f, :foreground, 'Disable automatic daemonizing.')
|
58
|
+
on(:c, :conf=, 'Specify a particular configuration file.')
|
59
|
+
on(:V, :verbose, 'Increase verbosity of output (more uses, the more verbose).') { $VERBOSITY += 1 }
|
60
|
+
end
|
61
|
+
|
62
|
+
# Begin start up.
|
63
|
+
puts "* Syndi #{Syndi::VERSION} starting...".bold
|
64
|
+
$log = Syndi::Logger.new
|
65
|
+
|
66
|
+
# Create an instance of Syndi.
|
67
|
+
begin
|
68
|
+
$m = Syndi::Bot.new opts
|
69
|
+
status = $m.init
|
70
|
+
rescue => e
|
71
|
+
$log.fatal "An initialization error occurred: #{e}"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Check our status.
|
75
|
+
if status
|
76
|
+
time = Time.now
|
77
|
+
$log.info "Syndi started at #{time}."
|
78
|
+
else
|
79
|
+
$log.fatal "Initialization inexplicably failed."
|
80
|
+
end
|
81
|
+
STARTTIME = time.freeze
|
82
|
+
|
83
|
+
# We survived? We survived! Fork into the background if not in debug or foreground.
|
84
|
+
$m.daemonize if !opts.foreground? && $VERBOSITY < 1
|
85
|
+
|
86
|
+
# Signals
|
87
|
+
sig = {
|
88
|
+
'TERM' => proc { $m.terminate('Caught termination signal') },
|
89
|
+
'INT' => proc { $m.terminate('Ctrl-C pressed') },
|
90
|
+
'HUP' => proc { $m.conf.rehash }
|
91
|
+
}
|
92
|
+
sig.delete 'HUP' if Syndi.windows?
|
93
|
+
sig.each { |signal, prc| Signal.trap(signal) { prc.call } }
|
94
|
+
|
95
|
+
begin
|
96
|
+
$m.start
|
97
|
+
rescue => e
|
98
|
+
$log.error_bt "Fatal exception: #{e}", e.backtrace
|
99
|
+
exit 1
|
100
|
+
end
|
101
|
+
|
102
|
+
# vim: set ts=4 sts=2 sw=2 et:
|
data/bin/syndi-conf
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright (c) 2013, Autumn Perrault, et al. All rights reserved.
|
3
|
+
# This free software is distributed under the FreeBSD license (see LICENSE).
|
4
|
+
|
5
|
+
require 'slop'
|
6
|
+
|
7
|
+
# Check whether we're installed as a gem or a standalone
|
8
|
+
unless File.expand_path(__FILE__) =~ /^#{Regexp.escape File.join(Dir.home, '.gem')}/
|
9
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) # Add the Syndi libraries to LOAD_PATH
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'syndi/configure'
|
13
|
+
|
14
|
+
# Parse options.
|
15
|
+
opts = Slop.parse(:banner => "Usage: #$0 [options/command]") do
|
16
|
+
|
17
|
+
on :h, :help, 'Display this help message.' do
|
18
|
+
puts self
|
19
|
+
exit 0
|
20
|
+
end
|
21
|
+
|
22
|
+
on :v, :version, 'Display version.' do
|
23
|
+
puts <<-EOV
|
24
|
+
Syndi Configure v#{Syndi::Configure::VERSION}
|
25
|
+
|
26
|
+
http://syndiproj.org
|
27
|
+
EOV
|
28
|
+
exit 0
|
29
|
+
end
|
30
|
+
|
31
|
+
# configuration generator
|
32
|
+
command :gen do
|
33
|
+
run do |_, _|
|
34
|
+
Syndi::Configure::Generator.new.generate
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# configuration editor
|
39
|
+
command :edit do
|
40
|
+
run do |_, args|
|
41
|
+
Syndi::Configure::CLI.start(args)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
# vim: set ts=4 sts=2 sw=2 et:
|
data/conf/example.yml
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
# Syndi 4 example YAML configuration file
|
4
|
+
|
5
|
+
# Core libraries to load.
|
6
|
+
#
|
7
|
+
# irc: IRC protocol framework.
|
8
|
+
libraries:
|
9
|
+
- irc
|
10
|
+
|
11
|
+
# List of IRC servers to which to connect.
|
12
|
+
irc:
|
13
|
+
# Server name, followed by properties.
|
14
|
+
freenode:
|
15
|
+
|
16
|
+
# Server address.
|
17
|
+
address: irc.freenode.net
|
18
|
+
|
19
|
+
# Server port.
|
20
|
+
port: 7000
|
21
|
+
|
22
|
+
# Whether to use SSL: true or false.
|
23
|
+
useSSL: true
|
24
|
+
|
25
|
+
# Nicknames. Syndi will use the first one, and if it fails, it will try
|
26
|
+
# each one until success is achieved.
|
27
|
+
nickname:
|
28
|
+
- moobot
|
29
|
+
- altnick
|
30
|
+
|
31
|
+
# Username or ident.
|
32
|
+
username: Syndi
|
33
|
+
|
34
|
+
# Real name or GECOS.
|
35
|
+
realName: Syndi
|
36
|
+
|
37
|
+
# SASL options. Remove this if you don't want to use SASL or the server
|
38
|
+
# does not support it.
|
39
|
+
SASL:
|
40
|
+
# Timeout in seconds. 15s is reasonable.
|
41
|
+
timeout: 15
|
42
|
+
# Account as which to identify.
|
43
|
+
username: moobot
|
44
|
+
# Password for the account.
|
45
|
+
password: moopass
|
46
|
+
|
47
|
+
# List of channels to join automatically.
|
48
|
+
syndijoin:
|
49
|
+
- name: '#syndi-bots' # The channel name. Don't forget the quotes because channels have octothorpes.
|
50
|
+
key: ~ # Key, if necessary.
|
51
|
+
|
52
|
+
# Another server. Add as many as you wish.
|
53
|
+
Rizon:
|
54
|
+
|
55
|
+
address: irc.rizon.net
|
56
|
+
port: 6667
|
57
|
+
useSSL: false
|
58
|
+
nickname:
|
59
|
+
- moobot
|
60
|
+
- altnick
|
61
|
+
username: Syndi
|
62
|
+
realName: Syndi
|
63
|
+
|
64
|
+
# Identify the traditional way; that is, by privately messaging a service.
|
65
|
+
nickIdentify:
|
66
|
+
# The name of the service--usually NickServ.
|
67
|
+
service: NickServ
|
68
|
+
# The command to use--usually identify.
|
69
|
+
command: identify
|
70
|
+
# The password to use. If the server uses Atheme, we suggest putting the accountname followed by
|
71
|
+
# the password here, so that identification never fails.
|
72
|
+
password: moopass
|
73
|
+
|
74
|
+
# Database configuration
|
75
|
+
#
|
76
|
+
# Syndi uses Redis for its database management, because it is the system we
|
77
|
+
# thought most apropos to our minimalist philosophy.
|
78
|
+
#
|
79
|
+
# There is a wiki page on this: https://github.com/Syndi/Syndi/wiki/Setting-Up-a-Database
|
80
|
+
#
|
81
|
+
# All of these are commented because the defaults are typically desirable.
|
82
|
+
database:
|
83
|
+
|
84
|
+
# This will disable database functionality. We discourage this.
|
85
|
+
#disable: yes
|
86
|
+
|
87
|
+
# If your Redis server is listening on a host other than the 'localhost'
|
88
|
+
# default, specify it here.
|
89
|
+
#address: '10.0.1.1'
|
90
|
+
|
91
|
+
# If it is listening on a port other than 6379, specify it here.
|
92
|
+
#port: 6500
|
93
|
+
|
94
|
+
# If it is using a UNIX socket, provide the path here.
|
95
|
+
#path: '/tmp/redis.sock'
|
96
|
+
|
97
|
+
# If a password is required, specify it here.
|
98
|
+
#password: insecurepassword123
|
99
|
+
|
100
|
+
# To use a different database from the default (0), specify its number here.
|
101
|
+
#number: 10
|