forked from RubyMoney/money
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
81 lines (60 loc) · 1.39 KB
/
Rakefile
File metadata and controls
81 lines (60 loc) · 1.39 KB
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
# Clean
#
# rake clean
# rake clobber
require "rake/clean"
CLOBBER.include("doc", ".yardoc")
# Bundler
#
# rake build
# rake release
require "bundler/gem_tasks"
gemspec = Gem::Specification.load("money.gemspec")
# RuboCop
#
# rake rubocop
require "rubocop/rake_task"
RuboCop::RakeTask.new
# Yard
#
# rake yard
require "yard"
YARD::Rake::YardocTask.new do |t|
t.options << "--title" << gemspec.description
t.options << "--files" << "CHANGELOG.md,LICENSE"
t.options << "--markup" << "markdown"
t.options << "--markup-provider" << "redcarpet" unless RUBY_PLATFORM == "java"
end
# RSpec
#
# rake spec
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec) do |t|
t.fail_on_error = false
t.ruby_opts = "-w"
end
# File permissions
#
# rake check_permissions
desc "Check file permissions"
task :check_permissions do
files = Dir.glob("**/*.rb")
files.each do |file|
dir = File.dirname(file)
unless File.new(dir).lstat.mode.to_s(8) == "40755"
raise "Please check permissions for dir #{dir.inspect}"
end
unless File.new(file).lstat.mode.to_s(8) == "100644"
raise "Please check permission for file #{file.inspect}"
end
end
end
# rubocop:disable Rake/Desc
task release: :check_permissions
task spec: :check_permissions
# rubocop:enable Rake/Desc
# Default task
#
# rake
task default: [:rubocop, :spec]