power_stencil 0.4.11 → 0.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94f31697927b7c398f3479e6119e5ec7b9ada878
4
- data.tar.gz: 1aa4ee24ce33bb0d056a471cde643d85c804b369
3
+ metadata.gz: b10ddad9f41bfb08e3d0917d4226038c4f80804c
4
+ data.tar.gz: 614c5bf32a33a9e55ce3b62f9a9d6a1e24db3b39
5
5
  SHA512:
6
- metadata.gz: 903b071f3761253f8dcb766bd1d340a494115f6a5483d5346872488074c023ebf9b1fd573510f64fbfa53abddcdcdd944ac8ea778d528188748d6be7f6af6cfe
7
- data.tar.gz: 6df31360e4f082f1a45e80120d49057da5222e3f8466a02c71bafe31e39b6047a9223e5eb793c0c50b5b88d4802105cdbeaac86e750d000539b067f6768aa980
6
+ metadata.gz: 23e52fc919f98bb92b173e4b5e945028b78a6a14597646ffc6fef7f39fbafe9be0d0bae32b8ee247537144ccb7ccd3206eb8d795711003879b76557f1b925dc7
7
+ data.tar.gz: f2af26ceb8859707ff7b721b2346c93fafca817c9253ac65b9b9840205f21833798bd39606f377715ed0c0ce6849656e7943b293e306ab2edca026621c774f6e
data/README.md CHANGED
@@ -75,10 +75,12 @@ Then you can install the `PowerStencil` gem by issuing the usual:
75
75
 
76
76
  $ gem install power_stencil
77
77
 
78
- If you want to create graphviz graphs, you probably may want to install it for your system. If you are using an _apt-based_ system like Ubuntu or Debian it may probably be as simple as:
78
+ If you want to create [Graphviz] graphs, you probably may want to install it for your system. If you are using an _apt-based_ system like Ubuntu or Debian it may probably be as simple as:
79
79
 
80
80
  $ sudo apt install graphviz
81
81
 
82
+ If you use Windows, install [Graphviz] using the stable version for Windows and add the `bin` directory to the `%PATH%`.
83
+
82
84
  # Usage
83
85
 
84
86
  ## Help
@@ -246,4 +248,5 @@ Everyone interacting in the PowerStencil project’s codebases, issue trackers,
246
248
  [Haml]: http://haml.info/ "The templating engine for XML-like documents"
247
249
  [Ruby]: https://www.ruby-lang.org "The powerful Ruby language"
248
250
  [Rails]: https://rubyonrails.org/ "The Ruby on Rails framework"
249
- [PowerStencil site]: https://powerstencil.brizone.org "Official PowerStencil website"
251
+ [PowerStencil site]: https://powerstencil.brizone.org "Official PowerStencil website"
252
+ [Graphviz]: https://www.graphviz.org/ "Graph Visualization Software"
@@ -984,4 +984,4 @@ Now you know an entity type is just a regular Ruby class. As such you could add
984
984
  [Ruby On Rails]: https://rubyonrails.org/ "One of the best Web framework"
985
985
  [universe_compiler]: https://gitlab.com/tools4devops/universe_compiler "The underlying engine to manage entities and compilation !"
986
986
  [`universe_compiler` advanced relations documentation]: https://gitlab.com/tools4devops/universe_compiler#advanced-relations "Advanced relational features"
987
- [Graphviz]: (https://www.graphviz.org/) "Graph Visualization Software"
987
+ [Graphviz]: https://www.graphviz.org/ "Graph Visualization Software"
data/doc/faq.md CHANGED
@@ -65,7 +65,9 @@ So the two main remaining contenders are JSON and YAML. Although there is no rea
65
65
 
66
66
  As such, even if I never tested, I would expect it to probably work out of the box on MacOS, BSD or other Unices supporting Ruby 2.2+.
67
67
 
68
- Regarding Windows, I stopped using spywareOS years ago so I can't really tell you. Last time I tried using Ruby on Windows (maybe 10 years ago), I did face a lot of dependency issues. Maybe things are better now, but I have no idea. As far as I understood you can now have an Ubuntu running on top of Windows 10 as a kind of blessed VM. I would probably more go this way...
68
+ ~~Regarding Windows, I stopped using spywareOS years ago so I can't really tell you. Last time I tried using Ruby on Windows (maybe 10 years ago), I did face a lot of dependency issues. Maybe things are better now, but I have no idea. As far as I understood you can now have an Ubuntu running on top of Windows 10 as a kind of blessed VM. I would probably more go this way...~~
69
+
70
+ I had the opportunity to have access to a Windows VM and tested `PowerStencil`. I had to fix a couple of issues related to the way Windows manages concurrent access to files (:rofl:) , but **since version `0.4.14`, `PowerStencil` should now fully work under Windows**, including generating files using GraphViz if it is installed and correctly set in the `%PATH%`. I used the standard Ruby for Windows with no hack.
69
71
 
70
72
 
71
73
  # What is the status of `PowerStencil` ?
@@ -71,6 +71,8 @@
71
71
 
72
72
  # Files matching particular patterns can be changed on the fly
73
73
  :file_renaming_patterns:
74
+ # Specific .gitignore file for Windows
75
+ ^(.+)\.zzzgitignore\.erb$: '\1.gitignore'
74
76
  # Erb files
75
77
  ^(.+)\.erb$: '\1'
76
78
 
@@ -0,0 +1,12 @@
1
+ PowerStencil plugins
2
+ ====================
3
+
4
+
5
+ In this directory, you can define project specific local plugins.
6
+ You should create them using the `PowerStencil` command-line.
7
+
8
+ $ power_stencil new-plugin myplugin
9
+
10
+ __It is strongly advised to keep this directory under source control__
11
+
12
+ This should be the PowerStencil default behaviour.
@@ -1,12 +1,10 @@
1
- PowerStencil project templates
2
- ==============================
1
+ PowerStencil project templates templates
2
+ ========================================
3
3
 
4
4
 
5
- In this directory, you can define project specific templates for entities
6
- defined locally in this project.
5
+ In this directory, you can define project specific templates for entity types defined locally in this project.
7
6
 
8
- Templates can be a whole tree structure in a directory named from the entity
9
- type of entities you defined in `entity_definitions` folder that are `buildable`.
7
+ Templates can be a whole tree structure in a directory named from the entity type of entities you defined in `entity_definitions` folder that are `buildable`.
10
8
 
11
9
  __It is strongly advised to keep this directory under source control__
12
10
 
@@ -2,3 +2,6 @@
2
2
  # Generated on the <%= Time.now %>
3
3
 
4
4
  echo "Nothing to do... Easy task..."
5
+
6
+ # Return 0 if the build succeeds
7
+ exit 0
@@ -67,7 +67,11 @@ module PowerStencil
67
67
  script_to_execute = File.expand_path File.join(files_path, entity_to_build.post_process.process)
68
68
  exec_options = {message: "Running '#{script_to_execute}'"}
69
69
  exec_options[:show_output] = true if config[:verbose]
70
- safely_exec_command script_to_execute, exec_options
70
+ process_report = safely_exec_command "'#{script_to_execute}'", exec_options
71
+ unless process_report.exit_status.exitstatus == 0
72
+ raise PowerStencil::Error, "Process `#{process_report.command}` failed and returned exit code '#{process_report.exit_status.exitstatus}'"
73
+ end
74
+ process_report
71
75
  end
72
76
  end
73
77
 
@@ -59,7 +59,7 @@ module PowerStencil
59
59
  unless files_not_to_rename.ignore_file? src_file
60
60
  config[:file_renaming_patterns].each do |regexp_str, replacement|
61
61
  regexp = Regexp.new regexp_str
62
- next if (dest_file =~ regexp).nil?
62
+ next if (src_file =~ regexp).nil?
63
63
  dest_file = dest_file.gsub regexp, replacement
64
64
  break
65
65
  end
@@ -12,7 +12,7 @@ module PowerStencil
12
12
  # Dir.glob_with_ignore_file ignore_file, base_dir, *glob_args, &block
13
13
  file_pattern = "#{source}/**/*"
14
14
  res = {}
15
- Dir.glob_with_ignore_file ignore_files_pattern, source, file_pattern, File::FNM_DOTMATCH do |original_file|
15
+ Dir.glob_with_ignore_file(ignore_files_pattern, source, file_pattern, File::FNM_DOTMATCH).sort.each do |original_file|
16
16
  logger.debug "Processing '#{original_file}'"
17
17
  res[original_file] = destination_file(original_file, source, destination)
18
18
  if block_given?
@@ -25,14 +25,21 @@ module PowerStencil
25
25
  def securely_edit_entity(entity, &modifications_validation_block)
26
26
  initial_uri = entity.source_uri
27
27
  modified_entity = nil
28
- Tempfile.create(["#{entity.type.to_s}_#{entity.name.to_s}", '.yaml']) do |tmpfile|
28
+ tmpfile = Tempfile.create(["#{entity.type.to_s}_#{entity.name.to_s}", '.yaml'])
29
+ tmpfile_path = tmpfile.path
30
+ begin
29
31
  tmpfile.puts entity.to_yaml
30
32
  tmpfile.flush
31
- securely_edit_file(tmpfile, &modifications_validation_block)
32
- modified_entity = UniverseCompiler::Entity::Persistence.load tmpfile
33
- modified_entity.source_uri = initial_uri
33
+ ensure
34
+ tmpfile.close
34
35
  end
36
+ securely_edit_file(tmpfile_path, &modifications_validation_block)
37
+ modified_entity = UniverseCompiler::Entity::Persistence.load tmpfile_path
38
+ modified_entity.source_uri = initial_uri
35
39
  return modified_entity
40
+ ensure
41
+ tmpfile.close
42
+ File.unlink tmpfile
36
43
  end
37
44
 
38
45
  def securely_edit_file(file, &modifications_validation_block)
@@ -41,7 +48,9 @@ module PowerStencil
41
48
  end
42
49
  ext = File.extname file
43
50
  base = File.basename file, ext
44
- tmp_file_path = Tempfile.new([base, ext]).path
51
+ tmp_file = Tempfile.create([base, ext])
52
+ tmp_file_path = tmp_file.path
53
+ tmp_file.close
45
54
  retry_count = 1
46
55
  begin
47
56
  FileUtils.copy file, tmp_file_path if retry_count == 1
@@ -1,3 +1,3 @@
1
1
  module PowerStencil
2
- VERSION = '0.4.11'.freeze
2
+ VERSION = '0.4.16'.freeze
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{PowerStencil is the Swiss-army knife templating workflow for developers and ops.}
13
13
  spec.description = %q{PowerStencil is the Swiss-army knife templating workflow for developers and ops.}
14
- spec.homepage = ''
14
+ spec.homepage = 'https://powerstencil.brizone.org/'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -33,9 +33,10 @@ Gem::Specification.new do |spec|
33
33
  source_code_uri = 'https://gitlab.com/tools4devops/power_stencil'
34
34
 
35
35
  spec.metadata = {
36
- "bug_tracker_uri" => "#{source_code_uri}/issues",
37
- "documentation_uri" => "#{source_code_uri}/blob/master/README.md",
38
- "source_code_uri" => source_code_uri
36
+ 'bug_tracker_uri' => "#{source_code_uri}/issues",
37
+ 'documentation_uri' => "#{source_code_uri}/blob/master/README.md",
38
+ 'source_code_uri' => source_code_uri,
39
+ 'homepage_uri' => spec.homepage
39
40
  }
40
41
 
41
42
  spec.post_install_message = %Q{
@@ -45,6 +46,7 @@ If your shell is not completing the command:
45
46
  If you use rbenv: `rbenv rehash`
46
47
  If you use zsh : `rehash`
47
48
 
49
+ Official Website : #{spec.homepage}
48
50
  Full documentation here : #{spec.metadata['source_code_uri']}/blob/master/README.md
49
51
  Feel free to report issues: #{spec.metadata['source_code_uri']}/issues
50
52
  }
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.4.11
4
+ version: 0.4.16
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-09-28 00:00:00.000000000 Z
11
+ date: 2019-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -171,18 +171,19 @@ files:
171
171
  - etc/templates/plugin_definition/spec/spec_helper.rb
172
172
  - etc/templates/plugin_definition/spec/{entity}_spec.rb
173
173
  - etc/templates/project/.copy_ignore
174
- - etc/templates/project/.gitignore.erb
175
174
  - etc/templates/project/.ps_project/entities/.gitkeep
176
175
  - etc/templates/project/.ps_project/entities/README.md
177
176
  - etc/templates/project/.ps_project/entity_definitions/.gitkeep
178
177
  - etc/templates/project/.ps_project/entity_definitions/README.md
179
178
  - etc/templates/project/.ps_project/personal-config.yaml
180
179
  - etc/templates/project/.ps_project/plugins/.gitkeep
180
+ - etc/templates/project/.ps_project/plugins/README.md
181
181
  - etc/templates/project/.ps_project/templates-templates/.gitkeep
182
182
  - etc/templates/project/.ps_project/templates-templates/README.md
183
183
  - etc/templates/project/.ps_project/user_entities/.gitkeep
184
184
  - etc/templates/project/.ps_project/user_entities/README.md
185
185
  - etc/templates/project/.ps_project/versioned-config.yaml
186
+ - etc/templates/project/.zzzgitignore.erb
186
187
  - etc/templates/simple_exec/main.sh
187
188
  - exe/power_stencil
188
189
  - lib/power_stencil.rb
@@ -250,18 +251,20 @@ files:
250
251
  - lib/power_stencil/utils/semantic_version.rb
251
252
  - lib/power_stencil/version.rb
252
253
  - power_stencil.gemspec
253
- homepage: ''
254
+ homepage: https://powerstencil.brizone.org/
254
255
  licenses:
255
256
  - MIT
256
257
  metadata:
257
258
  bug_tracker_uri: https://gitlab.com/tools4devops/power_stencil/issues
258
259
  documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
259
260
  source_code_uri: https://gitlab.com/tools4devops/power_stencil
260
- post_install_message: "\nThank you for installing PowerStencil 0.4.11 !\nFrom the
261
+ homepage_uri: https://powerstencil.brizone.org/
262
+ post_install_message: "\nThank you for installing PowerStencil 0.4.16 !\nFrom the
261
263
  command line you can run `power_stencil --help`\nIf your shell is not completing
262
- the command:\n If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nFull
263
- documentation here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel
264
- free to report issues: https://gitlab.com/tools4devops/power_stencil/issues\n "
264
+ the command:\n If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial
265
+ Website : https://powerstencil.brizone.org/\nFull documentation here :
266
+ https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel free to
267
+ report issues: https://gitlab.com/tools4devops/power_stencil/issues\n "
265
268
  rdoc_options: []
266
269
  require_paths:
267
270
  - lib