class Sanctum::Command::Config
Intentionally not extending Base
This command creates an example config
Attributes
config_path[R]
example_file[R]
Public Class Methods
new(options={}, _args=[])
click to toggle source
# File lib/sanctum/command/config.rb, line 11 def initialize(options={}, _args=[]) options = {working_dir: Dir.pwd}.merge(options) relative_path = File.expand_path File.dirname(__FILE__) @config_path = "#{options[:working_dir]}/sanctum.yaml" @example_file = "#{relative_path}/sanctum.example.yaml" end
Public Instance Methods
config_exist?()
click to toggle source
# File lib/sanctum/command/config.rb, line 24 def config_exist? File.file?(config_path) end
create_config_file()
click to toggle source
# File lib/sanctum/command/config.rb, line 28 def create_config_file FileUtils.cp(example_file, config_path) end
run()
click to toggle source
# File lib/sanctum/command/config.rb, line 19 def run raise yellow("config file already exists") if config_exist? create_config_file end