Sha256: 0d6701d8f299f46bdf7b21de06fcfb77cc99211f174dd7b975e533f1c6f478ed

Contents?: true

Size: 1001 Bytes

Versions: 10

Compression:

Stored size: 1001 Bytes

Contents

#!/usr/bin/env nake

# Snake is similar to sake http://www.rubyinside.com/sake-system-wide-rake-tasks-543.html

# tasks

# snake get db_tasks.rb
# snake get http://gist.github.com/raw/266818/7239049c59b32d07a8af7e26f89190b61e0a7860/snake.rb
Task.new(:get) do |task|
  task.description = "Add tasks from given file or URL to your %{task_file}"

  task.define do |path|
    require "open-uri"
    begin
      open(path) do |stream|
        File.open(self.config[:task_file], "a") do |file|
          file.puts(stream.read, "")
        end
      end
    rescue Exception => exception
      abort exception.message
    end
  end
end

Task.new(:edit) do |task|
  task.config = Task[:get].config
  task.description = "Edit %{task_file} in your editor"

  task.define do
    exec((ENV["EDITOR"] || "vim"), task.config[:task_file])
  end
end

# setup
Task[:get].config[:task_file] = File.expand_path("~/.tasks.rb")

# run
if File.exist?(Task[:get].config[:task_file])
  load Task[:get].config[:task_file]
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
nake-0.1.1 bin/snake
nake-0.1 bin/snake
nake-0.0.9.5 bin/snake
nake-0.0.9.4 bin/snake
nake-0.0.9.3 bin/snake
nake-0.0.9.2 bin/snake
nake-0.0.9.pre bin/snake
do_riak-0.10.1.pre gems/gems/nake-0.0.8/bin/snake
nake-0.0.8.pre bin/snake
nake-0.0.8 bin/snake