Sha256: 8aa07e989e8815be743a94d4d339342ccd387872719b1f1ecd8e0bf3df52a1b6

Contents?: true

Size: 1.38 KB

Versions: 9

Compression:

Stored size: 1.38 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)

        # build source code for each shape
        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)

        # build spec for each shape
        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

9 entries across 9 versions & 1 rubygems

Version Path
drawio_dsl-0.8.1 .builders/generators/02-generate-app.rb
drawio_dsl-0.8.0 .builders/generators/02-generate-app.rb
drawio_dsl-0.7.0 .builders/generators/02-generate-app.rb
drawio_dsl-0.6.0 .builders/generators/02-generate-app.rb
drawio_dsl-0.5.7 .builders/generators/02-generate-app.rb
drawio_dsl-0.5.6 .builders/generators/02-generate-app.rb
drawio_dsl-0.5.5 .builders/generators/02-generate-app.rb
drawio_dsl-0.5.4 .builders/generators/02-generate-app.rb
drawio_dsl-0.5.3 .builders/generators/02-generate-app.rb