Class: ThinIce::ThinManager

Inherits:
Object
  • Object
show all
Defined in:
lib/thin-ice/core.rb

Overview

ThinManager is designed to help construct the exact command to be excuted by the Rake task.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ThinManager

Creates a [ThinManager] object that is used to to aid rake task

generation

Parameters:

  • options (Hash) (defaults to: {})

    Hash containing various configuration options



41
42
43
44
45
46
# File 'lib/thin-ice/core.rb', line 41

def initialize(options = {})
  @env             = options[:env]
  @thin_path       = options[:thin_path]
  @config_path     = options[:config_path]
  @rackup_path     = options[:rackup_path]
end

Instance Attribute Details

#config_pathObject (readonly)

Path to YML configuration file



34
# File 'lib/thin-ice/core.rb', line 34

attr_reader :env, :config_path, :thin_path, :rackup_path

#envObject (readonly)

Environment



34
35
36
# File 'lib/thin-ice/core.rb', line 34

def env
  @env
end

#rackup_pathObject (readonly)

Returns the value of attribute rackup_path.



34
# File 'lib/thin-ice/core.rb', line 34

attr_reader :env, :config_path, :thin_path, :rackup_path

#thin_pathObject (readonly)

Path to Thin executable



34
# File 'lib/thin-ice/core.rb', line 34

attr_reader :env, :config_path, :thin_path, :rackup_path

Instance Method Details

#config_path_paramArray

Returns An Array cotaining the path to a YML configuration file. Empty by default.

Returns:

  • (Array)

    An Array cotaining the path to a YML configuration file. Empty by default



62
63
64
# File 'lib/thin-ice/core.rb', line 62

def config_path_param
  (config_path) ? ['-C', config_path] : []
end

#env_paramArray

Returns An Array cotaining the environment string. May be empty.

Returns:

  • (Array)

    An Array cotaining the environment string. May be empty



50
51
52
# File 'lib/thin-ice/core.rb', line 50

def env_param
  (env) ? [env] : []
end

#rackup_path_paramArray

Returns An Array cotaining the path to a Rackup configuration file. Empty by default.

Returns:

  • (Array)

    An Array cotaining the path to a Rackup configuration file. Empty by default



68
69
70
# File 'lib/thin-ice/core.rb', line 68

def rackup_path_param
  (rackup_path) ? ['-R', rackup_path] : []
end

#start_cmdString

Returns A concatination of strings resulting in the Thin start command to be invoked by Rake.

Returns:

  • (String)

    A concatination of strings resulting in the Thin start command to be invoked by Rake



74
75
76
# File 'lib/thin-ice/core.rb', line 74

def start_cmd
  env_param + thin_exec_param + rackup_path_param + config_path_param + ['start']
end

#stop_cmdString

Returns A concatination of strings resulting in the Thin stop command to be invoked by Rake.

Returns:

  • (String)

    A concatination of strings resulting in the Thin stop command to be invoked by Rake



80
81
82
# File 'lib/thin-ice/core.rb', line 80

def stop_cmd
  env_param + thin_exec_param + rackup_path_param + config_path_param + ['stop']
end

#thin_exec_paramArray

Returns An Array cotaining the Thin executable location. Uses local Thin gem by default.

Returns:

  • (Array)

    An Array cotaining the Thin executable location. Uses local Thin gem by default



56
57
58
# File 'lib/thin-ice/core.rb', line 56

def thin_exec_param
  [thin_path || 'thin']
end