revealing 1.0.2 → 1.0.3

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: 9ce7e4c5d36c9c49bd0706ab1e5144e3caf5f6eea1f78dcfd755380529e469da
4
- data.tar.gz: a3eb4ee20c3114bfea423f0bfb0ca9d2bc1f8b19c6a0d8bfac49966143fa83a9
3
+ metadata.gz: d47824e706f740bb4bd389506532615d0f27c64d3c222ac24ba9a5edfc9b7ec2
4
+ data.tar.gz: 37502d62f798b59acbd06b9e9a37bf62eb82bac0753bf1fa2e84594a29b7e40f
5
5
  SHA512:
6
- metadata.gz: 077c15b028cb74513e68703500c2a5842df05b32927b7ebe230e0ba3a9d438f1e9704c8d7d3811eafaa3a935e8e95616610ae87a1886bd2b431aa696a5398c1e
7
- data.tar.gz: c3044633f92ae7679ab6f72f6a8af1524b802d8ae42d77896b74966985c5063847b4df9d25cf01239534a7095330ab85ec3fb814701cf198c5f7fa93b594c2b8
6
+ metadata.gz: 91b2f7a00c4b60d06f0d81a59ffc43383272857cbaeb7f768091e101f17ff859c47cbcc6091843b111dff1ab899df7be1756c2a4fd49cf51f9d6d7c514dcfc1b
7
+ data.tar.gz: b10369ffc6c16f1e64635ac80998358a280eab4675c6e4a1279b89c2a21d44745d780394a8e0fe237af7327659d3849b20f205929936542f2a1a7b8409c81e73
data/.rspec ADDED
@@ -0,0 +1,5 @@
1
+ --color
2
+ --format documentation
3
+ --tty
4
+ --order random
5
+ --require 'spec_helper'
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
  gemspec
data/README.markdown CHANGED
@@ -1,5 +1,7 @@
1
1
  # `revealing` - A Workflow for reveal.js Presentations
2
2
 
3
+ [![Build Status](https://travis-ci.org/suhlig/revealing.svg?branch=master)](https://travis-ci.org/suhlig/revealing)
4
+
3
5
  This gem provides a set of [`Rake`](https://github.com/ruby/rake) tasks to create [`reveal.js`](https://revealjs.com) presentations from markdown files. It uses [`pandoc`](https://pandoc.org/) to create the final presentation. The output is a self-contained set of static HTML files that can be viewed locally uploaded to a web server.
4
6
 
5
7
  # Examples
@@ -9,18 +11,31 @@ This gem provides a set of [`Rake`](https://github.com/ruby/rake) tasks to creat
9
11
  # Development
10
12
 
11
13
  * Create a test project using `revealing init`
12
- * Update `revealing` locally with this one-liner:
14
+ * Test by referring to the changed tasks:
15
+ ```console
16
+ rake -f ~/workspace/revealing/lib/revealing/tasks.rb -T
17
+ ```
18
+
19
+ # Releasing
20
+
21
+ * Make the changes
22
+ * Run tests
23
+ * From a test project, install the updated gem locally and invoke it:
13
24
  ```console
14
- $ (cd ../revealing; git add .; bake install) && bundle update && bake -T
25
+ $ (cd ../revealing; git add .; bake install) && bundle update && bake clobber default
15
26
  ```
16
- * Test changes in the test project
27
+ Verify that everything works.
28
+ * Bump the version in `lib/revealing/version.rb`
29
+ * git commit
30
+ * `gem signin` to rubygems.org
31
+ * `bundle exec rake release`
17
32
 
18
33
  # TODO
19
34
 
20
- 1. Bail if any of the prereq tools are not there
21
35
  1. `revealing doctor` to analyze tools
22
36
  1. Target folders mirror source, so that we don't risk duplicates
23
37
  1. Read desired versions of dependencies from a YAML file (with sensible defaults coming from this project)
38
+ 1. Re-add ditaa processing
24
39
  1. Add mathjax (copy to target if present, otherwise use CDN)
25
40
  1. Expose customization of
26
41
  * highlight-style
data/lib/revealing/cli.rb CHANGED
@@ -1,14 +1,39 @@
1
1
  require 'thor'
2
+ require 'pathname'
2
3
 
3
4
  module Revealing
4
5
  class CLI < Thor
5
- desc 'init DIRECTORY', "initialize a new revealing project in DIRECTORY."
6
- def init(directory)
6
+ def self.exit_on_failure?
7
+ true
8
+ end
9
+
10
+ desc 'init [DIRECTORY]', 'initialize a new revealing project in DIRECTORY. Defaults to the current working directory.'
11
+ def init(directory = '.')
7
12
  project_directory = Pathname(directory)
8
- project_directory.mkdir
13
+ project_directory.mkdir unless project_directory.exist?
14
+
15
+ templates_directory = Pathname(__dir__) / '../../templates/init'
16
+
17
+ # FileUtils.cp_r overwrites the target if it exists, but we want to preserve it
18
+ # and print information about what happened
19
+ source_target_pairs(templates_directory, project_directory).each do |src, target|
20
+ if target.exist?
21
+ warn "#{target} exists; skipping"
22
+ else
23
+ target.dirname.mkpath
24
+ FileUtils.cp(src, target)
25
+ puts "#{target} created"
26
+ end
27
+ end
28
+ end
29
+
30
+ private
9
31
 
10
- templates_directory = Pathname(__dir__) / '../../templates'
11
- FileUtils.cp_r(templates_directory / 'init/.', project_directory)
32
+ def source_target_pairs(src_dir, target_dir)
33
+ src_dir
34
+ .glob('**/*')
35
+ .select(&:file?)
36
+ .map{|e| [e, target_dir / e.relative_path_from(src_dir)]}
12
37
  end
13
38
  end
14
39
  end
@@ -1,13 +1,15 @@
1
+ prereq 'gm'
2
+
1
3
  RESIZED_ASSETS.zip(RESIZABLE_ASSETS).each do |target, source|
2
4
  desc "Resize #{source} to #{target}"
3
- file target => source do
5
+ file target => ['gm', source] do
4
6
  sh "gm convert #{source} -geometry '1920x1080>' #{target}"
5
7
  end
6
8
  end
7
9
 
8
10
  ASSETS.zip(ASSET_SOURCES).each do |target, source|
9
11
  desc "Copy #{source} to #{target}"
10
- file target => source do
12
+ file target => ['gm', source] do
11
13
  cp source, target
12
14
  end
13
15
  end
@@ -1,4 +1,6 @@
1
+ prereq 'gpp'
2
+
1
3
  desc "Sources are pre-processed into the single #{GPP_FILE}"
2
- file GPP_FILE => [GPP_DIR, DIRTY_FILE] + SOURCE_FILES do |target|
4
+ file GPP_FILE => ['gpp', GPP_DIR, DIRTY_FILE] + SOURCE_FILES do |target|
3
5
  sh %(gpp -I src -x -o #{target} #{SOURCE_DIR}/index.markdown)
4
6
  end
@@ -0,0 +1,11 @@
1
+ #
2
+ # Synthesize a task that ensures that the given prerequisite tool is available
3
+ #
4
+ def prereq(name)
5
+ desc "Assert that #{name} is available"
6
+ task name do |task|
7
+ unless system("type #{name} > /dev/null 2>&1")
8
+ raise "#{task} is not available. Use `revealing doctor` to assist fixing."
9
+ end
10
+ end
11
+ end
@@ -1,7 +1,8 @@
1
1
  REVEAL_JS_VERSION = '3.7.0'.freeze
2
+ prereq 'curl'
2
3
 
3
4
  desc 'reveal.js is present'
4
- directory REVEAL_JS_TARGET_DIR => TARGET_DIR do |target|
5
+ directory REVEAL_JS_TARGET_DIR => ['curl', TARGET_DIR] do |target|
5
6
  mkdir target.name
6
7
 
7
8
  if ENV['REVEAL_JS_DIR'].to_s.empty?
@@ -3,7 +3,7 @@ require 'pathname'
3
3
  require 'git-dirty'
4
4
 
5
5
  SOURCE_DIR = Pathname('src')
6
- SOURCE_FILES = FileList["#{SOURCE_DIR}/**/*.markdown"]
6
+ SOURCE_FILES = FileList[SOURCE_DIR / '**/*.markdown']
7
7
 
8
8
  TARGET_DIR = Pathname('public_html')
9
9
  directory TARGET_DIR
@@ -12,7 +12,7 @@ TARGET_FILE = TARGET_DIR / 'index.html'
12
12
  GPP_DIR = Pathname('gpp')
13
13
  directory GPP_DIR
14
14
  DIRTY_FILE = GPP_DIR / '.dirty'
15
- GPP_FILE = FileList["#{GPP_DIR}/index.markdown"]
15
+ GPP_FILE = FileList[GPP_DIR / 'index.markdown']
16
16
 
17
17
  CLEAN.include GPP_DIR, DIRTY_FILE
18
18
  CLOBBER.include TARGET_DIR
@@ -20,20 +20,22 @@ CLOBBER.include TARGET_DIR
20
20
  REVEAL_JS = 'reveal.js'.freeze
21
21
  REVEAL_JS_TARGET_DIR = TARGET_DIR / REVEAL_JS
22
22
 
23
- RESIZABLE_ASSETS = (FileList[SOURCE_DIR / "**/*.png"] + FileList[SOURCE_DIR / "**/*.jpg"])
23
+ RESIZABLE_ASSETS = (FileList[SOURCE_DIR / '**/*.png'] + FileList[SOURCE_DIR / '**/*.jpg'])
24
24
  RESIZED_ASSETS = RESIZABLE_ASSETS.pathmap("#{TARGET_DIR}/%f")
25
- ASSET_SOURCES = FileList[SOURCE_DIR / "*"] - RESIZABLE_ASSETS - SOURCE_FILES
25
+ ASSET_SOURCES = FileList[SOURCE_DIR / '*'] - RESIZABLE_ASSETS - SOURCE_FILES
26
26
  ASSETS = ASSET_SOURCES.pathmap("#{TARGET_DIR}/%f") - RESIZED_ASSETS
27
- HEADERS = FileList["headers/*"] # These are included literal; no need to copy them
27
+ HEADERS = FileList['headers/*'] # These are included literal; no need to copy them
28
28
 
29
+ load "#{__dir__}/tasks/prereq.rake"
29
30
  load "#{__dir__}/tasks/gpp.rake"
30
31
  load "#{__dir__}/tasks/assets.rake"
31
32
  load "#{__dir__}/tasks/reveal.js.rake"
32
33
 
33
34
  git_dirty_file DIRTY_FILE
35
+ prereq 'pandoc'
34
36
 
35
37
  desc "Build #{TARGET_FILE}"
36
- file TARGET_FILE => [ TARGET_DIR, REVEAL_JS_TARGET_DIR, GPP_FILE, DIRTY_FILE ] + ASSETS + RESIZED_ASSETS + HEADERS do
38
+ file TARGET_FILE => [ TARGET_DIR, REVEAL_JS_TARGET_DIR, GPP_FILE, DIRTY_FILE, 'pandoc'] + ASSETS + RESIZED_ASSETS + HEADERS do
37
39
  sh %(pandoc
38
40
  --to=revealjs
39
41
  --standalone
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Revealing
4
- VERSION = '1.0.2'
4
+ VERSION = '1.0.3'
5
5
  end
@@ -5,7 +5,6 @@ This is the source of New Presentation. It was generated with [`revealing`](http
5
5
  # Features
6
6
 
7
7
  * Images are resized for the web using [`graphicsmagick`](http://www.graphicsmagick.org/)
8
- * Embedded [`ditaa`](http://ditaa.sourceforge.net/) snippets are rendered to images
9
8
  * `#include` and other [`gpp`](https://logological.org/gpp) features allow organizing the sources of complex presentations
10
9
  * Files in the `headers` folder are included verbatim in the HTML `<head>` section
11
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revealing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steffen Uhlig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-14 00:00:00.000000000 Z
11
+ date: 2019-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -134,6 +134,7 @@ extensions: []
134
134
  extra_rdoc_files: []
135
135
  files:
136
136
  - ".gitignore"
137
+ - ".rspec"
137
138
  - ".travis.yml"
138
139
  - Gemfile
139
140
  - README.markdown
@@ -143,6 +144,7 @@ files:
143
144
  - lib/revealing/tasks.rb
144
145
  - lib/revealing/tasks/assets.rake
145
146
  - lib/revealing/tasks/gpp.rake
147
+ - lib/revealing/tasks/prereq.rake
146
148
  - lib/revealing/tasks/reveal.js.rake
147
149
  - lib/revealing/version.rb
148
150
  - revealing.gemspec