Class: Repository::ConfigBuilder::DraftConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/devlogs/repository/config_builder.rb

Constant Summary collapse

INFO_FILE_SUFFIX =
"devlogs.info.md"
LOG_TEMPLATE_FILE_NAME =
"__log_template.erb.md"
ISSUE_TEMPLATE_FILE_NAME =
"__issue_template.erb.md"

Instance Method Summary collapse

Constructor Details

#initialize(config_store, config_info) ⇒ DraftConfig

Returns a new instance of DraftConfig.



59
60
61
62
# File 'lib/devlogs/repository/config_builder.rb', line 59

def initialize(config_store, config_info)
  @config_store = config_store
  @config_info = config_info
end

Instance Method Details

#save!(force: false) ⇒ Object

Initiates the write process of devlogs repository

Parameters:

  • force (Boolean) (defaults to: false)


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/devlogs/repository/config_builder.rb', line 69

def save!(force: false)
  exists = File.exist?(@config_store.file_path)

  if exists && !force
    puts "Log repository already exists in aborting..."
    raise RuntimeError
  end

  create_config_store_dir
  save_config_file
  save_info_file
  save_log_template_file

  create_issue_dir
  save_issue_template_file
  save_data_file
end