Module: Raad

Defined in:
lib/raad/env.rb,
lib/raad/logger.rb,
lib/raad/runner.rb,
lib/raad/version.rb,
lib/raad/bootstrap.rb,
lib/raad/configuration.rb

Defined Under Namespace

Modules: Configuration, Logger Classes: Bootstrap, Runner

Constant Summary collapse

VERSION =
"0.5.0"

Class Method Summary collapse

Class Method Details

.custom_optionsHash

returns the custom options hash set in the service options_parser class method

Returns:

  • (Hash)

    custom options hash



90
91
92
# File 'lib/raad/env.rb', line 90

def custom_options
  @custom_options
end

.development?Boolean

are we in the development environment

Returns:

  • (Boolean)

    true if current environemnt is development, false otherwise



41
42
43
# File 'lib/raad/env.rb', line 41

def development?
  @env == :development
end

.envSymbol

retrieves the current environment

Returns:

  • (Symbol)

    the current environment



14
15
16
# File 'lib/raad/env.rb', line 14

def env
  @env
end

.env=(env) ⇒ Object

sets the current environment

Parameters:

  • env (String or Symbol)

    the environment



21
22
23
24
25
26
27
28
29
# File 'lib/raad/env.rb', line 21

def env=(env)
  case(env.to_s)
  when 'dev', 'development' then @env = :development
  when 'prod', 'production' then @env = :production
  when 'stage', 'staging' then @env = :stage
  when 'test' then @env = :test
  else @env = env.to_sym
  end
end

.jruby?Boolean

are we running inside jruby

Returns:

  • (Boolean)

    true if runnig inside jruby



62
63
64
# File 'lib/raad/env.rb', line 62

def jruby?
  !!(defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby')
end

.production?Boolean

Determines if we are in the production environment

Returns:

  • (Boolean)

    true if current environemnt is production, false otherwise



34
35
36
# File 'lib/raad/env.rb', line 34

def production?
  @env == :production
end

.ruby_pathString

absolute path of current interpreter

Returns:

  • (String)

    absolute path of current interpreter



69
70
71
# File 'lib/raad/env.rb', line 69

def ruby_path
  File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"] + Config::CONFIG["EXEEXT"])
end

.stage?Boolean

are we in the staging environment

Returns:

  • (Boolean)

    true if current environemnt is staging, false otherwise



48
49
50
# File 'lib/raad/env.rb', line 48

def stage?
  @env == :stage
end

.stopped=(state) ⇒ Object

used internally to set the stopped flag

Parameters:

  • state (Boolean)

    true to set the stopped flag



83
84
85
# File 'lib/raad/env.rb', line 83

def stopped=(state)
  @stop_lock.synchronize{@stopped = !!state}
end

.stopped?Boolean

a request to stop the service has been received (or the #start method has returned and, if defined, the service #stop method has been called by Raad.

Returns:

  • (Boolean)

    true is the service has been stopped



76
77
78
# File 'lib/raad/env.rb', line 76

def stopped?
  @stop_lock.synchronize{@stopped}
end

.test?Boolean

are we in the test environment

Returns:

  • (Boolean)

    true if current environemnt is test, false otherwise



55
56
57
# File 'lib/raad/env.rb', line 55

def test?
  @env == :test
end