github-to-canvas 0.1.7.pre → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18f61edcbd53e1e26f59fe6767ae09b3bb227dee2f6529797a1f0fc6ace94b00
|
4
|
+
data.tar.gz: 0757bd6b39a7fd9e4bb996156db33309cd96afbe2f8274c1261e95b4aad210e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593e15eb02ee30c7d45b3ffb479efcd69ab3b80436a23b81f6f731e3ad7a2a3a81d05601baf15cd893a86a54029a919ac45617a20cdb4a2c5ad4e441b8529c4e
|
7
|
+
data.tar.gz: 8306e5d652b5e61c3aba33e09a70e0f8aa3a1455dea60269c685983793c443f7065944cf157aa365c693cec9ae12d49a579aec66efc73e390e2643c3fa07b198
|
data/bin/github-to-canvas
CHANGED
@@ -116,6 +116,10 @@ OptionParser.new do |opts|
|
|
116
116
|
"Adds AAQ flag to HTML header appended with --fis-links") do |aaq|
|
117
117
|
options[:aaq] = aaq
|
118
118
|
end
|
119
|
+
opts.on("--prework",
|
120
|
+
"Adds prework flag to HTML header appended with --fis-links") do |prework|
|
121
|
+
options[:prework] = prework
|
122
|
+
end
|
119
123
|
opts.on("--forkable",
|
120
124
|
"Used with --fis-links, adds fork button to HTML header injected into Canvas lesson") do |remote|
|
121
125
|
options[:forkable] = true
|
@@ -232,6 +236,7 @@ if options[:read_from_github]
|
|
232
236
|
forkable: !!options[:forkable],
|
233
237
|
fis_links: !!options[:fis],
|
234
238
|
aaq: !!options[:aaq],
|
239
|
+
prework: !!options[:prework],
|
235
240
|
contains_html: options[:contains_html])
|
236
241
|
abort
|
237
242
|
end
|
@@ -247,6 +252,7 @@ if options[:create_from_github]
|
|
247
252
|
forkable: !!options[:forkable],
|
248
253
|
fis_links: !!options[:fis],
|
249
254
|
aaq: !!options[:aaq],
|
255
|
+
prework: !!options[:prework],
|
250
256
|
contains_html: options[:contains_html])
|
251
257
|
else
|
252
258
|
puts 'Canvas course ID and lesson type required. Example: github-to-canvas --create-from-github URL --course ID --type TYPE'
|
@@ -266,6 +272,7 @@ if options[:align_from_github]
|
|
266
272
|
forkable: !!options[:forkable],
|
267
273
|
fis_links: !!options[:fis],
|
268
274
|
aaq: !!options[:aaq],
|
275
|
+
prework: !!options[:prework],
|
269
276
|
contains_html: options[:contains_html])
|
270
277
|
else
|
271
278
|
puts 'Canvas course ID, lesson ID, and type required. Example: github-to-canvas --create-from-github URL --course COURSE_ID --id LESSON_ID --type TYPE'
|
@@ -310,6 +317,7 @@ if options[:build_course]
|
|
310
317
|
fis_links: !!options[:fis],
|
311
318
|
remove_header_and_footer: !!options[:remove_header_and_footer],
|
312
319
|
aaq: !!options[:aaq],
|
320
|
+
prework: !!options[:prework],
|
313
321
|
forkable: !!options[:forkable],
|
314
322
|
contains_html: options[:contains_html],
|
315
323
|
git_links: !!options[:git_links])
|
@@ -325,6 +333,7 @@ if options[:add_to_course]
|
|
325
333
|
remove_header_and_footer: !!options[:remove_header_and_footer],
|
326
334
|
forkable: !!options[:forkable],
|
327
335
|
aaq: !!options[:aaq],
|
336
|
+
prework: !!options[:prework],
|
328
337
|
contains_html: options[:contains_html],
|
329
338
|
git_links: !!options[:git_links])
|
330
339
|
else
|
@@ -340,6 +349,7 @@ if options[:update_course_lessons]
|
|
340
349
|
remove_header_and_footer: !!options[:remove_header_and_footer],
|
341
350
|
forkable: !!options[:forkable],
|
342
351
|
aaq: !!options[:aaq],
|
352
|
+
prework: !!options[:prework],
|
343
353
|
contains_html: options[:contains_html],
|
344
354
|
git_links: !!options[:git_links])
|
345
355
|
abort
|
@@ -406,6 +416,7 @@ if options[:create_lesson]
|
|
406
416
|
only_update_content: !!options[:only_content],
|
407
417
|
forkable: !!options[:forkable],
|
408
418
|
aaq: !!options[:aaq],
|
419
|
+
prework: !!options[:prework],
|
409
420
|
contains_html: options[:contains_html])
|
410
421
|
end
|
411
422
|
|
@@ -425,5 +436,6 @@ if options[:align]
|
|
425
436
|
only_update_content: !!options[:only_content],
|
426
437
|
forkable: !!options[:forkable],
|
427
438
|
aaq: !!options[:aaq],
|
439
|
+
prework: !!options[:prework],
|
428
440
|
contains_html: options[:contains_html])
|
429
441
|
end
|
data/lib/github-to-canvas.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'byebug'
|
2
1
|
require 'csv'
|
3
2
|
require_relative './github-to-canvas/create_canvas_lesson'
|
4
3
|
require_relative './github-to-canvas/update_canvas_lesson'
|
@@ -53,7 +52,6 @@ class GithubToCanvas
|
|
53
52
|
|
54
53
|
html = RepositoryConverter.adjust_converted_html(options, html)
|
55
54
|
name = options[:name] ? options[:name] : RepositoryInterface.get_name(options[:filepath], html)
|
56
|
-
byebug
|
57
55
|
puts name
|
58
56
|
response = CanvasInterface.create_lesson(options, name, html)
|
59
57
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'byebug'
|
2
1
|
require 'json'
|
3
2
|
require 'rest-client'
|
4
3
|
require 'yaml'
|
@@ -74,8 +73,6 @@ class CanvasInterface
|
|
74
73
|
begin
|
75
74
|
response = RestClient.post(url, payload, self.headers)
|
76
75
|
rescue
|
77
|
-
byebug
|
78
|
-
|
79
76
|
puts "Something went wrong while adding lesson #{lesson_info["id"]} to module #{module_info["id"]} in course #{course_id}" if lesson_info["type"] == "Assignment"
|
80
77
|
puts "Something went wrong while adding lesson #{lesson_info["page_url"]} to module #{module_info["id"]} in course #{course_id}" if lesson_info["type"] == "Page"
|
81
78
|
abort
|
@@ -240,7 +237,6 @@ class CanvasInterface
|
|
240
237
|
puts course_info.to_yaml
|
241
238
|
|
242
239
|
rescue
|
243
|
-
byebug
|
244
240
|
puts "Something went wrong while getting info about course #{course}"
|
245
241
|
abort
|
246
242
|
end
|
@@ -338,7 +334,6 @@ class CanvasInterface
|
|
338
334
|
end
|
339
335
|
mod
|
340
336
|
end
|
341
|
-
byebug
|
342
337
|
puts course_info.to_yaml
|
343
338
|
end
|
344
339
|
|
@@ -192,7 +192,7 @@ class RepositoryConverter
|
|
192
192
|
begin
|
193
193
|
'src="' + raw_remote_url + '/' + branch + '/' + image_source + '"'
|
194
194
|
rescue
|
195
|
-
|
195
|
+
puts "Error adjust HTML images - check images in Canvas"
|
196
196
|
end
|
197
197
|
else
|
198
198
|
image_source
|
@@ -224,7 +224,7 @@ class RepositoryConverter
|
|
224
224
|
repo_info = self.get_repo_info(options[:filepath])
|
225
225
|
html = html.sub(/<div id="git-data-element.*<header class="fis-header.*<\/header>/,'') # remove existing fis header
|
226
226
|
header = self.create_github_link_header(repo_info[:repo_path], options)
|
227
|
-
data_element = self.create_data_element(repo_info[:repo_org], repo_info[:repo_name], options[:aaq])
|
227
|
+
data_element = self.create_data_element(repo_info[:repo_org], repo_info[:repo_name], options[:aaq], options[:prework])
|
228
228
|
data_element + header + html
|
229
229
|
end
|
230
230
|
|
@@ -247,12 +247,8 @@ class RepositoryConverter
|
|
247
247
|
end
|
248
248
|
end
|
249
249
|
|
250
|
-
def self.create_data_element(repo_org, repo_name, aaq)
|
251
|
-
|
252
|
-
"<div id='git-data-element' data-aaq='enabled' data-org='#{repo_org}' data-repo='#{repo_name}'></div>"
|
253
|
-
else
|
254
|
-
"<div id='git-data-element' data-org='#{repo_org}' data-repo='#{repo_name}'></div>"
|
255
|
-
end
|
250
|
+
def self.create_data_element(repo_org, repo_name, aaq, prework)
|
251
|
+
"<div id='git-data-element' #{prework ? "data-prework='true'" : ""} #{aaq ? "data-aaq='enabled'" : ""} data-org='#{repo_org}' data-repo='#{repo_name}'></div>"
|
256
252
|
end
|
257
253
|
|
258
254
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-to-canvas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maxwellbenton
|
@@ -104,9 +104,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubygems_version: 3.2.3
|
112
112
|
signing_key:
|