| 1 |
require 'rake' |
| 2 |
require 'rake/clean' |
| 3 |
require 'rbconfig' |
| 4 |
require 'rspec/core/rake_task' |
| 5 |
require 'rubocop/rake_task' |
| 6 |
|
| 7 |
CLEAN.include("**/*.rbc", "**/*.rbx", "**/*.gem", "**/*.lock") |
| 8 |
|
| 9 |
desc "Run the example program" |
| 10 |
task :example do |
| 11 |
if File::ALT_SEPARATOR |
| 12 |
sh 'ruby -Ilib/windows examples/uname_test.rb' |
| 13 |
else |
| 14 |
sh 'ruby -Ilib/unix examples/uname_test.rb' |
| 15 |
end |
| 16 |
end |
| 17 |
|
| 18 |
namespace :gem do |
| 19 |
desc "Create the sys-uname gem" |
| 20 |
task :create => [:clean] do |
| 21 |
require 'rubygems/package' |
| 22 |
spec = Gem::Specification.load('sys-uname.gemspec') |
| 23 |
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem') |
| 24 |
Gem::Package.build(spec) |
| 25 |
end |
| 26 |
|
| 27 |
desc "Install the sys-uname gem" |
| 28 |
task :install => [:create] do |
| 29 |
file = Dir["*.gem"].first |
| 30 |
sh "gem install #{file}" |
| 31 |
end |
| 32 |
end |
| 33 |
|
| 34 |
RuboCop::RakeTask.new |
| 35 |
|
| 36 |
desc "Run the test suite" |
| 37 |
RSpec::Core::RakeTask.new(:spec) do |t| |
| 38 |
t.verbose = true |
| 39 |
t.rspec_opts = '-f documentation -w' |
| 40 |
end |
| 41 |
|
| 42 |
task :default => :spec |