github-to-canvas 0.0.30 → 0.0.35
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: f4e34e736ab78c15e73d9b31910e5baaade981a85fad1e4d287ac2bb59cb2636
|
4
|
+
data.tar.gz: 1e7dd621016ec85200e5a305d9ad87f5bb9d913b553a242de2f4513f33d4e107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a3f26b24d6295a4709c17be3b7c258380e4320f213ffd34e7e84086e08b429cdbcc82a9eacc9c14c36ef91c69bbdbf60087d2081b7c80f22f50235642bfb1ff
|
7
|
+
data.tar.gz: 021d228fc7c8d8b05b2d2d2e952e9d324f255638b118b86db18a1ca3449a911c86f1b8d32b8fcdd512a78e2c7f8a8b4c7e9b8f8b18b2df4abbbe9f6f82b5e703
|
data/bin/github-to-canvas
CHANGED
@@ -93,10 +93,6 @@ if options[:version]
|
|
93
93
|
GithubToCanvas.new(mode: 'version', course: nil)
|
94
94
|
end
|
95
95
|
|
96
|
-
if !options[:file_to_convert]
|
97
|
-
options[:file_to_convert] = "README.md"
|
98
|
-
end
|
99
|
-
|
100
96
|
if !options[:type]
|
101
97
|
if Dir.glob("**/*/").empty?
|
102
98
|
options[:type] = "page"
|
@@ -110,7 +106,16 @@ if !options[:branch]
|
|
110
106
|
end
|
111
107
|
|
112
108
|
if !options[:name]
|
113
|
-
options[:
|
109
|
+
if options[:file_to_convert]
|
110
|
+
options[:name] = options[:file_to_convert]
|
111
|
+
else
|
112
|
+
options[:name] = File.basename(Dir.getwd)
|
113
|
+
options[:file_to_convert] = "README.md"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
if !options[:file_to_convert]
|
118
|
+
options[:file_to_convert] = "README.md"
|
114
119
|
end
|
115
120
|
|
116
121
|
if options[:create_lesson]
|
@@ -131,9 +136,9 @@ if options[:align]
|
|
131
136
|
course: nil,
|
132
137
|
filepath: Dir.pwd,
|
133
138
|
file_to_convert: options[:file_to_convert],
|
134
|
-
branch: options[:branch],
|
135
|
-
name: options[:name],
|
136
|
-
type: options[:type],
|
139
|
+
branch: options[:branch],
|
140
|
+
name: options[:name],
|
141
|
+
type: options[:type],
|
137
142
|
save_to_github: !!options[:save_to_github],
|
138
143
|
fis_links: !!options[:fis],
|
139
144
|
remove_header_and_footer: !!options[:remove_header_and_footer])
|
@@ -2,12 +2,13 @@ class CreateCanvasLesson
|
|
2
2
|
|
3
3
|
def initialize(course, filepath, file_to_convert, branch, name, type, save_to_github, fis_links, remove_header_and_footer)
|
4
4
|
name = name.split(/[- _]/).map(&:capitalize).join(' ')
|
5
|
-
|
6
|
-
|
5
|
+
begin
|
6
|
+
markdown = File.read("#{filepath}/#{file_to_convert}")
|
7
|
+
rescue
|
7
8
|
puts "#{file_to_convert} not found in current directory. Exiting..."
|
8
9
|
abort
|
9
10
|
end
|
10
|
-
create_canvas_lesson(markdown, course, filepath, branch, name, type, save_to_github, fis_links, remove_header_and_footer)
|
11
|
+
create_canvas_lesson(markdown, course, filepath, file_to_convert, branch, name, type, save_to_github, fis_links, remove_header_and_footer)
|
11
12
|
end
|
12
13
|
|
13
14
|
def create_canvas_lesson(markdown, course, filepath, branch, name, type, save_to_github, fis_links, remove_header_and_footer)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
class UpdateCanvasLesson
|
2
2
|
|
3
|
-
def initialize(filepath, branch, name, type, save_to_github, fis_links, remove_header_and_footer)
|
3
|
+
def initialize(filepath, file_to_convert, branch, name, type, save_to_github, fis_links, remove_header_and_footer)
|
4
4
|
name = name.split(/[- _]/).map(&:capitalize).join(' ')
|
5
|
-
|
6
|
-
|
5
|
+
begin
|
6
|
+
markdown = File.read("#{filepath}/#{file_to_convert}")
|
7
|
+
rescue
|
7
8
|
puts "#{file_to_convert} not found in current directory. Exiting..."
|
8
9
|
abort
|
9
10
|
end
|
@@ -19,7 +20,7 @@ class UpdateCanvasLesson
|
|
19
20
|
canvas_data = CanvasDotfile.read_canvas_data
|
20
21
|
canvas_data[:lessons].each { |lesson|
|
21
22
|
response = CanvasInterface.update_existing_lesson(lesson[:course_id], lesson[:id], lesson[:type], name, new_html, save_to_github)
|
22
|
-
puts "Canvas lesson created. Lesson available at #{response['html_url']}."
|
23
|
+
# puts "Canvas lesson created. Lesson available at #{response['html_url']}."
|
23
24
|
}
|
24
25
|
end
|
25
26
|
|