forked from berkshelf/vagrant-berkshelf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThorfile
59 lines (48 loc) · 1.26 KB
/
Thorfile
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
# encoding: utf-8
$:.push File.expand_path("../lib", __FILE__)
require 'bundler'
require 'bundler/setup'
require 'thor/rake_compat'
require 'berkshelf/vagrant'
GEM_PKG = "vagrant-berkshelf-#{Berkshelf::Vagrant::VERSION}.gem".freeze
class Gem < Thor
include Thor::RakeCompat
Bundler::GemHelper.install_tasks
desc "build", "Build #{GEM_PKG} into the pkg directory"
def build
Rake::Task["build"].execute
end
desc "release", "Create tag v#{Berkshelf::Vagrant::VERSION} and build and push #{GEM_PKG} to Rubygems"
def release
Rake::Task["release"].execute
end
desc "install", "Build and install #{GEM_PKG} into system gems"
def install
Rake::Task["install"].execute
end
end
class Spec < Thor
include Thor::Actions
default_task :unit
desc "plug", "Install #{GEM_PKG} into vagrant"
def plug
build
run "vagrant plugin install pkg/#{GEM_PKG}"
end
desc "ci", "Run all possible tests on Travis-CI"
def ci
ENV['CI'] = 'true' # Travis-CI also sets this, but set it here for local testing
invoke(:unit)
end
desc "unit", "Run unit tests"
def unit
unless run_unit
exit 1
end
end
no_tasks do
def run_unit(*flags)
run "rspec --color --format=documentation #{flags.join(' ')} spec"
end
end
end