Sha256: f43075f564774f3f204f031556594e26e783337d0533b683f4898d36285a44f2
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
#!/usr/bin/env ruby # coding: utf-8 require "vintner" require "optparse" require "pp" class String def undent gsub /^.{#{slice(/^ +/).length}}/, '' end end def help puts <<-EOD.undent Usage: vintner [OPTIONS] options: -h, --help\tShow help -v, --version\tShow version commands: init\tCreate Vintner template file install\tInstall formula EOD end def install(brewfile) unless File.exists?(brewfile) puts "Brewfile not found" exit 1 end parser = Vintner::Parser.new parser.parse(brewfile) end OptionParser.new do |opts| opts.on("-h", "--help") do display_help exit end opts.on("-v", "--version") do puts "Vintner #{Vintner::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 Vintner(Winemaker) # https://github.com/oame/vintner brew "nihonshu" brew "sake", :url => "http://example.com" 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 |
---|---|
vintner-1.0 | bin/vintner |