Sha256: e3ef27b64f58a161d4cb7fe27d0df72e45d5b6f5c35a9ec14dfbc9b56dd87324

Contents?: true

Size: 1.01 KB

Versions: 25

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require "clamp"
require_relative "../../makit"

module Makit
  module Cli
    # Define the 'init' subcommand
    class InitCommand < Clamp::Command
      parameter "DIRECTORY", "The directory to init as a git repository", attribute_name: :directory, required: true

      def execute
        begin
          Makit::init(directory)
          puts "initialized local repository: #{directory}"
        rescue => e
          $stderr.puts "failed to initialize repository: #{directory}"
          puts e.message
          puts e.backtrace
          exit 1
        end
      end

      #def self.init(directory)
      #  if !Dir.exist?(directory)
      #    FileUtils.mkdir_p(directory)
      #  end
      #  Dir.chdir(directory) do
      #    init = Makit::RUNNER.execute "git init"
      #    if init.exit_code != 0
      #      raise Makit::Error.new("failed to initialize local repository: #{directory}\n#{Makit::Humanize.get_command_summary(init)}")
      #    end#

      #  end
      #end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
makit-0.0.57 lib/makit/cli/init.rb
makit-0.0.53 lib/makit/cli/init.rb
makit-0.0.52 lib/makit/cli/init.rb
makit-0.0.51 lib/makit/cli/init.rb
makit-0.0.50 lib/makit/cli/init.rb
makit-0.0.49 lib/makit/cli/init.rb
makit-0.0.47 lib/makit/cli/init.rb
makit-0.0.46 lib/makit/cli/init.rb
makit-0.0.45 lib/makit/cli/init.rb
makit-0.0.44 lib/makit/cli/init.rb
makit-0.0.42 lib/makit/cli/init.rb
makit-0.0.41 lib/makit/cli/init.rb
makit-0.0.35 lib/makit/cli/init.rb
makit-0.0.34 lib/makit/cli/init.rb
makit-0.0.33 lib/makit/cli/init.rb
makit-0.0.32 lib/makit/cli/init.rb
makit-0.0.31 lib/makit/cli/init.rb
makit-0.0.30 lib/makit/cli/init.rb
makit-0.0.29 lib/makit/cli/init.rb
makit-0.0.28 lib/makit/cli/init.rb