Class: Linguist::Command::Project
- Inherits:
-
Base
- Object
- Base
- Linguist::Command::Project
show all
- Defined in:
- lib/linguist_ruby/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, #linguist, #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
Instance Method Details
#create ⇒ Object
26
27
28
29
30
31
|
# File 'lib/linguist_ruby/commands/project.rb', line 26
def create
title = args.shift.downcase.strip rescue nil
title ||=
linguist.projects.create title
display("Created #{title}")
end
|
#destroy ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/linguist_ruby/commands/project.rb', line 55
def destroy
display "=== #{project.title}"
display "Web URL: #{project.weburl}"
display "Owner: #{project.owner}"
if confirm_command(project_title)
redisplay "Destroying #{project_title} ... "
project.destroy
display "done"
end
end
|
#info ⇒ Object
44
45
46
47
48
49
|
# File 'lib/linguist_ruby/commands/project.rb', line 44
def info
display "=== #{project.title}"
display "Web URL: #{project.weburl}"
display "Owner: #{project.owner}"
display "Number of translation: #{project.translations_count}"
end
|
#list ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/linguist_ruby/commands/project.rb', line 15
def list
list = linguist.projects.all
if list.size > 0
display "Projects:\n" + list.keys.map { |name|
"- #{name}"
}.join("\n")
else
display "You have no projects."
end
end
|
#login ⇒ Object
6
7
8
|
# File 'lib/linguist_ruby/commands/project.rb', line 6
def login
Linguist::Command.run_internal "auth:reauthorize", args.dup
end
|
#logout ⇒ Object
10
11
12
13
|
# File 'lib/linguist_ruby/commands/project.rb', line 10
def logout
Linguist::Command.run_internal "auth:delete_credentials", args.dup
display "Local credentials cleared."
end
|
#open ⇒ Object
51
52
53
|
# File 'lib/linguist_ruby/commands/project.rb', line 51
def open
Launchy.open project.weburl
end
|
#rename ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/linguist_ruby/commands/project.rb', line 33
def rename
oldtitle = project.title
newtitle = args[1].downcase.strip rescue raise(CommandFailed, "Invalid new project name")
project.update(:title => newtitle)
display("Renaming project from #{oldtitle} to #{newtitle}")
display app_urls(newtitle)
end
|