middleman-presentation-helpers 0.1.0.rc1 → 0.16.0.rc2
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/features/support/ci.rb +2 -2
- data/features/support/env.rb +1 -1
- data/lib/middleman-presentation-helpers/plugins/slides_plugin.rb +1 -1
- data/lib/middleman-presentation-helpers/step_definitions.rb +237 -0
- data/lib/middleman-presentation-helpers/test_helpers.rb +44 -0
- data/middleman-presentation-helpers.gemspec +4 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b28d49b2636af79b8a194da8b96340cec1049cc3
|
4
|
+
data.tar.gz: 9fa794b51dab81572f7bcb011b172330d6f5e946
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 594a881f9bf8ae32af45bad531bb74cbcdf9fc2989e155aa013fe3e91cf60c401c59459a8499071701b6eed74bc474120202d049c47a004c04617d5345f0e0d8
|
7
|
+
data.tar.gz: 06f835ef37935218a8835ef0200fff35f591c13863f3a01b35516cba1f2249f4285b2faa6956151b478de63453011cf0bd7ad3226c8cb5ca315db93f5b48dc8c
|
data/features/support/ci.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
# Test helpers
|
2
|
-
require 'middleman-presentation-
|
3
|
-
World(Middleman::Presentation::
|
2
|
+
require 'middleman-presentation-helpers/test_helpers'
|
3
|
+
World(Middleman::Presentation::Helpers::Test)
|
data/features/support/env.rb
CHANGED
@@ -8,7 +8,7 @@ SimpleCov.start
|
|
8
8
|
# middleman
|
9
9
|
require 'middleman-core'
|
10
10
|
require 'middleman-core/step_definitions'
|
11
|
-
require 'middleman-presentation-
|
11
|
+
require 'middleman-presentation-helpers/step_definitions'
|
12
12
|
|
13
13
|
# Pull in all of the gems including those in the `test` group
|
14
14
|
require 'bundler'
|
@@ -20,7 +20,7 @@ module Middleman
|
|
20
20
|
name: :'reveal.js',
|
21
21
|
version: 'latest',
|
22
22
|
# importable_files: %w(js/reveal.min.js lib/js/head.min css/reveal.min.css lib/css/zenburn css/theme/template/mixins.scss css/theme/template/settings.scss),
|
23
|
-
importable_files: %w(js/reveal.
|
23
|
+
importable_files: %w(js/reveal.js lib/js/head.min css/reveal.css css/theme/template/mixins.scss css/theme/template/settings.scss),
|
24
24
|
ignorable_files: %w(reveal\.js/test/),
|
25
25
|
output_paths: output_paths,
|
26
26
|
loadable_files: loadable_files
|
@@ -0,0 +1,237 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
Before do
|
3
|
+
@aruba_timeout_seconds = 120
|
4
|
+
ENV['MM_ENV'] = 'development'
|
5
|
+
ENV['MP_ENV'] = 'test'
|
6
|
+
|
7
|
+
step 'a mocked home directory'
|
8
|
+
step 'I configure bundler for fast testing'
|
9
|
+
step 'git is configured with username "User" and email-address "email@example.com"'
|
10
|
+
step 'I set the language for the shell to "en_GB.UTF-8"'
|
11
|
+
end
|
12
|
+
|
13
|
+
Given(/I configure bundler for fast testing/) do
|
14
|
+
config = []
|
15
|
+
config << "BUNDLE_PATH: #{ENV['BUNDLE_PATH']}" if ENV.key? 'BUNDLE_PATH'
|
16
|
+
|
17
|
+
config_file = File.join ENV['HOME'], '.bundle', 'config'
|
18
|
+
|
19
|
+
FileUtils.mkdir_p File.dirname(config_file)
|
20
|
+
File.write config_file, config.join("\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
# Clean environment
|
24
|
+
Around do |_, block|
|
25
|
+
old_env = ENV.to_h
|
26
|
+
|
27
|
+
block.call
|
28
|
+
|
29
|
+
ENV.replace old_env
|
30
|
+
end
|
31
|
+
|
32
|
+
When(/^I start debugging/) do
|
33
|
+
# rubocop:disable Lint/Debugger
|
34
|
+
require 'pry'
|
35
|
+
binding.pry
|
36
|
+
# rubocop:enable Lint/Debugger
|
37
|
+
|
38
|
+
''
|
39
|
+
end
|
40
|
+
|
41
|
+
Given(/^I use presentation fixture "([^"]+)" with title "([^"]+)"(?: and date "([^"]+)")?$/) do |name, title, date|
|
42
|
+
create_presentation(name, title, date)
|
43
|
+
step %(I cd to "#{name}")
|
44
|
+
end
|
45
|
+
|
46
|
+
Given(/^I set the language for the shell to "([^"]+)"$/) do |language|
|
47
|
+
set_env 'LANG', language
|
48
|
+
end
|
49
|
+
|
50
|
+
Given(/only the executables of gems "([^"]+)" can be found in PATH/) do |gems|
|
51
|
+
dirs = []
|
52
|
+
gem_names = gems.split(/,\s?/).map(&:strip)
|
53
|
+
|
54
|
+
dirs.concat(
|
55
|
+
gem_names.each_with_object([]) do |e, a|
|
56
|
+
gem = Gem::Specification.each.find { |s| s.name == e }
|
57
|
+
|
58
|
+
fail if gem.blank?
|
59
|
+
|
60
|
+
a << gem.bin_dir
|
61
|
+
end
|
62
|
+
)
|
63
|
+
|
64
|
+
if ci?
|
65
|
+
dirs << "/home/travis/.rvm/rubies/ruby-#{RUBY_VERSION}/bin"
|
66
|
+
dirs << "/home/travis/.rvm/rubies/ruby-#{Gem.ruby_api_version}/bin" unless Gem.ruby_api_version == RUBY_VERSION
|
67
|
+
end
|
68
|
+
|
69
|
+
dirs << '/usr/bin'
|
70
|
+
|
71
|
+
set_env 'PATH', dirs.join(':')
|
72
|
+
end
|
73
|
+
|
74
|
+
Given(/^I create a new presentation with title "([^"]+)"(?: for speaker "([^"]+)")?(?: on "([^"]+)")?$/) do |title, speaker, date|
|
75
|
+
options = {}
|
76
|
+
options[:title] = title
|
77
|
+
options[:speaker] = speaker if speaker
|
78
|
+
options[:date] = date if date
|
79
|
+
|
80
|
+
step %(I successfully run `middleman-presentation create presentation presentation1 #{options.to_options.join(' ')}`)
|
81
|
+
step 'I cd to "presentation1"'
|
82
|
+
end
|
83
|
+
|
84
|
+
Given(/^I prepend "([^"]+)" to environment variable "([^"]+)"$/) do |value, variable|
|
85
|
+
set_env variable, value + ENV[variable]
|
86
|
+
end
|
87
|
+
|
88
|
+
Given(/^a slide named "(.*?)" with:$/) do |name, string|
|
89
|
+
step %(a file named "source/slides/#{name}" with:), string
|
90
|
+
end
|
91
|
+
|
92
|
+
Given(/^a project template named "(.*?)" with:$/) do |name, string|
|
93
|
+
step %(a file named "templates/#{name}" with:), string
|
94
|
+
end
|
95
|
+
|
96
|
+
Given(/^a user template named "(.*?)" with:$/) do |name, string|
|
97
|
+
step %(a file named "~/.config/middleman-presentation/templates/#{name}" with:), string
|
98
|
+
end
|
99
|
+
|
100
|
+
Given(/^a user defined predefined slide named "(.*?)" with:$/) do |name, string|
|
101
|
+
step %(a file named "~/.config/middleman-presentation/predefined_slides.d/#{name}" with:), string
|
102
|
+
end
|
103
|
+
|
104
|
+
Given(/^a presentation theme named "(.*?)" does not exist$/) do |name|
|
105
|
+
step %(I remove the directory "middleman-presentation-theme-#{name}")
|
106
|
+
end
|
107
|
+
|
108
|
+
Given(/^a file named "(.*?)" does not exist$/) do |name|
|
109
|
+
FileUtils.rm_rf absolute_path(name)
|
110
|
+
end
|
111
|
+
|
112
|
+
Given(/^a directory named "(.*?)" does not exist$/) do |name|
|
113
|
+
step %(I remove the directory "#{name}")
|
114
|
+
end
|
115
|
+
|
116
|
+
Given(/^a plugin named "(.*?)" does not exist$/) do |name|
|
117
|
+
step %(I remove the directory "#{name}")
|
118
|
+
end
|
119
|
+
|
120
|
+
Then(%r{^a plugin named "(.*?)" should exist( with default files/directories created)?$}) do |name, default_files|
|
121
|
+
step %(a directory named "#{name}" should exist)
|
122
|
+
|
123
|
+
if default_files
|
124
|
+
%W(
|
125
|
+
#{name}/#{name}.gemspec
|
126
|
+
#{name}/lib/#{name}.rb
|
127
|
+
#{name}/lib/#{name}/version.rb
|
128
|
+
#{name}/Gemfile
|
129
|
+
#{name}/LICENSE.txt
|
130
|
+
#{name}/README.md
|
131
|
+
#{name}/Rakefile
|
132
|
+
#{name}/.gitignore
|
133
|
+
).each do |file|
|
134
|
+
step %(a file named "#{file}" should exist)
|
135
|
+
end
|
136
|
+
|
137
|
+
%W(
|
138
|
+
#{name}/lib
|
139
|
+
#{name}/lib/#{name}
|
140
|
+
).each do |file|
|
141
|
+
step %(a directory named "#{file}" should exist)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
Given(/^git is configured with username "(.*?)" and email-address "(.*?)"$/) do |name, email|
|
147
|
+
step %(I successfully run `git config --global user.email "#{email}"`)
|
148
|
+
step %(I successfully run `git config --global user.name "#{name}"`)
|
149
|
+
end
|
150
|
+
|
151
|
+
Given(/^a user config file for middleman\-presentation with:$/) do |string|
|
152
|
+
step 'a file named "~/.config/middleman-presentation/application.yaml" with:', string
|
153
|
+
end
|
154
|
+
|
155
|
+
Given(/^a presentation config file for middleman\-presentation with:$/) do |string|
|
156
|
+
step 'a file named ".middleman-presentation.yaml" with:', string
|
157
|
+
end
|
158
|
+
|
159
|
+
Then(/^the user config file for middleman\-presentation should contain:$/) do |string|
|
160
|
+
step 'the file "~/.config/middleman-presentation/application.yaml" should contain:', string
|
161
|
+
end
|
162
|
+
|
163
|
+
Then(/^the presentation config file for middleman\-presentation should contain:$/) do |string|
|
164
|
+
step 'the file ".middleman-presentation.yaml" should contain:', string
|
165
|
+
end
|
166
|
+
|
167
|
+
Then(%r{^a presentation theme named "(.*?)" should exist( with default files/directories created)?$}) do |name, default_files|
|
168
|
+
name = "middleman-presentation-theme-#{name}"
|
169
|
+
|
170
|
+
step %(a directory named "#{name}" should exist)
|
171
|
+
|
172
|
+
if default_files
|
173
|
+
step %(a directory named "#{name}/stylesheets" should exist)
|
174
|
+
step %(a directory named "#{name}/javascripts" should exist)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
Then(/^I go to "([^"]*)" and see the following error message:$/) do |url, message|
|
179
|
+
message = capture :stderr do
|
180
|
+
# rubocop:disable Lint/HandleExceptions:
|
181
|
+
begin
|
182
|
+
@browser.get(URI.escape(url))
|
183
|
+
rescue StandardError
|
184
|
+
end
|
185
|
+
# rubocop:enable Lint/HandleExceptions:
|
186
|
+
end
|
187
|
+
|
188
|
+
expect(message).to include message
|
189
|
+
end
|
190
|
+
|
191
|
+
Then(/^a directory named "(.*?)" is a git repository$/) do |name|
|
192
|
+
step %(a directory named "#{name}/.git" should exist)
|
193
|
+
end
|
194
|
+
|
195
|
+
Given(/^a slide named "(.*?)" does not exist$/) do |name|
|
196
|
+
FileUtils.rm_rf absolute_path('source', 'slides', name)
|
197
|
+
end
|
198
|
+
|
199
|
+
Then(/^a slide named "(.*?)" should exist$/) do |name|
|
200
|
+
step %(a file named "source/slides/#{name}" should exist)
|
201
|
+
end
|
202
|
+
|
203
|
+
Then(/^a slide named "(.*?)" should exist with:$/) do |name, string|
|
204
|
+
step %(the file "source/slides/#{name}" should contain:), string
|
205
|
+
end
|
206
|
+
|
207
|
+
When(/^I successfully run `([^`]+)` in clean environment$/) do |command|
|
208
|
+
Bundler.with_clean_env do
|
209
|
+
step %(I successfully run `#{command}`)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
Given(/^I add a stylesheet asset named "(.*?)" to the presentation$/) do |asset|
|
214
|
+
import_string = "@import '#{asset}';"
|
215
|
+
|
216
|
+
step 'I append to "source/stylesheets/application.scss" with:', import_string
|
217
|
+
end
|
218
|
+
|
219
|
+
When(/^I successfully run `([^`]+)` in debug mode$/) do |cmd|
|
220
|
+
step "I run `#{cmd}` in debug mode"
|
221
|
+
end
|
222
|
+
|
223
|
+
When(/^I run `([^`]+)` in debug mode$/) do |cmd|
|
224
|
+
in_current_dir do
|
225
|
+
# rubocop:disable Lint/Debugger
|
226
|
+
require 'pry'
|
227
|
+
binding.pry
|
228
|
+
# rubocop:enable Lint/Debugger
|
229
|
+
system(cmd)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
Then(/^the size of "(.*?)" should be much smaller than from "(.*?)"$/) do |file1, file2|
|
234
|
+
in_current_dir do
|
235
|
+
expect(File.size(file1)).to be < File.size(file2)
|
236
|
+
end
|
237
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'fedux_org_stdlib/core_ext/string/characterize'
|
3
|
+
|
4
|
+
module Middleman
|
5
|
+
module Presentation
|
6
|
+
module Helpers
|
7
|
+
# Test helpers
|
8
|
+
module Test
|
9
|
+
# Helpers for tests
|
10
|
+
def ci?
|
11
|
+
ENV.key?('CI') || ENV.key?('TRAVIS')
|
12
|
+
end
|
13
|
+
|
14
|
+
def temporary_fixture_path(name)
|
15
|
+
File.expand_path("../../../tmp/fixtures/#{name}", __FILE__)
|
16
|
+
end
|
17
|
+
|
18
|
+
def temporary_fixture_exist?(name)
|
19
|
+
File.exist? File.expand_path("../../../tmp/fixtures/#{name}", __FILE__)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_presentation(name, title, date)
|
23
|
+
directory = []
|
24
|
+
directory << name
|
25
|
+
directory << ('-' + title)
|
26
|
+
directory << ('-' + date) if date
|
27
|
+
|
28
|
+
directory = directory.join.characterize
|
29
|
+
|
30
|
+
command = []
|
31
|
+
command << "middleman-presentation create presentation #{temporary_fixture_path(directory)}"
|
32
|
+
command << "--title #{Shellwords.escape(title)}"
|
33
|
+
command << "--date #{Shellwords.escape(date)}" if date
|
34
|
+
|
35
|
+
system(command.join(' ')) unless temporary_fixture_exist?(directory)
|
36
|
+
|
37
|
+
FileUtils.cp_r temporary_fixture_path(directory), absolute_path(name)
|
38
|
+
end
|
39
|
+
|
40
|
+
module_function :temporary_fixture_path
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path('
|
2
|
+
lib = File.expand_path('../../middleman-presentation-core/lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
|
4
|
+
|
5
|
+
require 'middleman-presentation-core/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = 'middleman-presentation-helpers'
|
8
|
-
spec.version = Middleman::Presentation::
|
9
|
+
spec.version = Middleman::Presentation::VERSION
|
9
10
|
spec.authors = ['Max Meyer']
|
10
11
|
spec.email = ['dev@fedux.org']
|
11
12
|
spec.summary = 'Helpers for middleman-presentation'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-presentation-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -57,6 +57,8 @@ files:
|
|
57
57
|
- lib/middleman-presentation-helpers/plugins/normalize_plugin.rb
|
58
58
|
- lib/middleman-presentation-helpers/plugins/print_plugin.rb
|
59
59
|
- lib/middleman-presentation-helpers/plugins/slides_plugin.rb
|
60
|
+
- lib/middleman-presentation-helpers/step_definitions.rb
|
61
|
+
- lib/middleman-presentation-helpers/test_helpers.rb
|
60
62
|
- lib/middleman-presentation-helpers/version.rb
|
61
63
|
- lib/middleman-presentation-plugin.rb
|
62
64
|
- middleman-presentation-helpers.gemspec
|
@@ -86,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
88
|
version: 1.3.1
|
87
89
|
requirements: []
|
88
90
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.4.
|
91
|
+
rubygems_version: 2.4.5
|
90
92
|
signing_key:
|
91
93
|
specification_version: 4
|
92
94
|
summary: Helpers for middleman-presentation
|