Giter VIP home page Giter VIP logo

cake's Introduction

Cake Build Status

Cake is a powerful and flexible Make-like utility tool. Implement tasks on plain crystal-lang and Make Tasks Great Again!

Installation

Execute command to install Cake

$ curl https://raw.githubusercontent.com/axvm/cake/master/install.sh | bash

Usage

Develop tasks in plain Crystal code in Cakefile and run them via $ cake :task_name

bin/cake

  Usage:
    cake task_name
    cake -T

  Options:
    -T, --tasks                      Show all tasks
    -h, --help                       This info
    -v, --version                    Show version

Cakefile sample

# Define task
task :task_name do
  # task logic
end

# Define task with description
desc "task useful description"
task :some_task do
  # 2 + 1
end

# Run one task from another
desc "invoke example"
task :first do
  # -Infinity / 0
  invoke! :second
end

task :second do
  # yay we are here!
end

# Execute shell commands
task :build do
  execute "shards build"

  # or with sweet logs
  execute(
    cmd: "shards build",
    announce: "Building binary...",
    success: "Binary built!",
    error: "Build failed."
  )
end

# Log things
task :deploy do
  # your deploy code
  log "Deploy successful!"
  log "Or errored.", 1
end

Development

  1. Implement feature and tests
  2. Create pull request
  3. ...
  4. Profit!

Contributing

  1. Fork it ( https://github.com/axvm/cake/fork )
  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 a new Pull Request

Contributors

  • [axvm] Alexander Marchenko - creator, maintainer
  • [alexandregv] Alexandre Guiot--Valentin - contributor

cake's People

Contributors

alexandregv avatar axvm avatar jkthorne avatar renich avatar timothysu 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

Watchers

 avatar  avatar  avatar  avatar  avatar

cake's Issues

Crystal-lang compiler not found, even though the debug says it has been found

it seems to detect the crystal compiler path: Crystal compiler path is /usr/bin/crystal
But then it fails at the end with: Crystal-lang compiler not found (Cake::Exceptions::CrystalEvalFailed)

Cake debug mode ENABLED
Cakefile processing
Cakefile processing completed
<import start>
[]
<import end>
<code start>
["LIB_NAME = \"mpv-crystal-simple-plugin.so\"", "PLUGIN_ENTRY_FILE = \"./src/simple-plugin.cr\"", "task :default do", "  invoke! :lib", "end", "#task :lib, deps: [\"./src/simple-plugin.cr\"]", "task :lib do", "  link_command = `crystal build --cross-compile \#{PLUGIN_ENTRY_FILE}`", "  unless $? == 0", "    exit 1", "  end", "  `\#{link_command} -shared -o \#{LIB_NAME}`", "end", "task :clean do", "  `rm -f *.o`", "  `rm -f \#{LIB_NAME}`", "end", "task :re do", "  invoke! :clean", "  invoke! :default", "end"]
<code end>
Crystal compiler path is /usr/bin/crystal
<script start>
require "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../home/lesell_b/.cake/src/cake"
extend Cake::DSL



require "colorize"
task :default do
  puts "\nHello there!".colorize(:light_green)
  puts "This is default task :)\n".colorize(:light_gray)

  print "Thank you for using ".colorize(:white)
  print "Cake~!\n".colorize(:light_cyan)
  print "You can override this task in your ".colorize(:white)
  print "Cakefile".colorize(:light_cyan)
  print " i.e:\n\n".colorize(:white)

  print "  task ".colorize(:light_cyan); print ":".colorize(:light_red); print "default ".colorize(:light_cyan); print "do\n".colorize(:light_magenta);
  print "    puts".colorize(:light_blue); print " \"Like that!\"\n".colorize(:light_green)
  puts  "  end".colorize(:light_magenta)
end

LIB_NAME = "mpv-crystal-simple-plugin.so"
PLUGIN_ENTRY_FILE = "./src/simple-plugin.cr"
task :default do
  invoke! :lib
end
#task :lib, deps: ["./src/simple-plugin.cr"]
task :lib do
  link_command = `crystal build --cross-compile #{PLUGIN_ENTRY_FILE}`
  unless $? == 0
    exit 1
  end
  `#{link_command} -shared -o #{LIB_NAME}`
end
task :clean do
  `rm -f *.o`
  `rm -f #{LIB_NAME}`
end
task :re do
  invoke! :clean
  invoke! :default
end

begin
  invoke!("lib")
rescue ex : Cake::Exceptions::TaskNotFound
  print "ERROR:".colorize(:white).on_red
  print " task "; print ":lib".colorize(:white); print " not defined.\n"
rescue e
  print "ERROR:".colorize(:white).on_red
  print " #{e.message}"
end
<script end>
Ouput is 
Exit code is 1
Crystal-lang compiler not found (Cake::Exceptions::CrystalEvalFailed)
Failed to raise an exception: END_OF_STACK
[0x461506] *CallStack::print_backtrace:Int32 +118
[0x445426] __crystal_raise +86
[0x44fce8] ???
[0x481e65] *File#initialize<String, String, Int32, Nil, Nil>:(Event::Event | Nil) +213
[0x481d64] *File::new<String, String, Int32, Nil, Nil>:File +212
[0x458b8a] *CallStack::read_dwarf_sections:(Array(Tuple(UInt64, UInt64, String)) | Nil) +106
[0x4588cd] *CallStack::decode_line_number<UInt64>:Tuple(String | Nil, Int32, Int32) +45
[0x458404] *CallStack#decode_backtrace:Array(String) +164
[0x458342] *CallStack#printable_backtrace:Array(String) +50
[0x4814cd] *Exception+ +77
[0x481135] *Exception+ +117
[0x4545de] main +158
[0x7f357873e43a] __libc_start_main +234
[0x443b8a] _start +42
[0x0] ???

nested task syntax

I've been using cake to define some db-related tasks, and I've been wanting to do this rake style i.e.: cake db:migrate however if I define a task like task "db:migrate" cake will strip out the inner : character. Would be great if this worked out of the box in lieu of multi-word task names.

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.