middleman-presentation 0.15.8 → 0.16.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +31 -4
- data/Rakefile +8 -3
- data/bin/middleman-presentation +9 -1
- data/bin/mp +9 -1
- data/lib/middleman-presentation.rb +1 -71
- data/middleman-presentation.gemspec +7 -20
- metadata +14 -357
- data/.gitignore +0 -33
- data/.rdebugrc +0 -7
- data/.rspec +0 -5
- data/.simplecov +0 -8
- data/.travis.yml +0 -8
- data/.yardopts +0 -5
- data/CONTRIBUTING.md +0 -44
- data/Gemfile +0 -49
- data/Gemfile.lock +0 -328
- data/Guardfile +0 -13
- data/LICENSE.software +0 -21
- data/README.md +0 -608
- data/RELEASE_NOTES.md +0 -36
- data/config/license_finder.yml +0 -13
- data/config/rubocop/exclude.yml +0 -25
- data/config/rubocop/include.yml +0 -142
- data/cucumber.yml +0 -2
- data/doc/licenses/dependencies.csv +0 -55
- data/doc/licenses/dependencies.db +0 -0
- data/doc/licenses/dependencies.html +0 -1415
- data/doc/licenses/dependencies.md +0 -603
- data/doc/licenses/dependencies_detailed.csv +0 -190
- data/features/create_presentation-cli.feature +0 -312
- data/features/create_theme-cli.feature +0 -62
- data/features/grouping_slides.feature +0 -116
- data/features/ignore_slides.feature +0 -86
- data/features/image_gallery.feature +0 -58
- data/features/init_application-cli.feature +0 -91
- data/features/init_predefined_slides.feature +0 -13
- data/features/presentation.feature +0 -113
- data/features/show_config-cli.feature +0 -27
- data/features/show_style-cli.feature +0 -21
- data/features/show_support_information-cli.feature +0 -12
- data/features/slide-cli.feature +0 -311
- data/features/step_definitions.rb +0 -135
- data/features/support/ci.rb +0 -3
- data/features/support/env.rb +0 -19
- data/features/support/reporting.rb +0 -2
- data/features/version_number.feature +0 -18
- data/fixtures/images/image01.png +0 -0
- data/fixtures/images/image02.png +0 -0
- data/lib/middleman-presentation/cli/create.rb +0 -14
- data/lib/middleman-presentation/cli/create_presentation.rb +0 -308
- data/lib/middleman-presentation/cli/create_theme.rb +0 -77
- data/lib/middleman-presentation/cli/init.rb +0 -34
- data/lib/middleman-presentation/cli/reset_thor.rb +0 -18
- data/lib/middleman-presentation/cli/runner.rb +0 -18
- data/lib/middleman-presentation/cli/show.rb +0 -37
- data/lib/middleman-presentation/commands/presentation.rb +0 -23
- data/lib/middleman-presentation/commands/slide.rb +0 -86
- data/lib/middleman-presentation/commands/style.rb +0 -29
- data/lib/middleman-presentation/comparable_slide.rb +0 -69
- data/lib/middleman-presentation/css_class_extracter.rb +0 -41
- data/lib/middleman-presentation/custom_template.rb +0 -11
- data/lib/middleman-presentation/erb_template.rb +0 -11
- data/lib/middleman-presentation/existing_slide.rb +0 -133
- data/lib/middleman-presentation/extension.rb +0 -12
- data/lib/middleman-presentation/file_extensions.rb +0 -60
- data/lib/middleman-presentation/frontend_component.rb +0 -82
- data/lib/middleman-presentation/group_template.rb +0 -11
- data/lib/middleman-presentation/helpers.rb +0 -11
- data/lib/middleman-presentation/helpers/images.rb +0 -38
- data/lib/middleman-presentation/helpers/slides.rb +0 -31
- data/lib/middleman-presentation/helpers/tests.rb +0 -13
- data/lib/middleman-presentation/ignore_file.rb +0 -52
- data/lib/middleman-presentation/liquid_template.rb +0 -11
- data/lib/middleman-presentation/logger.rb +0 -8
- data/lib/middleman-presentation/main.rb +0 -40
- data/lib/middleman-presentation/markdown_template.rb +0 -11
- data/lib/middleman-presentation/new_slide.rb +0 -145
- data/lib/middleman-presentation/predefined_slide_templates_directory.rb +0 -11
- data/lib/middleman-presentation/presentation_config.rb +0 -48
- data/lib/middleman-presentation/slide_group.rb +0 -38
- data/lib/middleman-presentation/slide_list.rb +0 -46
- data/lib/middleman-presentation/transformers/file_keeper.rb +0 -13
- data/lib/middleman-presentation/transformers/group_slides.rb +0 -34
- data/lib/middleman-presentation/transformers/ignore_slides.rb +0 -28
- data/lib/middleman-presentation/transformers/remove_duplicate_slides.rb +0 -32
- data/lib/middleman-presentation/transformers/sort_slides.rb +0 -13
- data/lib/middleman-presentation/version.rb +0 -8
- data/locales/de.yml +0 -9
- data/locales/en.yml +0 -18
- data/script/bootstrap +0 -11
- data/script/ci +0 -3
- data/spec/css_class_extracter_spec.rb +0 -28
- data/spec/existing_slide_spec.rb +0 -158
- data/spec/frontend_resource_spec.rb +0 -87
- data/spec/ignore_file_spec.rb +0 -74
- data/spec/new_slide_spec.rb +0 -136
- data/spec/shared_examples/.keep +0 -0
- data/spec/slide_group_spec.rb +0 -69
- data/spec/slide_list_spec.rb +0 -90
- data/spec/spec_helper.rb +0 -19
- data/spec/support/ci.rb +0 -20
- data/spec/support/environment.rb +0 -18
- data/spec/support/filesystem.rb +0 -22
- data/spec/support/reporting.rb +0 -2
- data/spec/support/rspec.rb +0 -9
- data/spec/support/string.rb +0 -2
- data/spec/transformers/file_keeper_spec.rb +0 -23
- data/spec/transformers/group_slides_spec.rb +0 -44
- data/spec/transformers/ignore_slides_spec.rb +0 -64
- data/spec/transformers/remove_duplicate_slides_spec.rb +0 -120
- data/spec/transformers/sort_slides_spec.rb +0 -17
- data/templates/.bowerrc.tt +0 -4
- data/templates/.gitignore +0 -5
- data/templates/LICENSE.presentation +0 -1
- data/templates/Rakefile +0 -59
- data/templates/bower.json.tt +0 -8
- data/templates/config.yaml.tt +0 -41
- data/templates/data/config.yml.tt +0 -9
- data/templates/data/metadata.yml.tt +0 -77
- data/templates/predefined_slides.d/00.html.erb.tt +0 -23
- data/templates/predefined_slides.d/999980.html.erb.tt +0 -4
- data/templates/predefined_slides.d/999981.html.erb.tt +0 -21
- data/templates/predefined_slides.d/999982.html.erb.tt +0 -3
- data/templates/presentation_theme/bower.json.tt +0 -20
- data/templates/presentation_theme/images/.keep +0 -0
- data/templates/presentation_theme/javascripts/%theme_name%.js.tt +0 -0
- data/templates/presentation_theme/stylesheets/%theme_name%.scss.tt +0 -9
- data/templates/presentation_theme/stylesheets/_fonts.scss.tt +0 -0
- data/templates/presentation_theme/stylesheets/_images.scss.tt +0 -5
- data/templates/presentation_theme/stylesheets/_theme.scss.tt +0 -251
- data/templates/script/bootstrap +0 -5
- data/templates/script/build +0 -3
- data/templates/script/export +0 -34
- data/templates/script/presentation +0 -3
- data/templates/script/slide +0 -3
- data/templates/script/start +0 -43
- data/templates/slides/custom.md.tt +0 -3
- data/templates/slides/erb.tt +0 -5
- data/templates/slides/group.tt +0 -3
- data/templates/slides/liquid.tt +0 -5
- data/templates/slides/markdown.tt +0 -3
- data/templates/source/index.html.erb +0 -1
- data/templates/source/javascripts/application.js.tt +0 -3
- data/templates/source/layout.erb +0 -89
- data/templates/source/stylesheets/application.scss.tt +0 -3
@@ -1,11 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
# Predefined slide templates directory
|
5
|
-
class PredefinedSlideTemplateDirectory < FeduxOrgStdlib::TemplateDirectory
|
6
|
-
def fallback_template_directory
|
7
|
-
File.expand_path('../../../templates', __FILE__)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# encoding, utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
# Configuration for presentation extension
|
5
|
-
class PresentationConfig < FeduxOrgStdlib::AppConfig
|
6
|
-
option :speaker, process_environment.fetch('USER')
|
7
|
-
option :license, 'CC BY 4.0'
|
8
|
-
option :bower_directory, 'vendor/assets/components'
|
9
|
-
option :author, process_environment.fetch('USER')
|
10
|
-
option :description, nil
|
11
|
-
option :homepage, nil
|
12
|
-
option :company, nil
|
13
|
-
option :location, nil
|
14
|
-
option :audience, nil
|
15
|
-
option :phone_number, nil
|
16
|
-
option :email_address, nil
|
17
|
-
option :github_url, nil
|
18
|
-
option :theme, {}
|
19
|
-
option :components, []
|
20
|
-
option :activate_controls, true
|
21
|
-
option :activate_progress, true
|
22
|
-
option :activate_history, true
|
23
|
-
option :activate_center, true
|
24
|
-
option :activate_slide_number, true
|
25
|
-
option :default_transition_type, 'linear'
|
26
|
-
option :default_transition_speed, 'default'
|
27
|
-
option :install_assets, true
|
28
|
-
option :initialize_git, true
|
29
|
-
option :check_for_bower, true
|
30
|
-
option :clear_source, true
|
31
|
-
option :create_predefined_slides, true
|
32
|
-
option :language, :de
|
33
|
-
option :default_version_number, 'v0.0.1'
|
34
|
-
|
35
|
-
option :slides_directory, 'slides'
|
36
|
-
option :slides_ignore_file, '.slidesignore'
|
37
|
-
|
38
|
-
option :create_stylesheets_directory, true
|
39
|
-
option :create_javascripts_directory, true
|
40
|
-
option :create_images_directory, true
|
41
|
-
option :theme_prefix, 'middleman-presentation-theme'
|
42
|
-
|
43
|
-
option :edit, false
|
44
|
-
option :editor_command, process_environment.fetch('EDITOR', 'vim')
|
45
|
-
option :error_on_duplicates, true
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
# A group of slides
|
5
|
-
class SlideGroup
|
6
|
-
private
|
7
|
-
|
8
|
-
attr_reader :template
|
9
|
-
|
10
|
-
public
|
11
|
-
|
12
|
-
attr_reader :name, :slides
|
13
|
-
|
14
|
-
def initialize(name:, slides:, template:)
|
15
|
-
@name = name
|
16
|
-
@slides = slides
|
17
|
-
@template = template
|
18
|
-
end
|
19
|
-
|
20
|
-
# Combine paths of all slides
|
21
|
-
def partial_path
|
22
|
-
slides.map(&:partial_path).to_list
|
23
|
-
end
|
24
|
-
|
25
|
-
# Call block for each slide
|
26
|
-
def render(&block)
|
27
|
-
slides_content = slides.each_with_object([]) { |e, a| a << e.render(&block) }.join("\n")
|
28
|
-
|
29
|
-
template.result(slides: slides_content)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Is group
|
33
|
-
def group_object?
|
34
|
-
true
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
# List of slides
|
5
|
-
class SlideList
|
6
|
-
private
|
7
|
-
|
8
|
-
attr_accessor :transformers
|
9
|
-
|
10
|
-
public
|
11
|
-
|
12
|
-
def initialize(names, slide_builder: Slide, **args, &block)
|
13
|
-
@slides = Array(names).map { |n| slide_builder.new(n, **args) }
|
14
|
-
@transformers = []
|
15
|
-
|
16
|
-
block.call(self) if block_given?
|
17
|
-
|
18
|
-
@slides = transformers.reduce(@slides) { |a, e| e.transform(a) }
|
19
|
-
end
|
20
|
-
|
21
|
-
def transform_with(transformer)
|
22
|
-
transformers << transformer
|
23
|
-
end
|
24
|
-
|
25
|
-
def all
|
26
|
-
@slides.dup
|
27
|
-
end
|
28
|
-
|
29
|
-
def each_new(&block)
|
30
|
-
all.keep_if { |s| s.respond_to?(:exist?) && !s.exist? }.each(&block)
|
31
|
-
end
|
32
|
-
|
33
|
-
def each_old(&block)
|
34
|
-
all.keep_if { |s| s.respond_to?(:exist?) && s.exist? }.each(&block)
|
35
|
-
end
|
36
|
-
|
37
|
-
def existing_slides
|
38
|
-
all.keep_if { |s| s.respond_to?(:exist?) && s.exist? }
|
39
|
-
end
|
40
|
-
|
41
|
-
def to_a
|
42
|
-
all
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
module Transformers
|
5
|
-
# Group slides together
|
6
|
-
class GroupSlides
|
7
|
-
private
|
8
|
-
|
9
|
-
attr_reader :template
|
10
|
-
|
11
|
-
public
|
12
|
-
|
13
|
-
def initialize(template:)
|
14
|
-
@template = template
|
15
|
-
end
|
16
|
-
|
17
|
-
def transform(slides)
|
18
|
-
groups = Set.new
|
19
|
-
|
20
|
-
new_slides = slides.map do |slide|
|
21
|
-
if slide.group && groups.none? { |g| g.name == slide.group }
|
22
|
-
slide = group = SlideGroup.new name: slide.group, slides: slides.select { |s| s.group? slide.group }, template: template
|
23
|
-
groups << group
|
24
|
-
end
|
25
|
-
|
26
|
-
slide
|
27
|
-
end
|
28
|
-
|
29
|
-
new_slides - groups.map { |g| g.slides }.flatten
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
module Transformers
|
5
|
-
# Ignore slides in list: delete them from list
|
6
|
-
class IgnoreSlides
|
7
|
-
private
|
8
|
-
|
9
|
-
attr_reader :ignore_file
|
10
|
-
|
11
|
-
public
|
12
|
-
|
13
|
-
def initialize(ignore_file:, ignore_file_builder: IgnoreFile)
|
14
|
-
@ignore_file = ignore_file_builder.new(ignore_file)
|
15
|
-
|
16
|
-
invalid_ignore_file = Pathname.new(ignore_file).dirname + Pathname.new('.slideignore')
|
17
|
-
|
18
|
-
message = "Invalid ignore file \"#{invalid_ignore_file}\" detected. I'm going to ignore it. Please use the correct one \"#{ignore_file}\"."
|
19
|
-
Middleman::Presentation.logger.warn message if invalid_ignore_file.exist?
|
20
|
-
end
|
21
|
-
|
22
|
-
def transform(slides)
|
23
|
-
slides.delete_if { |slide| ignore_file.ignore? slide }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
module Transformers
|
5
|
-
# Remove duplicates slides from list
|
6
|
-
class RemoveDuplicateSlides
|
7
|
-
private
|
8
|
-
|
9
|
-
attr_reader :additional_slides, :raise_error
|
10
|
-
|
11
|
-
public
|
12
|
-
|
13
|
-
def initialize(additional_slides: [], raise_error: false)
|
14
|
-
@additional_slides = additional_slides
|
15
|
-
@raise_error = raise_error
|
16
|
-
end
|
17
|
-
|
18
|
-
def transform(slides)
|
19
|
-
temp_slides = (Array(slides) + Array(additional_slides)).uniq
|
20
|
-
|
21
|
-
duplicate_slides = temp_slides.each_with_object([]) do |e, a|
|
22
|
-
a << slides.select { |s| e.similar?(s) && !e.eql?(s) }
|
23
|
-
end.flatten
|
24
|
-
|
25
|
-
fail ArgumentError, I18n.t('errors.duplicate_slide_names', slide_names: duplicate_slides.map(&:file_name).to_list) if !duplicate_slides.blank? && raise_error
|
26
|
-
|
27
|
-
slides - duplicate_slides
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/locales/de.yml
DELETED
data/locales/en.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
---
|
2
|
-
en:
|
3
|
-
errors:
|
4
|
-
argument_error: The value "%{value}" for "%{argument}" is invalid.
|
5
|
-
undefined_arguments: At least one argument of %{arguments} needs to be defined.
|
6
|
-
doubled_arguments: Only one argument of %{arguments} is allowed to be defined.
|
7
|
-
template_is_undefined: You need to provide information about your default template within presentations.yaml.
|
8
|
-
asset_not_found: I cannot find asset '%{asset}'. Please check the path and try again.
|
9
|
-
duplicate_slide_names: "Your input will result in duplicate slide file names: %{slide_names}. Maybe there are any existing slide names conflicting your input, e.g. 01.html.md (markdown) already exists and you try to create 01.html.erb (eruby)."
|
10
|
-
missing_argument: You need to define argument "%{argument}".
|
11
|
-
missing_data_attribute: "You need to define an option in one of your config or data files: %{message}."
|
12
|
-
slides:
|
13
|
-
contact:
|
14
|
-
title: Contact
|
15
|
-
questions:
|
16
|
-
title: Questions
|
17
|
-
end:
|
18
|
-
title: The End
|
data/script/bootstrap
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
npm install -g bower
|
4
|
-
|
5
|
-
if [ "$?" -ne "0" ]; then
|
6
|
-
echo "Make sure you've got 'npm' and 'bower' installed on your system! 'npm' comes with nodejs. Please see http://nodejs.org/ for information about 'node.js/npm' and http://bower.io/ for more information about installing 'bower' on your system." >&2
|
7
|
-
fi
|
8
|
-
|
9
|
-
gem install bundler
|
10
|
-
|
11
|
-
bundle install
|
data/script/ci
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe CssClassExtracter do
|
5
|
-
context '#extract' do
|
6
|
-
it 'extract classes' do
|
7
|
-
file = create_file 'index.html', <<-EOS.strip_heredoc
|
8
|
-
<html class="hello">
|
9
|
-
</html>
|
10
|
-
EOS
|
11
|
-
|
12
|
-
klasses = CssClassExtracter.new.extract([file])
|
13
|
-
expect(klasses.size).to eq 1
|
14
|
-
expect(klasses.first.name).to eq 'hello'
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'ignores classes' do
|
18
|
-
file = create_file 'index.html', <<-EOS.strip_heredoc
|
19
|
-
<html class="hello test">
|
20
|
-
</html>
|
21
|
-
EOS
|
22
|
-
|
23
|
-
klasses = CssClassExtracter.new.extract([file], ignore: ['test'])
|
24
|
-
expect(klasses.size).to eq 1
|
25
|
-
expect(klasses.first.name).to eq 'hello'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/spec/existing_slide_spec.rb
DELETED
@@ -1,158 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe ExistingSlide do
|
5
|
-
|
6
|
-
context '#file_name' do
|
7
|
-
it 'extracts file name' do
|
8
|
-
slide1 = ExistingSlide.new(File.join(working_directory, 'source', 'slides', '01.html.md'))
|
9
|
-
expect(slide1.file_name).to eq Pathname.new('01.html.md')
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'extracts file name with group' do
|
13
|
-
slide1 = ExistingSlide.new(File.join(working_directory, 'source', 'slides', 'group', '01.html.md'))
|
14
|
-
expect(slide1.file_name).to eq Pathname.new('01.html.md')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context '#group' do
|
19
|
-
it 'extracts group name' do
|
20
|
-
slide1 = ExistingSlide.new(File.join(working_directory, 'source', 'slides', 'group', '01.html.md'), base_path: File.join(working_directory, 'source'))
|
21
|
-
expect(slide1.group).to eq 'group'
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'returns nil if no group name is available' do
|
25
|
-
slide1 = ExistingSlide.new(File.join(working_directory, 'source', 'slides', '01.html.md'), base_path: File.join(working_directory, 'source'))
|
26
|
-
expect(slide1.group).to be_nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context '#path' do
|
31
|
-
it 'has path' do
|
32
|
-
path = File.join(working_directory, 'source', 'slides', 'group', '01.html.md')
|
33
|
-
slide1 = ExistingSlide.new(path)
|
34
|
-
expect(slide1.path).to eq Pathname.new(path)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context '#<=>' do
|
39
|
-
it 'compares slides with same file name' do
|
40
|
-
slide1 = ExistingSlide.new('01.html.md')
|
41
|
-
slide2 = ExistingSlide.new('01.html.md')
|
42
|
-
|
43
|
-
expect(slide1).to eq slide2
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'compares slides with different file names' do
|
47
|
-
slide1 = ExistingSlide.new('01.html.erb')
|
48
|
-
slide2 = ExistingSlide.new('01.html.md')
|
49
|
-
|
50
|
-
expect(slide1).not_to eq slide2
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context '#eql?' do
|
55
|
-
it 'succeeds on eqal file names' do
|
56
|
-
slide1 = ExistingSlide.new('01.html.erb')
|
57
|
-
slide2 = ExistingSlide.new('01.html.erb')
|
58
|
-
|
59
|
-
expect(slide1.eql?(slide2)).to be_truthy
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'fails on different names' do
|
63
|
-
slide1 = ExistingSlide.new('01.html.erb')
|
64
|
-
slide2 = ExistingSlide.new('02.html.erb')
|
65
|
-
|
66
|
-
expect(slide1.eql?(slide2)).to be_falsey
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context '#similar?' do
|
71
|
-
it 'succeeds if both files share the same base name' do
|
72
|
-
slide1 = ExistingSlide.new('01.html.erb')
|
73
|
-
slide2 = ExistingSlide.new('01.html.md')
|
74
|
-
|
75
|
-
expect(slide1).to be_similar slide2
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'fails if both files do not share the same basename' do
|
79
|
-
slide1 = ExistingSlide.new('01.html.erb')
|
80
|
-
slide2 = ExistingSlide.new('02.html.erb')
|
81
|
-
|
82
|
-
expect(slide1).not_to be_similar slide2
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context '#hash' do
|
87
|
-
it 'generates hash based on file name' do
|
88
|
-
slide = ExistingSlide.new('01.html.erb')
|
89
|
-
expect(slide).to respond_to :hash
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
context '#exist?' do
|
94
|
-
it 'succeeds if slide file exists in filesystem' do
|
95
|
-
file = create_file '02.html.md'
|
96
|
-
slide = ExistingSlide.new(file)
|
97
|
-
|
98
|
-
expect(slide).to be_exist
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'fails if slide file does not exists in filesystem' do
|
102
|
-
slide = ExistingSlide.new(SecureRandom.hex)
|
103
|
-
|
104
|
-
expect(slide).not_to be_exist
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context '#to_s' do
|
109
|
-
it 'returns string representation of self' do
|
110
|
-
slide = ExistingSlide.new('02.html.md')
|
111
|
-
|
112
|
-
expect(slide.to_s).to eq '02.html.md'
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
context '#basename' do
|
117
|
-
it 'reduces slide file name to minimum' do
|
118
|
-
slide = ExistingSlide.new(File.join(working_directory, '02.html.erb'))
|
119
|
-
expect(slide.base_name).to eq '02'
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
context '#match?' do
|
124
|
-
it 'matches full path' do
|
125
|
-
slide = ExistingSlide.new(File.join(working_directory, '02.html.md'))
|
126
|
-
|
127
|
-
expect(slide).to be_match(/02/)
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'supports string' do
|
131
|
-
slide = ExistingSlide.new(File.join(working_directory, '02.html.md'))
|
132
|
-
|
133
|
-
expect(slide).to be_match('02')
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context '#group?' do
|
138
|
-
it 'succeeds if slide has group' do
|
139
|
-
slide = ExistingSlide.new(File.join(working_directory, 'source', 'slides', 'group', '02.html.md'), base_path: File.join(working_directory, 'source'))
|
140
|
-
|
141
|
-
expect(slide).to be_group 'group'
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'fails if slide has not group' do
|
145
|
-
slide = ExistingSlide.new(File.join(working_directory, 'source', 'slides', '02.html.md'), base_path: File.join(working_directory, 'source'))
|
146
|
-
|
147
|
-
expect(slide).not_to be_group 'group'
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
context '#partial_path' do
|
152
|
-
it 'returns path based on base without extensions' do
|
153
|
-
slide = ExistingSlide.new(File.join(working_directory, 'slides', '02.html.md'), base_path: working_directory)
|
154
|
-
|
155
|
-
expect(slide.partial_path).to eq Pathname.new('slides/02')
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|