-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
64 lines (53 loc) · 1.29 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
# frozen_string_literal: true
require 'rake/testtask'
require 'bump/tasks'
Rake::TestTask.new do |t|
t.libs << 'test'
end
desc 'Run tests'
task default: :test
desc 'Run the Windclutter executable'
task :windclutter, [:args] do
ARGV.delete('--')
args = ARGV[1..]
begin
cmd = "ruby -Ilib ./bin/windclutter #{args.join(' ')}"
sh cmd
ensure
exit 0
end
end
namespace :gem do
desc 'Build the gem'
task :build do
sh 'gem build windclutter.gemspec'
end
desc 'Install the gem locally'
task :install do
gem_file = Dir.glob('*.gem').max_by { |f| File.mtime(f) }
if gem_file.nil?
puts 'No gem file found in the current directory.'
else
puts "Installing gem locally: #{gem_file}"
sh "gem install #{gem_file}"
end
end
desc 'Push the latest gem that was built.'
task :push do
gem_file = Dir.glob('*.gem').max_by { |f| File.mtime(f) }
if gem_file.nil?
puts 'No gem file found in the current directory.'
else
puts "Pushing gem: #{gem_file}"
sh "gem push #{gem_file}"
end
end
desc 'Clean all built gem.'
task :clean do
gem_files = Dir.glob('*.gem')
Dir.glob('*.gem').each do |gem_file|
File.delete(gem_file) if File.exist?(gem_file)
end
puts "#{gem_files.count} gem(s) cleaned!"
end
end