-
-
Notifications
You must be signed in to change notification settings - Fork 277
/
Rakefile
138 lines (120 loc) · 3.34 KB
/
Rakefile
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# frozen_string_literal: true
Dir.glob("#{File.expand_path(__dir__)}/lib/tasks/**/*.rake").each { |f| import f }
begin
require "reek/rake/task"
Reek::Rake::Task.new(:reek) do |t|
t.name = "reek"
t.config_file = ".reek.yml"
t.source_files = "."
t.reek_opts = %w[
--line-numbers
--color
--documentation
--progress
--single-line
--sort-by smelliness
].join(" ")
t.fail_on_error = true
t.verbose = true
end
rescue LoadError
puts "Reek is currently unavailable"
desc "Template Reek task"
task :reek do
puts "Should be running reek"
end
end
def changed_files(pedantry)
`git diff-tree --no-commit-id --name-only -r HEAD~#{pedantry} HEAD`
.split("\n").select { |f| f.match(/(\.rb\z)|Rakefile/) && File.exist?(f) && !f.include?("db") }
end
begin
require "rubocop/rake_task"
RuboCop::RakeTask.new(:rubocop) do |task|
# task.patterns = changed_files(5)
task.options = %w[-DEP --format fuubar]
end
rescue LoadError
puts "Rubocop is currently unavailable"
desc "Template Rubocop task"
task :rubocop do
puts "Should be running rubocop"
end
end
desc "Runs style validations"
task style: [:reek, :rubocop]
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:rspec) do |t|
t.rspec_opts = "--format Fuubar --format Nc"
end
rescue LoadError
puts "RSpec is currently not available"
desc "Template RSpec task"
task :rspec do
puts "Should be running rspec"
end
end
begin
require "yard"
YARD::Rake::YardocTask.new(:yard) do |t|
t.files = %w[lib/sidekiq_unique_jobs/**/*.rb]
t.options = %w[
--exclude lib/sidekiq_unique_jobs/testing.rb
--exclude lib/sidekiq_unique_jobs/web/helpers.rb
--exclude lib/redis.rb
--no-private
--embed-mixins
--markup=markdown
--markup-provider=redcarpet
--readme README.md
--files CHANGELOG.md,LICENSE.txt
]
t.stats_options = %w[
--exclude lib/sidekiq_unique_jobs/testing.rb
--exclude lib/sidekiq_unique_jobs/web/helpers.rb
--no-private
--compact
--list-undoc
]
end
rescue LoadError
puts "Yard is currently unavailable"
desc "Template Yard task"
task :yard do
puts "Should be running yard"
end
end
task default: [:style, :rspec, :yard]
namespace :appraisal do
namespace :rspec do
desc "Runs rspec for all appraisals"
task :all do
sh("bundle exec appraisal rspec")
end
desc "Runs rspec for older appraisals than sidekiq 6"
task :pre_sidekiq6 do
sh("bundle exec appraisal sidekiq-4.0 rspec")
sh("bundle exec appraisal sidekiq-4.1 rspec")
sh("bundle exec appraisal sidekiq-4.2 rspec")
sh("bundle exec appraisal sidekiq-5.0 rspec")
sh("bundle exec appraisal sidekiq-5.1 rspec")
sh("bundle exec appraisal sidekiq-5.2 rspec")
end
desc "Runs rspec for appraisals containing sidekiq 6 or greater"
task :post_sidekiq6 do
sh("bundle exec appraisal sidekiq-6.0 rspec")
sh("bundle exec appraisal sidekiq-develop rspec")
end
task default: [:all]
end
end
desc "Release a new gem version"
task :release do
# sh("./update_docs.sh")
sh("bundle install")
sh("bundle exec gem release --tag --push")
Rake::Task["changelog"].invoke
sh("bundle exec gem bump --file lib/sidekiq_unique_jobs/version.rb")
sh("git push")
end