Class: Gitpic::Command

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/gitpic/command.rb

Instance Method Summary collapse

Instance Method Details

#loginObject



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

def 
  email = ask("email:")
  system "stty -echo"
  trap("INT") do
    system "stty echo"
    puts("\n !    Command cancelled.")
    exit
  end
  password = ask("password:")
  puts
  system "stty echo"

  if Gitpic::Auth.(email, password)
    puts "Authentication Successful."
  else
    puts "Authentication Failed."
  end
end

#upload(dir) ⇒ Object



8
9
10
11
# File 'lib/gitpic/command.rb', line 8

def upload(dir)
  token = Gitpic::Auth.read_token || return
  Gitpic::Uploader.new(dir, token).upload!
end

#watch(dir) ⇒ Object



14
15
16
# File 'lib/gitpic/command.rb', line 14

def watch(dir)
  puts "watching #{dir}"
end