Giter VIP home page Giter VIP logo

makesure's People

Contributors

0mp avatar pcrockett avatar xonixx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

makesure's Issues

Redesign `@goal_glob`

See #18

New Design

Let's change the behavior to

@goal goal_name @glob *.txt 
 echo $ITEM $INDEX $TOTAL

Is eqivalent to

@goal [email protected]
 echo a.txt 0 2

@goal [email protected]
 echo b.txt 1 2

iff

$ ls
a.txt b.txt

Also allowed form

@goal @glob *.txt
 echo $ITEM $INDEX $TOTAL

as equivalent for

@goal a.txt
 echo a.txt 0 2

@goal b.txt
 echo b.txt 1 2

Rationale

  1. This will allow have multiple glob goals for same set of files
  2. This will allow multiple globs per goal
    • Discarded: this is big over-complication in terms of UX and implementation.

Discarded design attempt

@goal goal_name
@glob FILE *.txt
 echo $FILE $FILE_INDEX $FILE_TOTAL

Is eqivalent to

@goal goal_name-a.txt
 echo a.txt 0 2

@goal goal_name-b.txt
 echo b.txt 1 2

iff

$ ls
a.txt b.txt

Add more safety by handling the return value of close()

See https://www.gnu.org/software/gawk/manual/html_node/Close-Files-And-Pipes.html#index-sidebar-10

$ awk --posix 'BEGIN { (s="echo 123; exit 10") | getline; print; print close(s) }'
123
0
$ awk 'BEGIN { (s="echo 123; exit 10") | getline; print; print close(s) }'
123
2560
$ busybox awk 'BEGIN { (s="echo 123; exit 10") | getline; print; print close(s) }'
123
2560
$ mawk 'BEGIN { (s="echo 123; exit 10") | getline; print; print close(s) }'
123
10

Do not measure timing for [already satisfied] and [empty] goals

This gives meaningless noise

$ ./makesure 
  goal 'quickjs_installed' [already satisfied].
  goal 'quickjs_installed' took 0.01 s
  goal 'build_folder_created' [already satisfied].
  goal 'build_folder_created' took 0.01 s
  goal 'prepared_for_build' [empty].
  goal 'prepared_for_build' took 0.01 s
  goal 'built_for_prod' ...
Compiling release build with QuickJS Compiler version 2020-11-08...
-rwxr-xr-x 1 xonix xonix 657K Jan 26 18:57 jsqry
  goal 'built_for_prod' took 8.057 s
  goal 'tush_installed' [already satisfied].
  goal 'tush_installed' took 0.002 s
  goal 'tests_executed' ...
TESTS PASSED
  goal 'tests_executed' took 0.075 s
  goal 'built' [empty].
  goal 'built' took 0.001 s
  goal 'default' [empty].
  goal 'default' took 0.002 s
  total time 8.244 s

Improve `./makesure -l` output

For Makesurefile

@goal aaa
@doc some description

@goal other_goal
@doc do something important

@goal yet_another_goal
@doc do something even more important

@goal hello

./makesure -l should show

Available goals:
  aaa              : some description
  other_goal       : do something important
  yet_another_goal : do something even more important
  hello

Improvement to `@goal @glob`

In continuation of #34

New Design

In addition to proposed behavior in #34 let's also generate a root goal that also calls all child goals.
So:

@goal goal_name @glob *.txt 
 echo $ITEM $INDEX $TOTAL

Is eqivalent to

@goal goal_name
@depends_on [email protected]
@depends_on [email protected]

@goal [email protected]
 echo a.txt 0 2

@goal [email protected]
 echo b.txt 1 2

iff

$ ls
a.txt b.txt

@private

@private takes effect on all-goal only. Generated goals are aways private.

name

Name is not mandatory as now.

Without name let's use glob itself as a name (but only if it doesn't equal to a generated goal name)

@goal @glob *.txt 
 echo $ITEM $INDEX $TOTAL

Is eqivalent to

@goal *.txt
@depends_on a.txt
@depends_on b.txt

@goal a.txt
 echo a.txt 0 2

@goal b.txt
 echo b.txt 1 2

Child goals ordering

Let's make it natural sort order

Optimize goals execution

  1. We can change echo from shell to print from awk
  2. This can lower shell invocation count for [empty] goals

Revise variables behavior

Related #26

At the moment there is 2 ways to pass external parameters:

  • VAR=value ./makesure
  • ./makesure -D VAR=value

Need to understand:

  • Do we need the two methods to coexist or can just leave one? Looks like we can't omit the first one.
  • If we need both - how do they differ and interact?

Resolution

Let's have both approaches in place. Though, with the difference:

  • @defile A=2 in Makesurefile always overrides the environment variable with same name (A=1 ./makesure)
  • @define A=2 is overriden by -D A=1 (./makesure -D A=1)
  • Let's change @define to export environment variable, for consistency. In this case it just overrides the value of existing environment variable, if present.

So final precedence would be (higher priority top):

  • ./makesure -D VAR=1
  • @define VAR=2 in Makesurefile
  • VAR=3 ./makesure

Rationale

Though it's tempting to only rely on environment variables, in this case it also needs that environment variable override the @defines in build file, to be able to provide more specific config values externally. But this potentially makes a build unpredictable because you can't always control the environment variables.

Add `@lib` for code reuse

Needed for #32

@lib lib_name
a() { 
  echo Hello $1  
}

@goal goal_name
@use_lib lib_name
a World

For simplicity can omit name:

@lib
a() { 
  echo Hello $1  
}

@goal goal_name
@use_lib
a World

Propose a method to have parameterized goals

Use case:

We want to have a tested goal that depends on a tested_a and tested_b so as to have an option to run all tests as well as to run each test separately, tested_a and tested_b have fairly similar logic.

Can this be achieved via goal-level @defines?

`@goal_glob`

See #12

The idea:

@goal_glob *.txt
 echo $ITEM $INDEX $TOTAL

Is eqivalent to

@goal a.txt
 echo a.txt 0 2

@goal b.txt
 echo b.txt 1 2

iff

$ ls
a.txt b.txt

Consider the notion of private goals

The idea is for ./makesure -l only show goals intended to be ran by the user. This means we also need -la switch to list all goals.

Need special care with @goal_glob.

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.