Debian Codegraph @

Rakefile

raw symbols SCIP
1 #! /usr/bin/env ruby
2 # frozen_string_literal: true
3
4 require "rake"
5 require "fileutils"
6 require "tmpdir"
7 require "shellwords"
8 begin
9 require "rubocop/rake_task"
10 rescue LoadError
11 nil
12 end
13 begin
14 require "yard"
15 rescue LoadError
16 nil
17 end
18
19 require "packaging"
20
21 Packaging.configuration do |conf|
22 conf.obs_project = "devel:languages:ruby:extensions"
23 conf.obs_target = "openSUSE_Tumbleweed"
24 conf.package_name = "rubygem-ruby-dbus"
25 conf.obs_sr_project = "openSUSE:Factory"
26 conf.skip_license_check << %r{^[^/]*$}
27 conf.skip_license_check << %r{^(doc|examples|spec)/.*}
28 # "Ruby on Rails is released under the MIT License."
29 # but the files are missing copyright headers
30 conf.skip_license_check << %r{^lib/dbus/core_ext/}
31 end
32
33 desc "Default: run specs in the proper environment"
34 task default: [:spec, :rubocop]
35 task test: :spec
36
37 desc "Run RSpec code examples"
38 task "bare:spec", [:options] do |_t, args|
39 args.with_defaults(options: "")
40 sh "rspec #{args[:options]}"
41 end
42
43 ["spec"].each do |tname|
44 desc "Run bare:#{tname} in the proper environment"
45 task tname, [:options] do |_t, args|
46 args.with_defaults(options: "")
47 cd "spec/tools" do
48 sh "./test_env rake bare:#{tname}[#{args[:options].shellescape}]"
49 end
50 end
51 end
52
53 # remove tarball implementation and create gem for this gemfile
54 Rake::Task[:tarball].clear
55
56 desc "Build a package from a clone of the local Git repo"
57 task :tarball do |_t|
58 Dir.mktmpdir do |temp|
59 sh "git clone . #{temp}"
60 cd temp do
61 sh "gem build ruby-dbus.gemspec"
62 end
63 sh "rm -f package/*.gem"
64 cp Dir.glob("#{temp}/*.gem"), "package"
65 end
66 end
67
68 namespace :doc do
69 desc "Extract code examples from doc/Reference.md to examples/doc"
70 task :examples do
71 cd "examples/doc" do
72 sh "./_extract_examples ../../doc/Reference.md"
73 end
74 end
75 end
76
77 if Object.const_defined? :RuboCop
78 RuboCop::RakeTask.new
79 else
80 desc "Run RuboCop (dummy)"
81 task :rubocop do
82 warn "RuboCop not installed"
83 end
84 end
85
86 YARD::Rake::YardocTask.new if Object.const_defined? :YARD