Sha256: a449eb737c9729864b7aa36e42fd57a46cad768fee5ae8a225170b5078c44493

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

KManager.action :requires do

  action do
    shapes_file = k_builder.target_folders.get_filename(:data, 'shapes.json')
    shapes = JSON.parse(File.read(shapes_file))

    KDirector::Dsls::BasicDsl
      .init(k_builder,
        on_exist:                   :write,                      # %i[skip write compare]
        on_action:                  :execute                    # %i[queue execute]
      )
      .blueprint(
        active: true,
        on_exist: :write) do

        cd(:lib)

        add('schema/_.rb', template_file: 'schema_require.rb', shapes: shapes)

        shapes.each do |shape|
          add("schema/shapes/#{shape['type']}.rb",
            template_file: 'schema_shape.rb',
            shape: shape)
        end

        add("drawio_shapes.rb"        , template_file: 'drawio_shapes.rb'       , shapes: shapes, shape_length: shapes.length)
        add("dom_builder_shapes.rb"   , template_file: 'dom_builder_shapes.rb'  , shapes: shapes)
        add("configuration_shapes.rb" , template_file: 'configuration_shapes.rb', shapes: shapes)

        cd(:spec)

        shapes.each do |shape|
          add("schema/shapes/#{shape['type']}_spec.rb",
            template_file: 'schema_shape_spec.rb',
            shape: shape)
        end

        cd(:app)
        run_command('rubocop -a')

      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
drawio_dsl-0.5.2 .builders/generators/02-generate-app.rb
drawio_dsl-0.5.1 .builders/generators/02-generate-app.rb
drawio_dsl-0.5.0 .builders/generators/02-generate-app.rb