summaryrefslogtreecommitdiff
path: root/vendor/gems/bundler-checksum/lib/bundler/checksum/command.rb
blob: 438f41f6e69c8383cbd06ffb5079b7ea60761fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Bundler::Checksum
  module Command
    autoload :Init, File.expand_path("command/init", __dir__)
    autoload :Verify, File.expand_path("command/verify", __dir__)
    autoload :Helper, File.expand_path("command/helper", __dir__)

    def self.execute(args)
      if args.empty?
        $stderr.puts 'A command must be given [init,update,verify]'
      end

      if args.first == 'init'
        Init.execute
      elsif args.first == 'update'
        $stderr.puts 'Not implemented, please use init'
      elsif args.first == 'verify'
        verified = Verify.execute

        unless verified
          exit 1
        end
      end
    end
  end
end