Class: GitCloud::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/git_cloud/command.rb

Constant Summary collapse

CONFIG_FILE =
"#{ENV['HOME']}/.git_cloud.cfg"

Class Method Summary collapse

Class Method Details

.execute(*args) ⇒ Object

Public: executes a command.

args - The arguments passed in. Should only be one (the file_path) so

displays the help if greater.


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/git_cloud/command.rb', line 17

def execute(*args)

  return help unless args.size > 0
  return help if args[0] == 45 # any - dash options are pleads for help

  begin
    upload!(args[0])
    begin
      final_url = bitly.shorten(url).short_url
    rescue # Bitly failue - just use git url
      final_url = url
    end
    output Clipboard.copy(final_url)
  rescue GitCloud::GitException => ge
    output ge.message
    output "     Are you sure git is installed and you have configured your"
    output "     repository."
  rescue GitCloud::FileException => fe
    output fe.message
  end
end