github-to-canvas 0.1.3 → 0.1.4
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 +4 -4
- data/bin/github-to-canvas +13 -5
- data/lib/github-to-canvas.rb +1 -1
- data/lib/github-to-canvas/canvas_interface.rb +4 -3
- data/lib/github-to-canvas/github_interface.rb +2 -1
- data/lib/github-to-canvas/repository_converter.rb +8 -2
- data/lib/github-to-canvas/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17f3d65ceff1b6670cb57429c118cd22448bb68ff01d673e6ae43654f87f786e
|
4
|
+
data.tar.gz: 85f6f9c85cafb25b76988d4697dcc9bb539ddc7d9c0c34d59290256bce8cb34f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b4ea1f94dbfb8534de1fe2b2383443c4a0f846becc90b6ea553bf92d0ba366363be2db123157be1e1ce3bea85db1a020309d01cb91d14ca959ebd646ab60e2d
|
7
|
+
data.tar.gz: 71d4bc983ce83768a17b85b1cc92111ed7909b2ae27f3755f441da7b0810d846b6cf36b1ff827a09d7aacfd1af81860ec86c46c7e1a174f27dc06e82d63f82f4
|
data/bin/github-to-canvas
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
require 'byebug'
|
2
1
|
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'byebug'
|
4
|
+
|
3
5
|
require 'optparse'
|
4
6
|
require 'github-to-canvas'
|
5
7
|
|
@@ -138,10 +140,14 @@ OptionParser.new do |opts|
|
|
138
140
|
"REQUIRES -f or --file Associates canvas lessons with repositories. Use query to create required YAML file") do |file|
|
139
141
|
options[:map] = file
|
140
142
|
end
|
141
|
-
opts.on("--
|
142
|
-
"
|
143
|
-
options[:
|
143
|
+
opts.on("--urls-only",
|
144
|
+
"Use with --map. Outputs repo URLs instead of YAML") do |urls|
|
145
|
+
options[:urls_only] = urls
|
144
146
|
end
|
147
|
+
# opts.on("--csv COURSE",
|
148
|
+
# "Returns a course's lesson struction as CSV") do |course|
|
149
|
+
# options[:csv] = course
|
150
|
+
# end
|
145
151
|
opts.on("--read-from-canvas CANVAS_URL",
|
146
152
|
"Retrieves an existing Canvas lesson using the provided URL") do |url|
|
147
153
|
options[:read_from_canvas] = url
|
@@ -250,7 +256,9 @@ if options[:query]
|
|
250
256
|
end
|
251
257
|
|
252
258
|
if options[:map]
|
253
|
-
GithubToCanvas.new(mode: 'map',
|
259
|
+
GithubToCanvas.new(mode: 'map',
|
260
|
+
file_to_convert: options[:map],
|
261
|
+
urls_only: !!options[:urls_only])
|
254
262
|
abort
|
255
263
|
end
|
256
264
|
|
data/lib/github-to-canvas.rb
CHANGED
@@ -21,7 +21,7 @@ class GithubToCanvas
|
|
21
21
|
when 'query'
|
22
22
|
CanvasInterface.get_course_info(options[:course_id], options[:id])
|
23
23
|
when 'map'
|
24
|
-
CanvasInterface.map_course_info(options
|
24
|
+
CanvasInterface.map_course_info(options)
|
25
25
|
when 'csv'
|
26
26
|
CanvasInterface.csv(options[:file_to_convert])
|
27
27
|
when 'canvas_read'
|
@@ -241,8 +241,8 @@ class CanvasInterface
|
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
244
|
-
def self.map_course_info(
|
245
|
-
course_info = YAML.load(File.read("#{Dir.pwd}/#{file_to_convert}"))
|
244
|
+
def self.map_course_info(options)
|
245
|
+
course_info = YAML.load(File.read("#{Dir.pwd}/#{options[:file_to_convert]}"))
|
246
246
|
course_info[:modules] = course_info[:modules].map do |mod|
|
247
247
|
mod[:lessons] = mod[:lessons].map do |lesson|
|
248
248
|
|
@@ -278,6 +278,7 @@ class CanvasInterface
|
|
278
278
|
lesson["repository"] = repo
|
279
279
|
else
|
280
280
|
lesson["repository"] = "https://github.com/learn-co-curriculum/" + repo
|
281
|
+
puts lesson["repository"] if options[:urls_only]
|
281
282
|
end
|
282
283
|
end
|
283
284
|
sleep(1)
|
@@ -285,7 +286,7 @@ class CanvasInterface
|
|
285
286
|
end
|
286
287
|
mod
|
287
288
|
end
|
288
|
-
puts course_info.to_yaml
|
289
|
+
puts course_info.to_yaml if !options[:urls_only]
|
289
290
|
end
|
290
291
|
|
291
292
|
def self.csv(file_to_convert)
|
@@ -26,7 +26,11 @@ class RepositoryConverter
|
|
26
26
|
def self.remote_file_conversion(options)
|
27
27
|
markdown = GithubInterface.read_remote(options[:filepath])
|
28
28
|
raw_remote_url = self.set_raw_image_remote_url(options[:filepath])
|
29
|
-
|
29
|
+
if options[:contains_html]
|
30
|
+
puts "Contains HTML"
|
31
|
+
puts options[:contains_html]
|
32
|
+
markdown = self.escape_existing_html(markdown)
|
33
|
+
end
|
30
34
|
markdown = self.fix_local_images(options, markdown, raw_remote_url)
|
31
35
|
html = self.convert_to_html(markdown)
|
32
36
|
# self.fix_local_html_links(options, html, options[:filepath])
|
@@ -48,7 +52,9 @@ class RepositoryConverter
|
|
48
52
|
html = self.add_fis_links(options, html)
|
49
53
|
end
|
50
54
|
|
51
|
-
|
55
|
+
if options[:contains_html]
|
56
|
+
html = self.fix_escaped_inline_html_code(html)
|
57
|
+
end
|
52
58
|
|
53
59
|
html
|
54
60
|
end
|