github-to-canvas 0.0.29 → 0.0.34

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: 277ca5f225d7b666fd529a1914309ce575622645455b0b073bd37a8ab19145cf
4
- data.tar.gz: 8849918914e4201e73f6a6143e847ce2f30ea6d7bfcb8a6aa48f3adb8c6b88e3
3
+ metadata.gz: a10972429f9c88a53a35e4c1936058ddf4cea1bfbd8dcc28b539c56f137452a6
4
+ data.tar.gz: cb101bce0acb8a5089664da90bee2cbea9691152d46b675b797dca625580a019
5
5
  SHA512:
6
- metadata.gz: 04adb2efc3fe4b57e358de6974ecbd0097cd67a26c5a72bbbf1de1bd49dbd48dad44af6828a67c9ab8f0ef97bbe73b58d911be49637c3f24992ecd14bbe20ab8
7
- data.tar.gz: bdf9b9f2fa0bf3a0bba2b5816d89f3461081f81a5ad92262b0a3a0599f1da21ba1b041f445ca1c13e6766333d2197d90dab17a0481b091345efb68c157c26d3b
6
+ metadata.gz: 3bd2c769177990932b5429b9b380465864787d62417aa89c9b1b116582c459da313530edfe932b5125bca32b66ac5dc64f8cf0057ba7ef5582c299a3db11fe14
7
+ data.tar.gz: fdc82ddd252667def0a2bd26eac727567105ae4389885dec8509a03073b4393a131e547719268ca6fe59803225f58f6e7a4c4173b079a05ce0aaa8058cce0e8e
@@ -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[: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
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
- 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.34"
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.29
4
+ version: 0.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - maxwellbenton