github-to-canvas 0.0.15 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/bin/github-to-canvas +2 -2
- data/lib/github-to-canvas/repository_converter.rb +2 -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: 9a4f7a0afcf69fa3c6a3b2c06eb36d73e3bfaef2691653202478bab81c2db709
|
4
|
+
data.tar.gz: 975fb0c2f4cd1a19628da5f641f9b057852b3f2f5efa7ffdcc0868119bef3912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4fa7f6eee1eb0e7e30d21a47602df34e323daab0237fd85fcd1b7cdb613ab1ca7b2b68a7939ece0c91b9c840bd3ed7554f404839b45c95a843bb5f0e5df9fd8
|
7
|
+
data.tar.gz: f2c98036eedb4d14ebade41064091c8c85f093bd6434e8769d6a952536916de03d96cf7ab08d21ff5be8336fe183915bc6570f7a5305ff95d8341a2682e0dc88
|
data/README.md
CHANGED
@@ -106,8 +106,14 @@ You can override the default behaviors with the following arguments:
|
|
106
106
|
appropriate Canvas lesson type instead of relying on the repository's
|
107
107
|
directory structure
|
108
108
|
|
109
|
+
## Examples of Valid Images This Gem Can Convert
|
110
|
+
|
111
|
+
Inline Markdown:
|
112
|
+
|
109
113
|
![example in-line image](https://curriculum-content.s3.amazonaws.com/fewpjs/fewpjs-fetch-lab/Image_25_AsynchronousJavaScript.png)
|
110
114
|
|
115
|
+
HTML:
|
116
|
+
|
111
117
|
<p align="center">
|
112
118
|
<img src="https://curriculum-content.s3.amazonaws.com/fewpjs/fewpjs-fetch-lab/Image_25_AsynchronousJavaScript.png" width="500">
|
113
119
|
</p>
|
data/bin/github-to-canvas
CHANGED
@@ -48,7 +48,7 @@ OptionParser.new do |opts|
|
|
48
48
|
end
|
49
49
|
opts.on("-tTYPE", "--type TYPE",
|
50
50
|
"Sets the type Canvas lesson to be created (page or assignment). If no type, type decided based on repository structure") do |type|
|
51
|
-
if
|
51
|
+
if type == 'page' || type == 'assignment'
|
52
52
|
options[:type] = type
|
53
53
|
else
|
54
54
|
puts "Invalid type. Defaulting to page"
|
@@ -74,7 +74,7 @@ if options[:version]
|
|
74
74
|
GithubToCanvas.new(mode: 'version', course: nil)
|
75
75
|
end
|
76
76
|
|
77
|
-
if Dir.glob("**/*/").empty?
|
77
|
+
if Dir.glob("**/*/").empty? && !options[:type]
|
78
78
|
options[:type] = "page"
|
79
79
|
else
|
80
80
|
options[:type] = "assignment"
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'redcarpet'
|
2
|
-
|
3
2
|
class RepositoryConverter
|
4
3
|
|
5
4
|
def self.convert(filepath, readme, branch)
|
@@ -16,6 +15,7 @@ class RepositoryConverter
|
|
16
15
|
def self.set_raw_image_remote_url(filepath)
|
17
16
|
remote = GithubInterface.git_remote(filepath)
|
18
17
|
remote.gsub!("git@github.com:","https://raw.githubusercontent.com/")
|
18
|
+
remote.gsub!("https://github.com/","https://raw.githubusercontent.com/")
|
19
19
|
remote.gsub!(/.git$/,"")
|
20
20
|
remote.strip!
|
21
21
|
end
|
@@ -26,7 +26,7 @@ class RepositoryConverter
|
|
26
26
|
image.gsub!(/\(.+\)/) { |path|
|
27
27
|
path.delete_prefix!("(")
|
28
28
|
path.delete_suffix!(")")
|
29
|
-
"(" +
|
29
|
+
"(" + raw_remote_url + "/#{branch}/" + path + ")"
|
30
30
|
}
|
31
31
|
end
|
32
32
|
image
|