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: 4848e1245f38fecc827a52b9148f89526d3b38045eb155d6b5eba412dcb96376
4
- data.tar.gz: 1d414803e3fb134f82ecec3d2b21a80756b43000be3b69ea2df84fc7efedebb7
3
+ metadata.gz: f4e34e736ab78c15e73d9b31910e5baaade981a85fad1e4d287ac2bb59cb2636
4
+ data.tar.gz: 1e7dd621016ec85200e5a305d9ad87f5bb9d913b553a242de2f4513f33d4e107
5
5
  SHA512:
6
- metadata.gz: 9e2d63fab8492b4486626a8bd09d0c748eed6f6dbd76c340c3277058a6d982f1d62388c6443acf2f490fb9b91a0b9aa6b7cd68e98168d3e24d56b22fea5915a3
7
- data.tar.gz: f2ed3c42b44f75a629dce9d12bec144624102afb2c96148368e98cc9d6c2812fe26e2f6818fd41dc9d1a4c464b2ef8997c9801c467aa0829dffad191bab01172
6
+ metadata.gz: 7a3f26b24d6295a4709c17be3b7c258380e4320f213ffd34e7e84086e08b429cdbcc82a9eacc9c14c36ef91c69bbdbf60087d2081b7c80f22f50235642bfb1ff
7
+ data.tar.gz: 021d228fc7c8d8b05b2d2d2e952e9d324f255638b118b86db18a1ca3449a911c86f1b8d32b8fcdd512a78e2c7f8a8b4c7e9b8f8b18b2df4abbbe9f6f82b5e703
@@ -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[:name] = File.basename(Dir.getwd)
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
- markdown = File.read("#{filepath}/#{file_to_convert}")
6
- if !markdown
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
- markdown = File.read("#{filepath}/#{file_to_convert}")
6
- if !markdown
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
 
@@ -1,3 +1,3 @@
1
1
  class GithubToCanvas
2
- VERSION = "0.0.29"
2
+ VERSION = "0.0.35"
3
3
  end
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.0.30
4
+ version: 0.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - maxwellbenton