This repository has been archived by the owner on Apr 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Rakefile
62 lines (53 loc) · 1.5 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
51
52
53
54
55
56
57
58
59
60
61
62
# frozen_string_literal: true
require 'rubygems/package_task'
require 'rubygems/dependency_installer'
require 'rdoc/task'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
namespace :gem do
specfile = 'midea-air-condition.gemspec'
Gem::PackageTask.new(Gem::Specification.load(specfile)) {}
desc 'Install this gem locally'
task :install, [:user_install] => :gem do |_, args|
args.with_defaults(user_install: false)
Gem::Installer.new(
"pkg/midea-air-condition-#{MideaAirCondition::VERSION}.gem",
user_install: args.user_install
).install
end
end
namespace :dependencies do
desc 'Install development dependencies'
task :install do |_|
installer = Gem::Installer.new('')
gemspec = Gem::Specification.load(specfile)
unsatisfied_dep = gemspec.development_dependencies.reject do |dp|
installer.installation_satisfies_dependency?(dp)
end
next if unsatisfied_dep.empty?
unsatisfied_dep.each do |dp|
Gem::DependencyInstaller.new(
user_install: ENV['RUBY_ENV'] == 'citest'
).install(dp)
end
end
end
namespace :doc do
desc 'generate API documentation'
Rake::RDocTask.new do |rd|
rd.rdoc_dir = 'doc'
rd.main = 'README.md'
rd.rdoc_files.include(
'README.md',
'LICENSE',
"lib/**/*\.rb"
)
rd.options << '--line-numbers'
rd.options << '--all'
end
end
namespace :test do
RuboCop::RakeTask.new(:rubocop)
RSpec::Core::RakeTask.new(:spec)
end
task default: ['test:rubocop', 'test:spec']