hiptest-publisher 1.15.0 → 1.16.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09c7c858fbf0ec7499ca9a13ca5f4ebb9ea5cd2754811d57aaf47a8f2667a803'
4
- data.tar.gz: 301b30459a64f5fd4e98e7c395e4709177f5863bad7e2f6c9706ccaa6fb2cfbc
3
+ metadata.gz: 89f6b298fc2d84d8a98247f82b9234d5e7cdf30204ef8bcee60ef6f62deaf9df
4
+ data.tar.gz: 2b27dceed97bec88d11bbc85f852c83974b058725e290eacdab94f8f49c9c623
5
5
  SHA512:
6
- metadata.gz: c3cfe825b36ff482f5fe516f49e3406232a06c2cdddef20c6556c64ec1c1d64babfd3da823eb37425ae307eb19143c08ed55d7c461c68ae5923fcbe5dfd61ffc
7
- data.tar.gz: b60c17d5e69d9f676d7f14447a82d3a0c9db3759528166b715f4cd067b489f8453216f86700fa8028b709027058d599e1ff142a034512d445afb6403a22480a7
6
+ metadata.gz: a9849c9ecbcd570b3a3d156425d2e8131ed6d01f496cca56480bad6c6cace27ebf5648759a18644d337feb1db57ef59ea4f013cdb595f2dce32b636e0f900000
7
+ data.tar.gz: 382309325649dbdb96422cc15d937709dcbbc7073563ba3052e383727d762fe24d6c17900be681f0e67677e2b3369165f8f7814e618a2d7386f9eb1a677e97c5
@@ -23,3 +23,22 @@ template_dirs = behat/actionwords, php, common
23
23
  filename = 'Actionwords.php'
24
24
  naming_convention = 'camel_case'
25
25
  call_prefix = '$this'
26
+
27
+ [step_definitions_library]
28
+ node_name = libraries
29
+ call_prefix = 'actionwords'
30
+ template_dirs = behat, php, common
31
+ named_filename = '%sFeatureContext.php'
32
+ renderer_addons = 'GherkinAddon'
33
+ filename_convention = 'camelize'
34
+
35
+
36
+ [library]
37
+ template_dirs = php, common
38
+ filename = 'ActionwordLibrary.php'
39
+
40
+ [libraries]
41
+ template_dirs = php, common
42
+ named_filename = '%sLibrary.php'
43
+ filename_convention = 'camelize'
44
+
@@ -44,7 +44,7 @@ class FileConfigParser
44
44
  def self.update_path!(param, config, options)
45
45
  path = Pathname.new(config[param])
46
46
  return unless path.relative?
47
- config_path = Pathname.new(options.config)
47
+ config_path = Pathname.new(options.config)
48
48
  config_absolute_path = config_path.relative? ? Pathname.pwd + config_path : config_path
49
49
  resolved_path = config_absolute_path.cleanpath.dirname + path
50
50
  options[param] = resolved_path.cleanpath.to_path
@@ -88,7 +88,7 @@ class Option
88
88
  end
89
89
 
90
90
  class CliOptions < OpenStruct
91
- def initialize(hash=nil)
91
+ def initialize(hash = nil)
92
92
  hash ||= {}
93
93
  hash[:language] ||= ""
94
94
  hash[:framework] ||= ""
@@ -134,7 +134,7 @@ class CliOptions < OpenStruct
134
134
  end
135
135
 
136
136
  def normalize!(reporter = nil)
137
- self.no_uids = !uids # silent normalization
137
+ self.no_uids = !uids # silent normalization
138
138
  modified_options = self.clone
139
139
  if actionwords_only
140
140
  modified_options.only = 'actionwords'
@@ -362,12 +362,12 @@ class TemplateFinder
362
362
  attr_reader :template_dirs, :overriden_templates, :forced_templates, :fallback_template
363
363
 
364
364
  def initialize(
365
- template_dirs: nil,
366
- overriden_templates: nil,
367
- indentation: ' ',
368
- forced_templates: nil,
369
- fallback_template: nil,
370
- **)
365
+ template_dirs: nil,
366
+ overriden_templates: nil,
367
+ indentation: ' ',
368
+ forced_templates: nil,
369
+ fallback_template: nil,
370
+ **)
371
371
  @template_dirs = template_dirs || []
372
372
  @overriden_templates = overriden_templates
373
373
  @compiled_handlebars = {}
@@ -382,7 +382,7 @@ class TemplateFinder
382
382
  search_dirs = []
383
383
  # search in overriden template base dir first
384
384
  search_dirs << overriden_templates if overriden_templates
385
- template_dirs.each { |template_dir|
385
+ template_dirs.each {|template_dir|
386
386
  # search template paths in overriden_templates
387
387
  search_dirs << "#{overriden_templates}/#{template_dir}" if overriden_templates
388
388
  # search template paths in hiptest_publisher
@@ -656,10 +656,10 @@ class LanguageConfigParser
656
656
 
657
657
  def self.config_path_for(cli_options)
658
658
  config_name = if cli_options.framework.empty?
659
- "#{cli_options.language}.conf"
660
- else
661
- "#{cli_options.language}-#{cli_options.framework}.conf"
662
- end
659
+ "#{cli_options.language}.conf"
660
+ else
661
+ "#{cli_options.language}-#{cli_options.framework}.conf"
662
+ end
663
663
  config_path = File.expand_path("#{hiptest_publisher_path}/lib/config/#{config_name.downcase}")
664
664
  if !File.file?(config_path)
665
665
  message = "cannot find configuration file in \"#{hiptest_publisher_path}/lib/config\""
@@ -689,7 +689,7 @@ class LanguageConfigParser
689
689
  end
690
690
 
691
691
  def language_group_configs
692
- filtered_group_names.map { |group_name| make_language_group_config(group_name) }
692
+ filtered_group_names.map {|group_name| make_language_group_config(group_name)}
693
693
  end
694
694
 
695
695
  def name_action_word(name)
@@ -704,7 +704,7 @@ class LanguageConfigParser
704
704
 
705
705
  def group_config(group_name)
706
706
  if @config[group_name]
707
- key_values = @config[group_name].map { |key, value| [key.to_sym, value] }
707
+ key_values = @config[group_name].map {|key, value| [key.to_sym, value]}
708
708
  Hash[key_values]
709
709
  else
710
710
  {}
@@ -720,6 +720,9 @@ class LanguageConfigParser
720
720
  tests_ouput_dir: @cli_options.tests_ouput_dir,
721
721
  features_output_directory: @cli_options.features_output_directory,
722
722
  step_definitions_output_directory: @cli_options.step_definitions_output_directory,
723
+ step_definitions_library_output_directory: @cli_options.step_definitions_output_directory,
724
+ libraries_output_directory: @cli_options.actionwords_output_directory,
725
+ library_output_directory: @cli_options.actionwords_output_directory,
723
726
  actionwords_output_directory: @cli_options.actionwords_output_directory
724
727
  }
725
728
 
@@ -735,6 +738,15 @@ class LanguageConfigParser
735
738
  language_group_params[:overriden_templates] = @cli_options.overriden_templates
736
739
  end
737
740
 
741
+ if @cli_options.step_definitions_output_directory
742
+ @cli_options.step_definitions_library_output_directory = @cli_options.step_definitions_output_directory
743
+ end
744
+
745
+ if @cli_options.actionwords_output_directory
746
+ @cli_options.libraries_output_directory = @cli_options.actionwords_output_directory
747
+ @cli_options.library_output_directory = @cli_options.actionwords_output_directory
748
+ end
749
+
738
750
  LanguageGroupConfig.new(@cli_options, language_group_params)
739
751
  end
740
752
  end
@@ -3,6 +3,6 @@
3
3
  * @{{{ rendered_children.gherkin_annotation }}} /{{> gherkin_pattern}}/
4
4
  */
5
5
  public function {{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{{ join rendered_children.parameters_ordered_by_pattern ', '}}}{{/if}}){{#curly}}{{#indent}}
6
- $this->actionwords->{{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}${{{underscore this}}}{{/join}}{{/if}});
6
+ $this->actionwords->{{#if has_library?}}get{{{camelize library_name}}}Library()->{{/if}}{{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}${{{underscore this}}}{{/join}}{{/if}});
7
7
  {{/indent}}
8
8
  {{/curly}}{{/if}}
@@ -0,0 +1,16 @@
1
+ <?php
2
+ use Behat\Behat\Tester\Exception\PendingException;
3
+ use Behat\Behat\Context\SnippetAcceptingContext;
4
+ use Behat\Gherkin\Node\PyStringNode;
5
+ use Behat\Gherkin\Node\TableNode;
6
+
7
+ require_once('Actionwords.php');
8
+
9
+ class {{camelize rendered_children.name}}FeatureContext implements SnippetAcceptingContext {{#curly}}{{#indent}}
10
+ public function __construct() {{#curly}}{{#indent}}
11
+ $this->actionwords = new Actionwords();{{/indent}}
12
+ {{/curly}}
13
+ {{#each rendered_children.actionwords}}
14
+ {{{this}}}{{/each}}{{/indent}}
15
+ {{/curly}}
16
+ ?>
@@ -1,5 +1,7 @@
1
1
  <?php
2
- class Actionwords {{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
2
+ {{#if uses_library?}}require_once('ActionwordLibrary.php');{{/if}}
3
+
4
+ class Actionwords {{#if uses_library?}}extends ActionwordLibrary {{/if}}{{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
3
5
  {{{this}}}
4
6
  {{/each}}
5
7
  {{/indent}}
@@ -0,0 +1,11 @@
1
+ <?php
2
+ {{#each library_names}}require_once('{{camelize this}}Library.php');
3
+ {{/each}}
4
+ class ActionwordLibrary {{#curly}}{{#indent}}{{#each library_names}}
5
+ public function get{{camelize this}}Library() {{#curly}}{{#indent}}
6
+ return {{camelize this}}Library::getInstance();
7
+ {{/indent}}
8
+ {{/curly}}
9
+ {{/each}}{{/indent}}
10
+ {{/curly}}
11
+ ?>
@@ -0,0 +1,17 @@
1
+ <?php
2
+ class {{camelize rendered_children.name}}Library {{#curly}}{{#indent}}
3
+ private static $_instance = null;
4
+
5
+ private function __construct(){{#curly}}{{/curly}}
6
+
7
+ public static function getInstance(){{#curly}}{{#indent}}
8
+ if (is_null(self::$_instance)) {{#curly}}{{#indent}}
9
+ self::$_instance = new {{camelize rendered_children.name}}Library();
10
+ {{/indent}}
11
+ {{/curly}}
12
+ return self::$_instance;
13
+ {{/indent}}
14
+ {{/curly}}
15
+ {{/indent}}
16
+ {{/curly}}
17
+ ?>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiptest-publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.0
4
+ version: 1.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiptest R&D
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-01 00:00:00.000000000 Z
11
+ date: 2018-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -287,6 +287,7 @@ files:
287
287
  - lib/templates/behat/actionword.hbs
288
288
  - lib/templates/behat/actionwords.hbs
289
289
  - lib/templates/behat/actionwords/parameter.hbs
290
+ - lib/templates/behat/library.hbs
290
291
  - lib/templates/behat/parameter.hbs
291
292
  - lib/templates/behave/actionword.hbs
292
293
  - lib/templates/behave/actionwords.hbs
@@ -515,6 +516,8 @@ files:
515
516
  - lib/templates/php/folder.hbs
516
517
  - lib/templates/php/ifthen.hbs
517
518
  - lib/templates/php/index.hbs
519
+ - lib/templates/php/libraries.hbs
520
+ - lib/templates/php/library.hbs
518
521
  - lib/templates/php/list.hbs
519
522
  - lib/templates/php/nullliteral.hbs
520
523
  - lib/templates/php/parameter.hbs