Class: Jiveapps::Command::App
- Inherits:
-
Base
- Object
- Base
- Jiveapps::Command::App
show all
- Defined in:
- lib/jiveapps/commands/app.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#args, #autodetected_app
Instance Method Summary
collapse
Methods inherited from Base
#extract_app, #extract_app_from_git_config, #extract_app_in_dir, #extract_option, #git_remotes, #initialize, #jiveapps
Methods included from Helpers
#ask, #catch_args, #check_git_version, #confirm, #confirm_command, #debug, #debug_mode?, #display, #display_oauth_services, #error, #get_app_prop_with_default, #get_or_set_git_prop, #git_version, #has_program?, #home_directory, #run, #running_on_a_mac?, #running_on_windows?, #sh, #usage, #user_git_version
Instance Attribute Details
#current_app ⇒ Object
Returns the value of attribute current_app.
4
5
6
|
# File 'lib/jiveapps/commands/app.rb', line 4
def current_app
@current_app
end
|
Instance Method Details
#clone ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/jiveapps/commands/app.rb', line 37
def clone
usage "jiveapps clone <appname>"
catch_args :appname
app = jiveapps.info(@appname)
if app == nil
display "=== App not found."
else
if File.exists?(@appname) && File.directory?(@appname)
display "=== #{@appname} folder already exists."
else
display "=== Cloning #{@appname}..."
run("git clone #{app['git_url']} --origin jiveapps", :exec => true)
end
end
end
|
#create ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/jiveapps/commands/app.rb', line 55
def create
usage = "\n Usage:\n $ jiveapps create <appname>"
catch_args :appname
debug "Running in debug mode."
check_git_version
check_if_dir_already_exists
app_list = Jiveapps::Command.run_internal('auth:check', []) return unless app_list.class == Array
Jiveapps::Command.run_internal('keys:add', ["--silent"])
display "=== Creating new Jive App \"#{@appname}\"..."
create_remote_app
generate_app
create_local_git_repo_and_push_to_remote
check_app_push
register_app
create_notify_user
end
|
#delete ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/jiveapps/commands/app.rb', line 87
def delete
name = determine_app_name
app = jiveapps.info(name)
if app == nil
display "App not found."
else
if confirm("Are you sure you want to delete the app \"#{name}\" [y/N]? ")
display "=== Deleting \"#{name}\": ", false
@current_app = jiveapps.delete_app(name)
handle_response_errors
dir_delete_text = "Would you like to delete the local directory \"#{name}\" [y/N]? "
if File.split(Dir.pwd).last == name && File.directory?(".git") && confirm(dir_delete_text)
Dir.chdir("..")
FileUtils.rm_rf(name)
display "Local directory \"#{name}\" deleted."
elsif File.directory?(name) && confirm(dir_delete_text)
FileUtils.rm_rf(name)
display "Local directory \"#{name}\" deleted."
end
end
end
end
|
#info ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/jiveapps/commands/app.rb', line 26
def info
name = determine_app_name
app = jiveapps.info(name)
if app == nil
display "App not found."
else
display "=== #{app['name']}"
display_app_info(app)
end
end
|
#install ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/jiveapps/commands/app.rb', line 74
def install
name = determine_app_name
display "=== Installing \"#{name}\" on the Jive App Sandbox: ", false
app = jiveapps.install(name)
handle_response_errors
if app == nil
display "App not found."
else
display "=== #{app['name']}"
display_app_info(app)
end
end
|
#list ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/jiveapps/commands/app.rb', line 10
def list
jiveapps_list = jiveapps.list
return if jiveapps_list.nil?
formatted_list = jiveapps_list.map do |app|
" - " + app['name']
end
if formatted_list.size > 0
display "Your apps:"
display formatted_list
else
display "You have no apps."
end
end
|