lib/hu/collab.rb in hu-1.1.2 vs lib/hu/collab.rb in hu-1.2.0

- old
+ new

@@ -1,9 +1,10 @@ require 'powerbar' require 'yaml' require 'hashdiff' require 'set' +require 'netrc' require 'platform-api' module Hu class Cli < Optix::Cli class Collab < Optix::Cli @@ -26,10 +27,20 @@ text "may contain space delimited glob(7) patterns" text "of apps to be ignored." text "" text "WARNING: If you remove yourself from an application" text " then hu won't be able to see it anymore." + if Hu::API_TOKEN.nil? + text "" + text "\e[1mWARNING: Environment variable 'HEROKU_API_KEY' must be set.\e[0m" + end + filter do + if Hu::API_TOKEN.nil? + STDERR.puts "\e[0;31;1mERROR: Environment variable 'HEROKU_API_KEY' must be set.\e[0m" + exit 1 + end + end def collab; end OP_COLORS = { '+' => "\e[0;1;32m", '-' => "\e[0;1;34m", @@ -64,11 +75,11 @@ end desc "Print current mapping to stdout" text "Print current mapping to stdout" opt :format, "yaml|json", :default => 'yaml' - parent "collab", "Application collaborators" + parent "collab", "Manage application collaborators" def export(cmd, opts, argv) puts heroku_state.send("to_#{opts[:format]}".to_sym) end desc "Read mapping from stdin and push to heroku" @@ -235,10 +246,10 @@ data['collaborators'] = all_collaborators.to_a.sort @heroku_state = data end def h - @h ||= PlatformAPI.connect_oauth(Hu::Cli::API_TOKEN) + @h ||= PlatformAPI.connect_oauth(Hu::API_TOKEN) end def pb(show_opts) return if $quiet @pb ||= PowerBar.new