Coder Social home page Coder Social logo

dotnet-accelerator's People

Contributors

fjb4 avatar macsux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dotnet-accelerator's Issues

Ideas for simplifying accelerators.yaml

After looking at the machine generated accelerator.yaml file in a bit more detail, I think the following recipes could be used to make it more "natural" (and concise):

  1. All of the preprocessor #if x #endif directives could be replaced by a ReplaceText with regex, e.g. like so:
  - include:
    - src/MyProjectGroup.Common/MyProjectGroup.Common.csproj
    chain:
    - type: ReplaceText
      substitutions:
      - text: |2-
                  <!--#if configserver -->
                  <PackageReference Include="Steeltoe.Extensions.Configuration.ConfigServerCore" Version="3.1.3" />
                  <!--#endif -->
        with: "''"
      condition: '!(#configserver)'
    - type: ReplaceText
      substitutions:
      - text: |2-
                  <!--#if configserver -->
                  <PackageReference Include="Steeltoe.Extensions.Configuration.ConfigServerCore" Version="3.1.3" />
                  <!--#endif -->
        with: "'        <PackageReference Include=\"Steeltoe.Extensions.Configuration.ConfigServerCore\" Version=\"3.1.3\" />'"
      condition: '#configserver'

becomes

  - include:
    - src/MyProjectGroup.Common/MyProjectGroup.Common.csproj
    chain:
    - type: ReplaceText
      regex:
        pattern: '(?s)<!--#if configserver -->(.*?)<!--#endif -->'
        with: "#configserver ? '$1' : ''"

but then of course, there is no need to have this snippet per file, so the include can become

- include: ['**/*.csproj', '**/*.xml']

and handle all files in one swoop.

You're then left with one snippet per option + comment format (xml-like, C-like, etc.)
I believe this can apply to lines 70 to 800 and scale with the number of options instead of the number of files to touch.
If you're adventurous, this could be reduced to one snippet per option if you make the regex cope with all comment styles.

  1. Then, all the RewritePath of the form
  - type: RewritePath
    regex: config/DotnetAccelerator-Development.yaml
    rewriteTo: "'config/' + #artifactId + '-Development.yaml'"
  - type: RewritePath
    regex: config/DotnetAccelerator-LocalMySQL.yaml
    rewriteTo: "'config/' + #artifactId + '-LocalMySQL.yaml'"
etc...

can be rewritten to a couple of RewritePath using capturing groups:

  - type: RewritePath
    regex: (config/)DotnetAccelerator(-Development\\.yaml)
    rewriteTo: "#g1 + #artifactId + #g2"
etc...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.