Sha256: 8a319948a67969c878ba23146f2d8920306a11aca3d197360ef035717c28ec7f
Contents?: true
Size: 1001 Bytes
Versions: 8
Compression:
Stored size: 1001 Bytes
Contents
require 'rebuild' module Rebuild class CLI class << self def start return show_usage if ARGV.empty? && CommandLineTools.installed? unless CommandLineTools.installed? CommandLineTools.install end if ARGV.any? stdin = STDIN.gets unless STDIN.isatty bootstrap(ARGV, stdin) end end private def bootstrap(args, stdin) repo_path = Repository.new(args.first).fetch primary_scripts = stdin runner = Runner.new(repo_path, primary_scripts) runner.run end def show_usage puts unindent(<<-EOS) Commands: rebuild USER/PROJECT # execute all scripts in GitHub repo's root directory EOS end def unindent(text) indent = text.split("\n").select {|line| !line.strip.empty? }.map {|line| line.index(/[^\s]/) }.compact.min || 0 text.gsub(/^[[:blank:]]{#{indent}}/, '') end end end end
Version data entries
8 entries across 8 versions & 1 rubygems