File: Rakefile

package info (click to toggle)
ruby-dbus 0.25.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 776 kB
  • sloc: ruby: 6,584; xml: 225; sh: 38; makefile: 8
file content (86 lines) | stat: -rwxr-xr-x 2,038 bytes parent folder | download
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
#! /usr/bin/env ruby
# frozen_string_literal: true

require "rake"
require "fileutils"
require "tmpdir"
require "shellwords"
begin
  require "rubocop/rake_task"
rescue LoadError
  nil
end
begin
  require "yard"
rescue LoadError
  nil
end

require "packaging"

Packaging.configuration do |conf|
  conf.obs_project = "devel:languages:ruby:extensions"
  conf.obs_target = "openSUSE_Tumbleweed"
  conf.package_name = "rubygem-ruby-dbus"
  conf.obs_sr_project = "openSUSE:Factory"
  conf.skip_license_check << %r{^[^/]*$}
  conf.skip_license_check << %r{^(doc|examples|spec)/.*}
  # "Ruby on Rails is released under the MIT License."
  # but the files are missing copyright headers
  conf.skip_license_check << %r{^lib/dbus/core_ext/}
end

desc "Default: run specs in the proper environment"
task default: [:spec, :rubocop]
task test: :spec

desc "Run RSpec code examples"
task "bare:spec", [:options] do |_t, args|
  args.with_defaults(options: "")
  sh "rspec #{args[:options]}"
end

["spec"].each do |tname|
  desc "Run bare:#{tname} in the proper environment"
  task tname, [:options] do |_t, args|
    args.with_defaults(options: "")
    cd "spec/tools" do
      sh "./test_env rake bare:#{tname}[#{args[:options].shellescape}]"
    end
  end
end

# remove tarball implementation and create gem for this gemfile
Rake::Task[:tarball].clear

desc "Build a package from a clone of the local Git repo"
task :tarball do |_t|
  Dir.mktmpdir do |temp|
    sh "git clone . #{temp}"
    cd temp do
      sh "gem build ruby-dbus.gemspec"
    end
    sh "rm -f package/*.gem"
    cp Dir.glob("#{temp}/*.gem"), "package"
  end
end

namespace :doc do
  desc "Extract code examples from doc/Reference.md to examples/doc"
  task :examples do
    cd "examples/doc" do
      sh "./_extract_examples ../../doc/Reference.md"
    end
  end
end

if Object.const_defined? :RuboCop
  RuboCop::RakeTask.new
else
  desc "Run RuboCop (dummy)"
  task :rubocop do
    warn "RuboCop not installed"
  end
end

YARD::Rake::YardocTask.new if Object.const_defined? :YARD