forked from ac3cloud/roust
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
36 lines (27 loc) · 779 Bytes
/
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
#!/usr/bin/env ruby
require 'bundler/setup'
require 'rspec/core/rake_task'
require 'colorize'
RSpec::Core::RakeTask.new('spec')
desc 'build gem'
task :build do
build_output = `gem build roust.gemspec`
puts build_output
gem_filename = build_output[/File: (.*)/, 1]
pkg_path = 'pkg'
FileUtils.mkdir_p(pkg_path)
FileUtils.mv(gem_filename, pkg_path)
puts "Gem built in #{pkg_path}/#{gem_filename}".green
end
desc 'push gem'
task :push do
filenames = Dir.glob('pkg/*.gem')
filenames_with_times = filenames.map do |filename|
[filename, File.mtime(filename)]
end
newest = filenames_with_times.sort_by { |tuple| tuple.last }.last
newest_filename = newest.first
command = "gem push #{newest_filename}"
system(command)
end
task :default => [:spec]