lib/githubrepo.rb in githubrepo-0.1.0 vs lib/githubrepo.rb in githubrepo-0.2.0

- old
+ new

@@ -1,7 +1,9 @@ require 'json' require 'httparty' +require 'clipboard' +require 'os' module Githubrepo # no need for classes (will never create instance of self)... refactor and use just modules and methods # http://matt.aimonetti.net/posts/2012/07/30/ruby-class-module-mixins/ @@ -55,10 +57,29 @@ if attributes['errors'] != nil attributes['errors'].first['message'] end # messages to console - puts clone_url if clone_url + if clone_url + if OS.mac? + puts "#{clone_url} --- COPIED TO CLIPBOARD" + Clipboard.copy clone_url + elsif OS.linux? + puts clone_url + Clipboard.copy clone_url + puts "If xclip is installed, repository URL has been added to your clipboard." + puts "debian/ubuntu: apt-get install xclip" + # elsif OS.windows? + # Clipboard.copy clone_url + # # Will Clipboard output clone_url to console if ffi is not installed? + # # Below is what it looks like when Clipboard requirements are met + # # https://github.com/user/*.git --- COPIED TO CLIPBOARD + # puts "If ffi is installed, repository URL has been added to your clipboard." + # puts "for installation: gem install ffi" + else + puts clone_url + end + end puts message.capitalize if message puts error_message.capitalize if error_message end end