Sha256: 6e1c937589d76f2c7d0ca24382e6500f216015efbe9c9fe385cadfb9fe9f2c2d
Contents?: true
Size: 1.79 KB
Versions: 28
Compression:
Stored size: 1.79 KB
Contents
# frozen_string_literal: true require "clamp" #require "git" require "socket" require_relative "../humanize" module Makit module Cli # Define the 'make' subcommand class MakeCommand < Clamp::Command parameter "GIT_REPOSITORY", "The git repository URL or NAME", attribute_name: :git_repository, required: true #option ["-f", "--force"], "FORCE", "Force the command to be run, even if a result already exists", attribute_name: :force def execute begin # make sure a local clone of the repository exists clone_dir = Directories::get_clone_directory(git_repository) if Dir.exist?(clone_dir) # attempt to the pull the latest changes begin PullCommand::pull(git_repository) rescue => e puts "warning: failed to pull repository: #{git_repository}" end else CloneCommand::clone(git_repository) end rescue => e $stderr.puts "failed to make repository: #{git_repository}" puts "Please check the URL and your network connection." puts e.message exit 1 end # determine the latest commit id for the repository g = Git.open(clone_dir) latest_commit = g.log.first commit = latest_commit.sha begin #make_result = MakeCommand::make(git_repository, commit) make_result = Makit::make(git_repository, commit) puts make_result.summary rescue => e $stderr.puts "failed to make repository: #{git_repository} commit: #{commit}" puts e.message puts Makit::Humanize::get_make_result_summary make_result exit 1 end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems