Class: DokkuClient::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/dokku_client/base.rb
Constant Summary
collapse
- GIT_DIR =
'.git'
- KEYS_AND_QUESTIONS =
{
"dokku-client.project-name" => "Enter project name",
"dokku-client.project-host" => "Enter dokku host"
}
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/dokku_client/base.rb', line 13
def initialize(options={})
options = {}
@options = options
@current_dir = Dir.pwd
raise DokkuClient::Errors::NoGitRepoFound, "No git repository found" unless git_directory_present?
@git_dir = File.join(@current_dir, GIT_DIR)
@options[:repository] = Grit::Repo.new(@git_dir)
git_config_ok? ? parse_git_config : add_git_config
run
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4
5
6
|
# File 'lib/dokku_client/base.rb', line 4
def options
@options
end
|
Instance Method Details
#dokku(arg) ⇒ Object
41
42
43
44
|
# File 'lib/dokku_client/base.rb', line 41
def dokku arg
no_argument_error if arg.nil?
exec "ssh", "-t", "dokku@#{@options["project-host"]}", arg
end
|
#git_directory_present? ⇒ Boolean
27
28
29
|
# File 'lib/dokku_client/base.rb', line 27
def git_directory_present?
File.directory?(File.join(@current_dir, GIT_DIR))
end
|
#reconfig ⇒ Object
34
35
36
37
38
39
|
# File 'lib/dokku_client/base.rb', line 34
def reconfig
KEYS_AND_QUESTIONS.each do |key, question|
ask_question_and_force_update_config(question, key)
end
config_update_success
end
|
#run ⇒ Object
31
32
|
# File 'lib/dokku_client/base.rb', line 31
def run
end
|