Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.13.0'
Browse files Browse the repository at this point in the history
* release/0.13.0:
  release v0.13.0
  improved wording
  enable usage with a trailing slash (Ticket #73279)
  Redmine Issue #66113:  add test for template with dynamic filename
  decrease bundler version dependency
  add doc command to workflow command (Ticket #73280)
  adjust default_values custom file path to new workflow ( Ticket #66119)
  add changelog
  • Loading branch information
ncreuschling committed May 27, 2016
2 parents 79be803 + 9974805 commit 839ac13
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cache:
- apt
before_install:
- sudo apt-get update && sudo wget https://github.com/scottkosty/install-tl-ubuntu/raw/master/install-tl-ubuntu && sudo chmod +x ./install-tl-ubuntu && sudo ./install-tl-ubuntu
- gem install bundler -v 1.12.3
- gem install bundler -v 1.10.6
script:
- bundle exec indoctrinatr demo
- bundle exec rake test_with_coveralls
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# indoctrinatr-tools

## v0.13.0 (2016-05-27)

### features

* support for trailing slashes in template pack name

### changes

* refactoring

## v0.12.0 (2016-05-10)

### features

* added `check` command: This analyzes your template pack for major issues (#64232)
* add `pdf_with_field_names` command (#64694). This creates an example where the field names are shown
* add the example with fieldnames to technical documentation (#71536) - when it is successfully generated
* add `keep-aux-files` option to pdf generation (#66118)
* disable overwriting PDF examples for `doc` command (#71535)

### changes

* documentation doesn't break when description field is missing (#65001)
* @longtabu@ for attributes list in documentation (#66081)
* move examples after generation in `/doc` directory in template pack
* show attributes list documentation as landscape
* refactoring
39 changes: 24 additions & 15 deletions bin/indoctrinatr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ command :workflow do |c|
5. Run in shell: indoctrinatr check demo
Analyzes your Template Pack for potential errors
6. Run in shell: indoctrinatr pack demo
6. Run in shell: indoctrinatr doc demo
Creates a technical documentation for the Template Pack
7. Run in shell: indoctrinatr pack demo
Creates demo.zip with all required file for upload to Indoctrinatr server
'
Expand All @@ -58,20 +61,26 @@ command :demo do |c|
end
end

pre do |global_options, _, _, args|
# modify template_pack_name argument. This removes a trailing '/' that we get when users use tab completion
global_options['template_pack_name'] = File.split(args[0])[1] unless args.empty?
true # pre condition returns false when nothing is done
end

desc 'Create a scaffold for a new Template Pack'
arg_name 'template-pack-name'
command :new do |c|
c.action do |_, _, args|
template_pack_name = args.join '_'
c.action do |global_options, _, _|
template_pack_name = global_options['template_pack_name']
TemplatePackScaffold.new(template_pack_name).call
end
end

desc 'Parse XeTeX file with ERB and default values of Template Pack'
arg_name 'template_pack_name'
command :parse do |c|
c.action do |_, _, args|
template_pack_name = args.join '_'
c.action do |global_options, _, _|
template_pack_name = global_options['template_pack_name']
TemplatePackDefaultValuesParser.new(template_pack_name).call
end
end
Expand All @@ -81,8 +90,8 @@ arg_name 'template_pack_name'
command :pdf do |c|
c.desc 'Keep generated aux files'
c.switch [:'keep-aux-files']
c.action do |_, options, args|
template_pack_name = args.join '_'
c.action do |global_options, options, _|
template_pack_name = global_options['template_pack_name']
keep_aux_files = options[:'keep-aux-files']
TemplatePackDefaultValuesParser.new(template_pack_name).call
TemplatePackDefaultValuesCompiler.new(template_pack_name, keep_aux_files).call
Expand All @@ -94,8 +103,8 @@ arg_name 'template_pack_name'
command :pdf_with_field_names do |c|
c.desc 'Keep generated aux files'
c.switch [:'keep-aux-files']
c.action do |_, options, args|
template_pack_name = args.join '_'
c.action do |global_options, options, _|
template_pack_name = global_options['template_pack_name']
keep_aux_files = options[:'keep-aux-files']
TemplatePackFieldnamesCreator.new(template_pack_name, keep_aux_files).call
end
Expand All @@ -106,8 +115,8 @@ arg_name 'template_pack_name'
command :doc do |c|
c.desc 'Keep generated aux files'
c.switch [:'keep-aux-files']
c.action do |_, options, args|
template_pack_name = args.join '_'
c.action do |global_options, options, _|
template_pack_name = global_options['template_pack_name']
keep_aux_files = options[:'keep-aux-files']
TemplatePackDocumentation.new(template_pack_name, keep_aux_files).call
end
Expand All @@ -116,17 +125,17 @@ end
desc 'Check for errors in the given source folder'
arg_name 'template_pack_name'
command :check do |c|
c.action do |_, _, args|
template_pack_name = args.join '_'
c.action do |global_options, _, _|
template_pack_name = global_options['template_pack_name']
TemplatePackErrorChecker.new(template_pack_name).call
end
end

desc 'Create a Template Pack from a given source folder'
arg_name 'template_pack_name'
command :pack do |c|
c.action do |_, _, args|
template_pack_name = args.join '_'
c.action do |global_options, _, _|
template_pack_name = global_options['template_pack_name']
TemplatePackPacker.new(template_pack_name).call
end
end
Expand Down
10 changes: 7 additions & 3 deletions features/pdf.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ Feature: Running the 'pdf' command

Background:
Given the default aruba exit timeout is 20 seconds
Given I have an Indoctrinatr project 'demo'
When I successfully run `indoctrinatr parse demo`

Scenario: for a given 'demo' project
Given I have an Indoctrinatr project 'demo'
When I successfully run `indoctrinatr parse demo`
And I run `indoctrinatr pdf demo`
Then a file named "demo/doc/examples/demo_with_default_values.pdf" should exist
# there is not (an easy) way to use the current timestamp. Therefore the template for the 'new' command should not be static

Scenario: for a given 'demo' project and usage with tab-completion
And I run `indoctrinatr pdf demo/`
Then a file named "demo/doc/examples/demo_with_default_values.pdf" should exist

8 changes: 8 additions & 0 deletions features/pdf_with_timestamp.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Running the 'pdf' command with timestamp in filename
Scenario: using the test fixture
Given I use the fixture named "test"
When I cd to "../"
When I run the Indoctrinatr command 'parse test'
And I run `indoctrinatr pdf test`
# String interpolation for "file named should exist" does not work. Therefore less strict regexp matching:
Then a file matching %r<test/doc/examples/\d{4}_hello_world\.pdf> should exist
2 changes: 1 addition & 1 deletion features/version.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Feature: Running the "version" command

Scenario:
When I successfully run `indoctrinatr version`
Then the output should contain "0.12.0"
Then the output should contain "0.13.0"
2 changes: 1 addition & 1 deletion indoctrinatr-tools.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_development_dependency 'bundler', '~> 1.12'
spec.add_development_dependency 'bundler', '~> 1.10'
spec.add_development_dependency 'rake', '~> 11.1'
spec.add_development_dependency 'rspec', '~> 3.4'
spec.add_development_dependency 'cucumber', '~> 2.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ def compile_tex_file
make_pdf tex_with_default_values_file_path, pack_documentation_examples_dir_path, !@keep_aux_files
end

def rename_if_necessary
def rename_if_necessary # rubocop:disable Metrics/AbcSize
configuration = ConfigurationExtractor.new(template_pack_name).call # TODO: avoid repeated calling of the ConfigurationExtrator
@default_values = DefaultValues.new configuration
return if @default_values.customized_output_file_name == @default_values.default_file_name

FileUtils.rm @default_values.customized_output_file_name if File.exist? @default_values.customized_output_file_name
FileUtils.mv(@default_values.default_file_name, @default_values.customized_output_file_name)
custom_filepath = pack_documentation_examples_dir_path + @default_values.customized_output_file_name
FileUtils.rm custom_filepath if File.exist? custom_filepath
FileUtils.mv(pack_documentation_examples_dir_path + @default_values.default_file_name, custom_filepath)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/indoctrinatr/tools/template_pack_scaffold.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def call
private

def create_folder
fail 'Please specify a template pack name.' if template_pack_name.empty? # rubocop:disable Style/SignalException
fail 'Please specify a template pack name.' if template_pack_name.nil? || template_pack_name.empty? # rubocop:disable Style/SignalException
fail "A folder with name '#{template_pack_name}' already exists." if Dir.exist? path_name # rubocop:disable Style/SignalException

Dir.mkdir path_name
Expand Down
2 changes: 1 addition & 1 deletion lib/indoctrinatr/tools/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Indoctrinatr
module Tools
VERSION = '0.12.0'.freeze
VERSION = '0.13.0'.freeze
end
end
26 changes: 26 additions & 0 deletions spec/fixtures/test/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
template_name: Hello World Template
output_file_name: '#{Time.now.year}_hello_world.pdf'
textual_description: |
This is your first _Indoctrinatr_ template. You can use _Textile_ syntax here to *highlight* important information.
Edit this template as you like. Read more at https://github.com/dkd/indoctrinatr.
fields:
-
name: variable1
label: Who is it?
presentation: text
default_value: "World"
description: "The first variable"
-
name: date
label: Date
presentation: date
default_value: '#{Time.now.year}-#{Time.now.month}-#{Time.now.day}'
-
name: variable2
label: Type of World
required: "true"
presentation: dropdown
default_value: "not enough"
available_options: "not enough, beautiful, your oyster, a template"
description: "The second variable. The description name can be very long and should adequately describe what the variable is for etc. pp."
15 changes: 15 additions & 0 deletions spec/fixtures/test/test.tex.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
% This is the official Indoctrinatr "Hello World Template".
\documentclass{article}

\begin{document}
\section{Hello <%= variable1 -%>}

The <%= variable1 -%> is <%= variable2 -%>!

Today is \textbf{<%= date -%>}.

% This is is the raw, unescaped input of \texttt{variable1}:
\begin{verbatim}
<%= raw_variable1 -%>
\end{verbatim}
\end{document}
2 changes: 1 addition & 1 deletion spec/indoctrinatr/tools/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

describe Indoctrinatr::Tools do
it 'defines a VERSION constant' do
expect(Indoctrinatr::Tools::VERSION).to eq '0.12.0'
expect(Indoctrinatr::Tools::VERSION).to eq '0.13.0'
end
end

0 comments on commit 839ac13

Please sign in to comment.