Class: Roda::Project::JeremyTemplateCreator

Inherits:
Generator
  • Object
show all
Includes:
Helpers::Inflections
Defined in:
lib/roda/project/jeremy_template_creator.rb

Instance Attribute Summary

Attributes inherited from Generator

#pastel

Instance Method Summary collapse

Methods included from Helpers::Inflections

camelize, plural?, pluralize, singular?, singularize, underscore

Methods inherited from Generator

#initialize

Methods included from Helpers::Ids

#api_id, #fullstack_id, #id_to_string, #minimal_id, #minitest_id, #mysql_id, #postgresql_id, #rspec_id, #sqlite_id

Methods included from Helpers::Template

#cp_dir, #cp_file, #ensure_and_get_path, #erb_cp_dir, #erb_cp_file, #templates_root

Constructor Details

This class inherits a constructor from Roda::Project::Generator

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/roda/project/jeremy_template_creator.rb', line 8

def call
  repo_url = "https://github.com/jeremyevans/roda-sequel-stack"
  puts "* Downloading template with git...\n\n"

  success = system("git clone --depth 1 #{repo_url} #{@context.project_name}")
  abort("\nCould not download the template.") unless success

  git_dir = File.join(@context.project_name, '.git')
  if Dir.exist?(git_dir)
    FileUtils.rm_rf(git_dir)
    puts "\n* Cleaned up template git history.\n\n"
  end

  action_success_message("./#{@context.project_name}")

  setup_command = "cd #{@context.project_name} && rake setup[#{camelize(@context.project_name)}]"
  system(setup_command)

  action_success_message(setup_command, "run")
  puts "\n Setup is done! follow the link below to learn about this template:"
  puts "\n #{repo}"
end