Sha256: b796fd8f4c5fded9f0d9c1fda00cbfffd30d0fecbd47cd4f17abba1f98d58b2e

Contents?: true

Size: 978 Bytes

Versions: 3

Compression:

Stored size: 978 Bytes

Contents

require_relative "./template/functions_app"
require_relative "./template/functions_gemfile"
module Souls
  class Create < Thor
    desc "functions", "Create SOULs functions"
    def functions
      create_app_file
      create_gemfile
    end

    private

    def create_app_file
      file_dir = "./apps/functions"
      FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
      file_path = "#{file_dir}/app.rb"
      raise(StandardError, "Already Exist!") if File.exist?(file_path)

      File.write(file_path, Template.functions_app)
      Souls::Painter.create_file(file_path)
      file_path
    end

    def create_gemfile
      file_dir = "./apps/functions"
      FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
      file_path = "#{file_dir}/Gemfile"
      raise(StandardError, "Already Exist!") if File.exist?(file_path)

      File.write(file_path, Template.functions_gemfile)
      Souls::Painter.create_file(file_path)
      file_path
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
souls-1.14.1 lib/souls/cli/create/functions.rb
souls-1.14.0 lib/souls/cli/create/functions.rb
souls-1.13.8 lib/souls/cli/create/functions.rb