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
data/features/support/ci.rb
DELETED
data/features/support/env.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'aruba/cucumber'
|
3
|
-
|
4
|
-
require 'simplecov'
|
5
|
-
SimpleCov.command_name 'cucumber'
|
6
|
-
SimpleCov.start
|
7
|
-
|
8
|
-
# middleman
|
9
|
-
require 'middleman-core'
|
10
|
-
require 'middleman-core/step_definitions'
|
11
|
-
|
12
|
-
# Pull in all of the gems including those in the `test` group
|
13
|
-
require 'bundler'
|
14
|
-
Bundler.require :default, :test, :development
|
15
|
-
|
16
|
-
ENV['TEST'] = 'true'
|
17
|
-
ENV['AUTOLOAD_SPROCKETS'] = 'false'
|
18
|
-
|
19
|
-
PROJECT_ROOT_PATH = File.expand_path('../../../', __FILE__)
|
@@ -1,18 +0,0 @@
|
|
1
|
-
Feature: Show version number
|
2
|
-
|
3
|
-
As a presentator
|
4
|
-
I want to add a version number to a new presentation
|
5
|
-
In order to display it
|
6
|
-
|
7
|
-
Background:
|
8
|
-
Given a mocked home directory
|
9
|
-
And git is configured with username "User" and email-address "email@example.com"
|
10
|
-
|
11
|
-
Scenario: Default version number
|
12
|
-
Given I successfully run `middleman-presentation create presentation --title "Test"`
|
13
|
-
And the Server is running
|
14
|
-
When I go to "/"
|
15
|
-
Then I should see:
|
16
|
-
"""
|
17
|
-
v0.0.1
|
18
|
-
"""
|
data/fixtures/images/image01.png
DELETED
Binary file
|
data/fixtures/images/image02.png
DELETED
Binary file
|
@@ -1,14 +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 Create < Thor
|
7
|
-
register(CreateTheme, 'theme', 'theme NAME', 'Create a new theme named NAMED')
|
8
|
-
register(CreatePresentation, 'presentation', 'presentation [DIR]', 'Initialize a new presentation in DIR (default: $PWD)')
|
9
|
-
|
10
|
-
default_command :presentation
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,308 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
module Cli
|
5
|
-
# Initialize presentation
|
6
|
-
class CreatePresentation < Thor::Group
|
7
|
-
include Thor::Actions
|
8
|
-
|
9
|
-
class_option :speaker, required: true, default: Middleman::Presentation.config.speaker, desc: 'Name of speaker'
|
10
|
-
class_option :title, required: true, desc: 'Title of presentation'
|
11
|
-
class_option :date, required: true, default: Time.now.strftime('%d.%m.%Y'), desc: 'Date of presentation'
|
12
|
-
class_option :license, required: true, default: Middleman::Presentation.config.license, desc: 'License of the presentation, e.g. CC BY'
|
13
|
-
|
14
|
-
class_option :bower_directory, default: Middleman::Presentation.config.bower_directory, desc: 'Directory for bower components in "source"-directory'
|
15
|
-
class_option :author, default: Middleman::Presentation.config.author, desc: 'Author of presentation'
|
16
|
-
class_option :description, desc: 'Description for presentation'
|
17
|
-
class_option :subtitle, desc: 'Subtitle of presentation'
|
18
|
-
class_option :homepage, default: Middleman::Presentation.config.homepage, desc: 'Homepage of company and/or speaker'
|
19
|
-
class_option :company, default: Middleman::Presentation.config.company, desc: 'Company or employer or organization of speaker'
|
20
|
-
class_option :location, default: Middleman::Presentation.config.location, desc: 'Location where the presentation take place'
|
21
|
-
class_option :audience, default: Middleman::Presentation.config.audience, desc: 'Audience of presentation'
|
22
|
-
|
23
|
-
class_option :phone_number, default: Middleman::Presentation.config.phone_number, desc: 'Phone number to contact speaker'
|
24
|
-
class_option :email_address, default: Middleman::Presentation.config.email_address, desc: 'Email address to contact speaker'
|
25
|
-
class_option :github_url, default: Middleman::Presentation.config.github_url, desc: 'Url to Github account of speaker'
|
26
|
-
|
27
|
-
class_option :activate_controls, type: :boolean, default: Middleman::Presentation.config.activate_controls, desc: 'Activate controls in reveal.js'
|
28
|
-
class_option :activate_progress, type: :boolean, default: Middleman::Presentation.config.activate_progress, desc: 'Activate progress in reveal.js'
|
29
|
-
class_option :activate_history, type: :boolean, default: Middleman::Presentation.config.activate_history, desc: 'Activate history in reveal.js'
|
30
|
-
class_option :activate_center, type: :boolean, default: Middleman::Presentation.config.activate_center, desc: 'Activate center in reveal.js'
|
31
|
-
class_option :activate_slide_number, type: :boolean, default: Middleman::Presentation.config.activate_slide_number, desc: 'Activate slide number in reveal.js'
|
32
|
-
|
33
|
-
class_option :default_transition_type, default: Middleman::Presentation.config.default_transition_type, desc: 'Default slide transition. Can be overwridden per slide.'
|
34
|
-
class_option :default_transition_speed, default: Middleman::Presentation.config.default_transition_speed, desc: 'Default speed for slide transition. Can be overwridden per slide.'
|
35
|
-
|
36
|
-
class_option :install_assets, type: :boolean, default: Middleman::Presentation.config.install_assets, desc: 'Install assets'
|
37
|
-
class_option :initialize_git, type: :boolean, default: Middleman::Presentation.config.initialize_git, desc: 'Initialize git repository'
|
38
|
-
class_option :check_for_bower, type: :boolean, default: Middleman::Presentation.config.check_for_bower, desc: 'Check if bower is installed on the system'
|
39
|
-
|
40
|
-
class_option :create_predefined_slides, type: :boolean, default: Middleman::Presentation.config.create_predefined_slides, desc: 'Install predefined slides'
|
41
|
-
|
42
|
-
class_option :language, default: Middleman::Presentation.config.language, type: :array, desc: 'Language to use for translatable slide templates, e.g. "de", "en"'
|
43
|
-
class_option :version, default: Middleman::Presentation.config.default_version_number, desc: 'Version number for your presentation'
|
44
|
-
|
45
|
-
argument :directory, default: Dir.getwd, desc: 'Directory to create presentation in'
|
46
|
-
desc 'Initialize a new presentation in DIR (default: $PWD)'
|
47
|
-
|
48
|
-
def define_root_directory
|
49
|
-
@root_directory = File.expand_path directory
|
50
|
-
end
|
51
|
-
|
52
|
-
def add_to_source_path
|
53
|
-
source_paths << File.expand_path('../../../../templates', __FILE__)
|
54
|
-
end
|
55
|
-
|
56
|
-
def initialize_middleman
|
57
|
-
run("middleman init --skip-bundle --template empty #{directory}")
|
58
|
-
fail Thor::Error, 'Error executing `middleman init`-command. Please fix your setup and run again.' unless $CHILD_STATUS.exitstatus == 0
|
59
|
-
end
|
60
|
-
|
61
|
-
def set_language
|
62
|
-
language_detector = FeduxOrgStdlib::ShellLanguageDetector.new
|
63
|
-
language = language_detector.detect allowed: I18n.available_locales, overwrite: options[:language]
|
64
|
-
|
65
|
-
I18n.default_locale = language.language_code
|
66
|
-
end
|
67
|
-
|
68
|
-
def add_frontend_components
|
69
|
-
@external_assets = []
|
70
|
-
|
71
|
-
@external_assets << Middleman::Presentation::FrontendComponent.new(name: 'jquery', version: '~1.11', javascripts: %w(dist/jquery))
|
72
|
-
@external_assets << Middleman::Presentation::FrontendComponent.new(name: 'reveal.js', version: 'latest', javascripts: %w(lib/js/head.min js/reveal.min))
|
73
|
-
@external_assets << Middleman::Presentation::FrontendComponent.new(name: 'lightbox2', github: 'dg-vrnetze/revealjs-lightbox2', javascripts: %w(js/lightbox))
|
74
|
-
@external_assets << Middleman::Presentation::FrontendComponent.new(
|
75
|
-
name: 'middleman-presentation-theme-common',
|
76
|
-
github: 'dg-vrnetze/middleman-presentation-theme-common',
|
77
|
-
stylesheets: %w(stylesheets/middleman-presentation-theme-common),
|
78
|
-
javascripts: %w(javascripts/middleman-presentation-theme-common)
|
79
|
-
)
|
80
|
-
|
81
|
-
@external_assets.concat Middleman::Presentation::FrontendComponent.parse(Middleman::Presentation.config.components)
|
82
|
-
end
|
83
|
-
|
84
|
-
def add_theme
|
85
|
-
if Middleman::Presentation.config.theme.blank?
|
86
|
-
@external_assets << Middleman::Presentation::FrontendComponent.new(
|
87
|
-
name: 'middleman-presentation-theme-default',
|
88
|
-
github: 'maxmeyer/middleman-presentation-theme-default',
|
89
|
-
stylesheets: %w(stylesheets/middleman-presentation-theme-default)
|
90
|
-
)
|
91
|
-
else
|
92
|
-
@external_assets.concat Middleman::Presentation::FrontendComponent.parse(Middleman::Presentation.config.theme)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def set_variables_for_templates
|
97
|
-
@bower_directory = options[:bower_directory]
|
98
|
-
@author = options[:author]
|
99
|
-
@speaker = options[:speaker]
|
100
|
-
@title = options[:title]
|
101
|
-
@description = options[:description]
|
102
|
-
@subtitle = options[:subtitle]
|
103
|
-
@date = options[:date]
|
104
|
-
@homepage = options[:homepage]
|
105
|
-
@company = options[:company]
|
106
|
-
@license = options[:license]
|
107
|
-
@location = options[:location]
|
108
|
-
@audience = options[:audience]
|
109
|
-
|
110
|
-
@email_address = options[:email_address]
|
111
|
-
@phone_number = options[:phone_number]
|
112
|
-
@github_url = options[:github_url]
|
113
|
-
|
114
|
-
@version = options[:version]
|
115
|
-
@project_id = format '%s-%s', ActiveSupport::Inflector.transliterate(options[:title]).parameterize, SecureRandom.hex
|
116
|
-
end
|
117
|
-
|
118
|
-
def set_configuration_for_revealjs
|
119
|
-
@revealjs_config = {}
|
120
|
-
@revealjs_config[:controls] = options[:activate_controls]
|
121
|
-
@revealjs_config[:progress] = options[:activate_progress]
|
122
|
-
@revealjs_config[:history] = options[:activate_history]
|
123
|
-
@revealjs_config[:center] = options[:activate_center]
|
124
|
-
@revealjs_config[:slide_number] = options[:activate_slide_number]
|
125
|
-
@revealjs_config[:default_transition_type] = options[:default_transition_type]
|
126
|
-
@revealjs_config[:default_transition_speed] = options[:default_transition_speed]
|
127
|
-
end
|
128
|
-
|
129
|
-
def create_middleman_data_files
|
130
|
-
template 'data/metadata.yml.tt', File.join(data_directory, 'metadata.yml')
|
131
|
-
template 'data/config.yml.tt', File.join(data_directory, 'config.yml')
|
132
|
-
end
|
133
|
-
|
134
|
-
def create_bower_configuration_files
|
135
|
-
template '.bowerrc.tt', File.join(root_directory, '.bowerrc')
|
136
|
-
template 'bower.json.tt', File.join(root_directory, 'bower.json')
|
137
|
-
end
|
138
|
-
|
139
|
-
def create_rake_file
|
140
|
-
template 'Rakefile', File.join(root_directory, 'Rakefile')
|
141
|
-
end
|
142
|
-
|
143
|
-
def create_slides_ignore_file
|
144
|
-
create_file File.join(root_directory, '.slidesignore'), "# empty\n"
|
145
|
-
end
|
146
|
-
|
147
|
-
def add_gems_to_gem_file
|
148
|
-
if ENV['MM_ENV'] == 'development'
|
149
|
-
append_to_file File.join(root_directory, 'Gemfile'), <<-EOS.strip_heredoc
|
150
|
-
|
151
|
-
gem 'middleman-presentation', path: '#{File.expand_path('../../../../', __FILE__)}'
|
152
|
-
|
153
|
-
EOS
|
154
|
-
else
|
155
|
-
append_to_file File.join(root_directory, 'Gemfile'), <<-EOS.strip_heredoc
|
156
|
-
|
157
|
-
gem 'middleman-presentation'
|
158
|
-
|
159
|
-
EOS
|
160
|
-
end
|
161
|
-
|
162
|
-
append_to_file File.join(root_directory, 'Gemfile'), <<-EOS.strip_heredoc
|
163
|
-
|
164
|
-
group :development, :test do
|
165
|
-
gem 'pry'
|
166
|
-
gem 'byebug'
|
167
|
-
gem 'pry-byebug'
|
168
|
-
end
|
169
|
-
|
170
|
-
gem 'kramdown'
|
171
|
-
gem 'github-markup'
|
172
|
-
gem 'liquid'
|
173
|
-
gem 'rake'
|
174
|
-
EOS
|
175
|
-
end
|
176
|
-
|
177
|
-
def add_configuration_for_middleman_presentation
|
178
|
-
append_to_file File.join(root_directory, 'config.rb'), <<-EOS.strip_heredoc
|
179
|
-
|
180
|
-
activate :presentation
|
181
|
-
|
182
|
-
set :markdown_engine, :kramdown
|
183
|
-
set :markdown, parse_block_html: true
|
184
|
-
|
185
|
-
bower_directory = '#{@bower_directory}'
|
186
|
-
|
187
|
-
if respond_to?(:sprockets) && sprockets.respond_to?(:import_asset)
|
188
|
-
sprockets.append_path File.join(root, bower_directory)
|
189
|
-
|
190
|
-
patterns = [
|
191
|
-
'.png', '.gif', '.jpg', '.jpeg', '.svg', # Images
|
192
|
-
'.eot', '.otf', '.svc', '.woff', '.ttf', # Fonts
|
193
|
-
'.js', # Javascript
|
194
|
-
].map { |e| File.join(bower_directory, '**', "*\#{e}") }
|
195
|
-
|
196
|
-
require 'rake/file_list'
|
197
|
-
|
198
|
-
list = Rake::FileList.new(*patterns) do |l|
|
199
|
-
l.exclude(/src/)
|
200
|
-
l.exclude(/test/)
|
201
|
-
l.exclude(/demo/)
|
202
|
-
l.exclude { |f| !File.file? f }
|
203
|
-
end
|
204
|
-
|
205
|
-
list.each do |f|
|
206
|
-
sprockets.import_asset Pathname.new(f).relative_path_from(Pathname.new(bower_directory))
|
207
|
-
end
|
208
|
-
|
209
|
-
Rake::FileList.new(File.join('vendor/assets/components', '**', 'notes.html' )).each do |f|
|
210
|
-
sprockets.import_asset(Pathname.new(f).relative_path_from(Pathname.new(bower_directory))) { |local_path| Pathname.new('javascripts') + local_path }
|
211
|
-
end
|
212
|
-
|
213
|
-
Rake::FileList.new(File.join('vendor/assets/components', '**', 'pdf.css' )).each do |f|
|
214
|
-
sprockets.import_asset(Pathname.new(f).relative_path_from(Pathname.new(bower_directory))) { |local_path| Pathname.new('stylesheets') + local_path }
|
215
|
-
end
|
216
|
-
end
|
217
|
-
EOS
|
218
|
-
end
|
219
|
-
|
220
|
-
def add_patterns_to_gitignore
|
221
|
-
append_to_file File.join(root_directory, '.gitignore'), <<-EOS.strip_heredoc
|
222
|
-
*.zip
|
223
|
-
*.tar.gz
|
224
|
-
tmp/
|
225
|
-
EOS
|
226
|
-
end
|
227
|
-
|
228
|
-
def create_application_asset_files
|
229
|
-
template 'source/stylesheets/application.scss.tt', File.join(middleman_source_directory, 'stylesheets', 'application.scss')
|
230
|
-
template 'source/javascripts/application.js.tt', File.join(middleman_source_directory, 'javascripts', 'application.js')
|
231
|
-
end
|
232
|
-
|
233
|
-
def create_image_directory
|
234
|
-
empty_directory File.join(middleman_source_directory, 'images')
|
235
|
-
end
|
236
|
-
|
237
|
-
def create_presentation_layout
|
238
|
-
copy_file 'source/layout.erb', File.join(middleman_source_directory, 'layout.erb')
|
239
|
-
copy_file 'source/index.html.erb', File.join(middleman_source_directory, 'index.html.erb')
|
240
|
-
end
|
241
|
-
|
242
|
-
def create_default_slides
|
243
|
-
return unless options[:create_predefined_slides]
|
244
|
-
|
245
|
-
PredefinedSlideTemplateDirectory.new(working_directory: root_directory).template_files.each do |file|
|
246
|
-
template file, File.join(slides_directory, File.basename(file, '.tt'))
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
def create_default_license_file_to_presentation
|
251
|
-
copy_file 'LICENSE.presentation', File.join(root_directory, 'LICENSE.presentation')
|
252
|
-
end
|
253
|
-
|
254
|
-
def create_helper_scripts
|
255
|
-
%w(start bootstrap slide presentation build export).each do |s|
|
256
|
-
copy_file File.join('script', s), File.join(root_directory, 'script', s)
|
257
|
-
chmod File.join(root_directory, 'script', s), 0755
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
def install_external_assets
|
262
|
-
inside directory do
|
263
|
-
message = format('`bower`-command cannot be found in PATH "%s". Please make sure it is installed and PATH includes the directory where is stored.', ENV['PATH'])
|
264
|
-
fail Thor::Error, message if options[:check_for_bower] && File.which('bower').blank?
|
265
|
-
|
266
|
-
result = run('bower update', capture: true) if options[:install_assets] == true
|
267
|
-
fail Thor::Error, "Error executing `bower`-command. Please fix your setup and run again:\n#{result}" unless $CHILD_STATUS.exitstatus == 0
|
268
|
-
end
|
269
|
-
end
|
270
|
-
|
271
|
-
def install_gems
|
272
|
-
inside directory do
|
273
|
-
Bundler.with_clean_env do
|
274
|
-
result = run('bundle install', capture: true) if options[:install_assets] == true
|
275
|
-
fail Thor::Error, "Error executing `bundle`-command. Please fix your setup and run again:\n#{result}" unless $CHILD_STATUS.exitstatus == 0
|
276
|
-
end
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
def initialize_git_directory
|
281
|
-
return unless options[:initialize_git]
|
282
|
-
|
283
|
-
inside directory do
|
284
|
-
run 'git init'
|
285
|
-
run 'git add -A .'
|
286
|
-
run 'git commit -m Init'
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
no_commands do
|
291
|
-
attr_reader :root_directory
|
292
|
-
|
293
|
-
def data_directory
|
294
|
-
File.join root_directory, 'data'
|
295
|
-
end
|
296
|
-
|
297
|
-
def middleman_source_directory
|
298
|
-
File.join root_directory, 'source'
|
299
|
-
end
|
300
|
-
|
301
|
-
def slides_directory
|
302
|
-
File.join middleman_source_directory, Middleman::Presentation.config.slides_directory
|
303
|
-
end
|
304
|
-
end
|
305
|
-
end
|
306
|
-
end
|
307
|
-
end
|
308
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Middleman
|
3
|
-
module Presentation
|
4
|
-
module Cli
|
5
|
-
# Create theme
|
6
|
-
class CreateTheme < Thor::Group
|
7
|
-
include Thor::Actions
|
8
|
-
|
9
|
-
desc 'Create a new presentation theme for middleman-presentation'
|
10
|
-
|
11
|
-
class_option :theme_prefix, default: Middleman::Presentation.config.theme_prefix, desc: 'Prefix for new theme'
|
12
|
-
class_option :stylesheets_directory, default: Middleman::Presentation.config.create_stylesheets_directory, desc: 'Create stylesheets directory'
|
13
|
-
class_option :javascripts_directory, default: Middleman::Presentation.config.create_javascripts_directory, desc: 'Create javascripts directory'
|
14
|
-
class_option :images_directory, default: Middleman::Presentation.config.create_images_directory, desc: 'Create images directory'
|
15
|
-
class_option :author, default: Middleman::Presentation.config.author, desc: 'Author of theme'
|
16
|
-
class_option :email, desc: 'E-mail address of author of theme'
|
17
|
-
class_option :url, desc: 'Project url'
|
18
|
-
class_option :version, default: '0.0.1', required: true, desc: 'Project url'
|
19
|
-
class_option :year, default: Time.now.strftime('%Y'), desc: 'Copyright year for theme'
|
20
|
-
class_option :license, default: 'MIT', required: true, desc: 'License of theme'
|
21
|
-
class_option :initialize_git, type: :boolean, default: Middleman::Presentation.config.initialize_git, desc: 'Initialize git'
|
22
|
-
class_option :clean_css, type: :boolean, default: false, desc: 'Generate clean css without any classes defined'
|
23
|
-
|
24
|
-
argument :name, desc: 'Name of theme'
|
25
|
-
|
26
|
-
def add_path_to_source_paths
|
27
|
-
source_paths << File.expand_path('../../../../templates', __FILE__)
|
28
|
-
end
|
29
|
-
|
30
|
-
def build_theme_name
|
31
|
-
new_name = []
|
32
|
-
new_name << options[:theme_prefix] unless options[:theme_prefix].blank?
|
33
|
-
new_name << name
|
34
|
-
|
35
|
-
@theme_name = new_name.join('-')
|
36
|
-
end
|
37
|
-
|
38
|
-
def create_variables_for_templates
|
39
|
-
@author = options[:author]
|
40
|
-
@year = options[:year]
|
41
|
-
@license = options[:license]
|
42
|
-
@email = options[:email]
|
43
|
-
@version = options[:version]
|
44
|
-
@clean_css = options[:clean_css]
|
45
|
-
end
|
46
|
-
|
47
|
-
def create_theme_directory
|
48
|
-
empty_directory theme_name
|
49
|
-
end
|
50
|
-
|
51
|
-
def create_bower_config_file
|
52
|
-
template 'presentation_theme/bower.json.tt', File.join(theme_name, 'bower.json')
|
53
|
-
end
|
54
|
-
|
55
|
-
def create_asset_directories
|
56
|
-
directory('presentation_theme/javascripts', File.join(theme_name, 'javascripts')) if options[:javascripts_directory]
|
57
|
-
directory('presentation_theme/stylesheets', File.join(theme_name, 'stylesheets')) if options[:stylesheets_directory]
|
58
|
-
directory('presentation_theme/images', File.join(theme_name, 'images')) if options[:images_directory]
|
59
|
-
end
|
60
|
-
|
61
|
-
def initialize_git
|
62
|
-
return unless options[:initialize_git]
|
63
|
-
|
64
|
-
Dir.chdir(theme_name) do
|
65
|
-
run 'git init'
|
66
|
-
run 'git add -A .'
|
67
|
-
run 'git commit -m Init'
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
no_commands do
|
72
|
-
attr_reader :theme_name
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|