github-to-canvas 0.0.11 → 0.0.12

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: 732a757e941548fa67c1ede523fe03575dc22e8890d87300ce8e41732a2f01e3
4
- data.tar.gz: 9966442368051e67fea9e6b7ce44ebb1555c645bd61f0512feea8e9ca3486995
3
+ metadata.gz: 292c75129f49e571976390d008441b48b83af93ffcecbabc5071799aef6656f8
4
+ data.tar.gz: 831f32335f994923d179b8e819bbed986ee7a57ababa8789064b904b39407f32
5
5
  SHA512:
6
- metadata.gz: 6f67897ee3991f5e914524e04a7b90fb0985092c106ce57b16d64cb8afa74ec1555dbd8dbd57ad0a4be780595b6c8a02af9d914d5e6a63dbc9f5fac662418285
7
- data.tar.gz: 8e2793cc5b58f7ad2e0a1e2e9a4244d34172736e0d69f34940f87b0603432287ddb088876392905c36adaef4809298791a1164118e6ab8dec95a06469bb6cc24
6
+ metadata.gz: c0b0a5114f5e92d37ba700713c6d8071034f5915e9000e9e0174fef948f56b32ed42355badddf367fc6863e2f6947efbbaa450a7d0887a5b343c97fb75e76d22
7
+ data.tar.gz: df8a0118fccacf35ac7c93823899830c4ec7e82f62915f15d29ae4e713161a097997b254510089f1b79aca1c298939f2c01bd42f55cc1aab15d89808f4b8b982
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # GitHub to Canvas Gem
2
- hello
2
+
3
3
  ## Introduction
4
4
 
5
5
  The `github-to-canvas` gem is designed to enable GitHub to Canvas LMS
@@ -8,11 +8,13 @@ file, convert it to HTML, and push it to Canvas. The gem also updates the
8
8
  repository to include a `.canvas` file containing Canvas specific information.
9
9
 
10
10
  With the `.canvas` file in place, this gem can be used to continuously align
11
- content between GitHub and Canvas.
11
+ content between GitHub and Canvas using the GitHub repository as the single
12
+ source of truth.
12
13
 
13
14
  This gem is built for use internally at [Flatiron School][]. Access to the
14
15
  [Canvas LMS API][] and the ability to add pages and assignments to a Canvas
15
- course are required.
16
+ course are required. Write access to the GitHub repository being converted is
17
+ also required.
16
18
 
17
19
  ## Installation
18
20
 
@@ -51,11 +53,17 @@ are present by running `ENV`.
51
53
 
52
54
  ## Usage
53
55
 
54
- To migrate a GitHub `README.md` file to Canvas, at minimum, you will need to know the
55
- Canvas course id you are going to add to. This id can be found in the URL of the course.
56
+ ### Create a Canvas Lesson
57
+
58
+ To create a Canvas lesson from a GitHub `README.md` file, at minimum, you will
59
+ need to know the Canvas course id you are going to add to. This id can be found
60
+ in the URL of the course.
61
+
62
+ Once you have the course id, you will need to do the following:
56
63
 
57
- 1. clone down the repository to a local folder and change directory into it.
58
- 2. Run `github-to-canvas --create <your-course-id>`
64
+ 1. Clone down the repository you'd like to push to Canvas.
65
+ 2. Change directory into the new local repository
66
+ 3. Run `github-to-canvas --create <your-course-id>` from inside the local repo
59
67
 
60
68
  If everything is set up properly, `github-to-canvas` will create a Canvas lesson
61
69
  using `master` branch `README.md` and the name of the current folder. By
@@ -63,8 +71,30 @@ default, if the repository contains folders, an **assignment** will be created.
63
71
  Otherwise, a **page** will be created.
64
72
 
65
73
  After a successful lesson creation, `github-to-canvas` will use the API response
66
- to build a `.canvas` YAML file. This file contains the course id, the newly created
67
- page id, and the Canvas URL to the lesson for future reference.
74
+ to build a `.canvas` YAML file. This file contains the course id, the newly
75
+ created page id, and the Canvas URL to the lesson for future reference. With the
76
+ newly created `.canvas` file, `github-to-canvas` will attempt to commit and push the
77
+ file up to the remote GitHub repository.
78
+
79
+ If you create multiple Canvas lessons from the same repository, each lesson's
80
+ Canvas data will be stored in the `.canvas` file.
81
+
82
+ > **Note:** If you don't have write access to the repository, the `.canvas` file
83
+ > will still be created locally.
84
+
85
+ ### Update an existing Canvas Lesson
86
+
87
+ To update an existing Canvas lesson using a local repository, **a `.canvas` file
88
+ must be present in the repo**, as it contains the lesson information for the
89
+ Canvas API.
90
+
91
+ 1. Clone down and/or change directory into the repository you'd like to update
92
+ 2. Run `github-to-canvas --align <your-course-id>` from inside the local repo
93
+
94
+ `github-to-canvas` will get the course id and page/assignment id from the
95
+ `.canvas` file and update the associated Canvas lesson. If there are multiple
96
+ Canvas lessons included in the `.canvas` file, each lesson will be updated (i.e.
97
+ you have the same lesson in two courses created from one repository).
68
98
 
69
99
  ### Options
70
100
 
@@ -1,5 +1,5 @@
1
1
  require 'yaml'
2
- require 'byebug'
2
+
3
3
  class CanvasDotfile
4
4
 
5
5
  def self.update_or_create(filepath, response, course, type)
@@ -1,6 +1,6 @@
1
1
  require 'json'
2
2
  require 'rest-client'
3
- require 'byebug'
3
+
4
4
  class CanvasInterface
5
5
 
6
6
  def self.submit_to_canvas(course_id, type, name, readme, dry_run = false)
@@ -25,8 +25,8 @@ class CanvasInterface
25
25
  })
26
26
  end
27
27
 
28
- def self.update_existing_lesson(course_id, page_id, type, name, new_readme, dry_run)
29
- url = "#{ENV['CANVAS_API_PATH']}/courses/#{course_id}/#{type}s/#{page_id}"
28
+ def self.update_existing_lesson(course_id, id, type, name, new_readme, dry_run)
29
+ url = "#{ENV['CANVAS_API_PATH']}/courses/#{course_id}/#{type}s/#{id}"
30
30
  payload = self.build_payload(type, name, new_readme)
31
31
  RestClient.put(url, payload, headers={
32
32
  "Authorization" => "Bearer #{ENV['CANVAS_API_KEY']}"
@@ -13,7 +13,7 @@ class GithubInterface
13
13
  end
14
14
 
15
15
  def self.git_co_branch(filepath, branch)
16
- branch = self.cd_into_and(filepath, "git co #{branch}")
16
+ branch = self.cd_into_and(filepath, "git checkout #{branch}")
17
17
  if branch.to_s.strip.empty?
18
18
  puts "#{branch} branch not found. Exiting..."
19
19
  abort
@@ -1,3 +1,3 @@
1
1
  class LearnTool
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.12"
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.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - maxwellbenton