Class: ApplicationSetupAutoConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/renuo/cli/app/application_setup_auto_config.rb

Overview

Instance Method Summary collapse

Instance Method Details

#handle_file(file, hint) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/renuo/cli/app/application_setup_auto_config.rb', line 14

def handle_file(file, hint)
  base_url = 'https://raw.githubusercontent.com/renuo/rails-application-setup-guide/master/templates/'
  if agree("Overwrite #{file}?#{" Hint: #{hint})" if hint}")
    `curl #{base_url}#{file} > #{file}`
  else
    puts "Skipping file #{base_url}#{file}"
  end
end

#runObject



7
8
9
10
11
12
# File 'lib/renuo/cli/app/application_setup_auto_config.rb', line 7

def run
  url = 'https://raw.githubusercontent.com/renuo/rails-application-setup-guide/master/templates/auto_copy_files.md'
  data = Net::HTTP.get(URI(url))
  files = MarkdownParserService.new.parse_markdown(data)
  files.each { |file, hint| handle_file(file, hint) }
end