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: 3339220ef2651966b5210b29beaee88d721df298de1ec40d172829687dbafa29
4
- data.tar.gz: c910b3744c36c53c9a18026661644a8c2466691b13e35e8bebd471d7c7e432b2
3
+ metadata.gz: de815c41e7df0d792b7dae34188f1f796f135e24dd92047ea508381499c5995e
4
+ data.tar.gz: 2d8c16a2ea051e0b37138d0e758ba8093dc302f40f6f472760f103f07670bba4
5
5
  SHA512:
6
- metadata.gz: fe5611812871a24236eae1b5fef8c6f64739353286b83cc7cb6786e02333eaee865b03cf55e9586b75dca1834d49be8066533d5318ae8bb336c85416eddc4495
7
- data.tar.gz: c616ad70f3e299227733937935b5b4109dfab376460217c6a07092664b822ba5f66107b8a7fa26d8474533075571b3d60ffb937cd616b1da2a5264ef853141e6
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
- first = true
107
- loop do
108
- # If a host is explicitly passed, don't prompt for it on the first try
109
- unless first && host.present?
110
- if Rails.env.development?
111
- host ||= ConsoleHelpers.pandapalrc["lti_host"].presence || "http://localhost:5000"
112
- end
113
- host = ConsoleHelpers.prompt("Specify LTI host:", default: host)
114
- end
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
- begin
117
- install_lti(host: host, exists: exists)
118
- break
119
- rescue => ex
120
- puts "Failed to install in Canvas: #{ex}"
121
- raise ex unless ConsoleHelpers.prompt_pry_retry
122
- first = false
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
 
@@ -1,3 +1,3 @@
1
1
  module PandaPal
2
- VERSION = '5.16.14'
2
+ VERSION = '5.16.16'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda_pal
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.16.14
4
+ version: 5.16.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure CustomDev