lib/makit/cli/make.rb in makit-0.0.47 vs lib/makit/cli/make.rb in makit-0.0.48
- old
+ new
@@ -1,54 +1,54 @@
-# 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
+# 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