#!/usr/bin/env ruby # frozen_string_literal: true require 'thor' class ::CapistranoDataPlaneApiCommand < ::Thor include ::Thor::Actions class << self # Define the generator's root folder # # @return [String] def source_root ::File.expand_path('..', __dir__) end end desc 'install', 'Install the `capistrano-data_plane_api` gem in your application' # @return [void] def install copy_file 'templates/bin/deploy', 'bin/deploy' chmod 'bin/deploy', 'a+x' copy_file 'templates/bin/deploy.rb', 'bin/deploy.rb' copy_file 'templates/config/data_plane_api.yml', 'config/data_plane_api.yml' copy_file 'templates/config/data_plane_api.rb', 'config/data_plane_api.rb' inject_into_file 'Capfile', <<~RUBY, after: %r{require ("|')capistrano/deploy("|')\n} require_relative "config/data_plane_api" # load your `capistrano-data_plane_api` config file require "capistrano/data_plane_api/hooks" RUBY end end ::CapistranoDataPlaneApiCommand.start