Sha256: 8b6962cc96cbef35454568aaa7592f68c479497cf49cc147cef4201dfec29d8d
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
#!/usr/bin/env ruby # coding: utf-8 require "vint" require "optparse" require "pp" class String def undent gsub /^.{#{slice(/^ +/).length}}/, '' end end def help puts <<-EOD.undent Usage: vint [OPTIONS] options: -h, --help\tShow help -v, --version\tShow version commands: init\tCreate Vint template file install\tInstall formula EOD end def install(brewfile) unless File.exists?(brewfile) puts "Brewfile not found. please '$ vint init' to create Brewfile" exit 1 end parser = Vint::Parser.new parser.parse(brewfile) end OptionParser.new do |opts| opts.on("-h", "--help") do help exit end opts.on("-v", "--version") do puts "Vint #{Vint::VERSION}" exit end opts.parse!(ARGV) end command, args = ARGV case command when "install" brewfile = args ? File.expand_path(args) : File.join(Dir.pwd, "Brewfile") install(brewfile) when "init" File.open(File.join(Dir.pwd, "Brewfile"), "w") do |f| f.puts <<-EOD.undent # Brewfile is created by Vint(Winemaker) # https://github.com/oame/vint # brew "scala" # brew "cabocha", :url => "http://example.com/lib/formula2.rb" EOD end puts "Finish create Brewfile on current directory!" else brewfile = File.join(Dir.pwd, "Brewfile") install(brewfile) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vint-1.3 | bin/vint |