Class: Heroku::Bartender::Config
- Inherits:
-
Object
- Object
- Heroku::Bartender::Config
show all
- Defined in:
- lib/heroku/bartender/config.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(command, project_path = ".", parent = nil) ⇒ Config
Returns a new instance of Config.
10
11
12
13
14
|
# File 'lib/heroku/bartender/config.rb', line 10
def initialize(command, project_path = ".", parent = nil)
@command = command
@parent = parent
@project_path = project_path
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(command, *args) ⇒ Object
16
17
18
|
# File 'lib/heroku/bartender/config.rb', line 16
def method_missing(command, *args)
Config.new(command, @project_path, self)
end
|
Class Method Details
.method_missing(command, *args) ⇒ Object
6
7
8
|
# File 'lib/heroku/bartender/config.rb', line 6
def self.method_missing(command, *args)
new(command, *args)
end
|
Instance Method Details
#config_string ⇒ Object
32
33
34
|
# File 'lib/heroku/bartender/config.rb', line 32
def config_string
@parent ? "#{@parent.config_string}.#{@command}" : @command
end
|
#to_s ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/heroku/bartender/config.rb', line 20
def to_s
git_command = "cd #{@project_path} && git config #{config_string}"
result = `#{git_command} 2>&1`.chomp
process_status = $?
if successful_command?(process_status) || config_command_with_empty_value?(result,process_status)
return result
else
raise "Error calling git config, is a recent version of git installed? Command: #{git_command.inspect}, Error: #{result.inspect}, Status: #{process_status.inspect}"
end
end
|