indoctrinatr-tools 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.arcconfig +9 -0
  3. data/.coveralls.yml +1 -0
  4. data/.gitignore +54 -0
  5. data/.rubocop.yml +10 -0
  6. data/.rvmrc +5 -0
  7. data/.travis.yml +19 -0
  8. data/Gemfile +4 -0
  9. data/LICENSE +21 -0
  10. data/README.md +74 -0
  11. data/Rakefile +32 -0
  12. data/assets/images/dkd_logo.png +0 -0
  13. data/assets/images/logo.png +0 -0
  14. data/bin/indoctrinatr +146 -0
  15. data/cucumber.yml +1 -0
  16. data/features/autocompletion_support.feature +9 -0
  17. data/features/demo.feature +17 -0
  18. data/features/documentation.feature +11 -0
  19. data/features/pack.feature +11 -0
  20. data/features/parse.feature +6 -0
  21. data/features/pdf.feature +10 -0
  22. data/features/scaffold.feature +23 -0
  23. data/features/step_definitions/common.rb +3 -0
  24. data/features/step_definitions/indoctrinatr_cli.rb +11 -0
  25. data/features/support/env.rb +1 -0
  26. data/features/version.feature +5 -0
  27. data/features/workflow.feature +8 -0
  28. data/indoctrinatr-tools.gemspec +39 -0
  29. data/lib/indoctrinatr/templates/configuration.yaml +17 -0
  30. data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation-content.tex.erb +36 -0
  31. data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation.sty +195 -0
  32. data/lib/indoctrinatr/templates/documentation/indoctrinatr-technical-documentation.tex.erb +89 -0
  33. data/lib/indoctrinatr/templates/documentation/indoctrinatr_letterpaper.pdf +0 -0
  34. data/lib/indoctrinatr/templates/template.tex.erb +8 -0
  35. data/lib/indoctrinatr/tools.rb +9 -0
  36. data/lib/indoctrinatr/tools/configuration_extractor.rb +27 -0
  37. data/lib/indoctrinatr/tools/default_values.rb +54 -0
  38. data/lib/indoctrinatr/tools/directory_helpers.rb +18 -0
  39. data/lib/indoctrinatr/tools/template_documentation_content.rb +52 -0
  40. data/lib/indoctrinatr/tools/template_documentation_helpers.rb +59 -0
  41. data/lib/indoctrinatr/tools/template_documentation_source_file.rb +31 -0
  42. data/lib/indoctrinatr/tools/template_pack_configuration.rb +7 -0
  43. data/lib/indoctrinatr/tools/template_pack_default_values_compiler.rb +38 -0
  44. data/lib/indoctrinatr/tools/template_pack_default_values_parser.rb +51 -0
  45. data/lib/indoctrinatr/tools/template_pack_demo.rb +23 -0
  46. data/lib/indoctrinatr/tools/template_pack_documentation.rb +111 -0
  47. data/lib/indoctrinatr/tools/template_pack_helpers.rb +38 -0
  48. data/lib/indoctrinatr/tools/template_pack_packer.rb +49 -0
  49. data/lib/indoctrinatr/tools/template_pack_scaffold.rb +57 -0
  50. data/lib/indoctrinatr/tools/version.rb +5 -0
  51. data/lib/redcloth_latex_formatter_patch/patch.rb +35 -0
  52. data/spec/indoctrinatr/templates/configuration_file_spec.rb +9 -0
  53. data/spec/indoctrinatr/templates/tex_file_spec.rb +9 -0
  54. data/spec/indoctrinatr/tools/textile_support_spec.rb +18 -0
  55. data/spec/indoctrinatr/tools/version_spec.rb +8 -0
  56. data/spec/redcloth_latex_formatter_patch/patch_spec.rb +30 -0
  57. data/spec/spec_helper.rb +2 -0
  58. metadata +304 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6cfcf2736b68b9902cc18507c94b29a88f934cd4
4
+ data.tar.gz: 4fa1c18ad931c87f30ce99b1dd0ac4ae86c91fe9
5
+ SHA512:
6
+ metadata.gz: a18f5e2bbb59133915532cf9651428b6eec4b3981d5f700f1696a3556bc56dce37ff7b38cbb07d7901ac13f7d016f15874da287248262100f2eabccb17358397
7
+ data.tar.gz: fc606fac8c306de16693b5c8d1d60b50f45a042e1ae6e510eab49a45dfc2e2d9b651a3f178b73393739b5da749cb6f5e6460d42fa689d3a36560cf1bdd989a18
data/.arcconfig ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "phabricator.uri": "https://phabricator.dkd.de/",
3
+ "project.name": "INDOCTRINATRTOOLS",
4
+ "arc.feature.start.default": "development",
5
+ "arc.land.onto.default": "development",
6
+ "history.immutable": true,
7
+ "base": "git:merge-base(development),arc:upstream",
8
+ "load": []
9
+ }
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,54 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+
24
+ # Created by https://www.gitignore.io
25
+
26
+ ### Intellij ###
27
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
28
+
29
+ *.iml
30
+
31
+ ## Directory-based project format:
32
+ .idea/
33
+ # if you remove the above rule, at least ignore the following:
34
+
35
+ # User-specific stuff:
36
+ # .idea/workspace.xml
37
+ # .idea/tasks.xml
38
+ # .idea/dictionaries
39
+
40
+ # Sensitive or high-churn files:
41
+ # .idea/dataSources.ids
42
+ # .idea/dataSources.xml
43
+ # .idea/sqlDataSources.xml
44
+ # .idea/dynamic.xml
45
+ # .idea/uiDesigner.xml
46
+
47
+ # Gradle:
48
+ # .idea/gradle.xml
49
+ # .idea/libraries
50
+
51
+ # Mongo Explorer plugin:
52
+ # .idea/mongoSettings.xml
53
+
54
+ # End gitignore.io generated block
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ Metrics/LineLength:
2
+ Max: 200
3
+ Style/MethodDefParentheses:
4
+ EnforcedStyle: require_no_parentheses
5
+ Style/Documentation:
6
+ Enabled: false
7
+ Metrics/MethodLength:
8
+ Max: 20
9
+ Style/TrivialAccessors:
10
+ Enabled: false
data/.rvmrc ADDED
@@ -0,0 +1,5 @@
1
+ rvm use 2.1
2
+
3
+ alias brake='bundle exec'
4
+ alias rubocop='bundle exec rubocop'
5
+ alias cucumber='brake cucumber'
data/.travis.yml ADDED
@@ -0,0 +1,19 @@
1
+ sudo: true
2
+ language: ruby
3
+ rvm:
4
+ - '2.2'
5
+ - '2.1'
6
+ - '2.0'
7
+ cache:
8
+ - bundler
9
+ - apt
10
+ before_install:
11
+ - sudo apt-get install -qq texlive texlive-xetex texlive-latex-extra texlive-generic-extra
12
+ - gem install bundler -v 1.10.6
13
+ script:
14
+ - bundle exec cucumber --backtrace --verbose
15
+ - bundle exec rake test_with_coveralls
16
+ addons:
17
+ apt:
18
+ packages:
19
+ - texlive-full
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in indoctrinatr-tools.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Indoctrinatr Development Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # ![Indoctrinatr](assets/images/logo.png)
2
+
3
+ ## About
4
+
5
+ [Indoctrinatr Tools](https://github.com/dkd/indoctrinatr-tools) is a set of commandline tools to kick-start and develop [Indoctrinatr](https://github.com/dkd/indoctrinatr) Template Packs. Indoctrinatr in itself is an Open Source Software project by [dkd Internet Service GmbH](https://dkd.de/), Frankfurt (Germany), which renders [eRuby](https://en.wikipedia.org/wiki/ERuby) (more specifically: [Erubis](http://www.kuwata-lab.com/erubis/)) enriched [XeTeX](http://tug.org/xetex/) templates to PDF documents.
6
+
7
+ ## Installation
8
+
9
+ Rubygem: [![Gem Version](https://badge.fury.io/rb/indoctrinatr-tools.svg)](http://badge.fury.io/rb/indoctrinatr-tools) Branch: master [![Travis CI Status: master](https://travis-ci.org/dkd/indoctrinatr-tools.svg?branch=master)](https://travis-ci.org/dkd/indoctrinatr-tools) Branch: development [![Travis CI Status: development](https://travis-ci.org/dkd/indoctrinatr-tools.svg?branch=development)](https://travis-ci.org/dkd/indoctrinatr-tools) Coverage: [![Coverage Status](https://coveralls.io/repos/dkd/indoctrinatr-tools/badge.svg?branch=development&service=github)](https://coveralls.io/github/dkd/indoctrinatr-tools?branch=development)
10
+
11
+ 1. Install XeTeX:
12
+
13
+ Mac OS X: [MacTeX](https://tug.org/mactex/)
14
+
15
+ Debian/Ubuntu:
16
+
17
+ ```shell
18
+ apt-get install texlive texlive-xetex texlive-latex-extra texlive-generic-extra
19
+ ```
20
+
21
+ 2. We distribute Indoctrinatr Tools as a Rubygem. Please run:
22
+
23
+ ```shell
24
+ gem install indoctrinatr-tools
25
+ ```
26
+ After installation verify if you have a working `indoctrinatr` shell command.
27
+
28
+ ### LaTeX Requirements
29
+
30
+ * for the template documentation
31
+ * `dirtree`
32
+ * `datetime2`
33
+
34
+ ## Usage
35
+
36
+ Replace `project_name` with the name of your Template Pack:
37
+
38
+ Command | Description
39
+ ---|---
40
+ `indoctrinatr new project_name` | Creates a scaffold for a new Template Pack
41
+ `indoctrinatr parse project_name` | Parses a XeTex file with ERB and default values
42
+ `indoctrinatr pdf project_name` | Compiles PDF with default values
43
+ `indoctrinatr doc project_name` | Creates a technical documentation of your template pack
44
+ `indoctrinatr pack project_name` | Creates a Template Pack from a given project folder
45
+ `indoctrinatr demo` | Creates, parses, and compiles a demo project
46
+ `indoctrinatr workflow` | Displays a suggested workflow
47
+ `indoctrinatr bashcompletion` | Displays instructions for bash completion
48
+ `indoctrinatr zshcompletion` | Displays instructions for zsh completion
49
+
50
+ ## Build
51
+
52
+ If you want to build the Rubygem yourself, run `rake build` to build and `rake install` to build and install the Indoctrinatr Tools gem.
53
+
54
+ ## Feedback
55
+
56
+ What you think of Indoctrinatr and Indoctrinatr Tools? Drop us a line (<opensource@dkd.de>) and tell us how you use Indoctrinatr. You can also open a [GitHub Issue](https://github.com/dkd/indoctrinatr-tools/issues) if you experience any problems.
57
+
58
+ ## Contributing
59
+
60
+ We are also looking forward to your [GitHub Pull Requests](https://help.github.com/articles/using-pull-requests/).
61
+
62
+ Manual testing: After cloning the repo, run `bundle exec bin/indoctrinatr` inside the directory for testing your own development changes.
63
+
64
+ ## License
65
+
66
+ Indoctrinatr and Indoctrinatr Tools are licensed under the terms and conditions of the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
67
+
68
+ ## Credits
69
+
70
+ [![dkd](assets/images/dkd_logo.png)](https://dkd.de/)
71
+
72
+ * Luka Lüdicke
73
+ * Nicolai Reuschling (development)
74
+ * Søren Schaffstein (idea, product management)
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rubocop/rake_task'
4
+ RuboCop::RakeTask.new
5
+
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new('spec')
8
+ task default: :spec
9
+
10
+ require 'cucumber'
11
+ require 'cucumber/rake/task'
12
+ Cucumber::Rake::Task.new(:features) do |t|
13
+ t.cucumber_opts = 'features --format pretty'
14
+ end
15
+
16
+ require 'coveralls/rake/task'
17
+ Coveralls::RakeTask.new
18
+ task test_with_coveralls: [:rubocop, :spec, :features, 'coveralls:push']
19
+
20
+ desc 'Start up IRB session with Indoctrinatr Tools loaded'
21
+ task :console do
22
+ exec 'irb -r indoctrinatr/tools -I ./lib'
23
+ end
24
+
25
+ desc 'Run demo'
26
+ task :demo do
27
+ puts `bin/indoctrinatr new demo`
28
+ puts `bin/indoctrinatr parse demo`
29
+ puts `bin/indoctrinatr pdf demo`
30
+ puts `bin/indoctrinatr doc demo`
31
+ puts `bin/indoctrinatr pack demo`
32
+ end
Binary file
Binary file
data/bin/indoctrinatr ADDED
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gli'
4
+ require 'indoctrinatr/tools/version'
5
+ require 'indoctrinatr/tools/template_pack_demo'
6
+ require 'indoctrinatr/tools/template_pack_scaffold'
7
+ require 'indoctrinatr/tools/template_pack_packer'
8
+ require 'indoctrinatr/tools/template_pack_default_values_parser'
9
+ require 'indoctrinatr/tools/template_pack_default_values_compiler'
10
+ require 'indoctrinatr/tools/template_pack_documentation'
11
+
12
+ include GLI::App
13
+ include Indoctrinatr::Tools
14
+
15
+ program_desc 'Create and manage Template Packs for Indoctrinatr'
16
+ version Indoctrinatr::Tools::VERSION
17
+ config_file '.indoctrinatr.rc'
18
+
19
+ desc 'Display current version'
20
+ command :version do |c|
21
+ c.action do
22
+ puts Indoctrinatr::Tools::VERSION
23
+ end
24
+ end
25
+
26
+ desc 'Display the suggested workflow'
27
+ command :workflow do |c|
28
+ c.action do
29
+ puts 'The workflow for a project (e.g. demo) typically looks like this:
30
+
31
+ 1. Run in shell: indoctrinatr new demo
32
+ Creates a new Indoctrinatr Template Pack in the folder demo
33
+
34
+ 2. Edit demo.tex.erb and configuration.yaml according to needs
35
+
36
+ 3. Run in shell: indoctrinatr parse demo
37
+ Parses tex file demo_with_default_values.tex with ERB and default values from configuration.yaml
38
+
39
+ 4. Run in shell: indoctrinatr pdf demo
40
+ Compiles PDF from demo_with_default_values.tex
41
+
42
+ 5. Run in shell: indoctrinatr pack demo
43
+ Creates demo.zip with all required file for upload to Indoctrinatr server
44
+
45
+ '
46
+ end
47
+ end
48
+
49
+ desc 'Create, compile and pack a demo project'
50
+ command :demo do |c|
51
+ c.action do
52
+ Indoctrinatr::Tools::TemplatePackDemo.new('demo').call
53
+ end
54
+ end
55
+
56
+ desc 'Create a scaffold for a new Template Pack'
57
+ arg_name 'template-pack-name'
58
+ command :new do |c|
59
+ c.action do |_, _, args|
60
+ template_pack_name = args.join '_'
61
+ Indoctrinatr::Tools::TemplatePackScaffold.new(template_pack_name).call
62
+ end
63
+ end
64
+
65
+ desc 'Parse XeTeX file with ERB and default values of Template Pack'
66
+ arg_name 'template_pack_name'
67
+ command :parse do |c|
68
+ c.action do |_, _, args|
69
+ template_pack_name = args.join '_'
70
+ Indoctrinatr::Tools::TemplatePackDefaultValuesParser.new(template_pack_name).call
71
+ end
72
+ end
73
+
74
+ desc 'Compile PDF with default values'
75
+ arg_name 'template_pack_name'
76
+ command :pdf do |c|
77
+ c.action do |_, _, args|
78
+ template_pack_name = args.join '_'
79
+ TemplatePackDefaultValuesParser.new(template_pack_name).call
80
+ Indoctrinatr::Tools::TemplatePackDefaultValuesCompiler.new(template_pack_name).call
81
+ end
82
+ end
83
+
84
+ desc 'Create a documentation from a given source folder'
85
+ arg_name 'template_pack_name'
86
+ command :doc do |c|
87
+ c.action do |_, _, args|
88
+ template_pack_name = args.join '_'
89
+ TemplatePackDefaultValuesParser.new(template_pack_name).call # hierarchy - these files are needed. Unfortunately GLI::App does not offer to run other commands
90
+ TemplatePackDefaultValuesCompiler.new(template_pack_name).call
91
+ Indoctrinatr::Tools::TemplatePackDocumentation.new(template_pack_name).call
92
+ end
93
+ end
94
+
95
+ desc 'Create a Template Pack from a given source folder'
96
+ arg_name 'template_pack_name'
97
+ command :pack do |c|
98
+ c.action do |_, _, args|
99
+ template_pack_name = args.join '_'
100
+ Indoctrinatr::Tools::TemplatePackPacker.new(template_pack_name).call
101
+ end
102
+ end
103
+
104
+ desc 'Display instructions for bash completion'
105
+ command :bashcompletion do |c|
106
+ c.action do
107
+ puts 'Add this to your .bashrc (and open up a new shell):
108
+
109
+ complete -F get_indoctrinatr_targets indoctrinatr
110
+ function get_indoctrinatr_targets()
111
+ {
112
+ if [ -z $2 ] ; then
113
+ COMPREPLY=(`indoctrinatr help -c`)
114
+ else
115
+ COMPREPLY=(`indoctrinatr help -c $2`)
116
+ fi
117
+ }
118
+
119
+ '
120
+ end
121
+ end
122
+
123
+ # thanks to http://devopsbox.es/posts/2013/10-31-the-cleanest-gli-bash-zsh-tab-completion.html
124
+ desc 'Display instructions for zsh completion'
125
+ command :zshcompletion do |c|
126
+ c.action do
127
+ puts 'Add this to your .zshrc (and open up a new shell):
128
+
129
+ if [[ -n ${ZSH_VERSION-} ]]; then
130
+ autoload -U +X bashcompinit && bashcompinit
131
+ fi
132
+
133
+ complete -F get_indoctrinatr_commands indoctrinatr
134
+ function get_indoctrinatr_commands()
135
+ {
136
+ local binary="indoctrinatr"
137
+ help_params=${COMP_WORDS[@]:1}
138
+ clean_params=${help_params//-*([^ ])?( )}
139
+ COMPREPLY=(`$binary help -c $clean_params`)
140
+ }
141
+
142
+ '
143
+ end
144
+ end
145
+
146
+ exit run(ARGV)
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --format=progress
@@ -0,0 +1,9 @@
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()"
@@ -0,0 +1,17 @@
1
+ Feature: Running the "demo" command
2
+
3
+ Background:
4
+ Given the default aruba exit timeout is 20 seconds
5
+
6
+ Scenario:
7
+ When I successfully run `indoctrinatr demo`
8
+ Then a file named "demo_with_default_values.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/demo_with_default_values.tex |
15
+ | demo/demo_technical_documentation.pdf |
16
+ | demo_with_default_values.pdf |
17
+ | demo.zip |
@@ -0,0 +1,11 @@
1
+ Feature: Running the 'doc' command
2
+
3
+ Background:
4
+ Given the default aruba exit timeout is 20 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`
10
+ Then the output should match /A documentation for 'demo' has been successfully generated/
11
+ Then a file named "demo/demo_technical_documentation.pdf" should exist