Class: GitCheckCI::Server
- Inherits:
-
Object
- Object
- GitCheckCI::Server
- Includes:
- Silencer
- Defined in:
- lib/git-check-ci/server.rb
Instance Attribute Summary collapse
-
#outfile ⇒ Object
readonly
path where the results are stored.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Server
constructor
A new instance of Server.
- #running? ⇒ Boolean
- #start(options = {}) ⇒ Object
- #stop(options = {}) ⇒ Object
Methods included from Silencer
Constructor Details
#initialize(options = {}) ⇒ Server
Returns a new instance of Server.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/git-check-ci/server.rb', line 16 def initialize( = {}) @dir = [:dir] || Dir.pwd @interval = [:interval] || 60.0 @checker = Checker.new(:dir => @dir) @config = @checker.config @appgroup = Daemons::ApplicationGroup.new( app_name, :multiple => false, :dir => tmpdir.to_s, :dir_mode => :normal ) @app = @appgroup.new_application(:mode => :proc, :proc => method(:worker)) end |
Instance Attribute Details
#outfile ⇒ Object (readonly)
path where the results are stored
14 15 16 |
# File 'lib/git-check-ci/server.rb', line 14 def outfile @outfile end |
Instance Method Details
#running? ⇒ Boolean
56 57 58 |
# File 'lib/git-check-ci/server.rb', line 56 def running? @app.running? end |
#start(options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/git-check-ci/server.rb', line 30 def start( = {}) return unless @config.is_git_dir? return if @app.running? work # once manually so we're pretty sure the server loop will work @app.start sleep 0.1 until @app.pid.pid unless [:quiet] @app.started puts "project #{@config.ci.project}" end nil end |
#stop(options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/git-check-ci/server.rb', line 44 def stop( = {}) return unless @config.is_git_dir? return unless @app.running? if [:quiet] silencing($stdout) { @app.stop } else @app.stop end nil end |