Module: Syndi
- Extended by:
- Syndi
- Included in:
- Syndi
- Defined in:
- lib/syndi/bot.rb,
lib/syndi.rb,
lib/syndi/cli.rb,
lib/syndi/config.rb,
lib/syndi/events.rb,
lib/syndi/actress.rb,
lib/syndi/dsl/irc.rb,
lib/syndi/version.rb,
lib/syndi/dsl/base.rb,
lib/syndi/api/object.rb,
lib/syndi/irc/common.rb,
lib/syndi/irc/server.rb,
lib/syndi/jewel/util.rb,
lib/syndi/irc/library.rb,
lib/syndi/irc/protocol.rb,
lib/syndi/irc/object/user.rb,
lib/syndi/irc/std/commands.rb,
lib/syndi/irc/std/numerics.rb,
lib/syndi/irc/object/entity.rb,
lib/syndi/irc/state/support.rb,
lib/syndi/irc/sasl/mech/plain.rb,
lib/syndi/jewel/specification.rb,
lib/syndi/irc/protocol/numerics.rb,
lib/syndi/irc/sasl/mech/dh_blowfish.rb,
ext/csyndi/libauto.c
Overview
Copyright (c) 2013, Autumn Perrault, et al. All rights reserved. This free software is distributed under the FreeBSD license (see LICENSE).
Defined Under Namespace
Modules: API, DSL, IRC, Jewel Classes: Actress, Bot, CLI, Config, ConfigError, DatabaseError, Events, LogError, Logger, PluginError
Constant Summary collapse
- VERSION =
Standard version string.
We use semantic versioning: +MAJOR.MINOR.PATCH.PRE.PRENUM+
'0.1.3'.freeze
- FULLVERSION =
Standard version plus the codename (assigned to each minor release).
i.e., +VERSION-CODENAME+
"#{VERSION}-phoenix".freeze
Class Method Summary collapse
-
.edge? ⇒ Boolean
Whether this is an edge (i.e. testing, development, unstable) copy.
-
.prerelease? ⇒ Boolean
Whether this is a prerelease copy.
-
.rc? ⇒ Boolean
Whether this is a release candidate copy.
Instance Method Summary collapse
-
#actress ⇒ Syndi::Actress
Central Syndi Celluloid actor.
-
#after(interval, &prc) ⇒ Celluloid::Timer
Execute some code after the given interval.
-
#celluloid_log ⇒ Object
Make Celluloid logging consistent with Syndi logging.
-
#colorize ⇒ Object
Install terminal colors.
-
#conf ⇒ Syndi::Config
Configuration access.
-
#dir ⇒ String
Retrieve the application data directory.
-
#dir=(directory) ⇒ Object
Set the application data directory.
-
#events ⇒ Syndi::Events
Central event system access.
-
#every(interval, &prc) ⇒ Celluloid::Timer
Execute some code every +interval+.
-
#gem? ⇒ Boolean
Whether we're installed as a gem.
-
#go(options) ⇒ Object
Initiate Syndi with command-line +options+.
-
#log ⇒ Syndi::Logger
Logger access.
-
#windows? ⇒ Boolean
Whether we're running on Microsoft Windows.
Class Method Details
.edge? ⇒ Boolean
Returns Whether this is an edge (i.e. testing, development, unstable) copy.
27 28 29 |
# File 'lib/syndi/version.rb', line 27 def self.edge? prerelease? || rc? || VERSION < '1' end |
.prerelease? ⇒ Boolean
Returns Whether this is a prerelease copy.
17 18 19 |
# File 'lib/syndi/version.rb', line 17 def self.prerelease? (VERSION =~ /alpha|beta|pre/).nil? ? false : true end |
.rc? ⇒ Boolean
Returns Whether this is a release candidate copy.
22 23 24 |
# File 'lib/syndi/version.rb', line 22 def self.rc? (VERSION =~ /rc/).nil? ? false : true end |
Instance Method Details
#actress ⇒ Syndi::Actress
Central Syndi Celluloid actor.
108 109 110 |
# File 'lib/syndi.rb', line 108 def actress @actress ||= Syndi::Actress.new end |
#after(interval, &prc) ⇒ Celluloid::Timer
Execute some code after the given interval.
117 118 119 |
# File 'lib/syndi.rb', line 117 def after interval, &prc actress.after interval, &prc end |
#celluloid_log ⇒ Object
Make Celluloid logging consistent with Syndi logging.
87 88 89 |
# File 'lib/syndi.rb', line 87 def celluloid_log Celluloid.logger = self.log end |
#colorize ⇒ Object
Install terminal colors.
44 45 46 47 48 49 50 51 52 |
# File 'lib/syndi.rb', line 44 def colorize if windows? Term::ANSIColor.attributes.each do |name| String.send :define_method, name, proc { self } end else String.send :include, Term::ANSIColor end end |
#conf ⇒ Syndi::Config
Configuration access.
101 102 103 |
# File 'lib/syndi.rb', line 101 def conf @configuration ||= Syndi::Config.new end |
#dir ⇒ String
Retrieve the application data directory.
61 62 63 |
# File 'lib/syndi.rb', line 61 def dir @app_dir ||= File.join ENV['HOME'], '.syndi' end |
#dir=(directory) ⇒ Object
Set the application data directory.
66 67 68 69 70 |
# File 'lib/syndi.rb', line 66 def dir= directory FileUtils.mkdir_p directory unless Dir.exists? directory Dir.chdir directory @app_dir = directory end |
#events ⇒ Syndi::Events
Central event system access.
94 95 96 |
# File 'lib/syndi.rb', line 94 def events @event_manager ||= Syndi::Events.new end |
#every(interval, &prc) ⇒ Celluloid::Timer
Execute some code every +interval+.
126 127 128 |
# File 'lib/syndi.rb', line 126 def every interval, &prc actress.every interval, &prc end |
#gem? ⇒ Boolean
Returns Whether we're installed as a gem.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/syndi.rb', line 14 def gem? begin # If we already checked, just return the result of that. return @gem if defined? @gem # Otherwise, check. result = Gem.path.each do |gempath| break true if __FILE__ =~ /^#{Regexp.escape gempath}/ end @gem = (result == true ? true : false) ensure @gem ||= false end end |
#go(options) ⇒ Object
Initiate Syndi with command-line +options+.
75 76 77 |
# File 'lib/syndi.rb', line 75 def go end |
#log ⇒ Syndi::Logger
Logger access.
82 83 84 |
# File 'lib/syndi.rb', line 82 def log @logger ||= Syndi::Logger.new end |
#windows? ⇒ Boolean
Returns Whether we're running on Microsoft Windows.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/syndi.rb', line 30 def windows? begin return @windows if defined? @windows if ::RbConfig::CONFIG['host_os'] =~ /bccwin|djgpp|mswin|mingw|cygwin|wince/i @windows = true else @windows = false end ensure @windows ||= false end end |