Class: Scc::Commands::BuildManifestFromGit
- Inherits:
-
Object
- Object
- Scc::Commands::BuildManifestFromGit
- Defined in:
- lib/scc/commands/build_manifest_from_git.rb
Instance Method Summary collapse
Instance Method Details
#call(argv) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/scc/commands/build_manifest_from_git.rb', line 37 def call(argv) argv = %w[-h] if argv.empty? = parse_args(argv) # early exits return [:early_exit] if [:early_exit] deploy_info = Scc::DeployInfo.from_git(root: [:git_root]) deploy_info.extract! open_and_yield([:output_file]) do |f| f.puts(YAML.dump(deploy_info.to_poro)) end 0 rescue Scc::DeployInfo::Extractor::Git::NotAGitRootError => e puts e. 1 end |
#parse_args(argv) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/scc/commands/build_manifest_from_git.rb', line 10 def parse_args(argv) = {} OptionParser.new do |opts| opts. = "Usage: scc-build-deploy-manifest-from-git [options]" opts.on("-o", "--output FILE", "Output file") do |file| [:output_file] = file end opts.on("-d", "--git-dir PATH", "Git root") do |git_root| [:git_root] = git_root end opts.on("-h", "--help", "Prints this help") do [:early_exit] = true puts opts end opts.on("-v", "--version", "Prints gem version") do [:early_exit] = true puts Scc::VERSION end end.parse!(argv) end |