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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -39
  3. data/.rubocop.yml +2 -3
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +9 -1
  6. data/LICENSE +1 -1
  7. data/README.md +5 -6
  8. data/Rakefile +5 -20
  9. data/cucumber.yml +1 -1
  10. data/exe/indoctrinatr +4 -0
  11. data/indoctrinatr-tools.gemspec +24 -24
  12. data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation-content.tex.erb +4 -4
  13. data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation.sty +0 -15
  14. data/lib/indoctrinatr/tools/command_autocomplete_helpers.rb +9 -0
  15. data/lib/indoctrinatr/tools/commands/bash_completions.rb +21 -0
  16. data/lib/indoctrinatr/tools/commands/check.rb +26 -0
  17. data/lib/indoctrinatr/tools/commands/completion_commands.rb +25 -0
  18. data/lib/indoctrinatr/tools/commands/demo.rb +22 -0
  19. data/lib/indoctrinatr/tools/commands/doc.rb +28 -0
  20. data/lib/indoctrinatr/tools/commands/pack.rb +26 -0
  21. data/lib/indoctrinatr/tools/commands/parse.rb +26 -0
  22. data/lib/indoctrinatr/tools/commands/pdf.rb +39 -0
  23. data/lib/indoctrinatr/tools/commands/pdf_with_field_names.rb +28 -0
  24. data/lib/indoctrinatr/tools/commands/scaffold.rb +26 -0
  25. data/lib/indoctrinatr/tools/commands/version.rb +13 -0
  26. data/lib/indoctrinatr/tools/commands/workflow.rb +38 -0
  27. data/lib/indoctrinatr/tools/commands/zsh_completions.rb +25 -0
  28. data/lib/indoctrinatr/tools/commands.rb +21 -0
  29. data/lib/indoctrinatr/tools/configuration_extractor.rb +11 -13
  30. data/lib/indoctrinatr/tools/content_for_tex_files.rb +5 -3
  31. data/lib/indoctrinatr/tools/default_values.rb +1 -3
  32. data/lib/indoctrinatr/tools/field_name_values.rb +3 -5
  33. data/lib/indoctrinatr/tools/pdf_generator.rb +3 -3
  34. data/lib/{redcloth_latex_formatter_patch/patch.rb → indoctrinatr/tools/redcloth_formatters_latex_patch.rb} +14 -16
  35. data/lib/indoctrinatr/tools/template_documentation_content.rb +72 -23
  36. data/lib/indoctrinatr/tools/template_documentation_source_file.rb +9 -14
  37. data/lib/indoctrinatr/tools/transactions/template_pack_default_values_compiler.rb +67 -0
  38. data/lib/indoctrinatr/tools/transactions/template_pack_default_values_parser.rb +82 -0
  39. data/lib/indoctrinatr/tools/transactions/template_pack_demo.rb +104 -0
  40. data/lib/indoctrinatr/tools/transactions/template_pack_documentation.rb +223 -0
  41. data/lib/indoctrinatr/tools/transactions/template_pack_error_checker.rb +127 -0
  42. data/lib/indoctrinatr/tools/transactions/template_pack_fieldnames_creator.rb +97 -0
  43. data/lib/indoctrinatr/tools/transactions/template_pack_packer.rb +73 -0
  44. data/lib/indoctrinatr/tools/transactions/template_pack_scaffold.rb +73 -0
  45. data/lib/indoctrinatr/tools/version.rb +1 -1
  46. data/lib/indoctrinatr_tools.rb +12 -0
  47. metadata +90 -135
  48. checksums.yaml.gz.sig +0 -3
  49. data/.coveralls.yml +0 -1
  50. data/.travis.yml +0 -16
  51. data/bin/indoctrinatr +0 -182
  52. data/certs/dkd-reuschling.pem +0 -20
  53. data/features/autocompletion_support.feature +0 -9
  54. data/features/demo.feature +0 -17
  55. data/features/doc_keepauxfiles.feature +0 -13
  56. data/features/documentation.feature +0 -20
  57. data/features/fieldnames_pdf.feature +0 -9
  58. data/features/fieldnames_pdf_auxfiles.feature +0 -10
  59. data/features/pack.feature +0 -11
  60. data/features/parse.feature +0 -6
  61. data/features/pdf.feature +0 -15
  62. data/features/pdf_keepauxfiles.feature +0 -11
  63. data/features/pdf_with_timestamp.feature +0 -8
  64. data/features/scaffold.feature +0 -23
  65. data/features/step_definitions/common.rb +0 -3
  66. data/features/step_definitions/indoctrinatr_cli.rb +0 -11
  67. data/features/support/env.rb +0 -1
  68. data/features/version.feature +0 -5
  69. data/features/workflow.feature +0 -9
  70. data/lib/indoctrinatr/tools/directory_helpers.rb +0 -19
  71. data/lib/indoctrinatr/tools/template_pack_default_values_compiler.rb +0 -47
  72. data/lib/indoctrinatr/tools/template_pack_default_values_parser.rb +0 -55
  73. data/lib/indoctrinatr/tools/template_pack_demo.rb +0 -23
  74. data/lib/indoctrinatr/tools/template_pack_documentation.rb +0 -132
  75. data/lib/indoctrinatr/tools/template_pack_error_checker.rb +0 -108
  76. data/lib/indoctrinatr/tools/template_pack_fieldnames_creator.rb +0 -79
  77. data/lib/indoctrinatr/tools/template_pack_helpers.rb +0 -69
  78. data/lib/indoctrinatr/tools/template_pack_packer.rb +0 -49
  79. data/lib/indoctrinatr/tools/template_pack_scaffold.rb +0 -57
  80. data/lib/indoctrinatr/tools.rb +0 -9
  81. data/spec/fixtures/test/configuration.yaml +0 -26
  82. data/spec/fixtures/test/test.tex.erb +0 -15
  83. data/spec/indoctrinatr/templates/configuration_file_spec.rb +0 -9
  84. data/spec/indoctrinatr/templates/tex_file_spec.rb +0 -9
  85. data/spec/indoctrinatr/tools/textile_support_spec.rb +0 -18
  86. data/spec/indoctrinatr/tools/version_spec.rb +0 -8
  87. data/spec/redcloth_latex_formatter_patch/patch_spec.rb +0 -34
  88. data/spec/spec_helper.rb +0 -2
  89. data.tar.gz.sig +0 -3
  90. metadata.gz.sig +0 -2
data/bin/indoctrinatr DELETED
@@ -1,182 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'gli'
3
- require 'indoctrinatr/tools/version'
4
- require 'indoctrinatr/tools/template_pack_demo'
5
- require 'indoctrinatr/tools/template_pack_scaffold'
6
- require 'indoctrinatr/tools/template_pack_packer'
7
- require 'indoctrinatr/tools/template_pack_default_values_parser'
8
- require 'indoctrinatr/tools/template_pack_default_values_compiler'
9
- require 'indoctrinatr/tools/template_pack_fieldnames_creator'
10
- require 'indoctrinatr/tools/template_pack_documentation'
11
- require 'indoctrinatr/tools/template_pack_error_checker'
12
-
13
- # rubocop:disable Style/MixinUsage
14
- include GLI::App
15
- include Indoctrinatr::Tools
16
- # rubocop:enable Style/MixinUsage
17
-
18
- program_desc 'Create and manage Template Packs for Indoctrinatr'
19
- version Indoctrinatr::Tools::VERSION
20
- config_file '.indoctrinatr.rc'
21
-
22
- desc 'Display current version'
23
- command :version do |c|
24
- c.action do
25
- puts Indoctrinatr::Tools::VERSION
26
- end
27
- end
28
-
29
- desc 'Display the suggested workflow'
30
- command :workflow do |c|
31
- c.action do
32
- puts <<~HEREDOC
33
- The workflow for a project (e.g. demo) typically looks like this:
34
-
35
- 1. Run in shell: indoctrinatr new demo
36
- Creates a new Indoctrinatr Template Pack in the folder demo
37
-
38
- 2. Edit demo.tex.erb and configuration.yaml according to needs
39
-
40
- 3. Run in shell: indoctrinatr parse demo
41
- Parses tex file demo_with_default_values.tex with ERB and default values from configuration.yaml
42
-
43
- 4. Run in shell: indoctrinatr pdf demo
44
- Compiles PDF from demo_with_default_values.tex
45
-
46
- 5. Run in shell: indoctrinatr check demo
47
- Analyzes your Template Pack for potential errors
48
-
49
- 6. Run in shell: indoctrinatr doc demo
50
- Creates a technical documentation for the Template Pack
51
-
52
- 7. Run in shell: indoctrinatr pack demo
53
- Creates demo.zip with all required file for upload to Indoctrinatr server
54
- HEREDOC
55
- end
56
- end
57
-
58
- desc 'Create, compile and pack a demo project'
59
- command :demo do |c|
60
- c.action do
61
- TemplatePackDemo.new('demo').call
62
- end
63
- end
64
-
65
- pre do |global_options, _, _, args|
66
- # modify template_pack_name argument. This removes a trailing '/' that we get when users use tab completion
67
- global_options['template_pack_name'] = File.split(args[0])[1] unless args.empty?
68
- true # pre condition returns false when nothing is done
69
- end
70
-
71
- desc 'Create a scaffold for a new Template Pack'
72
- arg_name 'template-pack-name'
73
- command :new do |c|
74
- c.action do |global_options, _, _|
75
- template_pack_name = global_options['template_pack_name']
76
- TemplatePackScaffold.new(template_pack_name).call
77
- end
78
- end
79
-
80
- desc 'Parse XeTeX file with ERB and default values of Template Pack'
81
- arg_name 'template_pack_name'
82
- command :parse do |c|
83
- c.action do |global_options, _, _|
84
- template_pack_name = global_options['template_pack_name']
85
- TemplatePackDefaultValuesParser.new(template_pack_name).call
86
- end
87
- end
88
-
89
- desc 'Compile PDF with default values'
90
- arg_name 'template_pack_name'
91
- command :pdf do |c|
92
- c.desc 'Keep generated aux files'
93
- c.switch [:'keep-aux-files']
94
- c.action do |global_options, options, _|
95
- template_pack_name = global_options['template_pack_name']
96
- keep_aux_files = options[:'keep-aux-files']
97
- TemplatePackDefaultValuesParser.new(template_pack_name).call
98
- TemplatePackDefaultValuesCompiler.new(template_pack_name, keep_aux_files).call
99
- end
100
- end
101
-
102
- desc 'Compile PDF with Variable Names as values'
103
- arg_name 'template_pack_name'
104
- command :pdf_with_field_names do |c|
105
- c.desc 'Keep generated aux files'
106
- c.switch [:'keep-aux-files']
107
- c.action do |global_options, options, _|
108
- template_pack_name = global_options['template_pack_name']
109
- keep_aux_files = options[:'keep-aux-files']
110
- TemplatePackFieldnamesCreator.new(template_pack_name, keep_aux_files).call
111
- end
112
- end
113
-
114
- desc 'Create a documentation from a given source folder'
115
- arg_name 'template_pack_name'
116
- command :doc do |c|
117
- c.desc 'Keep generated aux files'
118
- c.switch [:'keep-aux-files']
119
- c.action do |global_options, options, _|
120
- template_pack_name = global_options['template_pack_name']
121
- keep_aux_files = options[:'keep-aux-files']
122
- TemplatePackDocumentation.new(template_pack_name, keep_aux_files).call
123
- end
124
- end
125
-
126
- desc 'Check for errors in the given source folder'
127
- arg_name 'template_pack_name'
128
- command :check do |c|
129
- c.action do |global_options, _, _|
130
- template_pack_name = global_options['template_pack_name']
131
- TemplatePackErrorChecker.new(template_pack_name).call
132
- end
133
- end
134
-
135
- desc 'Create a Template Pack from a given source folder'
136
- arg_name 'template_pack_name'
137
- command :pack do |c|
138
- c.action do |global_options, _, _|
139
- template_pack_name = global_options['template_pack_name']
140
- TemplatePackPacker.new(template_pack_name).call
141
- end
142
- end
143
-
144
- desc 'Display instructions for bash completion'
145
- command :bashcompletion do |c|
146
- c.action do
147
- puts <<~HEREDOC
148
- Add this to your .bashrc (and open up a new shell):
149
- complete -F get_indoctrinatr_targets indoctrinatr
150
- function get_indoctrinatr_targets()
151
- {
152
- if [ -z $2 ] ; then
153
- COMPREPLY=(`indoctrinatr help -c`)
154
- else
155
- COMPREPLY=(`indoctrinatr help -c $2`)
156
- fi
157
- }
158
- HEREDOC
159
- end
160
- end
161
-
162
- # thanks to http://devopsbox.es/posts/2013/10-31-the-cleanest-gli-bash-zsh-tab-completion.html
163
- desc 'Display instructions for zsh completion'
164
- command :zshcompletion do |c|
165
- c.action do
166
- puts 'Add this to your .zshrc (and open up a new shell):
167
- if [[ -n ${ZSH_VERSION-} ]]; then
168
- autoload -U +X bashcompinit && bashcompinit
169
- fi
170
- complete -F get_indoctrinatr_commands indoctrinatr
171
- function get_indoctrinatr_commands()
172
- {
173
- local binary="indoctrinatr"
174
- help_params=${COMP_WORDS[@]:1}
175
- clean_params=${help_params//-*([^ ])?( )}
176
- COMPREPLY=(`$binary help -c $clean_params`)
177
- }
178
- '
179
- end
180
- end
181
-
182
- exit run(ARGV)
@@ -1,20 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDVjCCAj6gAwIBAgIBATANBgkqhkiG9w0BAQsFADAqMSgwJgYDVQQDDB9uaWNv
3
- bGFpLnJldXNjaGxpbmcvREM9ZGtkL0RDPWRlMB4XDTIwMDIxNDE1MTcwNloXDTIx
4
- MDIxMzE1MTcwNlowKjEoMCYGA1UEAwwfbmljb2xhaS5yZXVzY2hsaW5nL0RDPWRr
5
- ZC9EQz1kZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL5RzbjnDuqA
6
- rb+fbMKmHdfNZcX9rAlcGo5i7lwtBImH8DAikZXpS5pmDh+tWq0wiYlGqBjghPRw
7
- rdWcVZDf23EiKjDuDDW0bqtqNg6wbClkjGgr1GEyYuhficipS/1xWD3PTaCMk9RS
8
- eVJwwtzNJQbLyTnUZI8biuaSJr/pXot2WqyC/+0z+ddXzI00W686NRpbRb3DNR2l
9
- 5P59g1NiHrwiPjzWj+viIgCXt4j5wxJcZmEDuJQIZLdkcLcp7XGMpFnNsOcr7BMv
10
- w4/5NJS/7QG/n7j3xMOrCRpred346xlUoG5seVuu7mvChkOFleEkkKomvAEdiC5Y
11
- wB2Zd1EptkkCAwEAAaOBhjCBgzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
12
- HQ4EFgQUbCmdTAu9t3RJwYPe9hOJ3JWBlfowJAYDVR0RBB0wG4EZbmljb2xhaS5y
13
- ZXVzY2hsaW5nQGRrZC5kZTAkBgNVHRIEHTAbgRluaWNvbGFpLnJldXNjaGxpbmdA
14
- ZGtkLmRlMA0GCSqGSIb3DQEBCwUAA4IBAQBk1mExobXS3Uljuvadir5gAWkGQSRt
15
- queISF2e9iQKmuXV3auAy0UWbHTBqjwu8dJtzQTX5UOtfG/Jt1QIU3X6sEBuMY76
16
- Zbyu2NYp54ESAAyZFpt2prs7oDkRiDYk6FdZ7mHLTjPgr8nZV0qqONRfzmWmpImG
17
- PxsXUcEiEZej8d8C5vcHy3bwXb/+CjzcKrcqN67lkXwrA9jzqMuqnjVuhx+JMXJ5
18
- kHAKYJXqSQLXcRmkRlqCNGKAJSy6FmpClVbei309Yg3dl4PmFSc8GdLcWD1keOvE
19
- qzeIYbdD18i9ZRk4hfm8vEpevt+xRgM+3ughiJIaiWI3eO3C+VRszvqU
20
- -----END CERTIFICATE-----
@@ -1,9 +0,0 @@
1
- Feature: Checking autocompletion
2
- Scenario: Running the 'bashcompletion' command
3
- When I successfully run `indoctrinatr bashcompletion`
4
- Then the output should contain "get_indoctrinatr_targets()"
5
-
6
- Scenario: Running the 'zshcompletion' command
7
- When I successfully run `indoctrinatr zshcompletion`
8
- Then the output should contain "autoload -U +X bashcompinit && bashcompinit"
9
- And the output should contain "get_indoctrinatr_commands()"
@@ -1,17 +0,0 @@
1
- Feature: Running the "demo" command
2
-
3
- Background:
4
- Given the default aruba exit timeout is 60 seconds
5
-
6
- Scenario:
7
- When I successfully run `indoctrinatr demo`
8
- Then a file named "demo/doc/demo_technical_documentation.pdf" should exist
9
- And a directory named "demo" should exist
10
- And a directory named "demo/assets" should exist
11
- And the following files should exist:
12
- | demo/configuration.yaml |
13
- | demo/demo.tex.erb |
14
- | demo/doc/examples/demo_with_default_values.tex |
15
- | demo/doc/examples/demo_with_default_values.pdf |
16
- | demo/doc/demo_technical_documentation.pdf |
17
- | demo.zip |
@@ -1,13 +0,0 @@
1
- Feature: Running the 'doc' command with keepauxfiles
2
-
3
- Background:
4
- Given the default aruba exit timeout is 40 seconds
5
-
6
- Scenario: creating documentation for given project
7
- Given I do not have a 'demo' project
8
- When I successfully run `indoctrinatr new demo`
9
- And I successfully run `indoctrinatr doc demo --keep-aux-files`
10
- Then the output should match /A documentation for 'demo' has been successfully generated/
11
- And a file named "demo/doc/demo_technical_documentation.pdf" should exist
12
- And a file named "demo/doc/indoctrinatr-technical-documentation.log" should exist
13
- And a file named "demo/doc/indoctrinatr-technical-documentation.tex" should exist
@@ -1,20 +0,0 @@
1
- Feature: Running the 'doc' command
2
-
3
- Background:
4
- Given the default aruba exit timeout is 40 seconds
5
- And I do not have a 'demo' project
6
- And I successfully run `indoctrinatr new demo`
7
-
8
- Scenario: creating documentation for given project
9
- When I successfully run `indoctrinatr doc demo`
10
- Then the output should match /Example with field names has been automatically generated for the documentation/
11
- And the output should match /A documentation for 'demo' has been successfully generated/
12
- And a file named "demo/doc/demo_technical_documentation.pdf" should exist
13
-
14
- Scenario: creating the documentation without overwriting a FieldNames PDF example
15
- When I successfully run `indoctrinatr pdf_with_field_names demo`
16
- Then a file named "demo/doc/examples/demo_with_fieldname_values.pdf" should exist
17
- And I successfully run `indoctrinatr doc demo`
18
- And the output should not match /Example with field names has been automatically generated for the documentation/
19
- And the output should match /A documentation for 'demo' has been successfully generated/
20
- And a file named "demo/doc/demo_technical_documentation.pdf" should exist
@@ -1,9 +0,0 @@
1
- Feature: Running the 'pdf_with_field_names' command
2
-
3
- Background:
4
- Given the default aruba exit timeout is 20 seconds
5
-
6
- Scenario: for a given 'demo' project
7
- Given I have an Indoctrinatr project 'demo'
8
- When I run `indoctrinatr pdf_with_field_names demo`
9
- Then a file named "demo/doc/examples/demo_with_fieldname_values.pdf" should exist
@@ -1,10 +0,0 @@
1
- Feature: Running the 'pdf_with_field_names' command with keepauxfiles
2
-
3
- Background:
4
- Given the default aruba exit timeout is 20 seconds
5
-
6
- Scenario: for a given 'demo' project
7
- Given I have an Indoctrinatr project 'demo'
8
- When I run `indoctrinatr pdf_with_field_names demo --keep-aux-files`
9
- Then a file named "demo/doc/examples/demo_with_fieldname_values.pdf" should exist
10
- And a file named "demo/doc/examples/demo_with_fieldname_values.log" should exist
@@ -1,11 +0,0 @@
1
- Feature: Running the 'pack' command
2
-
3
- Background:
4
- Given the default aruba exit timeout is 20 seconds
5
-
6
- Scenario:
7
- Given I have an Indoctrinatr project 'demo'
8
- When I successfully run `indoctrinatr parse demo`
9
- And I run `indoctrinatr pdf demo`
10
- And I run `indoctrinatr pack demo`
11
- Then a file named "demo.zip" should exist
@@ -1,6 +0,0 @@
1
- Feature: Running the 'parse' command
2
-
3
- Scenario: for a given 'demo' project
4
- Given I have an Indoctrinatr project 'demo'
5
- When I successfully run `indoctrinatr parse demo`
6
- Then a file named "demo/doc/examples/demo_with_default_values.tex" should exist
data/features/pdf.feature DELETED
@@ -1,15 +0,0 @@
1
- Feature: Running the 'pdf' command
2
-
3
- Background:
4
- Given the default aruba exit timeout is 20 seconds
5
- And I have an Indoctrinatr project 'demo'
6
- And I successfully run `indoctrinatr parse demo`
7
-
8
- Scenario: for a given 'demo' project
9
- When I run `indoctrinatr pdf demo`
10
- Then a file named "demo/doc/examples/demo_with_default_values.pdf" should exist
11
-
12
- Scenario: for a given 'demo' project and usage with tab-completion
13
- When I run `indoctrinatr pdf demo/`
14
- Then a file named "demo/doc/examples/demo_with_default_values.pdf" should exist
15
-
@@ -1,11 +0,0 @@
1
- Feature: Running the 'pdf' command with keepauxfiles option
2
-
3
- Background:
4
- Given the default aruba exit timeout is 20 seconds
5
-
6
- Scenario: for a given 'demo' project
7
- Given I have an Indoctrinatr project 'demo'
8
- When I run `indoctrinatr pdf demo --keep-aux-files`
9
- Then a file named "demo/doc/examples/demo_with_default_values.pdf" should exist
10
- And a file named "demo/doc/examples/demo_with_default_values.log" should exist
11
- # there is not (an easy) way to use the current timestamp. Therefore the template for the 'new' command should not be static
@@ -1,8 +0,0 @@
1
- Feature: Running the 'pdf' command with timestamp in filename
2
- Scenario: using the test fixture
3
- Given I use the fixture named "test"
4
- When I cd to "../"
5
- And I run the Indoctrinatr command 'parse test'
6
- And I run `indoctrinatr pdf test`
7
- # String interpolation for "file named should exist" does not work. Therefore less strict regexp matching:
8
- Then a file matching %r<test/doc/examples/\d{4}_hello_world\.pdf> should exist
@@ -1,23 +0,0 @@
1
- Feature: Running the 'new' command
2
-
3
- Scenario: with a valid name 'demo'
4
- Given I do not have a 'demo' project
5
- When I successfully run `indoctrinatr new demo`
6
- Then the output should match /A template pack scaffold was created in folder 'demo'. Happy templating…/
7
- And a directory named "demo" should exist
8
- And a directory named "demo/assets" should exist
9
- And the following files should exist:
10
- | demo/configuration.yaml |
11
- | demo/demo.tex.erb |
12
-
13
- Scenario: with an empty name
14
- Given I do not have a 'demo' project
15
- When I run `indoctrinatr new`
16
- Then the exit status should be 1
17
- And the output should match /Please specify a template pack name/
18
-
19
- Scenario: with the same name as an existing directory
20
- Given I have an Indoctrinatr project 'demo'
21
- When I run `indoctrinatr new demo`
22
- Then the exit status should be 1
23
- And the output should match /A folder with name 'demo' already exists/
@@ -1,3 +0,0 @@
1
- When(/I wait (.*) seconds?/) do |seconds|
2
- sleep(seconds.to_i)
3
- end
@@ -1,11 +0,0 @@
1
- Given(/^I do not have (?:a|an) '(.*)' project$/) do |project_name|
2
- FileUtils.rm_rf project_name
3
- end
4
-
5
- Given(/^I have an Indoctrinatr project '(.*)'$/) do |project_name|
6
- step "I run the Indoctrinatr command 'new #{project_name}'"
7
- end
8
-
9
- When(/^I run the Indoctrinatr command '(.*)'$/) do |command|
10
- step "I successfully run `indoctrinatr #{command}`"
11
- end
@@ -1 +0,0 @@
1
- require 'aruba/cucumber'
@@ -1,5 +0,0 @@
1
- Feature: Running the "version" command
2
-
3
- Scenario:
4
- When I successfully run `indoctrinatr version`
5
- Then the output should contain "0.16.0"
@@ -1,9 +0,0 @@
1
- Feature: Running the "workflow" command
2
-
3
- Scenario:
4
- When I successfully run `indoctrinatr workflow`
5
- Then the output should contain "new"
6
- And the output should contain "parse"
7
- And the output should contain "pdf"
8
- And the output should contain "check"
9
- And the output should contain "pack"
@@ -1,19 +0,0 @@
1
- module Indoctrinatr
2
- module Tools
3
- module DirectoryHelpers
4
- def print_dirtree_style directory = '.'
5
- Dir.glob("#{directory}/**/*").inject [] do |entries, entry| # list entries recursively
6
- nesting = entry.count(File::SEPARATOR) + 1 # nesting starts with 2, because for \dirtree 1 is root
7
- name = entry.split(File::SEPARATOR).last
8
- entries.push ".#{nesting} #{name}. " # formatting for \dirtree: .<level><space><text-node>.<space>
9
- end
10
- end
11
-
12
- # default file types for template docs
13
- def list_files_of_type directory = '.', types = %w[erb rb yaml sty tex]
14
- # found and modified from http://stackoverflow.com/a/3504307/1796645
15
- Dir.glob("#{directory}/**/*.{#{types.join(',')}}") # recursively list files of type in types array
16
- end
17
- end
18
- end
19
- end
@@ -1,47 +0,0 @@
1
- require 'indoctrinatr/tools/configuration_extractor'
2
- require 'indoctrinatr/tools/pdf_generator'
3
- require 'fileutils'
4
-
5
- module Indoctrinatr
6
- module Tools
7
- class TemplatePackDefaultValuesCompiler
8
- include TemplatePackHelpers
9
- include PdfGenerator
10
-
11
- attr_accessor :template_pack_name
12
-
13
- def initialize template_pack_name, keep_aux_files = false
14
- @template_pack_name = template_pack_name
15
- @keep_aux_files = keep_aux_files
16
- end
17
-
18
- def call
19
- check_for_folder
20
- compile_tex_file
21
- rename_if_necessary
22
- end
23
-
24
- def pdf_exists?
25
- check_for_folder
26
- file_path = pdf_with_default_values_file_path ConfigurationExtractor.new(template_pack_name).call
27
- File.exist? file_path
28
- end
29
-
30
- private
31
-
32
- def compile_tex_file
33
- make_pdf tex_with_default_values_file_path, pack_documentation_examples_dir_path, !@keep_aux_files
34
- end
35
-
36
- def rename_if_necessary # rubocop:disable Metrics/AbcSize
37
- configuration = ConfigurationExtractor.new(template_pack_name).call # TODO: avoid repeated calling of the ConfigurationExtrator
38
- @default_values = DefaultValues.new configuration
39
- return if @default_values.customized_output_file_name == @default_values.default_file_name
40
-
41
- custom_filepath = pack_documentation_examples_dir_path + @default_values.customized_output_file_name
42
- FileUtils.rm custom_filepath if File.exist? custom_filepath
43
- FileUtils.mv(pack_documentation_examples_dir_path + @default_values.default_file_name, custom_filepath)
44
- end
45
- end
46
- end
47
- end
@@ -1,55 +0,0 @@
1
- require 'indoctrinatr/tools/template_pack_helpers'
2
- require 'indoctrinatr/tools/default_values'
3
- require 'indoctrinatr/tools/configuration_extractor'
4
- require 'erubis'
5
- require 'to_latex'
6
-
7
- module Indoctrinatr
8
- module Tools
9
- class TemplatePackDefaultValuesParser
10
- include TemplatePackHelpers
11
-
12
- attr_accessor :template_pack_name, :configuration, :default_values, :tex_file_content, :parsed_tex_file_content
13
-
14
- def initialize template_pack_name
15
- @template_pack_name = template_pack_name
16
- end
17
-
18
- def call
19
- check_for_folder
20
- read_config_file
21
- read_tex_file
22
- parse_tex_file
23
- write_tex_file
24
- show_success
25
- end
26
-
27
- private
28
-
29
- def read_config_file
30
- @configuration = ConfigurationExtractor.new(template_pack_name).call
31
- @default_values = DefaultValues.new @configuration
32
- @default_values._use_default_values
33
- end
34
-
35
- def read_tex_file
36
- @tex_file_content = File.read tex_file_path
37
- end
38
-
39
- def parse_tex_file
40
- @parsed_tex_file_content = Erubis::Eruby.new(@tex_file_content).result(default_values.retrieve_binding)
41
- end
42
-
43
- def write_tex_file
44
- # Create directory to avoid file creation errors
45
- Dir.mkdir(pack_documentation_dir_path) unless Dir.exist?(pack_documentation_dir_path)
46
- Dir.mkdir(pack_documentation_examples_dir_path) unless Dir.exist?(pack_documentation_examples_dir_path)
47
- File.write tex_with_default_values_file_path, parsed_tex_file_content
48
- end
49
-
50
- def show_success
51
- puts "The template pack '#{template_pack_name}' has been successfully parsed with default values."
52
- end
53
- end
54
- end
55
- end
@@ -1,23 +0,0 @@
1
- require 'indoctrinatr/tools/template_pack_helpers'
2
-
3
- module Indoctrinatr
4
- module Tools
5
- class TemplatePackDemo
6
- include TemplatePackHelpers
7
-
8
- attr_accessor :template_pack_name
9
-
10
- def initialize template_pack_name
11
- @template_pack_name = template_pack_name
12
- end
13
-
14
- def call
15
- TemplatePackScaffold.new(template_pack_name).call
16
- TemplatePackDefaultValuesParser.new(template_pack_name).call
17
- TemplatePackDefaultValuesCompiler.new(template_pack_name).call
18
- TemplatePackDocumentation.new(template_pack_name).call
19
- TemplatePackPacker.new(template_pack_name).call
20
- end
21
- end
22
- end
23
- end