Class: ThinIce::ThinManager
- Inherits:
-
Object
- Object
- ThinIce::ThinManager
- 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
-
#config_path ⇒ Object
readonly
Path to YML configuration file.
-
#env ⇒ Object
readonly
Environment.
-
#rackup_path ⇒ Object
readonly
Returns the value of attribute rackup_path.
-
#thin_path ⇒ Object
readonly
Path to Thin executable.
Instance Method Summary collapse
-
#config_path_param ⇒ Array
An Array cotaining the path to a YML configuration file.
-
#env_param ⇒ Array
An Array cotaining the environment string.
-
#initialize(options = {}) ⇒ ThinManager
constructor
Creates a [ThinManager] object that is used to to aid rake task generation.
-
#rackup_path_param ⇒ Array
An Array cotaining the path to a Rackup configuration file.
-
#start_cmd ⇒ String
A concatination of strings resulting in the Thin start command to be invoked by Rake.
-
#stop_cmd ⇒ String
A concatination of strings resulting in the Thin stop command to be invoked by Rake.
-
#thin_exec_param ⇒ Array
An Array cotaining the Thin executable location.
Constructor Details
#initialize(options = {}) ⇒ ThinManager
Creates a [ThinManager] object that is used to to aid rake task
generation
41 42 43 44 45 46 |
# File 'lib/thin-ice/core.rb', line 41 def initialize( = {}) @env = [:env] @thin_path = [:thin_path] @config_path = [:config_path] @rackup_path = [:rackup_path] end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Path to YML configuration file
34 |
# File 'lib/thin-ice/core.rb', line 34 attr_reader :env, :config_path, :thin_path, :rackup_path |
#env ⇒ Object (readonly)
Environment
34 35 36 |
# File 'lib/thin-ice/core.rb', line 34 def env @env end |
#rackup_path ⇒ Object (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_path ⇒ Object (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_param ⇒ Array
Returns 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_param ⇒ Array
Returns 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_param ⇒ Array
Returns 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_cmd ⇒ String
Returns 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_cmd ⇒ String
Returns 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_param ⇒ Array
Returns 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 |