indoctrinatr-tools 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -39
- data/.rubocop.yml +2 -3
- data/.ruby-version +1 -0
- data/CHANGELOG.md +9 -1
- data/LICENSE +1 -1
- data/README.md +5 -6
- data/Rakefile +5 -20
- data/cucumber.yml +1 -1
- data/exe/indoctrinatr +4 -0
- data/indoctrinatr-tools.gemspec +24 -24
- data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation-content.tex.erb +4 -4
- data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation.sty +0 -15
- data/lib/indoctrinatr/tools/command_autocomplete_helpers.rb +9 -0
- data/lib/indoctrinatr/tools/commands/bash_completions.rb +21 -0
- data/lib/indoctrinatr/tools/commands/check.rb +26 -0
- data/lib/indoctrinatr/tools/commands/completion_commands.rb +25 -0
- data/lib/indoctrinatr/tools/commands/demo.rb +22 -0
- data/lib/indoctrinatr/tools/commands/doc.rb +28 -0
- data/lib/indoctrinatr/tools/commands/pack.rb +26 -0
- data/lib/indoctrinatr/tools/commands/parse.rb +26 -0
- data/lib/indoctrinatr/tools/commands/pdf.rb +39 -0
- data/lib/indoctrinatr/tools/commands/pdf_with_field_names.rb +28 -0
- data/lib/indoctrinatr/tools/commands/scaffold.rb +26 -0
- data/lib/indoctrinatr/tools/commands/version.rb +13 -0
- data/lib/indoctrinatr/tools/commands/workflow.rb +38 -0
- data/lib/indoctrinatr/tools/commands/zsh_completions.rb +25 -0
- data/lib/indoctrinatr/tools/commands.rb +21 -0
- data/lib/indoctrinatr/tools/configuration_extractor.rb +11 -13
- data/lib/indoctrinatr/tools/content_for_tex_files.rb +5 -3
- data/lib/indoctrinatr/tools/default_values.rb +1 -3
- data/lib/indoctrinatr/tools/field_name_values.rb +3 -5
- data/lib/indoctrinatr/tools/pdf_generator.rb +3 -3
- data/lib/{redcloth_latex_formatter_patch/patch.rb → indoctrinatr/tools/redcloth_formatters_latex_patch.rb} +14 -16
- data/lib/indoctrinatr/tools/template_documentation_content.rb +72 -23
- data/lib/indoctrinatr/tools/template_documentation_source_file.rb +9 -14
- data/lib/indoctrinatr/tools/transactions/template_pack_default_values_compiler.rb +67 -0
- data/lib/indoctrinatr/tools/transactions/template_pack_default_values_parser.rb +82 -0
- data/lib/indoctrinatr/tools/transactions/template_pack_demo.rb +104 -0
- data/lib/indoctrinatr/tools/transactions/template_pack_documentation.rb +223 -0
- data/lib/indoctrinatr/tools/transactions/template_pack_error_checker.rb +127 -0
- data/lib/indoctrinatr/tools/transactions/template_pack_fieldnames_creator.rb +97 -0
- data/lib/indoctrinatr/tools/transactions/template_pack_packer.rb +73 -0
- data/lib/indoctrinatr/tools/transactions/template_pack_scaffold.rb +73 -0
- data/lib/indoctrinatr/tools/version.rb +1 -1
- data/lib/indoctrinatr_tools.rb +12 -0
- metadata +90 -135
- checksums.yaml.gz.sig +0 -3
- data/.coveralls.yml +0 -1
- data/.travis.yml +0 -16
- data/bin/indoctrinatr +0 -182
- data/certs/dkd-reuschling.pem +0 -20
- data/features/autocompletion_support.feature +0 -9
- data/features/demo.feature +0 -17
- data/features/doc_keepauxfiles.feature +0 -13
- data/features/documentation.feature +0 -20
- data/features/fieldnames_pdf.feature +0 -9
- data/features/fieldnames_pdf_auxfiles.feature +0 -10
- data/features/pack.feature +0 -11
- data/features/parse.feature +0 -6
- data/features/pdf.feature +0 -15
- data/features/pdf_keepauxfiles.feature +0 -11
- data/features/pdf_with_timestamp.feature +0 -8
- data/features/scaffold.feature +0 -23
- data/features/step_definitions/common.rb +0 -3
- data/features/step_definitions/indoctrinatr_cli.rb +0 -11
- data/features/support/env.rb +0 -1
- data/features/version.feature +0 -5
- data/features/workflow.feature +0 -9
- data/lib/indoctrinatr/tools/directory_helpers.rb +0 -19
- data/lib/indoctrinatr/tools/template_pack_default_values_compiler.rb +0 -47
- data/lib/indoctrinatr/tools/template_pack_default_values_parser.rb +0 -55
- data/lib/indoctrinatr/tools/template_pack_demo.rb +0 -23
- data/lib/indoctrinatr/tools/template_pack_documentation.rb +0 -132
- data/lib/indoctrinatr/tools/template_pack_error_checker.rb +0 -108
- data/lib/indoctrinatr/tools/template_pack_fieldnames_creator.rb +0 -79
- data/lib/indoctrinatr/tools/template_pack_helpers.rb +0 -69
- data/lib/indoctrinatr/tools/template_pack_packer.rb +0 -49
- data/lib/indoctrinatr/tools/template_pack_scaffold.rb +0 -57
- data/lib/indoctrinatr/tools.rb +0 -9
- data/spec/fixtures/test/configuration.yaml +0 -26
- data/spec/fixtures/test/test.tex.erb +0 -15
- data/spec/indoctrinatr/templates/configuration_file_spec.rb +0 -9
- data/spec/indoctrinatr/templates/tex_file_spec.rb +0 -9
- data/spec/indoctrinatr/tools/textile_support_spec.rb +0 -18
- data/spec/indoctrinatr/tools/version_spec.rb +0 -8
- data/spec/redcloth_latex_formatter_patch/patch_spec.rb +0 -34
- data/spec/spec_helper.rb +0 -2
- data.tar.gz.sig +0 -3
- metadata.gz.sig +0 -2
@@ -1,132 +0,0 @@
|
|
1
|
-
require 'indoctrinatr/tools/template_documentation_content'
|
2
|
-
require 'indoctrinatr/tools/template_pack_helpers'
|
3
|
-
require 'indoctrinatr/tools/template_documentation_helpers'
|
4
|
-
require 'indoctrinatr/tools/configuration_extractor'
|
5
|
-
require 'indoctrinatr/tools/pdf_generator'
|
6
|
-
require 'erubis'
|
7
|
-
require 'to_latex'
|
8
|
-
require 'fileutils'
|
9
|
-
|
10
|
-
module Indoctrinatr
|
11
|
-
module Tools
|
12
|
-
class TemplatePackDocumentation
|
13
|
-
include TemplatePackHelpers
|
14
|
-
include TemplateDocumentationHelpers
|
15
|
-
include PdfGenerator
|
16
|
-
|
17
|
-
attr_accessor :template_pack_name, :keep_aux_files
|
18
|
-
|
19
|
-
def initialize template_pack_name, keep_aux_files = false
|
20
|
-
@template_pack_name = template_pack_name
|
21
|
-
@keep_aux_files = keep_aux_files
|
22
|
-
end
|
23
|
-
|
24
|
-
def call # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
25
|
-
fill_documentation_content
|
26
|
-
read_content_tex_file
|
27
|
-
read_main_tex_file
|
28
|
-
parse_content_tex_file
|
29
|
-
parse_main_tex_file
|
30
|
-
create_temp_compile_dir
|
31
|
-
write_content_tex_file
|
32
|
-
write_main_tex_file
|
33
|
-
copy_source_files
|
34
|
-
if compile_documentation_to_pdf
|
35
|
-
copy_doc_file_to_template_pack
|
36
|
-
if @keep_aux_files
|
37
|
-
copy_helper_files_to_template_pack
|
38
|
-
show_temp_directory
|
39
|
-
else
|
40
|
-
delete_temp_dir
|
41
|
-
end
|
42
|
-
show_success
|
43
|
-
else
|
44
|
-
if @keep_aux_files
|
45
|
-
copy_helper_files_to_template_pack
|
46
|
-
show_temp_directory
|
47
|
-
end
|
48
|
-
handle_latex_error
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def fill_documentation_content
|
55
|
-
configuration = ConfigurationExtractor.new(template_pack_name).call
|
56
|
-
begin
|
57
|
-
@documentation_content = TemplateDocumentationContent.new template_pack_name, configuration
|
58
|
-
rescue IOError => e
|
59
|
-
abort e.message
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def read_content_tex_file
|
64
|
-
@content_tex_file_content = File.read content_tex_file_path
|
65
|
-
end
|
66
|
-
|
67
|
-
def read_main_tex_file
|
68
|
-
@main_tex_file_content = File.read source_main_tex_file_path
|
69
|
-
end
|
70
|
-
|
71
|
-
def parse_content_tex_file
|
72
|
-
@parsed_content_tex_file_content = Erubis::Eruby.new(@content_tex_file_content).result(@documentation_content.retrieve_binding) # TODO: more useful error messages for user on errors
|
73
|
-
end
|
74
|
-
|
75
|
-
def parse_main_tex_file
|
76
|
-
@parsed_main_tex_file_content = Erubis::Eruby.new(@main_tex_file_content).result(@documentation_content.retrieve_binding)
|
77
|
-
end
|
78
|
-
|
79
|
-
def create_temp_compile_dir
|
80
|
-
make_documentation_compile_dir_path_name
|
81
|
-
end
|
82
|
-
|
83
|
-
def write_content_tex_file
|
84
|
-
File.write content_tex_file_destination_path, @parsed_content_tex_file_content
|
85
|
-
end
|
86
|
-
|
87
|
-
def write_main_tex_file
|
88
|
-
File.write main_tex_file_destination_path, @parsed_main_tex_file_content
|
89
|
-
end
|
90
|
-
|
91
|
-
def copy_source_files
|
92
|
-
FileUtils.copy_file source_latex_package_file_path, latex_package_destination_path
|
93
|
-
FileUtils.copy_file source_letterpaper_file_path, letterpaper_file_destination_path
|
94
|
-
FileUtils.copy_file source_image_tools_package_file_path, image_tools_package_destination_path
|
95
|
-
end
|
96
|
-
|
97
|
-
def compile_documentation_to_pdf
|
98
|
-
make_pdf main_tex_file_destination_path, documentation_compile_dir_path_name, !@keep_aux_files
|
99
|
-
end
|
100
|
-
|
101
|
-
def copy_helper_files_to_template_pack
|
102
|
-
helper_files_to_copy = [latex_log_file, content_tex_file_destination_path, main_tex_file_destination_path].freeze
|
103
|
-
Dir.mkdir(pack_documentation_dir_path) unless Dir.exist?(pack_documentation_dir_path)
|
104
|
-
FileUtils.copy helper_files_to_copy, pack_documentation_dir_path
|
105
|
-
puts 'TeX files and log file have been copied to doc subdirectory of your template_pack'
|
106
|
-
end
|
107
|
-
|
108
|
-
def copy_doc_file_to_template_pack
|
109
|
-
# All the documentation shall go into template_pack/doc
|
110
|
-
Dir.mkdir(pack_documentation_dir_path) unless Dir.exist?(pack_documentation_dir_path)
|
111
|
-
FileUtils.copy_file documentation_file_path, pack_technical_documentation_file_path
|
112
|
-
end
|
113
|
-
|
114
|
-
def show_temp_directory
|
115
|
-
puts "Look into the directory #{documentation_temp_dir} to see all files related to the technical documentation compilation"
|
116
|
-
end
|
117
|
-
|
118
|
-
def delete_temp_dir
|
119
|
-
FileUtils.remove_entry_secure documentation_compile_dir_path_name
|
120
|
-
end
|
121
|
-
|
122
|
-
def handle_latex_error
|
123
|
-
puts "possible LaTeX compilation failure! see #{latex_log_file_destination} for details. " # idea: process $CHILD_STATUS
|
124
|
-
FileUtils.copy_file latex_log_file, latex_log_file_destination
|
125
|
-
end
|
126
|
-
|
127
|
-
def show_success
|
128
|
-
puts "A documentation for '#{template_pack_name}' has been successfully generated."
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
@@ -1,108 +0,0 @@
|
|
1
|
-
require 'indoctrinatr/tools/template_pack_helpers'
|
2
|
-
|
3
|
-
module Indoctrinatr
|
4
|
-
module Tools
|
5
|
-
class TemplatePackErrorChecker
|
6
|
-
include TemplatePackHelpers
|
7
|
-
|
8
|
-
# class wide constants
|
9
|
-
# needs to match indoctrinatr's TemplateField model
|
10
|
-
VALID_PRESENTATIONS = %w[text textarea checkbox radiobutton dropdown date range file].freeze
|
11
|
-
REQUIRES_AVAILABLE_OPTIONS = %w[dropdown checkbox radiobutton].freeze
|
12
|
-
|
13
|
-
attr_accessor :template_pack_name, :config_file
|
14
|
-
def initialize template_pack_name
|
15
|
-
@template_pack_name = template_pack_name
|
16
|
-
end
|
17
|
-
|
18
|
-
def call
|
19
|
-
check_config_file_existence && check_config_file_syntax && check_attributes
|
20
|
-
# TODO: check multiple variable name declaration (low-prio)
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def check_config_file_existence
|
26
|
-
return true if File.exist? config_file_path
|
27
|
-
|
28
|
-
puts 'The file configuration.yaml does not exist in the template_pack directory'
|
29
|
-
false
|
30
|
-
end
|
31
|
-
|
32
|
-
# YAML syntax check
|
33
|
-
def check_config_file_syntax
|
34
|
-
puts 'Checking YAML syntax...'
|
35
|
-
YAML.parse_file config_file_path
|
36
|
-
puts 'YAML syntax ok!'
|
37
|
-
true
|
38
|
-
rescue YAML::SyntaxError => e # no program abort when this exception is thrown
|
39
|
-
puts 'YAML syntax error in configuration.yaml, see error for details:'
|
40
|
-
puts e.message
|
41
|
-
false
|
42
|
-
end
|
43
|
-
|
44
|
-
def check_attributes
|
45
|
-
configuration = ConfigurationExtractor.new(template_pack_name).call
|
46
|
-
puts 'Checking...'
|
47
|
-
|
48
|
-
configuration.attributes_as_hashes_in_array.each_with_index do |attribute_hash, index|
|
49
|
-
identifier = "Variable number #{index + 1}" # string for the user to localize variable with errors/warnings
|
50
|
-
name_field = check_field_attribute attribute_hash, identifier, 'name'
|
51
|
-
identifier = "Variable \"#{name_field}\"" if name_field != false
|
52
|
-
|
53
|
-
check_presentation attribute_hash, identifier
|
54
|
-
|
55
|
-
check_field_attribute attribute_hash, identifier, 'default_value'
|
56
|
-
|
57
|
-
check_field_attribute attribute_hash, identifier, 'description'
|
58
|
-
# idea: warning if no required attribute?
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# false if something wrong, otherwise returns the key value
|
63
|
-
def check_field_attribute attribute_hash, field_identifier, key
|
64
|
-
unless attribute_hash.key? key
|
65
|
-
puts "The #{field_identifier} has no #{key} type set!"
|
66
|
-
return false
|
67
|
-
end
|
68
|
-
if attribute_hash[key].nil? || attribute_hash[key].empty?
|
69
|
-
puts "The #{field_identifier} has an empty #{key}!"
|
70
|
-
false
|
71
|
-
else
|
72
|
-
attribute_hash[key]
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def check_presentation attribute_hash, identifier
|
77
|
-
presentation = check_field_attribute attribute_hash, identifier, 'presentation'
|
78
|
-
return false unless presentation
|
79
|
-
|
80
|
-
# check if it is one of the options
|
81
|
-
puts "Not an allowed presentation option set for #{identifier}" unless VALID_PRESENTATIONS.include? presentation
|
82
|
-
check_available_options attribute_hash, identifier, presentation if REQUIRES_AVAILABLE_OPTIONS.include? presentation
|
83
|
-
check_presentation_range attribute_hash, identifier, presentation if presentation == 'range'
|
84
|
-
end
|
85
|
-
|
86
|
-
def check_available_options attribute_hash, identifier, presentation_type
|
87
|
-
unless attribute_hash.key? 'available_options'
|
88
|
-
puts "The #{identifier} has no available_options (needed for #{presentation_type} presentation)"
|
89
|
-
return false
|
90
|
-
end
|
91
|
-
available_options = attribute_hash['available_options']
|
92
|
-
if available_options.nil?
|
93
|
-
puts("available_options for #{identifier} is empty (needed for #{presentation_type} presentation)")
|
94
|
-
false
|
95
|
-
else
|
96
|
-
puts("available_options for #{identifier} has only one option. That is useless.") if available_options.count(',') == 1
|
97
|
-
true
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def check_presentation_range attribute_hash, identifier, presentation
|
102
|
-
puts "The #{identifier} has no start_of_range field (needed for #{presentation} presentation)" unless attribute_hash.key? 'start_of_range'
|
103
|
-
puts "The #{identifier} has no end_of_range field (needed for #{presentation} presentation)" unless attribute_hash.key? 'end_of_range'
|
104
|
-
# TODO: check for content
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'indoctrinatr/tools/template_pack_helpers'
|
2
|
-
require 'indoctrinatr/tools/field_name_values'
|
3
|
-
require 'indoctrinatr/tools/configuration_extractor'
|
4
|
-
require 'indoctrinatr/tools/pdf_generator'
|
5
|
-
require 'erubis'
|
6
|
-
require 'to_latex'
|
7
|
-
|
8
|
-
module Indoctrinatr
|
9
|
-
module Tools
|
10
|
-
class TemplatePackFieldnamesCreator
|
11
|
-
include TemplatePackHelpers
|
12
|
-
include PdfGenerator
|
13
|
-
|
14
|
-
attr_accessor :template_pack_name, :configuration, :field_name_values, :tex_file_content, :parsed_tex_file_content
|
15
|
-
|
16
|
-
def initialize template_pack_name, keep_aux_files = false
|
17
|
-
@template_pack_name = template_pack_name
|
18
|
-
@keep_aux_files = keep_aux_files
|
19
|
-
end
|
20
|
-
|
21
|
-
def call
|
22
|
-
check_for_folder
|
23
|
-
read_config_file
|
24
|
-
read_tex_file
|
25
|
-
parse_tex_file
|
26
|
-
write_tex_file
|
27
|
-
if compile_tex_file
|
28
|
-
show_success
|
29
|
-
true
|
30
|
-
else
|
31
|
-
handle_latex_error
|
32
|
-
false
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def pdf_exists?
|
37
|
-
check_for_folder
|
38
|
-
File.exist? pdf_with_fieldname_values_file_path
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def read_config_file
|
44
|
-
@configuration = ConfigurationExtractor.new(template_pack_name).call
|
45
|
-
@field_name_values = FieldNameValues.new @configuration
|
46
|
-
field_name_values._field_names_as_values
|
47
|
-
end
|
48
|
-
|
49
|
-
def read_tex_file
|
50
|
-
@tex_file_content = File.read tex_file_path
|
51
|
-
end
|
52
|
-
|
53
|
-
def parse_tex_file
|
54
|
-
@parsed_tex_file_content = Erubis::Eruby.new(@tex_file_content).result(field_name_values.retrieve_binding)
|
55
|
-
end
|
56
|
-
|
57
|
-
def write_tex_file
|
58
|
-
# Create directory to avoid file creation errors
|
59
|
-
Dir.mkdir(pack_documentation_dir_path) unless Dir.exist?(pack_documentation_dir_path)
|
60
|
-
Dir.mkdir(pack_documentation_examples_dir_path) unless Dir.exist?(pack_documentation_examples_dir_path)
|
61
|
-
File.write tex_with_fieldname_values_file_path, parsed_tex_file_content
|
62
|
-
end
|
63
|
-
|
64
|
-
def compile_tex_file
|
65
|
-
make_pdf tex_with_fieldname_values_file_path, pack_documentation_examples_dir_path, !@keep_aux_files
|
66
|
-
end
|
67
|
-
|
68
|
-
def handle_latex_error
|
69
|
-
puts 'possible LaTeX compilation failure!' # see #{latex_log_file_destination} for details. " # idea: process $CHILD_STATUS
|
70
|
-
# FileUtils.copy_file latex_log_file, latex_log_file_destination
|
71
|
-
end
|
72
|
-
|
73
|
-
def show_success
|
74
|
-
puts "The template pack '#{template_pack_name}' has been successfully parsed with the variable names"
|
75
|
-
puts 'Please check the .tex file and modify it to your needs and compile it again'
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'indoctrinatr/tools/default_values'
|
2
|
-
|
3
|
-
module Indoctrinatr
|
4
|
-
module Tools
|
5
|
-
# classes that use this model are required to have template_pack_name as instance variable
|
6
|
-
module TemplatePackHelpers
|
7
|
-
def path_name
|
8
|
-
Pathname.new(Dir.pwd).join template_pack_name
|
9
|
-
end
|
10
|
-
|
11
|
-
def assets_path
|
12
|
-
path_name.join 'assets'
|
13
|
-
end
|
14
|
-
|
15
|
-
def check_for_folder
|
16
|
-
fail 'Please specify a template pack name.' if template_pack_name.empty? # rubocop:disable Style/SignalException
|
17
|
-
fail "A folder with name '#{template_pack_name}' does not exist." unless Dir.exist? path_name # rubocop:disable Style/SignalException
|
18
|
-
end
|
19
|
-
|
20
|
-
def config_file_path
|
21
|
-
path_name.join 'configuration.yaml'
|
22
|
-
end
|
23
|
-
|
24
|
-
def tex_file_path
|
25
|
-
path_name.join template_pack_name + '.tex.erb'
|
26
|
-
end
|
27
|
-
|
28
|
-
def tex_with_default_values_file_path
|
29
|
-
pack_documentation_examples_dir_path.join template_pack_name + '_with_default_values.tex'
|
30
|
-
end
|
31
|
-
|
32
|
-
# get file path for PDF example with default values:
|
33
|
-
def pdf_with_default_values_file_path configuration # rubocop:disable Metrics/AbcSize
|
34
|
-
default_values = DefaultValues.new configuration
|
35
|
-
# if there is a change in where the pdf command (DefaultValuesCompiler) saves it's output, this logic needs to be updated
|
36
|
-
if default_values.customized_output_file_name == default_values.default_file_name
|
37
|
-
Pathname.new(Dir.pwd).join pack_documentation_examples_dir_path + default_values.customized_output_file_name
|
38
|
-
else
|
39
|
-
Pathname.new(Dir.pwd).join pack_documentation_examples_dir_path + eval('"' + default_values.output_file_name + '"') # rubocop:disable Security/Eval
|
40
|
-
# usage of eval to execute the interpolation of a custom filename string with interpolation - e.g. a filename with the current date
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def pdf_with_fieldname_values_file_path
|
45
|
-
"#{pack_documentation_examples_dir_path.join template_pack_name}_with_fieldname_values.pdf"
|
46
|
-
end
|
47
|
-
|
48
|
-
def tex_with_fieldname_values_file_path
|
49
|
-
"#{pack_documentation_examples_dir_path.join template_pack_name}_with_fieldname_values.tex"
|
50
|
-
end
|
51
|
-
|
52
|
-
def pack_documentation_dir_path
|
53
|
-
path_name.join 'doc'
|
54
|
-
end
|
55
|
-
|
56
|
-
def pack_documentation_examples_dir_path
|
57
|
-
pack_documentation_dir_path.join 'examples'
|
58
|
-
end
|
59
|
-
|
60
|
-
def pack_technical_documentation_file_path
|
61
|
-
pack_documentation_dir_path.join template_pack_name + '_technical_documentation.pdf'
|
62
|
-
end
|
63
|
-
|
64
|
-
def latex_log_file_destination
|
65
|
-
path_name.join template_pack_name + 'documentation_latex_failure.log'
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'indoctrinatr/tools/template_pack_helpers'
|
2
|
-
require 'zip'
|
3
|
-
|
4
|
-
module Indoctrinatr
|
5
|
-
module Tools
|
6
|
-
class TemplatePackPacker
|
7
|
-
include TemplatePackHelpers
|
8
|
-
|
9
|
-
attr_accessor :template_pack_name
|
10
|
-
|
11
|
-
def initialize template_pack_name
|
12
|
-
@template_pack_name = template_pack_name
|
13
|
-
end
|
14
|
-
|
15
|
-
def call
|
16
|
-
check_for_folder
|
17
|
-
remove_existing_zip
|
18
|
-
zip_template_folder
|
19
|
-
show_success
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def remove_existing_zip
|
25
|
-
FileUtils.rm destination_zip_file, force: true
|
26
|
-
end
|
27
|
-
|
28
|
-
def zip_template_folder
|
29
|
-
Zip::File.open(destination_zip_file, Zip::File::CREATE) do |zipfile|
|
30
|
-
Dir[File.join(path_name, '**', '**')].each do |file|
|
31
|
-
zipfile.add(internal_file_name(file), file)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def show_success
|
37
|
-
puts "The template pack '#{template_pack_name}.zip' was created successfully."
|
38
|
-
end
|
39
|
-
|
40
|
-
def destination_zip_file
|
41
|
-
Pathname.new(Dir.pwd).join "#{template_pack_name}.zip"
|
42
|
-
end
|
43
|
-
|
44
|
-
def internal_file_name file_name
|
45
|
-
template_pack_name + '/' + file_name.sub(path_name.to_s, '')[1..-1] # remove leading /
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'indoctrinatr/tools/template_pack_helpers'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
module Indoctrinatr
|
5
|
-
module Tools
|
6
|
-
class TemplatePackScaffold
|
7
|
-
include TemplatePackHelpers
|
8
|
-
|
9
|
-
attr_accessor :template_pack_name
|
10
|
-
|
11
|
-
def initialize template_pack_name
|
12
|
-
@template_pack_name = template_pack_name
|
13
|
-
end
|
14
|
-
|
15
|
-
def call
|
16
|
-
create_folder
|
17
|
-
create_asset_folder
|
18
|
-
copy_configuration_file
|
19
|
-
copy_tex_file
|
20
|
-
show_success
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def create_folder
|
26
|
-
fail 'Please specify a template pack name.' if template_pack_name.nil? || template_pack_name.empty? # rubocop:disable Style/SignalException
|
27
|
-
fail "A folder with name '#{template_pack_name}' already exists." if Dir.exist? path_name # rubocop:disable Style/SignalException
|
28
|
-
|
29
|
-
Dir.mkdir path_name
|
30
|
-
end
|
31
|
-
|
32
|
-
def create_asset_folder
|
33
|
-
Dir.mkdir path_name.join('assets')
|
34
|
-
end
|
35
|
-
|
36
|
-
def copy_configuration_file
|
37
|
-
FileUtils.copy_file source_config_file_path, config_file_path
|
38
|
-
end
|
39
|
-
|
40
|
-
def copy_tex_file
|
41
|
-
FileUtils.copy_file source_tex_file_path, tex_file_path
|
42
|
-
end
|
43
|
-
|
44
|
-
def show_success
|
45
|
-
puts "A template pack scaffold was created in folder '#{template_pack_name}'. Happy templating…"
|
46
|
-
end
|
47
|
-
|
48
|
-
def source_config_file_path
|
49
|
-
Pathname.new(File.expand_path(__dir__)).join('..', 'templates', 'configuration.yaml')
|
50
|
-
end
|
51
|
-
|
52
|
-
def source_tex_file_path
|
53
|
-
Pathname.new(File.expand_path(__dir__)).join('..', 'templates', 'template.tex.erb')
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/lib/indoctrinatr/tools.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
template_name: Hello World Template
|
2
|
-
output_file_name: '#{Time.now.year}_hello_world.pdf'
|
3
|
-
textual_description: |
|
4
|
-
This is your first _Indoctrinatr_ template. You can use _Textile_ syntax here to *highlight* important information.
|
5
|
-
|
6
|
-
Edit this template as you like. Read more at https://github.com/dkd/indoctrinatr.
|
7
|
-
fields:
|
8
|
-
-
|
9
|
-
name: variable1
|
10
|
-
label: Who is it?
|
11
|
-
presentation: text
|
12
|
-
default_value: "World"
|
13
|
-
description: "The first variable"
|
14
|
-
-
|
15
|
-
name: date
|
16
|
-
label: Date
|
17
|
-
presentation: date
|
18
|
-
default_value: '#{Time.now.year}-#{Time.now.month}-#{Time.now.day}'
|
19
|
-
-
|
20
|
-
name: variable2
|
21
|
-
label: Type of World
|
22
|
-
required: "true"
|
23
|
-
presentation: dropdown
|
24
|
-
default_value: "not enough"
|
25
|
-
available_options: "not enough, beautiful, your oyster, a template"
|
26
|
-
description: "The second variable. The description name can be very long and should adequately describe what the variable is for etc. pp."
|
@@ -1,15 +0,0 @@
|
|
1
|
-
% This is the official Indoctrinatr "Hello World Template".
|
2
|
-
\documentclass{article}
|
3
|
-
|
4
|
-
\begin{document}
|
5
|
-
\section{Hello <%= variable1 -%>}
|
6
|
-
|
7
|
-
The <%= variable1 -%> is <%= variable2 -%>!
|
8
|
-
|
9
|
-
Today is \textbf{<%= date -%>}.
|
10
|
-
|
11
|
-
% This is is the raw, unescaped input of \texttt{variable1}:
|
12
|
-
\begin{verbatim}
|
13
|
-
<%= raw_variable1 -%>
|
14
|
-
\end{verbatim}
|
15
|
-
\end{document}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
context 'with configuration.yaml' do
|
5
|
-
it 'exists' do
|
6
|
-
configuration_file = Pathname.new(__FILE__).join '..', '..', '..', '..', 'lib', 'indoctrinatr', 'templates', 'configuration.yaml'
|
7
|
-
expect(File.exist?(configuration_file)).to eq true
|
8
|
-
end
|
9
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
context 'with template.tex.erb' do
|
5
|
-
it 'exists' do
|
6
|
-
template_file = Pathname.new(__FILE__).join '..', '..', '..', '..', 'lib', 'indoctrinatr', 'templates', 'template.tex.erb'
|
7
|
-
expect(File.exist?(template_file)).to eq true
|
8
|
-
end
|
9
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'indoctrinatr/tools/default_values'
|
3
|
-
require 'indoctrinatr/tools/template_pack_configuration'
|
4
|
-
|
5
|
-
context "when supporting Textile with 'textilize' function" do
|
6
|
-
let(:configuration) do
|
7
|
-
c = Indoctrinatr::Tools::TemplatePackConfiguration.new
|
8
|
-
c.attributes_as_hashes_in_array = []
|
9
|
-
c.template_asset_path = ''
|
10
|
-
c.output_file_name = ''
|
11
|
-
c
|
12
|
-
end
|
13
|
-
let(:default_values) { Indoctrinatr::Tools::DefaultValues.new configuration }
|
14
|
-
|
15
|
-
it 'parses to LaTeX' do
|
16
|
-
expect(default_values.textile2latex('*strong*')).to eq "\\textbf{strong}\n\n"
|
17
|
-
end
|
18
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'redcloth_latex_formatter_patch/patch'
|
3
|
-
|
4
|
-
context 'with patches for RedCloth::LATEX::Formatter' do
|
5
|
-
it 'tranforms a h1. headline to LaTeX chapter notation' do
|
6
|
-
text = 'h1. Headline'
|
7
|
-
expect(RedCloth.new(text).to_latex).to eq "\\chapter{Headline}\n\n"
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'tranforms a h2. headline to LaTeX section notation' do
|
11
|
-
text = 'h2. Headline'
|
12
|
-
expect(RedCloth.new(text).to_latex).to eq "\\section{Headline}\n\n"
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'tranforms a h3. headline to LaTeX subsection notation' do
|
16
|
-
text = 'h3. Headline'
|
17
|
-
expect(RedCloth.new(text).to_latex).to eq "\\subsection{Headline}\n\n"
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'tranforms a h4. headline to LaTeX subsubsection notation' do
|
21
|
-
text = 'h4. Headline'
|
22
|
-
expect(RedCloth.new(text).to_latex).to eq "\\subsubsection{Headline}\n\n"
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'transforms a table to LaTeX tabu notation' do
|
26
|
-
input = "|_.Headerspalte 1|_.Headerspalte 2|\n|Feld 1,1 |Feld 2,1 |\n|Feld 1,2 |Feld 2,2 |"
|
27
|
-
expected_result = "\\begin{tabu}{ l l }\n Headerspalte 1 & Headerspalte 2 \\\\\n \\tabletoprule\n Feld 1,1 & Feld 2,1 \\\\\n Feld 1,2 & Feld 2,2 \\\\\n \\tablebottomrule\n\\end{tabu}\n"
|
28
|
-
expect(RedCloth.new(input).to_latex).to eq expected_result
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'transforms -text- to to LaTeX \st{}' do
|
32
|
-
expect(RedCloth.new('-no no no-').to_latex).to eq "\\st{no no no}\n\n"
|
33
|
-
end
|
34
|
-
end
|
data/spec/spec_helper.rb
DELETED
data.tar.gz.sig
DELETED
metadata.gz.sig
DELETED