-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
50 lines (43 loc) · 1.18 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
require 'rake'
require 'rake/clean'
require 'rspec/core/rake_task'
require 'rbconfig'
require 'rubocop/rake_task'
CLEAN.include("**/*.gem", "**/*.rbx", "**/*.rbc", "ruby.core", "**/*.lock")
namespace :gem do
desc "Create the sys-admin gem"
task :create => [:clean] do
require 'rubygems/package'
spec = Gem::Specification.load('sys-admin.gemspec')
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
Gem::Package.build(spec)
end
desc "Install the sys-admin gem"
task :install => [:create] do
file = Dir["*.gem"].first
sh "gem install -l #{file}"
end
end
desc "Run the specs for the sys-admin library"
RSpec::Core::RakeTask.new(:spec) do |t|
case RbConfig::CONFIG['host_os']
when /darwin|osx/i
t.rspec_opts = '-Ilib/darwin'
when /linux/i
t.rspec_opts = '-Ilib/linux'
when /sunos|solaris/i
t.rspec_opts = '-Ilib/sunos'
when /bsd|dragonfly/i
t.rspec_opts = '-Ilib/bsd'
when /windows|win32|mingw|cygwin|dos/i
t.rspec_opts = '-Ilib/windows'
else
t.rspec_opts = '-Ilib/unix'
end
end
RuboCop::RakeTask.new
# Clean up afterwards
Rake::Task[:spec].enhance do
Rake::Task[:clean].invoke
end
task :default => :spec