panda_pal 5.16.14 → 5.16.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de815c41e7df0d792b7dae34188f1f796f135e24dd92047ea508381499c5995e
|
|
4
|
+
data.tar.gz: 2d8c16a2ea051e0b37138d0e758ba8093dc302f40f6f472760f103f07670bba4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b03bf08aae01c83ed43b64440df8640324cdf7a04256ce220733e5681de63e659a426f39d733dd0632826aaa23b9a08122c5fe0412413c0046ff56d90090447c
|
|
7
|
+
data.tar.gz: 3d54f0019e3c5fcb32f209621c0b585f30526576bce3ca59f9a4c4add121f335a2324335eaddde144fca170c30d5fd96db80621553f4e62dc367cd4389396e68
|
|
@@ -3,7 +3,7 @@ require 'jwt'
|
|
|
3
3
|
module PandaPal
|
|
4
4
|
class ApiCallController < PandaPalController
|
|
5
5
|
rescue_from StandardError do |err|
|
|
6
|
-
render json: { status: 'error' }, status: 500
|
|
6
|
+
render json: { status: 'error', message: err.message }, status: 500
|
|
7
7
|
end
|
|
8
8
|
rescue_from ::JWT::DecodeError do |err|
|
|
9
9
|
render json: { status: 'error', error: "Invalid JWT" }, status: 403
|
|
@@ -23,6 +23,10 @@ module PandaPal
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
included do
|
|
27
|
+
define_model_callbacks :panda_pal_interactive_install
|
|
28
|
+
end
|
|
29
|
+
|
|
26
30
|
class_methods do
|
|
27
31
|
def _interactive_save!(org)
|
|
28
32
|
code = org.generate_orgbuilder_ruby
|
|
@@ -103,23 +107,28 @@ module PandaPal
|
|
|
103
107
|
end
|
|
104
108
|
|
|
105
109
|
def interactive_install!(host: nil, exists: :error)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
switch_tenant do
|
|
111
|
+
run_callbacks :panda_pal_interactive_install do
|
|
112
|
+
first = true
|
|
113
|
+
loop do
|
|
114
|
+
# If a host is explicitly passed, don't prompt for it on the first try
|
|
115
|
+
unless first && host.present?
|
|
116
|
+
if Rails.env.development?
|
|
117
|
+
host ||= ConsoleHelpers.pandapalrc["lti_host"].presence || "http://localhost:5000"
|
|
118
|
+
end
|
|
119
|
+
host = ConsoleHelpers.prompt("Specify LTI host:", default: host)
|
|
120
|
+
end
|
|
115
121
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
begin
|
|
123
|
+
install_lti(host: host, exists: exists)
|
|
124
|
+
puts ""
|
|
125
|
+
break
|
|
126
|
+
rescue => ex
|
|
127
|
+
puts "Failed to install in Canvas: #{ex}"
|
|
128
|
+
raise ex unless ConsoleHelpers.prompt_pry_retry
|
|
129
|
+
first = false
|
|
130
|
+
end
|
|
131
|
+
end
|
|
123
132
|
end
|
|
124
133
|
end
|
|
125
134
|
end
|
|
@@ -24,6 +24,10 @@ module PandaPal
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def italic(text)
|
|
28
|
+
"\033[3m#{text}\033[0m"
|
|
29
|
+
end
|
|
30
|
+
|
|
27
31
|
def pandapalrc
|
|
28
32
|
# TODO Consider searching app and parent dirs before ~/
|
|
29
33
|
@pandapalrc ||= YAML.load(File.read(File.expand_path("~/pandapalrc.yml"))) rescue {}
|
|
@@ -73,6 +77,13 @@ module PandaPal
|
|
|
73
77
|
result
|
|
74
78
|
end
|
|
75
79
|
|
|
80
|
+
def pause(prompt = "Press Enter to continue")
|
|
81
|
+
styled_prompt = "\033[3;90m#{prompt}\033[0m" # grey and italic
|
|
82
|
+
puts styled_prompt
|
|
83
|
+
STDIN.gets
|
|
84
|
+
print "\033[A\033[2K\033[A\033[2K" # move up and clear both lines
|
|
85
|
+
end
|
|
86
|
+
|
|
76
87
|
def open_editor(file_path)
|
|
77
88
|
raise "EDITOR environment variable not set" unless ENV["EDITOR"].present?
|
|
78
89
|
|
data/lib/panda_pal/version.rb
CHANGED