github-to-canvas 0.0.29 → 0.0.34
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: a10972429f9c88a53a35e4c1936058ddf4cea1bfbd8dcc28b539c56f137452a6
|
4
|
+
data.tar.gz: cb101bce0acb8a5089664da90bee2cbea9691152d46b675b797dca625580a019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd2c769177990932b5429b9b380465864787d62417aa89c9b1b116582c459da313530edfe932b5125bca32b66ac5dc64f8cf0057ba7ef5582c299a3db11fe14
|
7
|
+
data.tar.gz: fdc82ddd252667def0a2bd26eac727567105ae4389885dec8509a03073b4393a131e547719268ca6fe59803225f58f6e7a4c4173b079a05ce0aaa8058cce0e8e
|
data/bin/github-to-canvas
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'github-to-canvas'
|
5
|
-
require 'byebug'
|
6
5
|
options = {}
|
7
6
|
OptionParser.new do |opts|
|
8
7
|
opts.banner = <<-EOBANNER
|
@@ -94,10 +93,6 @@ if options[:version]
|
|
94
93
|
GithubToCanvas.new(mode: 'version', course: nil)
|
95
94
|
end
|
96
95
|
|
97
|
-
if !options[:file_to_convert]
|
98
|
-
options[:file_to_convert] = "README.md"
|
99
|
-
end
|
100
|
-
|
101
96
|
if !options[:type]
|
102
97
|
if Dir.glob("**/*/").empty?
|
103
98
|
options[:type] = "page"
|
@@ -111,11 +106,14 @@ if !options[:branch]
|
|
111
106
|
end
|
112
107
|
|
113
108
|
if !options[:name]
|
114
|
-
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
115
|
end
|
116
116
|
|
117
|
-
byebug
|
118
|
-
|
119
117
|
if options[:create_lesson]
|
120
118
|
GithubToCanvas.new(mode: "create",
|
121
119
|
course: options[:course],
|
@@ -134,9 +132,9 @@ if options[:align]
|
|
134
132
|
course: nil,
|
135
133
|
filepath: Dir.pwd,
|
136
134
|
file_to_convert: options[:file_to_convert],
|
137
|
-
branch: options[:branch],
|
138
|
-
name: options[:name],
|
139
|
-
type: options[:type],
|
135
|
+
branch: options[:branch],
|
136
|
+
name: options[:name],
|
137
|
+
type: options[:type],
|
140
138
|
save_to_github: !!options[:save_to_github],
|
141
139
|
fis_links: !!options[:fis],
|
142
140
|
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
|
|