Class: Thrust::Config
- Inherits:
-
Object
- Object
- Thrust::Config
- Defined in:
- lib/thrust/config.rb
Constant Summary collapse
- THRUST_VERSION =
0.3
- 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.
24 25 26 27 28 29 |
# File 'lib/thrust/config.rb', line 24 def initialize(relative_project_root, config) @project_root = File.(relative_project_root) @build_dir = File.join(project_root, 'build') @app_config = config verify_configuration(@app_config) end |
Instance Attribute Details
#app_config ⇒ Object (readonly)
Returns the value of attribute app_config.
4 5 6 |
# File 'lib/thrust/config.rb', line 4 def app_config @app_config end |
#build_dir ⇒ Object (readonly)
Returns the value of attribute build_dir.
4 5 6 |
# File 'lib/thrust/config.rb', line 4 def build_dir @build_dir end |
#project_root ⇒ Object (readonly)
Returns the value of attribute project_root.
4 5 6 |
# File 'lib/thrust/config.rb', line 4 def project_root @project_root end |
Class Method Details
.make(relative_project_root, config_file) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/thrust/config.rb', line 8 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 |