module Syndi
Namespace: Syndi
Namespace: Syndi
Namespace: Syndi
Namespace: Syndi
Copyright © 2013, Autumn Perrault, et al. All rights reserved. This free software is distributed under the FreeBSD license (see LICENSE).
Copyright © 2013, Autumn Perrault, et al. All rights reserved. This free software is distributed under the FreeBSD license (see LICENSE).
Copyright © 2013, Autumn Perrault, et al. All rights reserved. This free software is distributed under the FreeBSD license (see LICENSE).
Copyright © 2013, Autumn Perrault, et al. All rights reserved. This free software is distributed under the FreeBSD license (see LICENSE).
namespace Syndi
Copyright © 2013, Autumn Perrault, et al. All rights reserved. This free software is distributed under the FreeBSD license (see LICENSE).
Copyright © 2013, Autumn Perrault, et al. All rights reserved. This free software is distributed under the FreeBSD license (see LICENSE).
namespace Syndi
Copyright © 2013, Autumn Perrault, et al. All rights reserved. This free software is distributed under the FreeBSD license (see LICENSE).
Constants
- FULLVERSION
Standard version plus the codename (assigned to each minor release).
i.e.,
VERSION-CODENAME
- VERSION
Standard version string.
We use semantic versioning:
MAJOR.MINOR.PATCH.PRE.PRENUM
Public Class Methods
@return [Boolean] Whether this is an edge (i.e. testing, development, unstable) copy.
# File lib/syndi/version.rb, line 27 def self.edge? prerelease? || rc? || VERSION < '1' end
@return [Boolean] Whether this is a prerelease copy.
# File lib/syndi/version.rb, line 17 def self.prerelease? (VERSION =~ /alpha|beta|pre/).nil? ? false : true end
@return [Boolean] Whether this is a release candidate copy.
# File lib/syndi/version.rb, line 22 def self.rc? (VERSION =~ /rc/).nil? ? false : true end
Public Instance Methods
Central Syndi
Celluloid actor.
@return [Syndi::Actress] Subclass of {Celluloid::Actor}.
# File lib/syndi.rb, line 108 def actress @actress ||= Syndi::Actress.new end
Execute some code after the given interval.
@param [Integer] interval
@return [Celluloid::Timer]
# File lib/syndi.rb, line 117 def after interval, &prc actress.after interval, &prc end
Make Celluloid logging consistent with Syndi
logging.
# File lib/syndi.rb, line 87 def celluloid_log Celluloid.logger = self.log end
Install terminal colors.
# 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
Configuration access.
@return [Syndi::Config]
# File lib/syndi.rb, line 101 def conf @configuration ||= Syndi::Config.new end
Retrieve the application data directory.
@return [String]
# File lib/syndi.rb, line 61 def dir @app_dir ||= File.join ENV['HOME'], '.syndi' end
Set the application data directory.
# File lib/syndi.rb, line 66 def dir= directory FileUtils.mkdir_p directory unless Dir.exists? directory Dir.chdir directory @app_dir = directory end
Central event system access.
@return [Syndi::Events]
# File lib/syndi.rb, line 94 def events @event_manager ||= Syndi::Events.new end
Execute some code every interval
.
@param [Integer] interval
@return [Celluloid::Timer]
# File lib/syndi.rb, line 126 def every interval, &prc actress.every interval, &prc end
@return [Boolean] Whether we're installed as a gem.
# 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
Initiate Syndi
with command-line options
.
@param [Slop] options The command-line options.
# File lib/syndi.rb, line 75 def go options end
Logger
access.
@return [Syndi::Logger]
# File lib/syndi.rb, line 82 def log @logger ||= Syndi::Logger.new end
@return [Boolean] Whether we're running on Microsoft Windows.
# 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