Class: Pgchief::Command::ConfigCreate
- Inherits:
-
Object
- Object
- Pgchief::Command::ConfigCreate
- Defined in:
- lib/pgchief/command/config_create.rb
Overview
Create a configuration file at $HOME
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(dir: "#{Dir.home}/.config/pgchief") ⇒ Object
9 10 11 |
# File 'lib/pgchief/command/config_create.rb', line 9 def self.call(dir: "#{Dir.home}/.config/pgchief") new.call(dir: dir) end |
Instance Method Details
#call(dir: "#{Dir.home}/.config/pgchief") ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/pgchief/command/config_create.rb', line 13 def call(dir: "#{Dir.home}/.config/pgchief") return if File.exist?("#{dir}/config.toml") template = File.join(__dir__, '..', '..', '..', 'config', 'pgchief.toml') FileUtils.mkdir_p(dir) FileUtils.cp(template, "#{dir}/config.toml") puts "Configuration file created at #{dir}/config.toml" end |