Class: Lingohub::Command::Project

Inherits:
Base
  • Object
show all
Defined in:
lib/lingohub/commands/project.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #autodetected_app

Instance Method Summary collapse

Methods inherited from Base

#app_urls, #escape, #extract_app_from_git_config, #extract_option, #extract_project_title_from_args, #extract_project_title_from_dir_name, #extract_project_title_from_git, #git_remotes, #git_url, #initialize, #lingohub, #project, #project_title

Methods included from Helpers

#ask, #confirm, #confirm_command, #deprecate, #display, #error, #format_date, #git, #has_git?, #home_directory, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #shell

Constructor Details

This class inherits a constructor from Lingohub::Command::Base

Instance Method Details

#listObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/lingohub/commands/project.rb', line 15

def list
  list = lingohub.projects.all
  if list.size > 0
    display "Projects:\n"
    list.each_pair { |name, project|
      display "- #{name}"
    }
  else
    display "You have no projects."
  end
end

#loginObject



6
7
8
# File 'lib/lingohub/commands/project.rb', line 6

def 
  Lingohub::Command.run_internal "auth:reauthorize", args.dup
end

#logoutObject



10
11
12
13
# File 'lib/lingohub/commands/project.rb', line 10

def logout
  Lingohub::Command.run_internal "auth:delete_credentials", args.dup
  display "Local credentials cleared."
end

#openObject



27
28
29
# File 'lib/lingohub/commands/project.rb', line 27

def open
  Launchy.open project.weburl
end