Class: Thrust::Config
- Inherits:
-
Object
- Object
- Thrust::Config
- Defined in:
- lib/thrust/config.rb
Constant Summary collapse
- THRUST_VERSION =
'0.5'
- THRUST_ROOT =
File.('../..', __FILE__)
Instance Attribute Summary collapse
-
#app_config ⇒ Object
readonly
Returns the value of attribute app_config.
-
#build_dir ⇒ Object
readonly
Returns the value of attribute build_dir.
-
#project_root ⇒ Object
readonly
Returns the value of attribute project_root.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(relative_project_root, config) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(relative_project_root, config) ⇒ Config
Returns a new instance of Config.
28 29 30 31 32 33 |
# File 'lib/thrust/config.rb', line 28 def initialize(relative_project_root, config) @project_root = File.(relative_project_root) @build_dir = File.join(project_root, 'build') @app_config = Thrust::AppConfig.new(config) verify_configuration end |
Instance Attribute Details
#app_config ⇒ Object (readonly)
Returns the value of attribute app_config.
7 8 9 |
# File 'lib/thrust/config.rb', line 7 def app_config @app_config end |
#build_dir ⇒ Object (readonly)
Returns the value of attribute build_dir.
7 8 9 |
# File 'lib/thrust/config.rb', line 7 def build_dir @build_dir end |
#project_root ⇒ Object (readonly)
Returns the value of attribute project_root.
7 8 9 |
# File 'lib/thrust/config.rb', line 7 def project_root @project_root end |
Class Method Details
.make(relative_project_root, config_file) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/thrust/config.rb', line 12 def self.make(relative_project_root, config_file) begin config_file_contents = YAML.load_file(config_file) rescue Errno::ENOENT puts "" puts " Missing thrust.yml. Create by running:\n".red puts " cp thrust.example.yml thrust.yml".blue exit 1 rescue Psych::SyntaxError puts "" puts " Malformed thrust.yml.".red exit 1 end new(relative_project_root, config_file_contents) end |