Coder Social home page Coder Social logo

bake's Introduction

Bake

Bake is a task execution tool, inspired by Rake, but codifying many of the use cases which are typically implemented in an ad-hoc manner.

Development Status

Features

Rake is an awesome tool and loved by the community. So, why reinvent it? Bake provides the following features that Rake does not:

  • On demand loading of files following a standard convention. This avoid loading all your rake tasks just to execute a single command.
  • Better argument handling including support for positional and optional arguments.
  • Focused on task execution not dependency resolution. Implementation is simpler and a bit more predictable.
  • Canonical structure for integration with gems.

That being said, Rake and Bake can exist side by side in the same project.

Usage

Please see the project documentation for more details.

  • Getting Started - This guide gives a general overview of bake and how to use it.

  • Command Line Interface - The bake command is broken up into two main functions: list and call.

  • Project Integration - This guide explains how to add bake to a Ruby project.

  • Gem Integration - This guide explains how to add bake to a Ruby gem and export standardised tasks for use by other gems and projects.

  • Input and Output - bake has built in tasks for reading input and writing output in different formats. While this can be useful for general processing, there are some limitations, notably that rich object representations like json and yaml often don't support stream processing.

Contributing

We welcome contributions to this project.

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create new Pull Request.

Developer Certificate of Origin

This project uses the Developer Certificate of Origin. All contributors to this project must agree to this document to have their contributions accepted.

Contributor Covenant

This project is governed by the Contributor Covenant. All contributors and participants agree to abide by its terms.

See Also

  • Bake::Gem — Release and install gems using bake.
  • Bake::Modernize — Modernize gems consistently using bake.
  • Console — A logging framework which integrates with bake.
  • Variant — A framework for selecting different environments, including bake tasks.
  • Utopia — A website framework which uses bake for maintenance tasks.

bake's People

Contributors

ioquatix avatar olleolleolle 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

Watchers

 avatar  avatar  avatar  avatar  avatar

bake's Issues

bake list filtering

bake list should probably do some kind of filtering, showing only the tasks in the root context if one is present. Otherwise, maybe list all tasks.

If a subset of tasks is listed, maybe include "and 5 other tasks. Run bake list --all to see all tasks".

4 test failures when packaging for GNU Guix

Hello!

I tried packaging this for GNU Guix, but I'm seeing 4 test failures when running the test suites:

phase `build' succeeded after 0.1 seconds
starting phase `check'

Bake::Base
  has a path
  formats nicely

Bake::Command::Call
  can invoke task
  with arguments
    can invoke task
  with mixed arguments
    can invoke task
  with = options
    can invoke task
  with -- options
    can invoke task
  with test_argument_normalized
    can accept --foo_bar
    can accept --foo-bar
  with value generating task
    with json output format
      can print the value (FAILED - 1)
    with raw output format
      can print the value (FAILED - 2)
    with pp output format
      can print the value (FAILED - 3)
    with yaml output format
      can print the value (FAILED - 4)

Bake::Command::List
  can list tasks
  with pattern
    lists only matching tasks

Bake::Context
  can invoke root task
  #invoke
    can invoke another task
    can invoke task with required argument
  #lookup
    can lookup method on parent instance
    can lookup method on child instance
    can lookup method on sibling instance

Bake::Types::Boolean
  true
    should be a kind of TrueClass
    should be == true
  false
    should be a kind of FalseClass
    should be == false

Bake::Types::Input
  -
    should be a kind of IO
    should be == #<IO:0x000000000046f910>
  /tmp/guix-build-ruby-bake-0.18.2.drv-0/source/spec/bake/types/input.txt
    should be a kind of IO

Bake::Types::Nil
  nil
    should be a kind of NilClass
    should be ==
  null
    should be a kind of NilClass
    should be ==

Bake::Types::Output
  -
    should be a kind of IO
    should be == #<IO:0x000000000046f870>
  /tmp/guix-build-ruby-bake-0.18.2.drv-0/source/spec/bake/types/output.txt
    should be a kind of IO

Bake::Types
  can use | operator
  Array(Any)
    should be a kind of Bake::Types::Array

Bake::Context
  should parse integer
  should parse an array of integers
  should parse a symbol and a hash
  should parse a JSON string
  should parse a URI string

Bake
  has a version number

Failures:

  1) Bake::Command::Call with value generating task with json output format can print the value
     Failure/Error: raise ArgumentError, "Could not find recipe for #{command}!"

     ArgumentError:
       Could not find recipe for output!
     # ./lib/bake/context.rb:124:in `call'
     # ./lib/bake/command/call.rb:50:in `call'
     # ./spec/bake/command/call_spec.rb:83:in `block (5 levels) in <top (required)>'
     # ./spec/bake/command/call_spec.rb:83:in `block (4 levels) in <top (required)>'

  2) Bake::Command::Call with value generating task with raw output format can print the value
     Failure/Error: raise ArgumentError, "Could not find recipe for #{command}!"

     ArgumentError:
       Could not find recipe for output!
     # ./lib/bake/context.rb:124:in `call'
     # ./lib/bake/command/call.rb:50:in `call'
     # ./spec/bake/command/call_spec.rb:95:in `block (5 levels) in <top (required)>'
     # ./spec/bake/command/call_spec.rb:95:in `block (4 levels) in <top (required)>'

  3) Bake::Command::Call with value generating task with pp output format can print the value
     Failure/Error: raise ArgumentError, "Could not find recipe for #{command}!"

     ArgumentError:
       Could not find recipe for output!
     # ./lib/bake/context.rb:124:in `call'
     # ./lib/bake/command/call.rb:50:in `call'
     # ./spec/bake/command/call_spec.rb:101:in `block (5 levels) in <top (required)>'
     # ./spec/bake/command/call_spec.rb:101:in `block (4 levels) in <top (required)>'

  4) Bake::Command::Call with value generating task with yaml output format can print the value
     Failure/Error: raise ArgumentError, "Could not find recipe for #{command}!"

     ArgumentError:
       Could not find recipe for output!
     # ./lib/bake/context.rb:124:in `call'
     # ./lib/bake/command/call.rb:50:in `call'
     # ./spec/bake/command/call_spec.rb:107:in `block (5 levels) in <top (required)>'
     # ./spec/bake/command/call_spec.rb:107:in `block (4 levels) in <top (required)>'

Finished in 0.01823 seconds (files took 0.09528 seconds to load)
43 examples, 4 failures

Failed examples:

rspec ./spec/bake/command/call_spec.rb:82 # Bake::Command::Call with value generating task with json output format can print the value
rspec ./spec/bake/command/call_spec.rb:94 # Bake::Command::Call with value generating task with raw output format can print the value
rspec ./spec/bake/command/call_spec.rb:100 # Bake::Command::Call with value generating task with pp output format can print the value
rspec ./spec/bake/command/call_spec.rb:106 # Bake::Command::Call with value generating task with yaml output format can print the value

error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "rspec" arguments: () exit-status: 1 term-signal: #f stop-signal: #f> 
phase `check' failed after 0.2 seconds

Would you happen to know what they may be caused by? If I ignore them, they reappear when using bake test in other projects (Could not find recipe for X).

I'm on Ruby 2.7.4 with the following direct dependencies: [email protected] [email protected] [email protected]

Can't parse "false"

Bake::Types::Boolean.parse only handles truthy values:

[4] pry(main)> Bake::Types::Boolean.parse("false")
=> nil

This makes it impossible to have tri-state inputs to recipes and handle true/false/nil, e.g. @param foo [Boolean | Nil] will only even supply true and nil.

Documentation feedback

This is my impression after reading the documentation:

  • some pages mention @parameter, others @param. Is this intentional?
  • some text reference a bakefile, but other text do not seem to want you to make a bakefile, and want you to make a bake.rb instead. It's not clear what the intention is. It comes over to menas if bakefile is a legacy file that shouldn't be used anymore.
  • is bake supposed to be a project-local tool, or can (and should) it also be used as a global tool? The comparison with rake makes it seem as if it's only the former. But then the docs mention cases in which you list/execute tasks from an installed gem, or even from http, so that got me confused.

Logo design brief.

This gem needs a logo.

I played around with some ideas. Maybe a baked pie with ruby cut outs, etc.

image

Or maybe a sourdough bread with a ruby cut out on top. Open to ideas, including characterisations of projects & code.

These designs will also be printed on tee-shirts and given away at conferences, etc.

For reference, here are some existing vector logos in other repos from the same organisation:

I am happy to pay for this work. I'm also happy for someone to contribute it. In both cases your work should be attributed in the README. Regarding commissioned work, it needs to be agreed on beforehand.

Is it possible to define methods that are not tasks?

I would like to define helper methods that will not be parsed into tasks. Ex:

# not a task!
def slugify(str)
  str.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
end

def create_post(post_name)
  File.write(slugify(post_name))
end

I don't know if this is possible, but I couldn't find in the docs.

One alternative, though is defining lambdas and using them.

Slugify = ->(str)  { str.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '') }

def create_post(post_name)
  File.write(Slugify.(post_name))
end

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.