require 'version' require 'flattr' require 'launchy' def error message puts "Error: #{message}" exit 1 end class Git class < "#{Dir.pwd}/.git", :config => "#{Dir.pwd}/.git/config" } unless File.exists?(git_opts[:dir]) error "Don't seem to be a git repository" end unless File.exists?(git_opts[:config]) error "Git .config file not found" end unless Git.current_repo_github? error "Not a GitHub repository" end end end end module Auth class < e puts e.message puts "Seems like you are missing a Flattr access token." puts "Browse to http://git-flattr.herokuapp.com and follow the instructions" token = ask("Token: ") end if token.nil? error "Invalid access token" end Git.set_config "flattr.token", token.chomp end end end