power_stencil 0.4.10 → 0.4.15

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: dc9c6f2ea647c097f3a6e9c84546369d8de9419e
4
- data.tar.gz: ffae8695d6cf182ea47bb990904838e2aaeb44ef
3
+ metadata.gz: 39ef892e57acf1b138606b8ce494324a76759eac
4
+ data.tar.gz: 811c9bbb835afa1f137c76d74a5261a01486fd6e
5
5
  SHA512:
6
- metadata.gz: c8f1c410c06d4be6b1e05bb4c2ac1c523bda13542108e5778db6778bec6a0d6defd5c6dccc31edfa212fb65fb7546607c0d316c9b4df668ec3f381e3e713ae58
7
- data.tar.gz: aa1e9c615cedefd8cebefdae156d3594c9e1e008de87a1a1ab864780182dd9851d81f527dc3a0b70855659e1afa75c1cbd2fed9b0f86a6e1441d08f0e373fc74
6
+ metadata.gz: 8d7d187f50b36b965576bc4dd538bacd401a8b62df1968c9f7cbc13ccfc3e6027c842dcc6e82be8753cd62e093c7d1c28d4e0f87c8247324cfa99d0e45a3aa70
7
+ data.tar.gz: 091f7d4bf28c89f292e33a78a1176b72678c8464c1dc0e517b6be47b42908fefd9a4fdabeec3af905871acecb72172b8a0a6395d67973ea3588c426c57acab42
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.10'.freeze
2
+ VERSION = '0.4.15'.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 = 'https://gitlab.com/tools4devops/power_stencil'
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|
@@ -30,10 +30,13 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency 'universe_compiler', '~> 0.4.3'
31
31
  spec.add_dependency 'pry'
32
32
 
33
+ source_code_uri = 'https://gitlab.com/tools4devops/power_stencil'
34
+
33
35
  spec.metadata = {
34
- "bug_tracker_uri" => "#{spec.homepage}/issues",
35
- "documentation_uri" => "#{spec.homepage}/blob/master/README.md",
36
- "official_website_uri" => "https://powerstencil.brizone.org"
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
37
40
  }
38
41
 
39
42
  spec.post_install_message = %Q{
@@ -43,7 +46,8 @@ If your shell is not completing the command:
43
46
  If you use rbenv: `rbenv rehash`
44
47
  If you use zsh : `rehash`
45
48
 
46
- Full documentation here : #{spec.homepage}/blob/master/README.md
47
- Feel free to report issues: #{spec.homepage}/issues
49
+ Official Website : #{spec.homepage}
50
+ Full documentation here : #{spec.metadata['source_code_uri']}/blob/master/README.md
51
+ Feel free to report issues: #{spec.metadata['source_code_uri']}/issues
48
52
  }
49
53
  end
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.10
4
+ version: 0.4.15
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-03 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: https://gitlab.com/tools4devops/power_stencil
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
- official_website_uri: https://powerstencil.brizone.org
260
- post_install_message: "\nThank you for installing PowerStencil 0.4.10 !\nFrom the
260
+ source_code_uri: https://gitlab.com/tools4devops/power_stencil
261
+ homepage_uri: https://powerstencil.brizone.org/
262
+ post_install_message: "\nThank you for installing PowerStencil 0.4.15 !\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