power_stencil 0.6.0 → 0.6.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
  SHA1:
3
- metadata.gz: 314848bb5c64481d2a9f56872d51ccb805038409
4
- data.tar.gz: 608468d222257ddb0063b935d939c75fd592b254
3
+ metadata.gz: 687808cf09467280d9b69cc408051a26c27910f1
4
+ data.tar.gz: 30ab8477a45c06b3263b8eaeeabf013b8641830c
5
5
  SHA512:
6
- metadata.gz: b73846ac1152992200f86cb5ae4e2f181c6d32b54fad1659ca90dea6ed6c05e0bf1252aea851ee67f315a6e624bedc2e9c05f47f92fd78a7f9913cc7a6811350
7
- data.tar.gz: aaffc74c41eee5dfc69151ba61a6a982bf13680f1968fd353a2bf1d311a4f0d93f66a2495b8ad02f5dac6460ff568eec84756a422681c8641e3d3b9ae60923df
6
+ metadata.gz: 6839ca4af2d78718eaf88c378c424109f9bc5f8cab5ef1ab944ee01a1a437fcb85304638c2d46196f8690d502cee40698416caaa0ef1492676363ee0220db2a5
7
+ data.tar.gz: f448a6a57f64bd209f9682f94581ad9fbd19433ad51a46e8fd6bbcc6aeaadedb4de5a6d1bccd21b1833eba6f4e0ffb94061acbc677360d131d6cff77ba7fa6f2
@@ -37,7 +37,7 @@ module PowerStencil
37
37
  if entity_report == ['Ok']
38
38
  puts " - '#{entity_full_name}' has been correctly built"
39
39
  else
40
- puts " - Failed to build '#{entity_full_name}' because ", entity_report
40
+ puts_and_logs " - Failed to build '#{entity_full_name}' because #{entity_report.join}", logs_as: :error, check_verbose: false
41
41
  end
42
42
  end
43
43
 
@@ -12,7 +12,7 @@ module PowerStencil
12
12
  def execute
13
13
  analyse_extra_params.each do |search_criterion|
14
14
  begin
15
- puts_and_logs "Creating new entity '#{search_criterion.as_path}'"
15
+ puts_and_logs "Creating new entity '#{search_criterion.as_path}'", check_verbose: false
16
16
  entity_as_hash = {name: search_criterion.name}
17
17
  unless config[:property].nil?
18
18
  config[:property].each do |property_def|
@@ -12,21 +12,21 @@ module PowerStencil
12
12
  analyse_extra_params.each do |search_criterion|
13
13
  begin
14
14
  unless project.engine.entity *search_criterion.to_a, project.engine.root_universe
15
- puts "Skipping '#{search_criterion.as_path}'. Entity not found."
15
+ puts_and_logs "Skipping '#{search_criterion.as_path}'. Entity not found.", check_verbose: false
16
16
  next
17
17
  end
18
- puts_and_logs "Deleting entity '#{search_criterion.as_path}'"
18
+ puts_and_logs "Deleting entity '#{search_criterion.as_path}'", check_verbose: false
19
19
  if project.engine.delete_entity project.engine.root_universe,
20
20
  *search_criterion.to_a,
21
21
  delete_files: config[:'delete-files']
22
22
  msg = "Deleted '#{search_criterion.as_path}'"
23
23
  msg << ' and associated files.' if config[:'delete-files']
24
- puts msg
24
+ puts_and_logs msg, check_verbose: false
25
25
  else
26
- puts 'Cancelled by user input.'
26
+ puts_and_logs 'Cancelled by user input.', check_verbose: false
27
27
  end
28
28
  rescue => e
29
- puts "Failed to delete '#{search_criterion.as_path}' with message '#{e.message}'."
29
+ puts_and_logs "Failed to delete '#{search_criterion.as_path}' with message '#{e.message}'.", logs_as: :error, check_verbose: false
30
30
  logger.debug PowerStencil::Error.report_error(e)
31
31
  end
32
32
  end
@@ -15,9 +15,9 @@ module PowerStencil
15
15
  def execute
16
16
  setup_project_path
17
17
  log_startup_context
18
- puts_and_logs "Creating new project structure in '#{config[:'project-path']}'"
18
+ puts_and_logs "Creating new project structure in '#{config[:'project-path']}'", check_verbose: false
19
19
  PowerStencil::Project::Base.create_project_tree config[:'project-path']
20
- puts_and_logs 'Done.'
20
+ puts_and_logs 'Done.', check_verbose: false
21
21
  end
22
22
 
23
23
  private
@@ -18,7 +18,7 @@ module PowerStencil
18
18
  unless config.command_line_layer.extra_parameters.empty?
19
19
  raise PowerStencil::Error, "Invalid command '#{config.command_line_layer.extra_parameters.first}'"
20
20
  end
21
- puts_and_logs 'No action specified. Exiting...'
21
+ puts_and_logs 'No action specified. Exiting...', check_verbose: false
22
22
  end
23
23
 
24
24
  end
@@ -39,8 +39,7 @@ module PowerStencil
39
39
  build_entity entity_to_build, build_entity_target_path
40
40
 
41
41
  entity_build_report << 'Ok'
42
- rescue => e
43
- logger.error "Failed building '#{entity_to_build.as_path}' because '#{e.message}' !"
42
+ rescue SyntaxError, StandardError => e
44
43
  entity_build_report << e.message
45
44
  if fail_on_error
46
45
  raise e
@@ -97,7 +97,12 @@ module PowerStencil
97
97
  raise PowerStencil::Error, "File '#{source}' is supposed to be rendered using '#{engine_name}', but seems not to be supported !"
98
98
  end
99
99
  context = running_context universe, main_entry_point: main_entry_point
100
- return send templating_engine_method_name, source, context
100
+ begin
101
+ return send templating_engine_method_name, source, context
102
+ rescue StandardError, SyntaxError => e
103
+ logger.puts_and_logs "Error rendering #{engine_name} template '#{source}'", logs_as: :error, check_verbose: false
104
+ raise e
105
+ end
101
106
  end
102
107
  end
103
108
  logger.warn "File '#{source}' was supposed to be processed but there is no template engine defined ! Applying simple copy."
@@ -44,10 +44,12 @@ module PowerStencil
44
44
  @gem_spec = PowerStencil::Plugins::Base.find_locally_installed_gem_spec name, gem_req
45
45
  raise PowerStencil::Error, "Cannot find plugin '#{name}'. Try 'power_stencil plugin --install'" if gem_spec.nil?
46
46
  raise PowerStencil::Error, "Invalid plugin '#{name}' ! Missing metadata 'plugin_name' in spec !" if gem_spec.metadata['plugin_name'].nil?
47
+ logger.debug "Plugin '#{name}' real name is '#{gem_spec.metadata['plugin_name']}'."
47
48
  @name = gem_spec.metadata['plugin_name']
48
- logger.debug "Plugin real name is '#{name}'."
49
49
  when :local
50
50
  logger.debug "Plugin '#{name}' is provided locally by the project."
51
+ else
52
+ raise PowerStencil::Error, "Unsupported plugin type (#{type}) for plugin '#{name}' !"
51
53
  end
52
54
 
53
55
  logger.debug "Loading plugin '#{name}'..."
@@ -21,11 +21,16 @@ module PowerStencil
21
21
  raise PowerStencil::Error, "Plugin '#{self.name}' has no definition file !"
22
22
  end
23
23
  logger.debug "Loading plugin '#{self.name}' capabilities..."
24
- @plugin_definition = yaml_file_to_hash yaml_file
25
- %i(processors entity_definitions templates build dsl).each do |capability|
26
- unless plugin_definition[capability].nil? or plugin_definition[capability].empty?
27
- capabilities[capability] = true
24
+ begin
25
+ @plugin_definition = yaml_file_to_hash yaml_file
26
+ %i(processors entity_definitions templates build dsl).each do |capability|
27
+ unless plugin_definition[capability].nil? or plugin_definition[capability].empty?
28
+ capabilities[capability] = true
29
+ end
28
30
  end
31
+ rescue => e
32
+ logger.debug PowerStencil::Error.report_error(e)
33
+ raise PowerStencil::Error, "Invalid plugin capabilities file '#{yaml_file}' for plugin '#{self.name}'"
29
34
  end
30
35
 
31
36
  end
@@ -52,17 +52,16 @@ module PowerStencil
52
52
  return
53
53
  end
54
54
 
55
- candidates = Dir.entries(project_local_plugins_path)
56
- .select { |e| File.directory? File.join(project_local_plugins_path, e) }
57
- .reject { |d| %w(. ..).include? d }
58
-
59
- candidates.each do |candidate|
55
+ Dir.entries(project_local_plugins_path)
56
+ .select { |e| File.directory? File.join(project_local_plugins_path, e) }
57
+ .reject { |d| %w(. ..).include? d }
58
+ .each do |candidate|
60
59
  begin
61
60
  raise PowerStencil::Error, "Plugin '#{candidate}' already exists !" unless plugins[candidate].nil?
62
61
  plugins[candidate] = PowerStencil::Plugins::Base.new(candidate, self)
63
62
  rescue PowerStencil::Error => pse
64
- PowerStencil.logger.debug pse.message
65
- PowerStencil.logger.error "Discarding invalid plugin '#{candidate}'."
63
+ logger.puts_and_logs pse.message, logs_as: :error
64
+ logger.puts_and_logs "Discarding invalid plugin '#{candidate}'.", logs_as: :error
66
65
  end
67
66
  end
68
67
 
@@ -1,3 +1,3 @@
1
1
  module PowerStencil
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.6.1'.freeze
3
3
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
  spec.add_development_dependency 'rspec', '~> 3.0'
27
27
 
28
- spec.add_dependency 'climatic', '~> 0.2.29'
28
+ spec.add_dependency 'climatic', '~> 0.2.30'
29
29
  spec.add_dependency 'dir_glob_ignore', '~> 0.3'
30
30
  spec.add_dependency 'universe_compiler', '~> 0.5.1'
31
31
  spec.add_dependency 'pry'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: power_stencil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Briais
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-26 00:00:00.000000000 Z
11
+ date: 2019-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.29
61
+ version: 0.2.30
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.29
68
+ version: 0.2.30
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: dir_glob_ignore
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -275,7 +275,7 @@ metadata:
275
275
  documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
276
276
  source_code_uri: https://gitlab.com/tools4devops/power_stencil
277
277
  homepage_uri: https://powerstencil.brizone.org/
278
- post_install_message: "\nThank you for installing PowerStencil 0.6.0 !\nFrom the command
278
+ post_install_message: "\nThank you for installing PowerStencil 0.6.1 !\nFrom the command
279
279
  line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
280
280
  \ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial Website
281
281
  \ : https://powerstencil.brizone.org/\nFull documentation here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel