Sha256: 5f425e1357d8c6353eb8c021d0919d5d8939b3f32442f77e7a8388049b919a35

Contents?: true

Size: 936 Bytes

Versions: 2

Compression:

Stored size: 936 Bytes

Contents

task :test do
  require "cutest"
  Cutest.run(Dir["test/nest*"])
end

task :default => :test

task :commands do
  require "open-uri"
  require "json"

  file = File.expand_path("lib/nest.rb", File.dirname(__FILE__))
  path = "https://github.com/antirez/redis-doc/raw/master/commands.json"

  commands = JSON.parse(open(path).read).select do |name, command|
    # Skip all DEBUG commands
    next if command["group"] == "server"

    # If the command has no arguments, it doesn't operate on a key
    next if command["arguments"].nil?

    arg = command["arguments"].first

    arg["type"] == "key" ||
      Array(arg["name"]) == ["channel"]
  end

  commands = commands.keys.map { |key| key.downcase.to_sym }

  commands.delete(:mget)

  source = File.read(file).sub(/  METHODS = .+?\n\n/m) do
    "  METHODS = #{commands.inspect}\n\n"
  end

  File.open(file, "w") { |f| f.write source }

  system "git diff --color-words #{file}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nest-2.1.0 Rakefile
nest-2.0.0 Rakefile