drawio_dsl 0.5.4 → 0.5.5

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.
@@ -27,6 +27,7 @@ module DrawioDsl
27
27
 
28
28
  add(file_name, content: diagram.build, **opts)
29
29
 
30
+ # if last_save_file_name is nil then you are not in execute mode
30
31
  @last_save_file_name = k_builder.last_output_file
31
32
 
32
33
  self
@@ -50,6 +51,21 @@ module DrawioDsl
50
51
 
51
52
  self
52
53
  end
54
+
55
+ def export_png(output_file_name, page: 1)
56
+ return unless last_save_file_name
57
+ return unless File.exist?(last_save_file_name)
58
+
59
+ page -= 1 # use zero based index
60
+
61
+ output_file_name = "#{output_file_name}.png" unless output_file_name.end_with?('.png')
62
+
63
+ command = "/Applications/draw.io.app/Contents/MacOS/draw.io '#{last_save_file_name}' -p #{page} -x -o #{output_file_name}"
64
+
65
+ run_command(command)
66
+
67
+ self
68
+ end
53
69
  end
54
70
 
55
71
  # DrawioDsl::DrawioPage is created when you call .page on the draw-io DSL.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- VERSION = '0.5.4'
4
+ VERSION = '0.5.5'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "drawio_dsl",
9
- "version": "0.5.4",
9
+ "version": "0.5.5",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.1",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "DrawIO DSL can build DrawIO diagrams using a Domain Specific Language",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drawio_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -91,7 +91,6 @@ files:
91
91
  - ".builders/generators/sample_diagrams/16-grid-alignment.rb"
92
92
  - ".builders/generators/sample_diagrams/20-styles.rb"
93
93
  - ".builders/generators/sample_diagrams/25-themes.rb"
94
- - ".builders/generators/sample_diagrams/30-shapes.rb"
95
94
  - ".builders/generators/sample_diagrams/50-willoughby-council.rb"
96
95
  - ".releaserc.json"
97
96
  - ".rspec"
@@ -110,6 +109,20 @@ files:
110
109
  - docs/project_done.svg
111
110
  - docs/project_in_progress.svg
112
111
  - docs/project_todo.svg
112
+ - docs/samples/grid-alignment-center.svg
113
+ - docs/samples/grid-alignment.svg
114
+ - docs/samples/grid-direction-horizontal.svg
115
+ - docs/samples/grid-direction-vertical.svg
116
+ - docs/samples/samples.md
117
+ - docs/samples/styles-glass.svg
118
+ - docs/samples/styles-plain.svg
119
+ - docs/samples/styles-rounded.svg
120
+ - docs/samples/styles-shadow.svg
121
+ - docs/samples/styles-sketch.svg
122
+ - docs/samples/themes-circle.svg
123
+ - docs/samples/themes-random.svg
124
+ - docs/samples/themes-square.svg
125
+ - docs/samples/willoughby-council.svg
113
126
  - lib/drawio_dsl.rb
114
127
  - lib/drawio_dsl/configuration.rb
115
128
  - lib/drawio_dsl/configuration_extension.rb
@@ -1,23 +0,0 @@
1
- KManager.action :bootstrap do
2
- action do
3
-
4
- # :rounded, :shadow, :sketch, :glass
5
- director = DrawioDsl::Drawio
6
- .init(k_builder)
7
- .diagram(theme: :style_06)
8
- .page('Shapes', margin_left: 0, margin_top: 0) do
9
- grid_layout(wrap_at: 5)
10
-
11
- KConfig.configuration.drawio.shapes.members.each do |shape|
12
- next if shape == :shape
13
-
14
- send(shape, title: shape.to_s, shape: shape)
15
- end
16
- end
17
-
18
- diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
19
-
20
- File.write('../spec/.samples/drawio/30-shapes.xml', diagram.build)
21
- File.write('../spec/.samples/drawio/30-shapes.drawio', diagram.build)
22
- end
23
- end