Sha256: 84ea760f748c3855b19fb90832665dba9d57a6d971a084ae6a0611ebe2eb82bc
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
module GitReflow module Sandbox extend self COLOR_FOR_LABEL = { notice: :yellow, error: :red, deliver_halted: :red, success: :green } def run(command, options = {}) options = { loud: true }.merge(options) if options[:with_system] == true system(command) elsif options[:loud] == true puts `#{command}` else `#{command}` end end def run_command_with_label(command, options = {}) label_color = options.delete(:color) || :green puts command.colorize(label_color) run(command, options) end def say(message, label_type = :plain) if COLOR_FOR_LABEL[label_type] puts "[#{ label_type.to_s.gsub('_', ' ').colorize(COLOR_FOR_LABEL[label_type]) }] #{message}" else puts message end end # WARNING: this currently only supports OS X and UBUNTU def ask_to_open_in_browser(url) if RUBY_PLATFORM =~ /darwin|linux/i open_in_browser = ask "Would you like to open it in your browser? " if open_in_browser =~ /^y/i if RUBY_PLATFORM =~ /darwin/i # OS X run "open #{url}" else # Ubuntu run "xdg-open #{url}" end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
git_reflow-0.5.2 | lib/git_reflow/sandbox.rb |
git_reflow-0.5.1 | lib/git_reflow/sandbox.rb |
git_reflow-0.5.0 | lib/git_reflow/sandbox.rb |