Class: BluxConfigurationReader
- Inherits:
-
Object
- Object
- BluxConfigurationReader
- Defined in:
- lib/blux_config_reader.rb
Overview
Copyright 2010 Louis-Philippe Salin de l’Etoile, aka Louis Salin email: [email protected]
This file is part of Blux.
Blux is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Blux is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Blux. If not, see <www.gnu.org/licenses/>.
Instance Attribute Summary collapse
-
#author_name ⇒ Object
readonly
Returns the value of attribute author_name.
-
#blog ⇒ Object
readonly
Returns the value of attribute blog.
-
#launch_editor_cmd ⇒ Object
readonly
Returns the value of attribute launch_editor_cmd.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#user_name ⇒ Object
readonly
Returns the value of attribute user_name.
Instance Method Summary collapse
Instance Attribute Details
#author_name ⇒ Object (readonly)
Returns the value of attribute author_name.
21 22 23 |
# File 'lib/blux_config_reader.rb', line 21 def end |
#blog ⇒ Object (readonly)
Returns the value of attribute blog.
21 22 23 |
# File 'lib/blux_config_reader.rb', line 21 def blog @blog end |
#launch_editor_cmd ⇒ Object (readonly)
Returns the value of attribute launch_editor_cmd.
20 21 22 |
# File 'lib/blux_config_reader.rb', line 20 def launch_editor_cmd @launch_editor_cmd end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
21 22 23 |
# File 'lib/blux_config_reader.rb', line 21 def password @password end |
#user_name ⇒ Object (readonly)
Returns the value of attribute user_name.
21 22 23 |
# File 'lib/blux_config_reader.rb', line 21 def user_name @user_name end |
Instance Method Details
#load_config(blux_rc, verbose = false) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/blux_config_reader.rb', line 23 def load_config(blux_rc, verbose = false) unless File.exists? blux_rc system "touch #{blux_rc}" end line = `grep editor: #{blux_rc}` match = line =~ /^editor:\s(.+)$/ @launch_editor_cmd = $1 line = `grep blog: #{blux_rc}` match = line =~ /^blog:\s(.+)$/ @blog = $1 line = `grep author_name: #{blux_rc}` match = line =~ /^author_name:\s(.+)$/ = $1 line = `grep user_name: #{blux_rc}` match = line =~ /^user_name:\s(.+)$/ @user_name = $1 line = `grep password: #{blux_rc}` match = line =~ /^password:\s(.+)$/ @password = $1 validate end |