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.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +31 -4
  3. data/Rakefile +8 -3
  4. data/bin/middleman-presentation +9 -1
  5. data/bin/mp +9 -1
  6. data/lib/middleman-presentation.rb +1 -71
  7. data/middleman-presentation.gemspec +7 -20
  8. metadata +14 -357
  9. data/.gitignore +0 -33
  10. data/.rdebugrc +0 -7
  11. data/.rspec +0 -5
  12. data/.simplecov +0 -8
  13. data/.travis.yml +0 -8
  14. data/.yardopts +0 -5
  15. data/CONTRIBUTING.md +0 -44
  16. data/Gemfile +0 -49
  17. data/Gemfile.lock +0 -328
  18. data/Guardfile +0 -13
  19. data/LICENSE.software +0 -21
  20. data/README.md +0 -608
  21. data/RELEASE_NOTES.md +0 -36
  22. data/config/license_finder.yml +0 -13
  23. data/config/rubocop/exclude.yml +0 -25
  24. data/config/rubocop/include.yml +0 -142
  25. data/cucumber.yml +0 -2
  26. data/doc/licenses/dependencies.csv +0 -55
  27. data/doc/licenses/dependencies.db +0 -0
  28. data/doc/licenses/dependencies.html +0 -1415
  29. data/doc/licenses/dependencies.md +0 -603
  30. data/doc/licenses/dependencies_detailed.csv +0 -190
  31. data/features/create_presentation-cli.feature +0 -312
  32. data/features/create_theme-cli.feature +0 -62
  33. data/features/grouping_slides.feature +0 -116
  34. data/features/ignore_slides.feature +0 -86
  35. data/features/image_gallery.feature +0 -58
  36. data/features/init_application-cli.feature +0 -91
  37. data/features/init_predefined_slides.feature +0 -13
  38. data/features/presentation.feature +0 -113
  39. data/features/show_config-cli.feature +0 -27
  40. data/features/show_style-cli.feature +0 -21
  41. data/features/show_support_information-cli.feature +0 -12
  42. data/features/slide-cli.feature +0 -311
  43. data/features/step_definitions.rb +0 -135
  44. data/features/support/ci.rb +0 -3
  45. data/features/support/env.rb +0 -19
  46. data/features/support/reporting.rb +0 -2
  47. data/features/version_number.feature +0 -18
  48. data/fixtures/images/image01.png +0 -0
  49. data/fixtures/images/image02.png +0 -0
  50. data/lib/middleman-presentation/cli/create.rb +0 -14
  51. data/lib/middleman-presentation/cli/create_presentation.rb +0 -308
  52. data/lib/middleman-presentation/cli/create_theme.rb +0 -77
  53. data/lib/middleman-presentation/cli/init.rb +0 -34
  54. data/lib/middleman-presentation/cli/reset_thor.rb +0 -18
  55. data/lib/middleman-presentation/cli/runner.rb +0 -18
  56. data/lib/middleman-presentation/cli/show.rb +0 -37
  57. data/lib/middleman-presentation/commands/presentation.rb +0 -23
  58. data/lib/middleman-presentation/commands/slide.rb +0 -86
  59. data/lib/middleman-presentation/commands/style.rb +0 -29
  60. data/lib/middleman-presentation/comparable_slide.rb +0 -69
  61. data/lib/middleman-presentation/css_class_extracter.rb +0 -41
  62. data/lib/middleman-presentation/custom_template.rb +0 -11
  63. data/lib/middleman-presentation/erb_template.rb +0 -11
  64. data/lib/middleman-presentation/existing_slide.rb +0 -133
  65. data/lib/middleman-presentation/extension.rb +0 -12
  66. data/lib/middleman-presentation/file_extensions.rb +0 -60
  67. data/lib/middleman-presentation/frontend_component.rb +0 -82
  68. data/lib/middleman-presentation/group_template.rb +0 -11
  69. data/lib/middleman-presentation/helpers.rb +0 -11
  70. data/lib/middleman-presentation/helpers/images.rb +0 -38
  71. data/lib/middleman-presentation/helpers/slides.rb +0 -31
  72. data/lib/middleman-presentation/helpers/tests.rb +0 -13
  73. data/lib/middleman-presentation/ignore_file.rb +0 -52
  74. data/lib/middleman-presentation/liquid_template.rb +0 -11
  75. data/lib/middleman-presentation/logger.rb +0 -8
  76. data/lib/middleman-presentation/main.rb +0 -40
  77. data/lib/middleman-presentation/markdown_template.rb +0 -11
  78. data/lib/middleman-presentation/new_slide.rb +0 -145
  79. data/lib/middleman-presentation/predefined_slide_templates_directory.rb +0 -11
  80. data/lib/middleman-presentation/presentation_config.rb +0 -48
  81. data/lib/middleman-presentation/slide_group.rb +0 -38
  82. data/lib/middleman-presentation/slide_list.rb +0 -46
  83. data/lib/middleman-presentation/transformers/file_keeper.rb +0 -13
  84. data/lib/middleman-presentation/transformers/group_slides.rb +0 -34
  85. data/lib/middleman-presentation/transformers/ignore_slides.rb +0 -28
  86. data/lib/middleman-presentation/transformers/remove_duplicate_slides.rb +0 -32
  87. data/lib/middleman-presentation/transformers/sort_slides.rb +0 -13
  88. data/lib/middleman-presentation/version.rb +0 -8
  89. data/locales/de.yml +0 -9
  90. data/locales/en.yml +0 -18
  91. data/script/bootstrap +0 -11
  92. data/script/ci +0 -3
  93. data/spec/css_class_extracter_spec.rb +0 -28
  94. data/spec/existing_slide_spec.rb +0 -158
  95. data/spec/frontend_resource_spec.rb +0 -87
  96. data/spec/ignore_file_spec.rb +0 -74
  97. data/spec/new_slide_spec.rb +0 -136
  98. data/spec/shared_examples/.keep +0 -0
  99. data/spec/slide_group_spec.rb +0 -69
  100. data/spec/slide_list_spec.rb +0 -90
  101. data/spec/spec_helper.rb +0 -19
  102. data/spec/support/ci.rb +0 -20
  103. data/spec/support/environment.rb +0 -18
  104. data/spec/support/filesystem.rb +0 -22
  105. data/spec/support/reporting.rb +0 -2
  106. data/spec/support/rspec.rb +0 -9
  107. data/spec/support/string.rb +0 -2
  108. data/spec/transformers/file_keeper_spec.rb +0 -23
  109. data/spec/transformers/group_slides_spec.rb +0 -44
  110. data/spec/transformers/ignore_slides_spec.rb +0 -64
  111. data/spec/transformers/remove_duplicate_slides_spec.rb +0 -120
  112. data/spec/transformers/sort_slides_spec.rb +0 -17
  113. data/templates/.bowerrc.tt +0 -4
  114. data/templates/.gitignore +0 -5
  115. data/templates/LICENSE.presentation +0 -1
  116. data/templates/Rakefile +0 -59
  117. data/templates/bower.json.tt +0 -8
  118. data/templates/config.yaml.tt +0 -41
  119. data/templates/data/config.yml.tt +0 -9
  120. data/templates/data/metadata.yml.tt +0 -77
  121. data/templates/predefined_slides.d/00.html.erb.tt +0 -23
  122. data/templates/predefined_slides.d/999980.html.erb.tt +0 -4
  123. data/templates/predefined_slides.d/999981.html.erb.tt +0 -21
  124. data/templates/predefined_slides.d/999982.html.erb.tt +0 -3
  125. data/templates/presentation_theme/bower.json.tt +0 -20
  126. data/templates/presentation_theme/images/.keep +0 -0
  127. data/templates/presentation_theme/javascripts/%theme_name%.js.tt +0 -0
  128. data/templates/presentation_theme/stylesheets/%theme_name%.scss.tt +0 -9
  129. data/templates/presentation_theme/stylesheets/_fonts.scss.tt +0 -0
  130. data/templates/presentation_theme/stylesheets/_images.scss.tt +0 -5
  131. data/templates/presentation_theme/stylesheets/_theme.scss.tt +0 -251
  132. data/templates/script/bootstrap +0 -5
  133. data/templates/script/build +0 -3
  134. data/templates/script/export +0 -34
  135. data/templates/script/presentation +0 -3
  136. data/templates/script/slide +0 -3
  137. data/templates/script/start +0 -43
  138. data/templates/slides/custom.md.tt +0 -3
  139. data/templates/slides/erb.tt +0 -5
  140. data/templates/slides/group.tt +0 -3
  141. data/templates/slides/liquid.tt +0 -5
  142. data/templates/slides/markdown.tt +0 -3
  143. data/templates/source/index.html.erb +0 -1
  144. data/templates/source/javascripts/application.js.tt +0 -3
  145. data/templates/source/layout.erb +0 -89
  146. data/templates/source/stylesheets/application.scss.tt +0 -3
@@ -1,34 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Presentation
4
- module Cli
5
- # This class provides an 'presentation init' command for the middleman CLI.
6
- class Init < Thor
7
- include Thor::Actions
8
-
9
- desc 'application ', 'Initialize system for use of middleman-presentation'
10
- option :configuration_file, default: Middleman::Presentation.config.preferred_configuration_file, desc: 'Path to configuration file'
11
- option :force, type: :boolean, desc: 'Force creation of config file'
12
- def application
13
- source_paths << File.expand_path('../../../../templates', __FILE__)
14
-
15
- @version = Middleman::Presentation::VERSION
16
- @config = Middleman::Presentation.config
17
-
18
- opts = options.dup.deep_symbolize_keys
19
- template 'config.yaml.tt', opts.delete(:configuration_file), **opts
20
- end
21
-
22
- desc 'predefined_slides ', 'Initialize predefined_slides'
23
- option :directory, default: PredefinedSlideTemplateDirectory.new.preferred_template_directory, desc: 'Directory where the predefined templates should be stored'
24
- def predefined_slides
25
- source_paths << File.expand_path('../../../../templates/predefined_slides.d', __FILE__)
26
-
27
- PredefinedSlideTemplateDirectory.new(working_directory: File.expand_path('../../../../templates', __FILE__)).template_files.each do |file|
28
- copy_file file, File.join(options[:directory], File.basename(file))
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,18 +0,0 @@
1
- # Restore original behaviour of thor
2
- # rubocop:disable Style/ClassAndModuleChildren
3
- class ::Thor
4
- # rubocop:enable Style/ClassAndModuleChildren
5
- module Actions
6
- # Create file helper class
7
- class CreateFile
8
- def on_conflict_behavior(&block)
9
- if identical?
10
- say_status :identical, :blue
11
- else
12
- options = base.options.merge(config)
13
- force_or_skip_or_conflict(options[:force], options[:skip], &block)
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Presentation
4
- module Cli
5
- # Run command
6
- class Runner < Thor
7
- desc 'init', 'Initialize system, presentation, ...'
8
- subcommand 'init', Init
9
-
10
- desc 'show', 'Show information ...'
11
- subcommand 'show', Show
12
-
13
- desc 'create', 'Create something...'
14
- subcommand 'create', Create
15
- end
16
- end
17
- end
18
- end
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Presentation
4
- module Cli
5
- # This class provides an 'presentation init' command for the middleman CLI.
6
- class Show < Thor
7
- include Thor::Actions
8
-
9
- desc 'support_information', 'Collect information for support'
10
- def support_information
11
- puts FeduxOrgStdlib::SupportInformation.new.to_s
12
- end
13
-
14
- desc 'config', 'Show configuration'
15
- option :defaults, type: :boolean, desc: 'Show default configuration'
16
- def config
17
- if options[:defaults]
18
- capture :stderr do
19
- puts Middleman::Presentation::PresentationConfig.new(file: nil).to_s
20
- end
21
- else
22
- puts Middleman::Presentation.config.to_s
23
- end
24
- end
25
-
26
- desc 'style', 'Show available styles'
27
- def style
28
- css_classes = Middleman::Presentation::CssClassExtracter.new.extract Middleman::Presentation.stylable_files, ignore: %w(slides reveal)
29
-
30
- puts "Available css classes in templates used by middleman-presentation:\n"
31
- css_classes.each { |klass| puts format ' %20s: %s', klass.name, klass.files.to_list }
32
- puts
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,23 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Presentation
4
- module Cli
5
- # This class provides an 'presentation' command for the middleman CLI.
6
- class Presentation < Thor
7
- include Thor::Actions
8
-
9
- def self.check_unknown_options?(*)
10
- false
11
- end
12
-
13
- namespace :presentation
14
-
15
- desc 'presentation ', 'Initialize a new presentation'
16
- def presentation(*)
17
- warn('The use of this command is deprecated. Please use `middleman-presentation create presentation` instead.')
18
- exit 1
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,86 +0,0 @@
1
- # encoding: utf-8
2
- require 'middleman-presentation'
3
-
4
- module Middleman
5
- module Cli
6
- # This class provides an 'slide' command for the middleman CLI.
7
- class Slide < Thor
8
- include Thor::Actions
9
-
10
- check_unknown_options!
11
-
12
- namespace :slide
13
-
14
- def self.source_root
15
- ENV['MM_ROOT']
16
- end
17
-
18
- # Tell Thor to exit with a nonzero exit code on failure
19
- def self.exit_on_failure?
20
- true
21
- end
22
-
23
- desc 'slide NAME(S)', 'Create a new slide(s) or edit existing ones. If you want to create multiple slides enter them with a space between the names "01 02 03".'
24
- option :edit, default: Middleman::Presentation.config.edit, desc: 'Start ENV["EDITOR"] to edit slide.', aliases: %w(-e)
25
- option :editor_command, default: Middleman::Presentation.config.editor_command, desc: 'editor command to be used, e.g. ENV["EDITOR"] --servername presentation --remote-tab'
26
- option :error_on_duplicates, type: :boolean, default: Middleman::Presentation.config.error_on_duplicates, desc: 'Raise an error if a slide of the same base name alread exists, e.g. Filename: 01.html.erb => Basename: 01'
27
- option :title, desc: 'Title of slide'
28
- def slide(*names)
29
- fail ArgumentError, I18n.t('errors.missing_argument', argument: 'name') if names.blank?
30
-
31
- shared_instance = ::Middleman::Application.server.inst
32
-
33
- # This only exists when the config.rb sets it!
34
- if shared_instance.extensions.key? :presentation
35
- presentation_inst = shared_instance.extensions[:presentation]
36
-
37
- existing_slides = Middleman::Presentation::SlideList.new(
38
- Dir.glob(File.join(shared_instance.source_dir, presentation_inst.options.slides_directory, '**', '*')),
39
- slide_builder: Middleman::Presentation::ExistingSlide,
40
- base_path: shared_instance.source_dir
41
- ) do |l|
42
- l.transform_with Middleman::Presentation::Transformers::FileKeeper.new
43
- end
44
-
45
- slide_list = Middleman::Presentation::SlideList.new(
46
- names,
47
- slide_builder: Middleman::Presentation::NewSlide,
48
- base_path: File.join(shared_instance.source_dir, presentation_inst.options.slides_directory)
49
- ) do |l|
50
- l.transform_with Middleman::Presentation::Transformers::RemoveDuplicateSlides.new(additional_slides: existing_slides, raise_error: options[:error_on_duplicates])
51
- l.transform_with Middleman::Presentation::Transformers::SortSlides.new
52
- end
53
-
54
- slide_list.each_old do |slide|
55
- $stderr.puts format('%-20s %-s', 'exist'.colorize(color: :blue, mode: :bold), slide.relative_path)
56
- end
57
-
58
- slide_list.each_new do |slide|
59
- $stderr.puts format('%-20s %-s', 'create'.colorize(color: :green, mode: :bold), slide.relative_path)
60
- slide.write(title: options[:title])
61
- end
62
-
63
- data = if shared_instance.data.respond_to? :metadata
64
- shared_instance.data.metadata.dup
65
- else
66
- OpenStruct.new
67
- end
68
-
69
- if options[:edit]
70
- editor = []
71
- begin
72
- editor << Erubis::Eruby.new(options[:editor_command]).result(data)
73
- rescue NameError => e
74
- $stderr.puts I18n.t('errors.missing_data_attribute', message: e.message)
75
- end
76
- editor.concat slide_list.existing_slides
77
-
78
- system(editor.join(' '))
79
- end
80
- else
81
- fail Thor::Error, 'You need to activate the presentation extension in config.rb before you can create a slide.'
82
- end
83
- end
84
- end
85
- end
86
- end
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Cli
4
- # This class provides an 'slide' command for the middleman CLI.
5
- class Style < Thor
6
- include Thor::Actions
7
-
8
- namespace :style
9
-
10
- def self.source_root
11
- ENV['MM_ROOT']
12
- end
13
-
14
- # Tell Thor to exit with a nonzero exit code on failure
15
- def self.exit_on_failure?
16
- true
17
- end
18
-
19
- desc 'style', 'Show available styles'
20
- def style
21
- css_classes = Middleman::Presentation::CssClassExtracter.new.extract Middleman::Presentation.stylable_files, ignore: %w(slides reveal)
22
-
23
- puts "Available css classes in templates used by middleman-presentation:\n"
24
- css_classes.each { |klass| puts format ' %20s: %s', klass.name, klass.files.to_list }
25
- puts
26
- end
27
- end
28
- end
29
- end
@@ -1,69 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Presentation
4
- # All methods needed to compare slides
5
- module ComparableSlide
6
- include Comparable
7
-
8
- # Needs to be implemented to make the other methods work
9
- def path
10
- fail MethodNotImplemented
11
- end
12
-
13
- # Needs to be implemented to make the other methods work
14
- def base_name
15
- fail MethodNotImplemented
16
- end
17
-
18
- # Needs to be implemented to make the other methods work
19
- def group
20
- fail MethodNotImplemented
21
- end
22
-
23
- # @private
24
- def <=>(other)
25
- path <=> other.path
26
- end
27
-
28
- # @private
29
- def eql?(other)
30
- path.eql? other.path
31
- end
32
-
33
- # Is slide similar to another slide
34
- def similar?(other)
35
- return true if eql? other
36
-
37
- base_name?(other.base_name) && group?(other.group)
38
- end
39
-
40
- # @private
41
- def hash
42
- path.hash
43
- end
44
-
45
- # Checks if slide is in group
46
- def group?(g)
47
- group == g
48
- end
49
-
50
- # Check if string/regex matches path
51
- def match?(string_or_regex)
52
- regex = if string_or_regex.is_a? String
53
- Regexp.new(string_or_regex)
54
- else
55
- string_or_regex
56
- end
57
-
58
- # rubocop:disable Style/CaseEquality:
59
- regex === relative_path.to_s
60
- # rubocop:enable Style/CaseEquality:
61
- end
62
-
63
- # Check if basename is equal
64
- def base_name?(b)
65
- base_name == b
66
- end
67
- end
68
- end
69
- end
@@ -1,41 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Presentation
4
- # Extract css classes from html files
5
- class CssClassExtracter
6
- # Extracted css class
7
- class CssClass
8
- attr_reader :name, :files
9
-
10
- def initialize(name:, files: [])
11
- @name = name
12
- @files = files.to_a
13
- end
14
- end
15
-
16
- def extract(paths, ignore: [])
17
- classes = build(paths)
18
- classes.delete_if { |klass| ignore.include? klass }.sort_by { |klass, _| klass }.map { |klass, files| CssClass.new(name: klass, files: files) }
19
- end
20
-
21
- private
22
-
23
- def build(paths)
24
- paths.each_with_object({}) do |f, a|
25
- page = Nokogiri::HTML(open(f))
26
-
27
- page.traverse do |n|
28
- if n['class']
29
- klasses = n['class'].split(/ /)
30
-
31
- klasses.each do |k|
32
- a[k] ||= Set.new
33
- a[k] << File.basename(f)
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Presentation
4
- # Custom template for a new slide
5
- class CustomTemplate < FeduxOrgStdlib::FileTemplate
6
- def fallback_template_directory
7
- File.expand_path('../../../templates/slides', __FILE__)
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
- module Middleman
3
- module Presentation
4
- # Erb template for a new slide
5
- class ErbTemplate < FeduxOrgStdlib::FileTemplate
6
- def fallback_template_directory
7
- File.expand_path('../../../templates/slides', __FILE__)
8
- end
9
- end
10
- end
11
- end
@@ -1,133 +0,0 @@
1
- # encoding
2
- module Middleman
3
- module Presentation
4
- # Used for slides which already exist in file system
5
- class ExistingSlide
6
- include ComparableSlide
7
-
8
- attr_reader :path
9
-
10
- private
11
-
12
- attr_reader :base_path
13
-
14
- public
15
-
16
- # Create Existin slide object
17
- def initialize(path, base_path: nil)
18
- @path = Pathname.new(path)
19
-
20
- base_path = @path.dirname if base_path.blank?
21
- @base_path = Pathname.new(base_path)
22
- end
23
-
24
- # Relative path inside source directory
25
- def relative_path
26
- path.relative_path_from(base_path)
27
- end
28
-
29
- # Group of slide
30
- def group
31
- @group ||= extract_group
32
- end
33
-
34
- # Filename of slide, e.g 01.html.erb
35
- def file_name
36
- path.basename
37
- end
38
-
39
- # Does slide really exist in filesystem
40
- def exist?
41
- path.exist?
42
- end
43
-
44
- # Does this object group multiple slides
45
- def group_object?
46
- false
47
- end
48
-
49
- # Render slide
50
- def render(&block)
51
- result = []
52
- result << "<!-- #{relative_path} -->"
53
- result << block.call(partial_path).to_s
54
-
55
- result.join("\n")
56
- end
57
-
58
- # String representation of slide
59
- def to_s
60
- path.to_s
61
- end
62
-
63
- def partial_path
64
- dirname, base = relative_path.split
65
-
66
- base = base.basename('.*') until base.extname.blank?
67
-
68
- dirname + base
69
- end
70
-
71
- def base_name
72
- base = relative_path.basename
73
-
74
- base = base.basename('.*') until base.extname.blank?
75
-
76
- base.to_s
77
- end
78
-
79
- private
80
-
81
- def extract_group
82
- group = relative_path.dirname.basename
83
-
84
- return nil if group == relative_path.dirname
85
-
86
- group.to_s
87
- end
88
- end
89
- end
90
- end
91
- #
92
- # # Check type of slide
93
- # def type?(t)
94
- # type == t
95
- # end
96
- #
97
- # # Determine type of slide
98
- # def type
99
- # return :erb if extname? '.erb'
100
- # return :md if extname? '.md', '.markdown', '.mkd'
101
- # return :liquid if extname? '.l', '.liquid'
102
- #
103
- # :custom
104
- # end
105
- # private :type
106
- #
107
- # # Check if slide has given extensions
108
- # def extname?(*extensions)
109
- # return false if !path && !name
110
- #
111
- # extensions.any? { |e| extname == e }
112
- # end
113
- # private :extname?
114
- #
115
- # # Return string representation of self
116
- # def to_s
117
- # path
118
- # end
119
- #
120
- # # Return basename of slide
121
- # def basename
122
- # File.basename(name).scan(/^([^.]+)(?:\..+)?/).flatten.first
123
- # end
124
- #
125
- # # Check if basename is equal
126
- # def basename?(b)
127
- # basename == b
128
- # end
129
- # private :basename?
130
- #
131
- # end
132
- # end
133
- # end