puppet-courseware-manager 0.6.0 → 0.6.1
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 +4 -4
- data/CHANGELOG.txt +7 -0
- data/bin/courseware +8 -0
- data/lib/courseware/printer.rb +16 -5
- data/lib/courseware/repository.rb +30 -12
- data/lib/courseware/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 437863d336c96a49cb06d1408f8adeb5596dfc08
|
4
|
+
data.tar.gz: 6c372f7ec27c63a6e3986c44a6bc38466effcf85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e6f9934a4e590a0504491f52fdd10e142da58e67a6b7327fb98c6302b8da75aacde5c1dfc426eb460c9de21b2271672ece630aa1c5a16a3c38c3be359a11f38
|
7
|
+
data.tar.gz: 56dad38430244340e114f54df83e1aad599858dda115cafb6a58c23d78a4e48780154f4e22726b84a3ca3667f63159b2557f485789d307fe89b517dc5870ae90
|
data/CHANGELOG.txt
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Courseware Manager
|
2
2
|
## Release Notes
|
3
3
|
|
4
|
+
### v0.6.1
|
5
|
+
* Generate release notes for shared content
|
6
|
+
* Allow different schemes for different git remotes
|
7
|
+
* More robust printing options, such as key/id CLI args
|
8
|
+
* Catch empty PDF files when printing shared content
|
9
|
+
|
10
|
+
|
4
11
|
### v0.6.0
|
5
12
|
* Can now work with topic directories.
|
6
13
|
* Knows how to identify obsolete slides and images across all courses.
|
data/bin/courseware
CHANGED
@@ -39,6 +39,14 @@ optparse = OptionParser.new { |opts|
|
|
39
39
|
cmdlineopts[:nocache] = true
|
40
40
|
end
|
41
41
|
|
42
|
+
opts.on("-e ID", "--event-id ID", "Event ID to use for generated PDF files") do |opt|
|
43
|
+
cmdlineopts[:event_id] = opt
|
44
|
+
end
|
45
|
+
|
46
|
+
opts.on("-k KEY", "--key KEY", "Key to encrypt PDF files with") do |opt|
|
47
|
+
cmdlineopts[:key] = opt
|
48
|
+
end
|
49
|
+
|
42
50
|
opts.on("-d", "--debug", "Display debugging messages") do
|
43
51
|
cmdlineopts[:debug] = true
|
44
52
|
end
|
data/lib/courseware/printer.rb
CHANGED
@@ -16,13 +16,23 @@ class Courseware::Printer
|
|
16
16
|
|
17
17
|
if @config[:pdf][:watermark]
|
18
18
|
showoff = Courseware.parse_showoff(@config[:presfile])
|
19
|
+
default = @event_id[/-?(\w*)$/, 1] rescue nil
|
19
20
|
|
20
|
-
@event_id = showoff['event_id'] || Courseware.question('Enter the Event ID:')
|
21
|
-
@password = showoff['key'] || Courseware.question('Enter desired password:',
|
21
|
+
@event_id = @config[:event_id] || showoff['event_id'] || Courseware.question('Enter the Event ID:')
|
22
|
+
@password = @config[:key] || showoff['key'] || Courseware.question('Enter desired password:', default)
|
22
23
|
|
23
24
|
if @config[:nocache]
|
24
|
-
|
25
|
-
|
25
|
+
# Find the '_support' directory, up to three levels up
|
26
|
+
# This allows some flexibility in how the courseware repository is laid out
|
27
|
+
path = '_support'
|
28
|
+
3.times do
|
29
|
+
break if File.exist?(path)
|
30
|
+
path = File.join('..', path)
|
31
|
+
end
|
32
|
+
raise "No support files found" unless File.directory?(path)
|
33
|
+
|
34
|
+
@watermark_style = File.join(path, 'watermark.css')
|
35
|
+
@watermark_pdf = File.join(path, 'watermark.pdf')
|
26
36
|
else
|
27
37
|
@watermark_style = File.join(@config[:cachedir], 'templates', 'watermark.css')
|
28
38
|
@watermark_pdf = File.join(@config[:cachedir], 'templates', 'watermark.pdf')
|
@@ -178,7 +188,8 @@ class Courseware::Printer
|
|
178
188
|
system(*command.flatten)
|
179
189
|
raise 'Error generating PDF files' unless $?.success?
|
180
190
|
|
181
|
-
|
191
|
+
pagecount = `pdftk #{output} dump_data`.each_line.select {|l| l.match /NumberOfPages/ }.first.split.last.to_i rescue nil
|
192
|
+
if [1, 2].include? pagecount
|
182
193
|
puts "#{output} is empty; aborting and cleaning up."
|
183
194
|
FileUtils.rm(output)
|
184
195
|
return
|
@@ -105,10 +105,29 @@ class Courseware::Repository
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def releasenotes(last, version)
|
108
|
+
# get used files from showoff and combine them into a single array
|
109
|
+
used = JSON.parse(`showoff info --json`).values.reduce(:+)
|
110
|
+
logs = `git log --name-only --no-merges --pretty="format:* (%h) %s [%aN]" #{last}..HEAD`
|
111
|
+
curr = nil
|
112
|
+
keep = []
|
113
|
+
|
114
|
+
# sanitize
|
115
|
+
used.map! {|i| i.sub('_shared', '_content') }
|
116
|
+
used.map! {|i| i.sub('_images/shared', '_images') }
|
117
|
+
|
118
|
+
# now iterate through and select log entries that change files this presentation uses
|
119
|
+
logs.each_line do |line|
|
120
|
+
if (curr.nil? or line.start_with? '*')
|
121
|
+
curr = line
|
122
|
+
else
|
123
|
+
keep << curr if used.include? line.strip
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
108
127
|
str = "### #{version}\n"
|
109
128
|
str << "{{{Please summarize the release here}}}\n"
|
110
129
|
str << "\n"
|
111
|
-
str <<
|
130
|
+
str << keep.uniq.join
|
112
131
|
str
|
113
132
|
end
|
114
133
|
|
@@ -126,25 +145,24 @@ class Courseware::Repository
|
|
126
145
|
private
|
127
146
|
|
128
147
|
def configure_courseware
|
129
|
-
courseware
|
130
|
-
upstream
|
148
|
+
check_remote('courseware', "#{@config[:github][:public]}/#{@config[:github][:repository]}")
|
149
|
+
check_remote('upstream', "#{@config[:github][:development]}/#{@config[:github][:repository]}")
|
150
|
+
end
|
131
151
|
|
132
|
-
|
133
|
-
|
134
|
-
if
|
152
|
+
def check_remote(remote, url)
|
153
|
+
existing = `git config --get remote.#{remote}.url`.chomp
|
154
|
+
if existing =~ /^(git@|https:\/\/)github.com[:\/].*\/#{@config[:github][:repository]}(?:-.*)?(?:.git)?$/
|
135
155
|
case $1
|
136
156
|
when 'git@'
|
137
|
-
ensure_remote(
|
138
|
-
ensure_remote('upstream', "git@github.com:#{upstream}.git")
|
157
|
+
ensure_remote(remote, "git@github.com:#{url}.git")
|
139
158
|
when 'https://'
|
140
|
-
ensure_remote(
|
141
|
-
ensure_remote('upstream', "https://github.com/#{upstream}.git")
|
159
|
+
ensure_remote(remote, "https://github.com/#{url}.git")
|
142
160
|
end
|
143
|
-
elsif
|
161
|
+
elsif existing.empty?
|
144
162
|
$logger.warn 'Your origin remote is not set properly.'
|
145
163
|
$logger.warn 'Generating PDF files and other local operations will work properly, but many repository actions will fail.'
|
146
164
|
else
|
147
|
-
raise "Your
|
165
|
+
raise "Your remote (#{existing}) does not appear to be configured correctly."
|
148
166
|
end
|
149
167
|
end
|
150
168
|
|
data/lib/courseware/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-courseware-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Ford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mdl
|