File: Rakefile

package info (click to toggle)
ruby-pathutil 0.16.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 88 kB
  • sloc: ruby: 614; makefile: 3
file content (81 lines) | stat: -rw-r--r-- 1,642 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Frozen-string-literal: true
# Copyright: 2015 - 2017 Jordon Bedwell - MIT License
# Encoding: utf-8

require "open3"
require "rspec/core/rake_task"
require_relative "benchmark/support/task"
require "rubocop/rake_task"
require "simple/ansi"
require "pathutil"
require "json"

# --

task :default => [
  ENV["BENCHMARK"] ? :benchmark : :spec
]

# --

BenchmarkTask.new :benchmark
RSpec::Core::RakeTask.new :spec
task :test => :spec

# --

namespace :diff do
  desc "List methods we have that Pathname doesn't."
  task :methods do
    methods = Pathutil.instance_methods - Pathname.instance_methods - Object.instance_methods
    methods.each do |method|
      $stdout.print "- ", "`", method, "`", "\n"
    end
  end
end

# --

namespace :missing do
  desc "List methods we are missing."
  task :methods do
    methods = Pathname.instance_methods - Pathutil.instance_methods - Object.instance_methods
    methods-= [
      :cleanpath
    ]

    methods.each do |method|
      $stdout.puts method
    end
  end
end

# --

namespace :pathname do
  desc "List all of Pathnames methods."
  task :methods do
    methods = Pathname.instance_methods - Object.instance_methods
    methods.each_with_index do |method, index|
      $stdout.print method
      unless index == methods.size - 1
        $stdout.print ", "
      end
    end

    $stdout.puts
  end
end

# --

desc "List all of Pathutils methods."
task :methods do
  methods = Pathutil.instance_methods - Object.instance_methods
  methods.each_with_index do |method, index|
    $stdout.print "`", method, "`"
    $stdout.print ", " unless index == methods.size - 1
  end

  $stdout.puts
end